diff --git a/.gitignore b/.gitignore index 814a948..a84103e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ __pycache__ .DS_Store node_modules +jsconfig.json # pyinstaller build dirs /dist diff --git a/public/js/bundle.js b/public/js/bundle.js index 7eb6c71..3d0ec8e 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -36,4 +36,4 @@ function(e){var t,n,r,i,o,a,s,l,u,c,d,f,p,h,v,m,g,y,b,_="sizzle"+1*new Date,w=e. * * Copyright (C) 2018 Varun A P */ -!function(t,n){e.exports?e.exports=n():t.Toastify=n()}(Tu,(function(e){var t=function(e){return new t.lib.init(e)};function n(e,t){return!(!e||"string"!=typeof t)&&!!(e.className&&e.className.trim().split(/\s+/gi).indexOf(t)>-1)}return t.lib=t.prototype={toastify:"1.8.0",constructor:t,init:function(e){return e||(e={}),this.options={},this.toastElement=null,this.options.text=e.text||"Hi there!",this.options.node=e.node,this.options.duration=0===e.duration?0:e.duration||3e3,this.options.selector=e.selector,this.options.callback=e.callback||function(){},this.options.destination=e.destination,this.options.newWindow=e.newWindow||!1,this.options.close=e.close||!1,this.options.gravity="bottom"===e.gravity?"toastify-bottom":"toastify-top",this.options.positionLeft=e.positionLeft||!1,this.options.position=e.position||"",this.options.backgroundColor=e.backgroundColor,this.options.avatar=e.avatar||"",this.options.className=e.className||"",this.options.stopOnFocus=void 0===e.stopOnFocus||e.stopOnFocus,this.options.onClick=e.onClick,this},buildToast:function(){if(!this.options)throw"Toastify is not initialized";var e=document.createElement("div");if(e.className="toastify on "+this.options.className,this.options.position?e.className+=" toastify-"+this.options.position:!0===this.options.positionLeft?(e.className+=" toastify-left",console.warn("Property `positionLeft` will be depreciated in further versions. Please use `position` instead.")):e.className+=" toastify-right",e.className+=" "+this.options.gravity,this.options.backgroundColor&&(e.style.background=this.options.backgroundColor),this.options.node&&this.options.node.nodeType===Node.ELEMENT_NODE)e.appendChild(this.options.node);else if(e.innerHTML=this.options.text,""!==this.options.avatar){var t=document.createElement("img");t.src=this.options.avatar,t.className="toastify-avatar","left"==this.options.position||!0===this.options.positionLeft?e.appendChild(t):e.insertAdjacentElement("beforeend",t)}if(!0===this.options.close){var n=document.createElement("span");n.innerHTML="✖",n.className="toast-close",n.addEventListener("click",function(e){e.stopPropagation(),this.removeElement(this.toastElement),window.clearTimeout(this.toastElement.timeOutValue)}.bind(this));var r=window.innerWidth>0?window.innerWidth:screen.width;("left"==this.options.position||!0===this.options.positionLeft)&&r>360?e.insertAdjacentElement("afterbegin",n):e.appendChild(n)}if(this.options.stopOnFocus&&this.options.duration>0){const t=this;e.addEventListener("mouseover",(function(t){window.clearTimeout(e.timeOutValue)})),e.addEventListener("mouseleave",(function(){e.timeOutValue=window.setTimeout((function(){t.removeElement(e)}),t.options.duration)}))}return void 0!==this.options.destination&&e.addEventListener("click",function(e){e.stopPropagation(),!0===this.options.newWindow?window.open(this.options.destination,"_blank"):window.location=this.options.destination}.bind(this)),"function"==typeof this.options.onClick&&void 0===this.options.destination&&e.addEventListener("click",function(e){e.stopPropagation(),this.options.onClick()}.bind(this)),e},showToast:function(){var e;if(this.toastElement=this.buildToast(),!(e=void 0===this.options.selector?document.body:document.getElementById(this.options.selector)))throw"Root element is not defined";return e.insertBefore(this.toastElement,e.firstChild),t.reposition(),this.options.duration>0&&(this.toastElement.timeOutValue=window.setTimeout(function(){this.removeElement(this.toastElement)}.bind(this),this.options.duration)),this},hideToast:function(){this.toastElement.timeOutValue&&clearTimeout(this.toastElement.timeOutValue),this.removeElement(this.toastElement)},removeElement:function(e){e.className=e.className.replace(" on",""),window.setTimeout(function(){this.options.node&&this.options.node.parentNode&&this.options.node.parentNode.removeChild(this.options.node),e.parentNode&&e.parentNode.removeChild(e),this.options.callback.call(e),t.reposition()}.bind(this),400)}},t.reposition=function(){for(var e,t={top:15,bottom:15},r={top:15,bottom:15},i={top:15,bottom:15},o=document.getElementsByClassName("toastify"),a=0;a0?window.innerWidth:screen.width)<=360?(o[a].style[e]=i[e]+"px",i[e]+=s+15):!0===n(o[a],"toastify-left")?(o[a].style[e]=t[e]+"px",t[e]+=s+15):(o[a].style[e]=r[e]+"px",r[e]+=s+15)}return this},t.lib.init.prototype=t.lib,t}))}));let Au={};const Eu=function(e,t=null,n=!0,r=null){if(Au[r]){let i=Au[r],o=ku(`div.toastify[toast_id=${r}]`);e&&o.find(".toast-message").html(e),t&&(t="loading"==t?'
':`${t}`,o.find(".toast-icon").html(t)),null!==n&&n&&setTimeout((function(){i.hideToast(),delete Au[r]}),3e3)}else{let i=Su({text:`${t=null==t?"":"loading"==t?'
':`${t}`}
${e}`,duration:n?3e3:0,gravity:"bottom",position:"left"}).showToast();r&&(Au[r]=i,ku(i.toastElement).attr("toast_id",r))}};xu.on("toast",e=>{const{msg:t,icon:n,dismiss:r,id:i}=e;Eu(t,n||null,void 0===r||r,i||null)});const $u={open:!1,url:"",element:null};function Ou(e){const{target:t}=e;if($u.element.classList.add("animated","fadeOut"),!t.matches(".quality-button"))return;let n=t.dataset.qualityValue;yc.sendAddToQueue($u.url,n)}function ju(){$u.element.classList.remove("animated",$u.open?"fadeOut":"fadeIn"),$u.element.style.display=$u.open?"none":"block",$u.open=!$u.open}var Lu={init:function(){$u.element=document.getElementById("modal_quality"),$u.element.addEventListener("click",Ou),$u.element.addEventListener("webkitAnimationEnd",ju)},open:function(e){$u.url=e,$u.element.style.display="block",$u.element.classList.add("animated","fadeIn")}};window.vol={preview_max_volume:100};let Nu=document.getElementById("preview-track"),Du=!0;var Iu={init:function(){Nu.volume=1,Nu.addEventListener("canplay",(function(){Nu.play(),Du=!1,ku(Nu).animate({volume:vol.preview_max_volume/100},500)})),Nu.addEventListener("timeupdate",(function(){Nu.currentTime>Nu.duration-1&&(ku(Nu).animate({volume:0},800),Du=!0,ku("a[playing] > .preview_controls").css({opacity:0}),ku("*").removeAttr("playing"),ku(".preview_controls").text("play_arrow"),ku(".preview_playlist_controls").text("play_arrow"))}))},stopStackedTabsPreview:function(){ku(".preview_playlist_controls").filter((function(){return ku(this).attr("playing")})).length>0&&(ku(Nu).animate({volume:0},800),Du=!0,ku(".preview_playlist_controls").removeAttr("playing"),ku(".preview_playlist_controls").text("play_arrow"))},previewMouseEnter:function(e){ku(e.currentTarget).css({opacity:1})},previewMouseLeave:function(e){const{currentTarget:t}=e;(ku(t).parent().attr("playing")&&Du||!ku(t).parent().attr("playing"))&&ku(t).css({opacity:0},200)},playPausePreview:function(e){e.preventDefault();const{currentTarget:t}=event;var n="I"==t.tagName?ku(t):ku(t).children("i");ku(t).attr("playing")?Nu.paused?(Nu.play(),Du=!1,n.text("pause"),ku(Nu).animate({volume:vol.preview_max_volume/100},500)):(Du=!0,n.text("play_arrow"),ku(Nu).animate({volume:0},250,"swing",()=>{Nu.pause()})):(ku("*").removeAttr("playing"),ku(t).attr("playing",!0),ku(".preview_controls").text("play_arrow"),ku(".preview_playlist_controls").text("play_arrow"),ku(".preview_controls").css({opacity:0}),n.text("pause"),n.css({opacity:1}),Du=!1,ku(Nu).animate({volume:0},250,"swing",()=>{Nu.pause(),ku("#preview-track_source").prop("src",ku(t).data("preview")),Nu.load()}))}};var Mu={isValidURL:function(e){let t=e.toLowerCase();if(t.startsWith("http")){if(t.indexOf("deezer.com")>=0||t.indexOf("open.spotify.com")>=0)return!0}else if(t.startsWith("spotify:"))return!0;return!1},convertDuration:function(e){let t,n;return t=Math.floor(e/60),n=e-60*t,n<10&&(n="0"+n),t+":"+n},convertDurationSeparated:function(e){let t,n,r;return n=Math.floor(e/60),t=Math.floor(n/60),r=e-60*n,n-=60*t,[t,n,r]},numberWithDots:function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,".")},debounce:function(e,t,n){var r;return function(){var i=this,o=arguments,a=function(){r=null,n||e.apply(i,o)},s=n&&!r;clearTimeout(r),r=setTimeout(a,t),s&&e.apply(i,o)}},COUNTRIES:{AF:"Afghanistan",AX:"Åland Islands",AL:"Albania",DZ:"Algeria",AS:"American Samoa",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antarctica",AG:"Antigua and Barbuda",AR:"Argentina",AM:"Armenia",AW:"Aruba",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BS:"Bahamas",BH:"Bahrain",BD:"Bangladesh",BB:"Barbados",BY:"Belarus",BE:"Belgium",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivia, Plurinational State of",BQ:"Bonaire, Sint Eustatius and Saba",BA:"Bosnia and Herzegovina",BW:"Botswana",BV:"Bouvet Island",BR:"Brazil",IO:"British Indian Ocean Territory",BN:"Brunei Darussalam",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",KH:"Cambodia",CM:"Cameroon",CA:"Canada",CV:"Cape Verde",KY:"Cayman Islands",CF:"Central African Republic",TD:"Chad",CL:"Chile",CN:"China",CX:"Christmas Island",CC:"Cocos (Keeling) Islands",CO:"Colombia",KM:"Comoros",CG:"Congo",CD:"Congo, the Democratic Republic of the",CK:"Cook Islands",CR:"Costa Rica",CI:"Côte d'Ivoire",HR:"Croatia",CU:"Cuba",CW:"Curaçao",CY:"Cyprus",CZ:"Czech Republic",DK:"Denmark",DJ:"Djibouti",DM:"Dominica",DO:"Dominican Republic",EC:"Ecuador",EG:"Egypt",SV:"El Salvador",GQ:"Equatorial Guinea",ER:"Eritrea",EE:"Estonia",ET:"Ethiopia",FK:"Falkland Islands (Malvinas)",FO:"Faroe Islands",FJ:"Fiji",FI:"Finland",FR:"France",GF:"French Guiana",PF:"French Polynesia",TF:"French Southern Territories",GA:"Gabon",GM:"Gambia",GE:"Georgia",DE:"Germany",GH:"Ghana",GI:"Gibraltar",GR:"Greece",GL:"Greenland",GD:"Grenada",GP:"Guadeloupe",GU:"Guam",GT:"Guatemala",GG:"Guernsey",GN:"Guinea",GW:"Guinea-Bissau",GY:"Guyana",HT:"Haiti",HM:"Heard Island and McDonald Islands",VA:"Holy See (Vatican City State)",HN:"Honduras",HK:"Hong Kong",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran, Islamic Republic of",IQ:"Iraq",IE:"Ireland",IM:"Isle of Man",IL:"Israel",IT:"Italy",JM:"Jamaica",JP:"Japan",JE:"Jersey",JO:"Jordan",KZ:"Kazakhstan",KE:"Kenya",KI:"Kiribati",KP:"Korea, Democratic People's Republic of",KR:"Korea, Republic of",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Lao People's Democratic Republic",LV:"Latvia",LB:"Lebanon",LS:"Lesotho",LR:"Liberia",LY:"Libya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MO:"Macao",MK:"Macedonia, the Former Yugoslav Republic of",MG:"Madagascar",MW:"Malawi",MY:"Malaysia",MV:"Maldives",ML:"Mali",MT:"Malta",MH:"Marshall Islands",MQ:"Martinique",MR:"Mauritania",MU:"Mauritius",YT:"Mayotte",MX:"Mexico",FM:"Micronesia, Federated States of",MD:"Moldova, Republic of",MC:"Monaco",MN:"Mongolia",ME:"Montenegro",MS:"Montserrat",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar",NA:"Namibia",NR:"Nauru",NP:"Nepal",NL:"Netherlands",NC:"New Caledonia",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NU:"Niue",NF:"Norfolk Island",MP:"Northern Mariana Islands",NO:"Norway",OM:"Oman",PK:"Pakistan",PW:"Palau",PS:"Palestine, State of",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PN:"Pitcairn",PL:"Poland",PT:"Portugal",PR:"Puerto Rico",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russian Federation",RW:"Rwanda",BL:"Saint Barthélemy",SH:"Saint Helena, Ascension and Tristan da Cunha",KN:"Saint Kitts and Nevis",LC:"Saint Lucia",MF:"Saint Martin (French part)",PM:"Saint Pierre and Miquelon",VC:"Saint Vincent and the Grenadines",WS:"Samoa",SM:"San Marino",ST:"Sao Tome and Principe",SA:"Saudi Arabia",SN:"Senegal",RS:"Serbia",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapore",SX:"Sint Maarten (Dutch part)",SK:"Slovakia",SI:"Slovenia",SB:"Solomon Islands",SO:"Somalia",ZA:"South Africa",GS:"South Georgia and the South Sandwich Islands",SS:"South Sudan",ES:"Spain",LK:"Sri Lanka",SD:"Sudan",SR:"Suriname",SJ:"Svalbard and Jan Mayen",SZ:"Swaziland",SE:"Sweden",CH:"Switzerland",SY:"Syrian Arab Republic",TW:"Taiwan, Province of China",TJ:"Tajikistan",TZ:"Tanzania, United Republic of",TH:"Thailand",TL:"Timor-Leste",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad and Tobago",TN:"Tunisia",TR:"Turkey",TM:"Turkmenistan",TC:"Turks and Caicos Islands",TV:"Tuvalu",UG:"Uganda",UA:"Ukraine",AE:"United Arab Emirates",GB:"United Kingdom",US:"United States",UM:"United States Minor Outlying Islands",UY:"Uruguay",UZ:"Uzbekistan",VU:"Vanuatu",VE:"Venezuela, Bolivarian Republic of",VN:"Viet Nam",VG:"Virgin Islands, British",VI:"Virgin Islands, U.S.",WF:"Wallis and Futuna",EH:"Western Sahara",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe"}};const Pu=new wn({data:()=>({title:"",metadata:"",release_date:"",label:"",explicit:!1,image:"",type:"",link:"",body:[]}),methods:{artistView:Xu.bind(null,"artist"),albumView:Xu.bind(null,"album"),playPausePreview:Iu.playPausePreview,reset(){this.title="Loading...",this.image="",this.metadata="",this.label="",this.release_date="",this.explicit=!1,this.type="",this.body=[]},addToQueue(e){yc.sendAddToQueue(e.currentTarget.dataset.link)},openQualityModal(e){Lu.open(e.currentTarget.dataset.link)},toggleAll(e){this.body.forEach(t=>{"track"==t.type&&(t.selected=e.currentTarget.checked)})},selectedLinks(){var e=[];return this.body&&this.body.forEach(t=>{"track"==t.type&&t.selected&&e.push("Spotify Playlist"==this.type?t.uri:t.link)}),e.join(";")},convertDuration:Mu.convertDuration,showAlbum(e){const{id:t,title:n,explicit_lyrics:r,label:i,artist:{name:o},tracks:a,tracks:{length:s},release_date:l,cover_xl:u}=e;this.type="Album",this.link="https://www.deezer.com/album/"+t,this.title=n,this.explicit=r,this.label=i,this.metadata=`${o} • ${s} songs`,this.release_date=l.substring(0,10),this.image=u,bu(a)?this.body=null:this.body=a},showPlaylist(e){const{id:t,title:n,picture_xl:r,creation_date:i,creator:{name:o},tracks:a,tracks:{length:s}}=e;this.type="Playlist",this.link="https://www.deezer.com/playlist/"+t,this.title=n,this.image=r,this.release_date=i.substring(0,10),this.metadata=`by ${o} • ${s} songs`,bu(a)?this.body=null:this.body=a},showSpotifyPlaylist(e){const{uri:t,name:n,images:r,images:{length:i},owner:{display_name:o},tracks:a,tracks:{length:s}}=e;this.type="Spotify Playlist",this.link=t,this.title=n,this.image=i?r[0].url:"https://e-cdns-images.dzcdn.net/images/cover/d41d8cd98f00b204e9800998ecf8427e/1000x1000-000000-80-0-0.jpg",this.release_date="",this.metadata=`by ${o} • ${s} songs`,bu(a)?this.body=null:this.body=a}},mounted(){xu.on("show_album",this.showAlbum),xu.on("show_playlist",this.showPlaylist),xu.on("show_spotifyplaylist",this.showSpotifyPlaylist)}}).$mount("#tracklist_tab"),Ru=new wn({data:()=>({title:"",subtitle:"",image:"",data:{},type:"",link:"",id:"0",countries:[]}),methods:{artistView:Xu.bind(null,"artist"),albumView:Xu.bind(null,"album"),convertDuration:Mu.convertDuration,reset(){this.title="Loading...",this.subtitle="",this.image="",this.data={},this.type="",this.link="",this.countries=[]},showTrack(e){const{title:t,title_version:n,album:{cover_xl:r},link:i,available_countries:o,id:a}=e;this.title=t+(n&&-1==t.indexOf(n)?" "+n:""),this.image=r,this.type="track",this.link=i,this.id=a,o.forEach(e=>{let t=[],n=[...e].map(e=>e.charCodeAt()+127397);t.push(String.fromCodePoint(...n)),t.push(Mu.COUNTRIES[e]),this.countries.push(t)}),this.data=e},showAlbum(e){const{title:t,cover_xl:n,link:r,id:i}=e;this.title=t,this.image=n,this.type="album",this.link=r,this.data=e,this.id=i},notSupported(){this.link="error"}},mounted(){xu.on("analyze_track",this.showTrack),xu.on("analyze_album",this.showAlbum),xu.on("analyze_notSupported",this.notSupported)}}).$mount("#analyzer_tab"),Bu=new wn({data:()=>({title:"",errors:[]}),methods:{reset(){this.title="",this.errors=[]},showErrors(e){this.title=e.artist+" - "+e.title,this.errors=e.errors}}}).$mount("#errors_tab");var Fu={data:()=>({test:"super test"}),mounted(){console.log("abcdefghi")}};var qu=function(e,t,n,r,i,o,a,s,l,u){"boolean"!=typeof a&&(l=s,s=a,a=!1);var c,d="function"==typeof n?n.options:n;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,i&&(d.functional=!0)),r&&(d._scopeId=r),o?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,l(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},d._ssrRegister=c):t&&(c=a?function(){t.call(this,u(this.$root.$options.shadowRoot))}:function(e){t.call(this,s(e))}),c)if(d.functional){var f=d.render;d.render=function(e,t){return c.call(t),f(e,t)}}else{var p=d.beforeCreate;d.beforeCreate=p?[].concat(p,c):[c]}return n},Hu="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var zu=document.head||document.getElementsByTagName("head")[0],Uu={};var Vu=function(e){return function(e,t){return function(e,t){var n=Hu?t.media||"default":e,r=Uu[n]||(Uu[n]={ids:new Set,styles:[]});if(!r.ids.has(e)){r.ids.add(e);var i=t.source;if(t.map&&(i+="\n/*# sourceURL="+t.map.sources[0]+" */",i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),r.element||(r.element=document.createElement("style"),r.element.type="text/css",t.media&&r.element.setAttribute("media",t.media),zu.appendChild(r.element)),"styleSheet"in r.element)r.styles.push(i),r.element.styleSheet.cssText=r.styles.filter(Boolean).join("\n");else{var o=r.ids.size-1,a=document.createTextNode(i),s=r.element.childNodes;s[o]&&r.element.removeChild(s[o]),s.length?r.element.insertBefore(a,s[o]):r.element.appendChild(a)}}}(e,t)}};const Wu=Fu;var Gu=function(){var e=this.$createElement;return(this._self._c||e)("div",[this._v("Test")])};Gu._withStripped=!0;const Ku=new wn({components:{TestComponent:qu({render:Gu,staticRenderFns:[]},(function(e){e&&e("data-v-4f3341a0_0",{source:"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",map:{version:3,sources:[],names:[],mappings:"",file:"TestComponent.vue"},media:void 0})}),Wu,void 0,!1,void 0,Vu,void 0)},data:()=>({settings:{tags:{}},lastSettings:{},spotifyFeatures:{},lastCredentials:{},defaultSettings:{},lastUser:"",spotifyUser:"",slimDownloads:!1,previewVolume:window.vol,accountNum:0,accounts:[]}),computed:{changeSlimDownloads:{get(){return this.slimDownloads},set(e){this.slimDownloads=e,document.getElementById("download_list").classList.toggle("slim",e),localStorage.setItem("slimDownloads",e)}}},methods:{copyARLtoClipboard(){let e=this.$refs.loginInput;e.setAttribute("type","text"),e.select(),e.setSelectionRange(0,99999),document.execCommand("copy"),e.setAttribute("type","password"),Eu("ARL copied to clipboard","assignment")},updateMaxVolume(){localStorage.setItem("previewVolume",this.previewVolume.preview_max_volume)},saveSettings(){this.lastSettings={...this.settings},this.lastCredentials={...this.spotifyFeatures};let e=!1;this.lastUser!=this.spotifyUser&&(this.lastUser=(" "+this.spotifyUser).slice(1),localStorage.setItem("spotifyUser",this.lastUser),e=!0),xu.emit("saveSettings",this.lastSettings,this.lastCredentials,!!e&&this.lastUser)},loadSettings(e,t,n=null){n&&(this.defaultSettings={...n}),this.lastSettings={...e},this.lastCredentials={...t},this.settings=e,this.spotifyFeatures=t},login(){let e=this.$refs.loginInput.value.trim();""!=e&&e!=localStorage.getItem("arl")&&xu.emit("login",e,!0,this.accountNum)},changeAccount(){xu.emit("changeAccount",this.accountNum)},accountChanged(e,t){this.$refs.username.innerText=e.name,this.$refs.userpicture.src=`https://e-cdns-images.dzcdn.net/images/user/${e.picture}/125x125-000000-80-0-0.jpg`,this.accountNum=t,localStorage.setItem("accountNum",this.accountNum)},initAccounts(e){this.accounts=e},logout(){xu.emit("logout")},initSettings(e,t,n){this.loadSettings(e,t,n),Eu("Settings loaded!","settings")},updateSettings(e,t){this.loadSettings(e,t),Eu("Settings updated!","settings")},resetSettings(){this.settings={...this.defaultSettings}}},mounted(){this.$refs.loggedInInfo.classList.add("hide"),localStorage.getItem("arl")&&(this.$refs.loginInput.value=localStorage.getItem("arl").trim()),localStorage.getItem("accountNum")&&(this.accountNum=localStorage.getItem("accountNum"));let e=localStorage.getItem("spotifyUser");e&&(this.lastUser=e,this.spotifyUser=e,xu.emit("update_userSpotifyPlaylists",e)),this.changeSlimDownloads="true"===localStorage.getItem("slimDownloads");let t=parseInt(localStorage.getItem("previewVolume"));isNaN(t)&&(t=80,localStorage.setItem("previewVolume",t)),window.vol.preview_max_volume=t,xu.on("init_settings",this.initSettings),xu.on("updateSettings",this.updateSettings),xu.on("accountChanged",this.accountChanged),xu.on("familyAccounts",this.initAccounts)}}).$mount("#settings_tab"),Qu=new wn({data:{names:{TOP_RESULT:"Top Result",TRACK:"Tracks",ARTIST:"Artists",ALBUM:"Albums",PLAYLIST:"Playlists"},results:{query:"",allTab:{ORDER:[],TOP_RESULT:[],ALBUM:{},ARTIST:{},TRACK:{},PLAYLIST:{}},trackTab:{data:[],next:0,total:0,loaded:!1},albumTab:{data:[],next:0,total:0,loaded:!1},artistTab:{data:[],next:0,total:0,loaded:!1},playlistTab:{data:[],next:0,total:0,loaded:!1}}},methods:{artistView:Xu.bind(null,"artist"),albumView:Xu.bind(null,"album"),playlistView:Xu.bind(null,"playlist"),playPausePreview:Iu.playPausePreview,previewMouseEnter:Iu.previewMouseEnter,previewMouseLeave:Iu.previewMouseLeave,handleClickTopResult(e){switch(this.results.allTab.TOP_RESULT[0].type){case"artist":this.artistView(e);break;case"album":this.albumView(e);break;case"playlist":this.playlistView(e)}},changeSearchTab(e){if("TOP_RESULT"===e)return;let t;switch(e){case"TRACK":t="search_track_tab";break;case"ALBUM":t="search_album_tab";break;case"ARTIST":t="search_artist_tab";break;case"PLAYLIST":t="search_playlist_tab"}document.getElementById(t).click()},addToQueue(e){yc.sendAddToQueue(e.currentTarget.dataset.link)},openQualityModal(e){Lu.open(e.currentTarget.dataset.link)},numberWithDots:Mu.numberWithDots,convertDuration:Mu.convertDuration,search(e){xu.emit("search",{term:this.results.query,type:e,start:this.results[e+"Tab"].next,nb:30})},scrolledSearch(e){let t=e+"Tab";this.results[t].next{e.style.transition="all 200ms ease-in-out"}),document.documentElement.addEventListener("transitionend",(function e(){document.querySelectorAll("*").forEach(e=>{e.style.transition=""}),document.documentElement.removeEventListener("transitionend",e)}))}}function ec(e){const{target:t,target:{id:n}}=e;switch(n){case"search_all_tab":nc(t,"search","main_search");break;case"search_track_tab":nc(t,"search","track_search");break;case"search_album_tab":nc(t,"search","album_search");break;case"search_artist_tab":nc(t,"search","artist_search");break;case"search_playlist_tab":nc(t,"search","playlist_search")}}function tc(e){const{target:t,target:{id:n}}=e;switch(n){case"favorites_playlist_tab":nc(t,"favorites","playlist_favorites");break;case"favorites_album_tab":nc(t,"favorites","album_favorites");break;case"favorites_artist_tab":nc(t,"favorites","artist_favorites");break;case"favorites_track_tab":nc(t,"favorites","track_favorites")}}function nc(e,t,n){var r,i,o;for(windows_stack=[],Ju={},i=document.getElementsByClassName(t+"_tabcontent"),r=0;r{e.addEventListener("click",ic)})},changeTab:nc,showView:Xu,analyzeLink:function(e){Ru.reset(),xu.emit("analyzeLink",e)},showErrors:Yu};let ac,sc,lc,uc=parseInt(localStorage.getItem("downloadTabWidth"))||300,cc={},dc=[],fc=[];function pc(e){void 0===e?(ac.style.width="",sc.style.width=""):(ac.style.width=e+"px",sc.style.width=e+"px")}function hc(e){let t=window.innerWidth-e.pageX+2;t<250?t=250:t>500&&(t=500),uc=t,pc(t)}function vc(e,t=!1){cc[e.uuid]=e,e.downloaded+e.failed==e.size?-1==fc.indexOf(e.uuid)&&fc.push(e.uuid):-1==dc.indexOf(e.uuid)&&dc.push(e.uuid);let n=document.getElementById("download_"+e.uuid);if(void 0!==n&&null!=n||ku(sc).append(`
\n\t\t\t
\n\t\t\t\tCover ${e.title}\n\t\t\t\t
\n\t\t\t\t\t${e.title} - \n\t\t\t\t\t${e.artist}\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t${e.downloaded+e.failed}/${e.size}\n\t\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\tremove\n\t\t\t
\n\t\t
`),(e.progress>0||t)&&ku("#bar_"+e.uuid).removeClass("indeterminate").addClass("determinate"),ku("#bar_"+e.uuid).css("width",e.progress+"%"),e.failed>=1&&0==ku("#download_"+e.uuid+" .queue_failed").length&&ku("#download_"+e.uuid+" .download_info_status").append(`(${e.failed}error_outline)`),e.downloaded+e.failed==e.size){let t=ku("#download_"+e.uuid).find(".queue_icon");if(0==e.failed)t.text("done");else{let n=ku("#download_"+e.uuid).find(".queue_failed_button");t.addClass("clickable"),n.addClass("clickable"),t.bind("click",{item:e},Yu),n.bind("click",{item:e},Yu),e.failed>=e.size?t.text("error"):t.text("warning")}}e.init||Eu(e.title+" added to queue","playlist_add_check")}function mc(e){const{target:t}=e;if(!t.matches(".queue_icon[data-uuid]"))return;let n=t.innerText,r=ku(t).data("uuid");switch(n){case"remove":xu.emit("removeFromQueue",r)}}function gc(e){e.preventDefault(),pc(),ac.style.transition="all 250ms ease-in-out";let t=ac.classList.toggle("tab_hidden");t||pc(uc),localStorage.setItem("downloadTabOpen",!t)}xu.on("startDownload",(function(e){ku("#bar_"+e).removeClass("indeterminate").addClass("determinate")})),xu.on("init_downloadQueue",(function(e){const{queue:t,queueComplete:n,currentItem:r,queueList:i}=e;n.length&&n.forEach(e=>{i[e].init=!0,vc(i[e])}),r&&(i[r].init=!0,vc(i[r],!0)),t.forEach(e=>{i[e].init=!0,vc(i[e])})})),xu.on("addedToQueue",vc),xu.on("removedFromQueue",(function(e){let t=dc.indexOf(e);t>-1&&(dc.splice(t,1),ku("#download_"+cc[e].uuid).remove(),delete cc[e])})),xu.on("finishDownload",(function(e){if(dc.indexOf(e)>-1){Eu(cc[e].title+" finished downloading.","done"),ku("#bar_"+e).css("width","100%");let t=ku("#download_"+e).find(".queue_icon");if(0==cc[e].failed)t.text("done");else{let n=ku("#download_"+e).find(".queue_failed_button");t.addClass("clickable"),n.addClass("clickable"),t.bind("click",{item:cc[e]},Yu),n.bind("click",{item:cc[e]},Yu),cc[e].failed>=cc[e].size?t.text("error"):t.text("warning")}let n=dc.indexOf(e);n>-1&&(dc.splice(n,1),fc.push(e)),dc.length<=0&&Eu("All downloads completed!","done_all")}})),xu.on("removedAllDownloads",(function(e){if(fc=[],""==e)dc=[],cc={},ku(sc).html("");else{dc=[e];let t=cc[e];cc={},cc[e]=t,ku(".download_object").each((function(t){ku(this).attr("id")!="download_"+e&&ku(this).remove()}))}})),xu.on("removedFinishedDownloads",(function(){fc.forEach(e=>{ku("#download_"+e).remove()}),fc=[]})),xu.on("updateQueue",(function(e){const{uuid:t,downloaded:n,failed:r,progress:i}=e;t&&dc.indexOf(t)>-1&&(n&&(cc[t].downloaded++,ku("#download_"+t+" .queue_downloaded").text(cc[t].downloaded+cc[t].failed)),r&&(cc[t].failed++,ku("#download_"+t+" .queue_downloaded").text(cc[t].downloaded+cc[t].failed),1==cc[t].failed&&0==ku("#download_"+t+" .queue_failed").length?ku("#download_"+t+" .download_info_status").append('(1 error_outline)'):ku("#download_"+t+" .queue_failed").text(cc[t].failed),cc[t].errors.push({message:e.error,data:e.data})),i&&(cc[t].progress=i,ku("#bar_"+t).css("width",i+"%")))}));var yc={init:function(){ac=document.getElementById("download_tab_container"),sc=document.getElementById("download_list"),lc=document.getElementById("download_tab_drag_handler"),"true"===localStorage.getItem("slimDownloads")&&sc.classList.add("slim"),"true"===localStorage.getItem("downloadTabOpen")&&(ac.classList.remove("tab_hidden"),pc(uc)),sc.addEventListener("click",mc),document.getElementById("toggle_download_tab").addEventListener("click",gc),document.getElementById("clean_queue").addEventListener("click",()=>{xu.emit("removeFinishedDownloads")}),document.getElementById("cancel_queue").addEventListener("click",()=>{xu.emit("cancelAllDownloads")}),document.getElementById("open_downloads_folder").addEventListener("click",()=>{window.clientMode&&xu.emit("openDownloadsFolder")}),lc.addEventListener("mousedown",e=>{e.preventDefault(),document.addEventListener("mousemove",hc)}),document.addEventListener("mouseup",()=>{document.removeEventListener("mousemove",hc)}),ac.addEventListener("transitionend",()=>{ac.style.transition=""}),window.addEventListener("beforeunload",()=>{localStorage.setItem("downloadTabWidth",uc)})},sendAddToQueue:function(e,t=null){""!=e&&xu.emit("addToQueue",{url:e,bitrate:t})},addToQueue:vc};const bc=new wn({data:()=>({currentTab:"",sortKey:"release_date",sortOrder:"desc",title:"",image:"",type:"",link:"",head:null,body:null}),methods:{albumView:Xu.bind(null,"album"),reset(){this.title="Loading...",this.image="",this.type="",this.currentTab="",this.sortKey="release_date",this.sortOrder="desc",this.link="",this.head=[],this.body=null},addToQueue(e){e.stopPropagation(),yc.sendAddToQueue(e.currentTarget.dataset.link)},openQualityModal(e){Lu.open(e.currentTarget.dataset.link)},sortBy(e){e==this.sortKey?this.sortOrder="asc"==this.sortOrder?"desc":"asc":(this.sortKey=e,this.sortOrder="asc")},changeTab(e){this.currentTab=e},getCurrentTab(){return this.currentTab},checkNewRelease(e){let t=new Date,n=new Date(e);return n.setDate(n.getDate()+3),t.setHours(0,0,0,0),t.getTime()<=n.getTime()},showArtist(e){const{name:t,picture_xl:n,id:r,releases:i}=e;this.title=t,this.image=n,this.type="Artist",this.link="https://www.deezer.com/artist/"+r,""===this.currentTab&&(this.currentTab=Object.keys(i)[0]),this.sortKey="release_date",this.sortOrder="desc",this.head=[{title:"Title",sortKey:"title"},{title:"Release Date",sortKey:"release_date"},{title:"",width:"32px"}],bu(i)?this.body=null:this.body=i}},computed:{showTable(){return this.body?(e=this.body[this.currentTab],t=this.sortKey,n=this.sortOrder,null==e?[]:(ms(t)||(t=null==t?[]:[t]),ms(n=r?void 0:n)||(n=null==n?[]:[n]),wu(e,t,n))):[];var e,t,n,r}},mounted(){xu.on("show_artist",this.showArtist)}}).$mount("#artist_tab");new wn({data:()=>({country:"",id:0,countries:[],chart:[]}),methods:{artistView:Xu.bind(null,"artist"),albumView:Xu.bind(null,"album"),playPausePreview:Iu.playPausePreview,previewMouseEnter:Iu.previewMouseEnter,previewMouseLeave:Iu.previewMouseLeave,convertDuration:Mu.convertDuration,addToQueue(e){e.stopPropagation(),yc.sendAddToQueue(e.currentTarget.dataset.link)},openQualityModal(e){Lu.open(e.currentTarget.dataset.link)},getTrackList(e){document.getElementById("content").scrollTo(0,0);const{currentTarget:{dataset:{title:t}},currentTarget:{dataset:{id:n}}}=e;this.country=t,localStorage.setItem("chart",this.country),this.id=n,xu.emit("getChartTracks",this.id)},setTracklist(e){this.chart=e},changeCountry(){this.country="",this.id=0},initCharts(e){if(this.countries=e,this.country=localStorage.getItem("chart")||"",!this.country)return;let t=0;for(;t({tracks:[],albums:[],artists:[],playlists:[],spotifyPlaylists:[]}),methods:{artistView:Xu.bind(null,"artist"),albumView:Xu.bind(null,"album"),playlistView:Xu.bind(null,"playlist"),spotifyPlaylistView:Xu.bind(null,"spotifyplaylist"),playPausePreview:Iu.playPausePreview,previewMouseEnter:Iu.previewMouseEnter,previewMouseLeave:Iu.previewMouseLeave,convertDuration:Mu.convertDuration,addToQueue(e){e.stopPropagation(),yc.sendAddToQueue(e.currentTarget.dataset.link)},openQualityModal(e){Lu.open(e.currentTarget.dataset.link)},updated_userSpotifyPlaylists(e){this.spotifyPlaylists=e},updated_userPlaylists(e){this.playlists=e},updated_userAlbums(e){this.albums=e},updated_userArtist(e){this.artists=e},updated_userTracks(e){this.tracks=e},reloadTabs(){this.$refs.reloadButton.classList.add("spin"),xu.emit("update_userFavorites"),localStorage.getItem("spotifyUser")&&xu.emit("update_userSpotifyPlaylists",localStorage.getItem("spotifyUser"))},updated_userFavorites(e){const{tracks:t,albums:n,artists:r,playlists:i}=e;this.tracks=t,this.albums=n,this.artists=r,this.playlists=i,this.$refs.reloadButton.addEventListener("animationiteration",()=>{this.$refs.reloadButton.classList.remove("spin"),Eu("Refresh completed!","done",!0)},{once:!0})},initFavorites(e){this.updated_userFavorites(e),document.getElementById("favorites_playlist_tab").click()}},mounted(){xu.on("init_favorites",this.initFavorites),xu.on("updated_userFavorites",this.updated_userFavorites),xu.on("updated_userSpotifyPlaylists",this.updated_userSpotifyPlaylists),xu.on("updated_userPlaylists",this.updated_userPlaylists),xu.on("updated_userAlbums",this.updated_userAlbums),xu.on("updated_userArtist",this.updated_userArtist),xu.on("updated_userTracks",this.updated_userTracks)}}).$mount("#favorites_tab"),new wn({data:()=>({playlists:[],albums:[]}),methods:{artistView:Xu.bind(null,"artist"),albumView:Xu.bind(null,"album"),playlistView:Xu.bind(null,"playlist"),openSettings(){document.getElementById("main_settings_tablink").click()},addToQueue(e){yc.sendAddToQueue(e.currentTarget.dataset.link)},openQualityModal(e){Lu.open(e.currentTarget.dataset.link)},initHome(e){const{playlists:{data:t},albums:{data:n}}=e;this.playlists=t,this.albums=n}},mounted(){localStorage.getItem("arl")&&this.$refs.notLogged.classList.add("hide"),xu.on("init_home",this.initHome)}}).$mount("#home_tab");function _c(e){let t=e.target;t.scrollTop+t.clientHeight>=t.scrollHeight&&"search_tab"===main_selected&&-1!=["track_search","album_search","artist_search","playlist_search"].indexOf(search_selected)&&Qu.scrolledSearch(search_selected.split("_")[0])}function wc(e){if(13!==e.keyCode)return;let t=this.value;if(Mu.isValidURL(t))e.ctrlKey?Lu.open(t):"analyzer_tab"==window.main_selected?oc.analyzeLink(t):yc.sendAddToQueue(t);else{if(""===t)return;t!==Qu.results.query||"search_tab"==main_selected?(document.getElementById("search_tab_content").style.display="none",xu.emit("mainSearch",{term:t}),document.getElementById("content").style.display="none",document.getElementById("search_placeholder").classList.toggle("loading_placeholder--hidden")):(document.getElementById("search_tab_content").style.display="block",document.getElementById("main_search_tablink").click())}}var xc={linkListeners:function(){document.getElementById("content").addEventListener("scroll",Mu.debounce(_c,100)),document.getElementById("searchbar").addEventListener("keyup",wc)}};document.addEventListener("DOMContentLoaded",(function(){!function(){let e=localStorage.getItem("selectedTheme");if(e){let t="theme_toggler--active";document.querySelector("."+t).classList.remove(t),document.querySelector(`.theme_toggler[data-theme-variant="${e}"]`).classList.add(t)}}(),yc.init(),Lu.init(),oc.init(),xc.linkListeners(),Iu.init()})),window.addEventListener("pywebviewready",(function(){window.clientMode=!0,document.querySelector("#open_downloads_folder").classList.remove("hide")})),xu.on("message",(function(e){console.log(e)})),xu.on("logging_in",(function(){Eu("Logging in","loading",!1,"login-toast")})),xu.on("init_autologin",(function(){let e=localStorage.getItem("arl"),t=localStorage.getItem("accountNum");e&&(e=e.trim(),0!=t?xu.emit("login",e,!0,t):xu.emit("login",e))})),xu.on("logged_in",(function(e){switch(e.status){case 1:case 3:Eu("Logged in","done",!0,"login-toast"),e.arl&&(localStorage.setItem("arl",e.arl),ku("#login_input_arl").val(e.arl)),ku("#open_login_prompt").hide(),e.user&&(ku("#settings_username").text(e.user.name),ku("#settings_picture").attr("src",`https://e-cdns-images.dzcdn.net/images/user/${e.user.picture}/125x125-000000-80-0-0.jpg`),document.getElementById("logged_in_info").classList.remove("hide")),document.getElementById("home_not_logged_in").classList.add("hide");break;case 2:Eu("Already logged in","done",!0,"login-toast"),e.user&&(ku("#settings_username").text(e.user.name),ku("#settings_picture").attr("src",`https://e-cdns-images.dzcdn.net/images/user/${e.user.picture}/125x125-000000-80-0-0.jpg`),document.getElementById("logged_in_info").classList.remove("hide")),document.getElementById("home_not_logged_in").classList.add("hide");break;case 0:Eu("Couldn't log in","close",!0,"login-toast"),localStorage.removeItem("arl"),ku("#login_input_arl").val(""),ku("#open_login_prompt").show(),document.getElementById("logged_in_info").classList.add("hide"),ku("#settings_username").text("Not Logged"),ku("#settings_picture").attr("src","https://e-cdns-images.dzcdn.net/images/user/125x125-000000-80-0-0.jpg"),document.getElementById("home_not_logged_in").classList.remove("hide")}})),xu.on("logged_out",(function(){Eu("Logged out","done",!0,"login-toast"),localStorage.removeItem("arl"),ku("#login_input_arl").val(""),ku("#open_login_prompt").show(),document.getElementById("logged_in_info").classList.add("hide"),ku("#settings_username").text("Not Logged"),ku("#settings_picture").attr("src","https://e-cdns-images.dzcdn.net/images/user/125x125-000000-80-0-0.jpg"),document.getElementById("home_not_logged_in").classList.remove("hide")})),xu.on("cancellingCurrentItem",(function(e){Eu("Cancelling current item.","loading",!1,"cancelling_"+e)})),xu.on("currentItemCancelled",(function(e){Eu("Current item cancelled.","done",!0,"cancelling_"+e)})),xu.on("startAddingArtist",(function(e){Eu(`Adding ${e.name} albums to queue`,"loading",!1,"artist_"+e.id)})),xu.on("finishAddingArtist",(function(e){Eu(`Added ${e.name} albums to queue`,"done",!0,"artist_"+e.id)})),xu.on("startConvertingSpotifyPlaylist",(function(e){Eu("Converting spotify tracks to deezer tracks","loading",!1,"spotifyplaylist_"+e)})),xu.on("finishConvertingSpotifyPlaylist",(function(e){Eu("Spotify playlist converted","done",!0,"spotifyplaylist_"+e)})),xu.on("errorMessage",(function(e){Eu(e,"error")})),xu.on("alreadyInQueue",(function(e){Eu(e.title+" is already in queue!","playlist_add_check")})); +!function(t,n){e.exports?e.exports=n():t.Toastify=n()}(Tu,(function(e){var t=function(e){return new t.lib.init(e)};function n(e,t){return!(!e||"string"!=typeof t)&&!!(e.className&&e.className.trim().split(/\s+/gi).indexOf(t)>-1)}return t.lib=t.prototype={toastify:"1.8.0",constructor:t,init:function(e){return e||(e={}),this.options={},this.toastElement=null,this.options.text=e.text||"Hi there!",this.options.node=e.node,this.options.duration=0===e.duration?0:e.duration||3e3,this.options.selector=e.selector,this.options.callback=e.callback||function(){},this.options.destination=e.destination,this.options.newWindow=e.newWindow||!1,this.options.close=e.close||!1,this.options.gravity="bottom"===e.gravity?"toastify-bottom":"toastify-top",this.options.positionLeft=e.positionLeft||!1,this.options.position=e.position||"",this.options.backgroundColor=e.backgroundColor,this.options.avatar=e.avatar||"",this.options.className=e.className||"",this.options.stopOnFocus=void 0===e.stopOnFocus||e.stopOnFocus,this.options.onClick=e.onClick,this},buildToast:function(){if(!this.options)throw"Toastify is not initialized";var e=document.createElement("div");if(e.className="toastify on "+this.options.className,this.options.position?e.className+=" toastify-"+this.options.position:!0===this.options.positionLeft?(e.className+=" toastify-left",console.warn("Property `positionLeft` will be depreciated in further versions. Please use `position` instead.")):e.className+=" toastify-right",e.className+=" "+this.options.gravity,this.options.backgroundColor&&(e.style.background=this.options.backgroundColor),this.options.node&&this.options.node.nodeType===Node.ELEMENT_NODE)e.appendChild(this.options.node);else if(e.innerHTML=this.options.text,""!==this.options.avatar){var t=document.createElement("img");t.src=this.options.avatar,t.className="toastify-avatar","left"==this.options.position||!0===this.options.positionLeft?e.appendChild(t):e.insertAdjacentElement("beforeend",t)}if(!0===this.options.close){var n=document.createElement("span");n.innerHTML="✖",n.className="toast-close",n.addEventListener("click",function(e){e.stopPropagation(),this.removeElement(this.toastElement),window.clearTimeout(this.toastElement.timeOutValue)}.bind(this));var r=window.innerWidth>0?window.innerWidth:screen.width;("left"==this.options.position||!0===this.options.positionLeft)&&r>360?e.insertAdjacentElement("afterbegin",n):e.appendChild(n)}if(this.options.stopOnFocus&&this.options.duration>0){const t=this;e.addEventListener("mouseover",(function(t){window.clearTimeout(e.timeOutValue)})),e.addEventListener("mouseleave",(function(){e.timeOutValue=window.setTimeout((function(){t.removeElement(e)}),t.options.duration)}))}return void 0!==this.options.destination&&e.addEventListener("click",function(e){e.stopPropagation(),!0===this.options.newWindow?window.open(this.options.destination,"_blank"):window.location=this.options.destination}.bind(this)),"function"==typeof this.options.onClick&&void 0===this.options.destination&&e.addEventListener("click",function(e){e.stopPropagation(),this.options.onClick()}.bind(this)),e},showToast:function(){var e;if(this.toastElement=this.buildToast(),!(e=void 0===this.options.selector?document.body:document.getElementById(this.options.selector)))throw"Root element is not defined";return e.insertBefore(this.toastElement,e.firstChild),t.reposition(),this.options.duration>0&&(this.toastElement.timeOutValue=window.setTimeout(function(){this.removeElement(this.toastElement)}.bind(this),this.options.duration)),this},hideToast:function(){this.toastElement.timeOutValue&&clearTimeout(this.toastElement.timeOutValue),this.removeElement(this.toastElement)},removeElement:function(e){e.className=e.className.replace(" on",""),window.setTimeout(function(){this.options.node&&this.options.node.parentNode&&this.options.node.parentNode.removeChild(this.options.node),e.parentNode&&e.parentNode.removeChild(e),this.options.callback.call(e),t.reposition()}.bind(this),400)}},t.reposition=function(){for(var e,t={top:15,bottom:15},r={top:15,bottom:15},i={top:15,bottom:15},o=document.getElementsByClassName("toastify"),a=0;a0?window.innerWidth:screen.width)<=360?(o[a].style[e]=i[e]+"px",i[e]+=s+15):!0===n(o[a],"toastify-left")?(o[a].style[e]=t[e]+"px",t[e]+=s+15):(o[a].style[e]=r[e]+"px",r[e]+=s+15)}return this},t.lib.init.prototype=t.lib,t}))}));let Au={};const Eu=function(e,t=null,n=!0,r=null){if(Au[r]){let i=Au[r],o=ku(`div.toastify[toast_id=${r}]`);e&&o.find(".toast-message").html(e),t&&(t="loading"==t?'
':`${t}`,o.find(".toast-icon").html(t)),null!==n&&n&&setTimeout((function(){i.hideToast(),delete Au[r]}),3e3)}else{let i=Su({text:`${t=null==t?"":"loading"==t?'
':`${t}`}
${e}`,duration:n?3e3:0,gravity:"bottom",position:"left"}).showToast();r&&(Au[r]=i,ku(i.toastElement).attr("toast_id",r))}};xu.on("toast",e=>{const{msg:t,icon:n,dismiss:r,id:i}=e;Eu(t,n||null,void 0===r||r,i||null)});const $u={open:!1,url:"",element:null};function Ou(e){const{target:t}=e;if($u.element.classList.add("animated","fadeOut"),!t.matches(".quality-button"))return;let n=t.dataset.qualityValue;yc.sendAddToQueue($u.url,n)}function ju(){$u.element.classList.remove("animated",$u.open?"fadeOut":"fadeIn"),$u.element.style.display=$u.open?"none":"block",$u.open=!$u.open}var Lu={init:function(){$u.element=document.getElementById("modal_quality"),$u.element.addEventListener("click",Ou),$u.element.addEventListener("webkitAnimationEnd",ju)},open:function(e){$u.url=e,$u.element.style.display="block",$u.element.classList.add("animated","fadeIn")}};window.vol={preview_max_volume:100};let Nu=document.getElementById("preview-track"),Du=!0;var Iu={init:function(){Nu.volume=1,Nu.addEventListener("canplay",(function(){Nu.play(),Du=!1,ku(Nu).animate({volume:vol.preview_max_volume/100},500)})),Nu.addEventListener("timeupdate",(function(){Nu.currentTime>Nu.duration-1&&(ku(Nu).animate({volume:0},800),Du=!0,ku("a[playing] > .preview_controls").css({opacity:0}),ku("*").removeAttr("playing"),ku(".preview_controls").text("play_arrow"),ku(".preview_playlist_controls").text("play_arrow"))}))},stopStackedTabsPreview:function(){ku(".preview_playlist_controls").filter((function(){return ku(this).attr("playing")})).length>0&&(ku(Nu).animate({volume:0},800),Du=!0,ku(".preview_playlist_controls").removeAttr("playing"),ku(".preview_playlist_controls").text("play_arrow"))},previewMouseEnter:function(e){ku(e.currentTarget).css({opacity:1})},previewMouseLeave:function(e){const{currentTarget:t}=e;(ku(t).parent().attr("playing")&&Du||!ku(t).parent().attr("playing"))&&ku(t).css({opacity:0},200)},playPausePreview:function(e){e.preventDefault();const{currentTarget:t}=event;var n="I"==t.tagName?ku(t):ku(t).children("i");ku(t).attr("playing")?Nu.paused?(Nu.play(),Du=!1,n.text("pause"),ku(Nu).animate({volume:vol.preview_max_volume/100},500)):(Du=!0,n.text("play_arrow"),ku(Nu).animate({volume:0},250,"swing",()=>{Nu.pause()})):(ku("*").removeAttr("playing"),ku(t).attr("playing",!0),ku(".preview_controls").text("play_arrow"),ku(".preview_playlist_controls").text("play_arrow"),ku(".preview_controls").css({opacity:0}),n.text("pause"),n.css({opacity:1}),Du=!1,ku(Nu).animate({volume:0},250,"swing",()=>{Nu.pause(),ku("#preview-track_source").prop("src",ku(t).data("preview")),Nu.load()}))}};var Mu={isValidURL:function(e){let t=e.toLowerCase();if(t.startsWith("http")){if(t.indexOf("deezer.com")>=0||t.indexOf("open.spotify.com")>=0)return!0}else if(t.startsWith("spotify:"))return!0;return!1},convertDuration:function(e){let t,n;return t=Math.floor(e/60),n=e-60*t,n<10&&(n="0"+n),t+":"+n},convertDurationSeparated:function(e){let t,n,r;return n=Math.floor(e/60),t=Math.floor(n/60),r=e-60*n,n-=60*t,[t,n,r]},numberWithDots:function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,".")},debounce:function(e,t,n){var r;return function(){var i=this,o=arguments,a=function(){r=null,n||e.apply(i,o)},s=n&&!r;clearTimeout(r),r=setTimeout(a,t),s&&e.apply(i,o)}},COUNTRIES:{AF:"Afghanistan",AX:"Åland Islands",AL:"Albania",DZ:"Algeria",AS:"American Samoa",AD:"Andorra",AO:"Angola",AI:"Anguilla",AQ:"Antarctica",AG:"Antigua and Barbuda",AR:"Argentina",AM:"Armenia",AW:"Aruba",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BS:"Bahamas",BH:"Bahrain",BD:"Bangladesh",BB:"Barbados",BY:"Belarus",BE:"Belgium",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivia, Plurinational State of",BQ:"Bonaire, Sint Eustatius and Saba",BA:"Bosnia and Herzegovina",BW:"Botswana",BV:"Bouvet Island",BR:"Brazil",IO:"British Indian Ocean Territory",BN:"Brunei Darussalam",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",KH:"Cambodia",CM:"Cameroon",CA:"Canada",CV:"Cape Verde",KY:"Cayman Islands",CF:"Central African Republic",TD:"Chad",CL:"Chile",CN:"China",CX:"Christmas Island",CC:"Cocos (Keeling) Islands",CO:"Colombia",KM:"Comoros",CG:"Congo",CD:"Congo, the Democratic Republic of the",CK:"Cook Islands",CR:"Costa Rica",CI:"Côte d'Ivoire",HR:"Croatia",CU:"Cuba",CW:"Curaçao",CY:"Cyprus",CZ:"Czech Republic",DK:"Denmark",DJ:"Djibouti",DM:"Dominica",DO:"Dominican Republic",EC:"Ecuador",EG:"Egypt",SV:"El Salvador",GQ:"Equatorial Guinea",ER:"Eritrea",EE:"Estonia",ET:"Ethiopia",FK:"Falkland Islands (Malvinas)",FO:"Faroe Islands",FJ:"Fiji",FI:"Finland",FR:"France",GF:"French Guiana",PF:"French Polynesia",TF:"French Southern Territories",GA:"Gabon",GM:"Gambia",GE:"Georgia",DE:"Germany",GH:"Ghana",GI:"Gibraltar",GR:"Greece",GL:"Greenland",GD:"Grenada",GP:"Guadeloupe",GU:"Guam",GT:"Guatemala",GG:"Guernsey",GN:"Guinea",GW:"Guinea-Bissau",GY:"Guyana",HT:"Haiti",HM:"Heard Island and McDonald Islands",VA:"Holy See (Vatican City State)",HN:"Honduras",HK:"Hong Kong",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran, Islamic Republic of",IQ:"Iraq",IE:"Ireland",IM:"Isle of Man",IL:"Israel",IT:"Italy",JM:"Jamaica",JP:"Japan",JE:"Jersey",JO:"Jordan",KZ:"Kazakhstan",KE:"Kenya",KI:"Kiribati",KP:"Korea, Democratic People's Republic of",KR:"Korea, Republic of",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Lao People's Democratic Republic",LV:"Latvia",LB:"Lebanon",LS:"Lesotho",LR:"Liberia",LY:"Libya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MO:"Macao",MK:"Macedonia, the Former Yugoslav Republic of",MG:"Madagascar",MW:"Malawi",MY:"Malaysia",MV:"Maldives",ML:"Mali",MT:"Malta",MH:"Marshall Islands",MQ:"Martinique",MR:"Mauritania",MU:"Mauritius",YT:"Mayotte",MX:"Mexico",FM:"Micronesia, Federated States of",MD:"Moldova, Republic of",MC:"Monaco",MN:"Mongolia",ME:"Montenegro",MS:"Montserrat",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar",NA:"Namibia",NR:"Nauru",NP:"Nepal",NL:"Netherlands",NC:"New Caledonia",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NU:"Niue",NF:"Norfolk Island",MP:"Northern Mariana Islands",NO:"Norway",OM:"Oman",PK:"Pakistan",PW:"Palau",PS:"Palestine, State of",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PN:"Pitcairn",PL:"Poland",PT:"Portugal",PR:"Puerto Rico",QA:"Qatar",RE:"Réunion",RO:"Romania",RU:"Russian Federation",RW:"Rwanda",BL:"Saint Barthélemy",SH:"Saint Helena, Ascension and Tristan da Cunha",KN:"Saint Kitts and Nevis",LC:"Saint Lucia",MF:"Saint Martin (French part)",PM:"Saint Pierre and Miquelon",VC:"Saint Vincent and the Grenadines",WS:"Samoa",SM:"San Marino",ST:"Sao Tome and Principe",SA:"Saudi Arabia",SN:"Senegal",RS:"Serbia",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapore",SX:"Sint Maarten (Dutch part)",SK:"Slovakia",SI:"Slovenia",SB:"Solomon Islands",SO:"Somalia",ZA:"South Africa",GS:"South Georgia and the South Sandwich Islands",SS:"South Sudan",ES:"Spain",LK:"Sri Lanka",SD:"Sudan",SR:"Suriname",SJ:"Svalbard and Jan Mayen",SZ:"Swaziland",SE:"Sweden",CH:"Switzerland",SY:"Syrian Arab Republic",TW:"Taiwan, Province of China",TJ:"Tajikistan",TZ:"Tanzania, United Republic of",TH:"Thailand",TL:"Timor-Leste",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad and Tobago",TN:"Tunisia",TR:"Turkey",TM:"Turkmenistan",TC:"Turks and Caicos Islands",TV:"Tuvalu",UG:"Uganda",UA:"Ukraine",AE:"United Arab Emirates",GB:"United Kingdom",US:"United States",UM:"United States Minor Outlying Islands",UY:"Uruguay",UZ:"Uzbekistan",VU:"Vanuatu",VE:"Venezuela, Bolivarian Republic of",VN:"Viet Nam",VG:"Virgin Islands, British",VI:"Virgin Islands, U.S.",WF:"Wallis and Futuna",EH:"Western Sahara",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe"}};const Pu=new wn({data:()=>({title:"",metadata:"",release_date:"",label:"",explicit:!1,image:"",type:"",link:"",body:[]}),methods:{artistView:Xu.bind(null,"artist"),albumView:Xu.bind(null,"album"),playPausePreview:Iu.playPausePreview,reset(){this.title="Loading...",this.image="",this.metadata="",this.label="",this.release_date="",this.explicit=!1,this.type="",this.body=[]},addToQueue(e){yc.sendAddToQueue(e.currentTarget.dataset.link)},openQualityModal(e){Lu.open(e.currentTarget.dataset.link)},toggleAll(e){this.body.forEach(t=>{"track"==t.type&&(t.selected=e.currentTarget.checked)})},selectedLinks(){var e=[];return this.body&&this.body.forEach(t=>{"track"==t.type&&t.selected&&e.push("Spotify Playlist"==this.type?t.uri:t.link)}),e.join(";")},convertDuration:Mu.convertDuration,showAlbum(e){const{id:t,title:n,explicit_lyrics:r,label:i,artist:{name:o},tracks:a,tracks:{length:s},release_date:l,cover_xl:u}=e;this.type="Album",this.link="https://www.deezer.com/album/"+t,this.title=n,this.explicit=r,this.label=i,this.metadata=`${o} • ${s} songs`,this.release_date=l.substring(0,10),this.image=u,bu(a)?this.body=null:this.body=a},showPlaylist(e){const{id:t,title:n,picture_xl:r,creation_date:i,creator:{name:o},tracks:a,tracks:{length:s}}=e;this.type="Playlist",this.link="https://www.deezer.com/playlist/"+t,this.title=n,this.image=r,this.release_date=i.substring(0,10),this.metadata=`by ${o} • ${s} songs`,bu(a)?this.body=null:this.body=a},showSpotifyPlaylist(e){const{uri:t,name:n,images:r,images:{length:i},owner:{display_name:o},tracks:a,tracks:{length:s}}=e;this.type="Spotify Playlist",this.link=t,this.title=n,this.image=i?r[0].url:"https://e-cdns-images.dzcdn.net/images/cover/d41d8cd98f00b204e9800998ecf8427e/1000x1000-000000-80-0-0.jpg",this.release_date="",this.metadata=`by ${o} • ${s} songs`,bu(a)?this.body=null:this.body=a}},mounted(){xu.on("show_album",this.showAlbum),xu.on("show_playlist",this.showPlaylist),xu.on("show_spotifyplaylist",this.showSpotifyPlaylist)}}).$mount("#tracklist_tab"),Ru=new wn({data:()=>({title:"",subtitle:"",image:"",data:{},type:"",link:"",id:"0",countries:[]}),methods:{artistView:Xu.bind(null,"artist"),albumView:Xu.bind(null,"album"),convertDuration:Mu.convertDuration,reset(){this.title="Loading...",this.subtitle="",this.image="",this.data={},this.type="",this.link="",this.countries=[]},showTrack(e){const{title:t,title_version:n,album:{cover_xl:r},link:i,available_countries:o,id:a}=e;this.title=t+(n&&-1==t.indexOf(n)?" "+n:""),this.image=r,this.type="track",this.link=i,this.id=a,o.forEach(e=>{let t=[],n=[...e].map(e=>e.charCodeAt()+127397);t.push(String.fromCodePoint(...n)),t.push(Mu.COUNTRIES[e]),this.countries.push(t)}),this.data=e},showAlbum(e){const{title:t,cover_xl:n,link:r,id:i}=e;this.title=t,this.image=n,this.type="album",this.link=r,this.data=e,this.id=i},notSupported(){this.link="error"}},mounted(){xu.on("analyze_track",this.showTrack),xu.on("analyze_album",this.showAlbum),xu.on("analyze_notSupported",this.notSupported)}}).$mount("#analyzer_tab"),Bu=new wn({data:()=>({title:"",errors:[]}),methods:{reset(){this.title="",this.errors=[]},showErrors(e){this.title=e.artist+" - "+e.title,this.errors=e.errors}}}).$mount("#errors_tab");var Fu={data:()=>({test:"super test"}),mounted(){console.log("abcdefghi")}};var qu=function(e,t,n,r,i,o,a,s,l,u){"boolean"!=typeof a&&(l=s,s=a,a=!1);var c,d="function"==typeof n?n.options:n;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,i&&(d.functional=!0)),r&&(d._scopeId=r),o?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,l(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},d._ssrRegister=c):t&&(c=a?function(){t.call(this,u(this.$root.$options.shadowRoot))}:function(e){t.call(this,s(e))}),c)if(d.functional){var f=d.render;d.render=function(e,t){return c.call(t),f(e,t)}}else{var p=d.beforeCreate;d.beforeCreate=p?[].concat(p,c):[c]}return n},Hu="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var zu=document.head||document.getElementsByTagName("head")[0],Uu={};var Vu=function(e){return function(e,t){return function(e,t){var n=Hu?t.media||"default":e,r=Uu[n]||(Uu[n]={ids:new Set,styles:[]});if(!r.ids.has(e)){r.ids.add(e);var i=t.source;if(t.map&&(i+="\n/*# sourceURL="+t.map.sources[0]+" */",i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),r.element||(r.element=document.createElement("style"),r.element.type="text/css",t.media&&r.element.setAttribute("media",t.media),zu.appendChild(r.element)),"styleSheet"in r.element)r.styles.push(i),r.element.styleSheet.cssText=r.styles.filter(Boolean).join("\n");else{var o=r.ids.size-1,a=document.createTextNode(i),s=r.element.childNodes;s[o]&&r.element.removeChild(s[o]),s.length?r.element.insertBefore(a,s[o]):r.element.appendChild(a)}}}(e,t)}};const Wu=Fu;var Gu=function(){var e=this.$createElement;return(this._self._c||e)("div",[this._v("Test")])};Gu._withStripped=!0;const Ku=new wn({components:{TestComponent:qu({render:Gu,staticRenderFns:[]},(function(e){e&&e("data-v-46b9b2a0_0",{source:"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",map:{version:3,sources:[],names:[],mappings:"",file:"TestComponent.vue"},media:void 0})}),Wu,void 0,!1,void 0,Vu,void 0)},data:()=>({settings:{tags:{}},lastSettings:{},spotifyFeatures:{},lastCredentials:{},defaultSettings:{},lastUser:"",spotifyUser:"",slimDownloads:!1,previewVolume:window.vol,accountNum:0,accounts:[]}),computed:{changeSlimDownloads:{get(){return this.slimDownloads},set(e){this.slimDownloads=e,document.getElementById("download_list").classList.toggle("slim",e),localStorage.setItem("slimDownloads",e)}}},methods:{copyARLtoClipboard(){let e=this.$refs.loginInput;e.setAttribute("type","text"),e.select(),e.setSelectionRange(0,99999),document.execCommand("copy"),e.setAttribute("type","password"),Eu("ARL copied to clipboard","assignment")},updateMaxVolume(){localStorage.setItem("previewVolume",this.previewVolume.preview_max_volume)},saveSettings(){this.lastSettings={...this.settings},this.lastCredentials={...this.spotifyFeatures};let e=!1;this.lastUser!=this.spotifyUser&&(this.lastUser=(" "+this.spotifyUser).slice(1),localStorage.setItem("spotifyUser",this.lastUser),e=!0),xu.emit("saveSettings",this.lastSettings,this.lastCredentials,!!e&&this.lastUser)},loadSettings(e,t,n=null){n&&(this.defaultSettings={...n}),this.lastSettings={...e},this.lastCredentials={...t},this.settings=e,this.spotifyFeatures=t},login(){let e=this.$refs.loginInput.value.trim();""!=e&&e!=localStorage.getItem("arl")&&xu.emit("login",e,!0,this.accountNum)},changeAccount(){xu.emit("changeAccount",this.accountNum)},accountChanged(e,t){this.$refs.username.innerText=e.name,this.$refs.userpicture.src=`https://e-cdns-images.dzcdn.net/images/user/${e.picture}/125x125-000000-80-0-0.jpg`,this.accountNum=t,localStorage.setItem("accountNum",this.accountNum)},initAccounts(e){this.accounts=e},logout(){xu.emit("logout")},initSettings(e,t,n){this.loadSettings(e,t,n),Eu("Settings loaded!","settings")},updateSettings(e,t){this.loadSettings(e,t),Eu("Settings updated!","settings")},resetSettings(){this.settings={...this.defaultSettings}}},mounted(){this.$refs.loggedInInfo.classList.add("hide"),localStorage.getItem("arl")&&(this.$refs.loginInput.value=localStorage.getItem("arl").trim()),localStorage.getItem("accountNum")&&(this.accountNum=localStorage.getItem("accountNum"));let e=localStorage.getItem("spotifyUser");e&&(this.lastUser=e,this.spotifyUser=e,xu.emit("update_userSpotifyPlaylists",e)),this.changeSlimDownloads="true"===localStorage.getItem("slimDownloads");let t=parseInt(localStorage.getItem("previewVolume"));isNaN(t)&&(t=80,localStorage.setItem("previewVolume",t)),window.vol.preview_max_volume=t,xu.on("init_settings",this.initSettings),xu.on("updateSettings",this.updateSettings),xu.on("accountChanged",this.accountChanged),xu.on("familyAccounts",this.initAccounts)}}).$mount("#settings_tab"),Qu=new wn({data:{names:{TOP_RESULT:"Top Result",TRACK:"Tracks",ARTIST:"Artists",ALBUM:"Albums",PLAYLIST:"Playlists"},results:{query:"",allTab:{ORDER:[],TOP_RESULT:[],ALBUM:{},ARTIST:{},TRACK:{},PLAYLIST:{}},trackTab:{data:[],next:0,total:0,loaded:!1},albumTab:{data:[],next:0,total:0,loaded:!1},artistTab:{data:[],next:0,total:0,loaded:!1},playlistTab:{data:[],next:0,total:0,loaded:!1}}},methods:{artistView:Xu.bind(null,"artist"),albumView:Xu.bind(null,"album"),playlistView:Xu.bind(null,"playlist"),playPausePreview:Iu.playPausePreview,previewMouseEnter:Iu.previewMouseEnter,previewMouseLeave:Iu.previewMouseLeave,handleClickTopResult(e){switch(this.results.allTab.TOP_RESULT[0].type){case"artist":this.artistView(e);break;case"album":this.albumView(e);break;case"playlist":this.playlistView(e)}},changeSearchTab(e){if("TOP_RESULT"===e)return;let t;switch(e){case"TRACK":t="search_track_tab";break;case"ALBUM":t="search_album_tab";break;case"ARTIST":t="search_artist_tab";break;case"PLAYLIST":t="search_playlist_tab"}document.getElementById(t).click()},addToQueue(e){yc.sendAddToQueue(e.currentTarget.dataset.link)},openQualityModal(e){Lu.open(e.currentTarget.dataset.link)},numberWithDots:Mu.numberWithDots,convertDuration:Mu.convertDuration,search(e){xu.emit("search",{term:this.results.query,type:e,start:this.results[e+"Tab"].next,nb:30})},scrolledSearch(e){let t=e+"Tab";this.results[t].next{e.style.transition="all 200ms ease-in-out"}),document.documentElement.addEventListener("transitionend",(function e(){document.querySelectorAll("*").forEach(e=>{e.style.transition=""}),document.documentElement.removeEventListener("transitionend",e)}))}}function ec(e){const{target:t,target:{id:n}}=e;switch(n){case"search_all_tab":nc(t,"search","main_search");break;case"search_track_tab":nc(t,"search","track_search");break;case"search_album_tab":nc(t,"search","album_search");break;case"search_artist_tab":nc(t,"search","artist_search");break;case"search_playlist_tab":nc(t,"search","playlist_search")}}function tc(e){const{target:t,target:{id:n}}=e;switch(n){case"favorites_playlist_tab":nc(t,"favorites","playlist_favorites");break;case"favorites_album_tab":nc(t,"favorites","album_favorites");break;case"favorites_artist_tab":nc(t,"favorites","artist_favorites");break;case"favorites_track_tab":nc(t,"favorites","track_favorites")}}function nc(e,t,n){var r,i,o;for(windows_stack=[],Ju={},i=document.getElementsByClassName(t+"_tabcontent"),r=0;r{e.addEventListener("click",ic)})},changeTab:nc,showView:Xu,analyzeLink:function(e){Ru.reset(),xu.emit("analyzeLink",e)},showErrors:Yu};let ac,sc,lc,uc=parseInt(localStorage.getItem("downloadTabWidth"))||300,cc={},dc=[],fc=[];function pc(e){void 0===e?(ac.style.width="",sc.style.width=""):(ac.style.width=e+"px",sc.style.width=e+"px")}function hc(e){let t=window.innerWidth-e.pageX+2;t<250?t=250:t>500&&(t=500),uc=t,pc(t)}function vc(e,t=!1){cc[e.uuid]=e,e.downloaded+e.failed==e.size?-1==fc.indexOf(e.uuid)&&fc.push(e.uuid):-1==dc.indexOf(e.uuid)&&dc.push(e.uuid);let n=document.getElementById("download_"+e.uuid);if(void 0!==n&&null!=n||ku(sc).append(`
\n\t\t\t
\n\t\t\t\tCover ${e.title}\n\t\t\t\t
\n\t\t\t\t\t${e.title} - \n\t\t\t\t\t${e.artist}\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t${e.downloaded+e.failed}/${e.size}\n\t\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\tremove\n\t\t\t
\n\t\t
`),(e.progress>0||t)&&ku("#bar_"+e.uuid).removeClass("indeterminate").addClass("determinate"),ku("#bar_"+e.uuid).css("width",e.progress+"%"),e.failed>=1&&0==ku("#download_"+e.uuid+" .queue_failed").length&&ku("#download_"+e.uuid+" .download_info_status").append(`(${e.failed}error_outline)`),e.downloaded+e.failed==e.size){let t=ku("#download_"+e.uuid).find(".queue_icon");if(0==e.failed)t.text("done");else{let n=ku("#download_"+e.uuid).find(".queue_failed_button");t.addClass("clickable"),n.addClass("clickable"),t.bind("click",{item:e},Yu),n.bind("click",{item:e},Yu),e.failed>=e.size?t.text("error"):t.text("warning")}}e.init||Eu(e.title+" added to queue","playlist_add_check")}function mc(e){const{target:t}=e;if(!t.matches(".queue_icon[data-uuid]"))return;let n=t.innerText,r=ku(t).data("uuid");switch(n){case"remove":xu.emit("removeFromQueue",r)}}function gc(e){e.preventDefault(),pc(),ac.style.transition="all 250ms ease-in-out";let t=ac.classList.toggle("tab_hidden");t||pc(uc),localStorage.setItem("downloadTabOpen",!t)}xu.on("startDownload",(function(e){ku("#bar_"+e).removeClass("indeterminate").addClass("determinate")})),xu.on("init_downloadQueue",(function(e){const{queue:t,queueComplete:n,currentItem:r,queueList:i}=e;n.length&&n.forEach(e=>{i[e].init=!0,vc(i[e])}),r&&(i[r].init=!0,vc(i[r],!0)),t.forEach(e=>{i[e].init=!0,vc(i[e])})})),xu.on("addedToQueue",vc),xu.on("removedFromQueue",(function(e){let t=dc.indexOf(e);t>-1&&(dc.splice(t,1),ku("#download_"+cc[e].uuid).remove(),delete cc[e])})),xu.on("finishDownload",(function(e){if(dc.indexOf(e)>-1){Eu(cc[e].title+" finished downloading.","done"),ku("#bar_"+e).css("width","100%");let t=ku("#download_"+e).find(".queue_icon");if(0==cc[e].failed)t.text("done");else{let n=ku("#download_"+e).find(".queue_failed_button");t.addClass("clickable"),n.addClass("clickable"),t.bind("click",{item:cc[e]},Yu),n.bind("click",{item:cc[e]},Yu),cc[e].failed>=cc[e].size?t.text("error"):t.text("warning")}let n=dc.indexOf(e);n>-1&&(dc.splice(n,1),fc.push(e)),dc.length<=0&&Eu("All downloads completed!","done_all")}})),xu.on("removedAllDownloads",(function(e){if(fc=[],""==e)dc=[],cc={},ku(sc).html("");else{dc=[e];let t=cc[e];cc={},cc[e]=t,ku(".download_object").each((function(t){ku(this).attr("id")!="download_"+e&&ku(this).remove()}))}})),xu.on("removedFinishedDownloads",(function(){fc.forEach(e=>{ku("#download_"+e).remove()}),fc=[]})),xu.on("updateQueue",(function(e){const{uuid:t,downloaded:n,failed:r,progress:i}=e;t&&dc.indexOf(t)>-1&&(n&&(cc[t].downloaded++,ku("#download_"+t+" .queue_downloaded").text(cc[t].downloaded+cc[t].failed)),r&&(cc[t].failed++,ku("#download_"+t+" .queue_downloaded").text(cc[t].downloaded+cc[t].failed),1==cc[t].failed&&0==ku("#download_"+t+" .queue_failed").length?ku("#download_"+t+" .download_info_status").append('(1 error_outline)'):ku("#download_"+t+" .queue_failed").text(cc[t].failed),cc[t].errors.push({message:e.error,data:e.data})),i&&(cc[t].progress=i,ku("#bar_"+t).css("width",i+"%")))}));var yc={init:function(){ac=document.getElementById("download_tab_container"),sc=document.getElementById("download_list"),lc=document.getElementById("download_tab_drag_handler"),"true"===localStorage.getItem("slimDownloads")&&sc.classList.add("slim"),"true"===localStorage.getItem("downloadTabOpen")&&(ac.classList.remove("tab_hidden"),pc(uc)),sc.addEventListener("click",mc),document.getElementById("toggle_download_tab").addEventListener("click",gc),document.getElementById("clean_queue").addEventListener("click",()=>{xu.emit("removeFinishedDownloads")}),document.getElementById("cancel_queue").addEventListener("click",()=>{xu.emit("cancelAllDownloads")}),document.getElementById("open_downloads_folder").addEventListener("click",()=>{window.clientMode&&xu.emit("openDownloadsFolder")}),lc.addEventListener("mousedown",e=>{e.preventDefault(),document.addEventListener("mousemove",hc)}),document.addEventListener("mouseup",()=>{document.removeEventListener("mousemove",hc)}),ac.addEventListener("transitionend",()=>{ac.style.transition=""}),window.addEventListener("beforeunload",()=>{localStorage.setItem("downloadTabWidth",uc)})},sendAddToQueue:function(e,t=null){""!=e&&xu.emit("addToQueue",{url:e,bitrate:t})},addToQueue:vc};const bc=new wn({data:()=>({currentTab:"",sortKey:"release_date",sortOrder:"desc",title:"",image:"",type:"",link:"",head:null,body:null}),methods:{albumView:Xu.bind(null,"album"),reset(){this.title="Loading...",this.image="",this.type="",this.currentTab="",this.sortKey="release_date",this.sortOrder="desc",this.link="",this.head=[],this.body=null},addToQueue(e){e.stopPropagation(),yc.sendAddToQueue(e.currentTarget.dataset.link)},openQualityModal(e){Lu.open(e.currentTarget.dataset.link)},sortBy(e){e==this.sortKey?this.sortOrder="asc"==this.sortOrder?"desc":"asc":(this.sortKey=e,this.sortOrder="asc")},changeTab(e){this.currentTab=e},getCurrentTab(){return this.currentTab},checkNewRelease(e){let t=new Date,n=new Date(e);return n.setDate(n.getDate()+3),t.setHours(0,0,0,0),t.getTime()<=n.getTime()},showArtist(e){const{name:t,picture_xl:n,id:r,releases:i}=e;this.title=t,this.image=n,this.type="Artist",this.link="https://www.deezer.com/artist/"+r,""===this.currentTab&&(this.currentTab=Object.keys(i)[0]),this.sortKey="release_date",this.sortOrder="desc",this.head=[{title:"Title",sortKey:"title"},{title:"Release Date",sortKey:"release_date"},{title:"",width:"32px"}],bu(i)?this.body=null:this.body=i}},computed:{showTable(){return this.body?(e=this.body[this.currentTab],t=this.sortKey,n=this.sortOrder,null==e?[]:(ms(t)||(t=null==t?[]:[t]),ms(n=r?void 0:n)||(n=null==n?[]:[n]),wu(e,t,n))):[];var e,t,n,r}},mounted(){xu.on("show_artist",this.showArtist)}}).$mount("#artist_tab");new wn({data:()=>({country:"",id:0,countries:[],chart:[]}),methods:{artistView:Xu.bind(null,"artist"),albumView:Xu.bind(null,"album"),playPausePreview:Iu.playPausePreview,previewMouseEnter:Iu.previewMouseEnter,previewMouseLeave:Iu.previewMouseLeave,convertDuration:Mu.convertDuration,addToQueue(e){e.stopPropagation(),yc.sendAddToQueue(e.currentTarget.dataset.link)},openQualityModal(e){Lu.open(e.currentTarget.dataset.link)},getTrackList(e){document.getElementById("content").scrollTo(0,0);const{currentTarget:{dataset:{title:t}},currentTarget:{dataset:{id:n}}}=e;this.country=t,localStorage.setItem("chart",this.country),this.id=n,xu.emit("getChartTracks",this.id)},setTracklist(e){this.chart=e},changeCountry(){this.country="",this.id=0},initCharts(e){if(this.countries=e,this.country=localStorage.getItem("chart")||"",!this.country)return;let t=0;for(;t({tracks:[],albums:[],artists:[],playlists:[],spotifyPlaylists:[]}),methods:{artistView:Xu.bind(null,"artist"),albumView:Xu.bind(null,"album"),playlistView:Xu.bind(null,"playlist"),spotifyPlaylistView:Xu.bind(null,"spotifyplaylist"),playPausePreview:Iu.playPausePreview,previewMouseEnter:Iu.previewMouseEnter,previewMouseLeave:Iu.previewMouseLeave,convertDuration:Mu.convertDuration,addToQueue(e){e.stopPropagation(),yc.sendAddToQueue(e.currentTarget.dataset.link)},openQualityModal(e){Lu.open(e.currentTarget.dataset.link)},updated_userSpotifyPlaylists(e){this.spotifyPlaylists=e},updated_userPlaylists(e){this.playlists=e},updated_userAlbums(e){this.albums=e},updated_userArtist(e){this.artists=e},updated_userTracks(e){this.tracks=e},reloadTabs(){this.$refs.reloadButton.classList.add("spin"),xu.emit("update_userFavorites"),localStorage.getItem("spotifyUser")&&xu.emit("update_userSpotifyPlaylists",localStorage.getItem("spotifyUser"))},updated_userFavorites(e){const{tracks:t,albums:n,artists:r,playlists:i}=e;this.tracks=t,this.albums=n,this.artists=r,this.playlists=i,this.$refs.reloadButton.addEventListener("animationiteration",()=>{this.$refs.reloadButton.classList.remove("spin"),Eu("Refresh completed!","done",!0)},{once:!0})},initFavorites(e){this.updated_userFavorites(e),document.getElementById("favorites_playlist_tab").click()}},mounted(){xu.on("init_favorites",this.initFavorites),xu.on("updated_userFavorites",this.updated_userFavorites),xu.on("updated_userSpotifyPlaylists",this.updated_userSpotifyPlaylists),xu.on("updated_userPlaylists",this.updated_userPlaylists),xu.on("updated_userAlbums",this.updated_userAlbums),xu.on("updated_userArtist",this.updated_userArtist),xu.on("updated_userTracks",this.updated_userTracks)}}).$mount("#favorites_tab"),new wn({data:()=>({playlists:[],albums:[]}),methods:{artistView:Xu.bind(null,"artist"),albumView:Xu.bind(null,"album"),playlistView:Xu.bind(null,"playlist"),openSettings(){document.getElementById("main_settings_tablink").click()},addToQueue(e){yc.sendAddToQueue(e.currentTarget.dataset.link)},openQualityModal(e){Lu.open(e.currentTarget.dataset.link)},initHome(e){const{playlists:{data:t},albums:{data:n}}=e;this.playlists=t,this.albums=n}},mounted(){localStorage.getItem("arl")&&this.$refs.notLogged.classList.add("hide"),xu.on("init_home",this.initHome)}}).$mount("#home_tab");function _c(e){let t=e.target;t.scrollTop+t.clientHeight>=t.scrollHeight&&"search_tab"===main_selected&&-1!=["track_search","album_search","artist_search","playlist_search"].indexOf(search_selected)&&Qu.scrolledSearch(search_selected.split("_")[0])}function wc(e){if(13!==e.keyCode)return;let t=this.value;if(Mu.isValidURL(t))e.ctrlKey?Lu.open(t):"analyzer_tab"==window.main_selected?oc.analyzeLink(t):yc.sendAddToQueue(t);else{if(""===t)return;t!==Qu.results.query||"search_tab"==main_selected?(document.getElementById("search_tab_content").style.display="none",xu.emit("mainSearch",{term:t}),document.getElementById("content").style.display="none",document.getElementById("search_placeholder").classList.toggle("loading_placeholder--hidden")):(document.getElementById("search_tab_content").style.display="block",document.getElementById("main_search_tablink").click())}}var xc={linkListeners:function(){document.getElementById("content").addEventListener("scroll",Mu.debounce(_c,100)),document.getElementById("searchbar").addEventListener("keyup",wc)}};document.addEventListener("DOMContentLoaded",(function(){!function(){let e=localStorage.getItem("selectedTheme");if(e){let t="theme_toggler--active";document.querySelector("."+t).classList.remove(t),document.querySelector(`.theme_toggler[data-theme-variant="${e}"]`).classList.add(t)}}(),yc.init(),Lu.init(),oc.init(),xc.linkListeners(),Iu.init()})),window.addEventListener("pywebviewready",(function(){window.clientMode=!0,document.querySelector("#open_downloads_folder").classList.remove("hide")})),xu.on("message",(function(e){console.log(e)})),xu.on("logging_in",(function(){Eu("Logging in","loading",!1,"login-toast")})),xu.on("init_autologin",(function(){let e=localStorage.getItem("arl"),t=localStorage.getItem("accountNum");e&&(e=e.trim(),0!=t?xu.emit("login",e,!0,t):xu.emit("login",e))})),xu.on("logged_in",(function(e){switch(e.status){case 1:case 3:Eu("Logged in","done",!0,"login-toast"),e.arl&&(localStorage.setItem("arl",e.arl),ku("#login_input_arl").val(e.arl)),ku("#open_login_prompt").hide(),e.user&&(ku("#settings_username").text(e.user.name),ku("#settings_picture").attr("src",`https://e-cdns-images.dzcdn.net/images/user/${e.user.picture}/125x125-000000-80-0-0.jpg`),document.getElementById("logged_in_info").classList.remove("hide")),document.getElementById("home_not_logged_in").classList.add("hide");break;case 2:Eu("Already logged in","done",!0,"login-toast"),e.user&&(ku("#settings_username").text(e.user.name),ku("#settings_picture").attr("src",`https://e-cdns-images.dzcdn.net/images/user/${e.user.picture}/125x125-000000-80-0-0.jpg`),document.getElementById("logged_in_info").classList.remove("hide")),document.getElementById("home_not_logged_in").classList.add("hide");break;case 0:Eu("Couldn't log in","close",!0,"login-toast"),localStorage.removeItem("arl"),ku("#login_input_arl").val(""),ku("#open_login_prompt").show(),document.getElementById("logged_in_info").classList.add("hide"),ku("#settings_username").text("Not Logged"),ku("#settings_picture").attr("src","https://e-cdns-images.dzcdn.net/images/user/125x125-000000-80-0-0.jpg"),document.getElementById("home_not_logged_in").classList.remove("hide")}})),xu.on("logged_out",(function(){Eu("Logged out","done",!0,"login-toast"),localStorage.removeItem("arl"),ku("#login_input_arl").val(""),ku("#open_login_prompt").show(),document.getElementById("logged_in_info").classList.add("hide"),ku("#settings_username").text("Not Logged"),ku("#settings_picture").attr("src","https://e-cdns-images.dzcdn.net/images/user/125x125-000000-80-0-0.jpg"),document.getElementById("home_not_logged_in").classList.remove("hide")})),xu.on("cancellingCurrentItem",(function(e){Eu("Cancelling current item.","loading",!1,"cancelling_"+e)})),xu.on("currentItemCancelled",(function(e){Eu("Current item cancelled.","done",!0,"cancelling_"+e)})),xu.on("startAddingArtist",(function(e){Eu(`Adding ${e.name} albums to queue`,"loading",!1,"artist_"+e.id)})),xu.on("finishAddingArtist",(function(e){Eu(`Added ${e.name} albums to queue`,"done",!0,"artist_"+e.id)})),xu.on("startConvertingSpotifyPlaylist",(function(e){Eu("Converting spotify tracks to deezer tracks","loading",!1,"spotifyplaylist_"+e)})),xu.on("finishConvertingSpotifyPlaylist",(function(e){Eu("Spotify playlist converted","done",!0,"spotifyplaylist_"+e)})),xu.on("errorMessage",(function(e){Eu(e,"error")})),xu.on("alreadyInQueue",(function(e){Eu(e.title+" is already in queue!","playlist_add_check")})); diff --git a/rollup.config.js b/rollup.config.js index e8a8d1e..535017e 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -25,6 +25,14 @@ export default { { find: 'vue', replacement: 'vue/dist/vue.esm' + }, + { + find: '@', + replacement: __dirname + '/src' + }, + { + find: '@components', + replacement: __dirname + '/src/js/components' } ] }), diff --git a/src/js/app.js b/src/js/app.js index 4d34629..c340538 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -1,25 +1,27 @@ // Global Vue components -import './modules/components/LoadingPlaceholder.js' +import '@components/LoadingPlaceholder.js' // Vue views components -import './modules/components/artist-tab.js' -import './modules/components/charts-tab.js' -import './modules/components/errors-tab.js' -import './modules/components/favorites-tab.js' -import './modules/components/home-tab.js' -import './modules/components/link-analyzer-tab.js' -import './modules/components/main-search.js' -import './modules/components/settings-tab.js' -import './modules/components/tracklist-tab.js' +import '@components/artist-tab.js' +import '@components/charts-tab.js' +import '@components/errors-tab.js' +import '@components/favorites-tab.js' +import '@components/home-tab.js' +import '@components/link-analyzer-tab.js' +import '@components/main-search.js' +import '@components/settings-tab.js' +import '@components/tracklist-tab.js' + +import '@components/TestComponent.vue' import $ from 'jquery' -import { socket } from './modules/socket.js' -import { toast } from './modules/toasts.js' -import Downloads from './modules/downloads.js' -import QualityModal from './modules/quality-modal.js' -import Tabs from './modules/tabs.js' -import Search from './modules/search.js' -import TrackPreview from './modules/track-preview.js' +import { socket } from '@/js/socket.js' +import { toast } from '@/js/toasts.js' +import Downloads from '@/js/downloads.js' +import QualityModal from '@/js/quality-modal.js' +import Tabs from '@/js/tabs.js' +import Search from '@/js/search.js' +import TrackPreview from '@/js/track-preview.js' /* ===== App initialization ===== */ @@ -61,15 +63,15 @@ function setCurrentUserTheme() { /* ===== Socketio listeners ===== */ // Debug messages for socketio -socket.on('message', function (msg) { +socket.on('message', function(msg) { console.log(msg) }) -socket.on('logging_in', function () { +socket.on('logging_in', function() { toast('Logging in', 'loading', false, 'login-toast') }) -socket.on('init_autologin', function () { +socket.on('init_autologin', function() { let arl = localStorage.getItem('arl') let accountNum = localStorage.getItem('accountNum') if (arl) { @@ -82,7 +84,7 @@ socket.on('init_autologin', function () { } }) -socket.on('logged_in', function (data) { +socket.on('logged_in', function(data) { switch (data.status) { case 1: case 3: @@ -130,7 +132,7 @@ socket.on('logged_in', function (data) { } }) -socket.on('logged_out', function () { +socket.on('logged_out', function() { toast('Logged out', 'done', true, 'login-toast') localStorage.removeItem('arl') $('#login_input_arl').val('') @@ -141,34 +143,34 @@ socket.on('logged_out', function () { document.getElementById('home_not_logged_in').classList.remove('hide') }) -socket.on('cancellingCurrentItem', function (uuid) { +socket.on('cancellingCurrentItem', function(uuid) { toast('Cancelling current item.', 'loading', false, 'cancelling_' + uuid) }) -socket.on('currentItemCancelled', function (uuid) { +socket.on('currentItemCancelled', function(uuid) { toast('Current item cancelled.', 'done', true, 'cancelling_' + uuid) }) -socket.on('startAddingArtist', function (data) { +socket.on('startAddingArtist', function(data) { toast(`Adding ${data.name} albums to queue`, 'loading', false, 'artist_' + data.id) }) -socket.on('finishAddingArtist', function (data) { +socket.on('finishAddingArtist', function(data) { toast(`Added ${data.name} albums to queue`, 'done', true, 'artist_' + data.id) }) -socket.on('startConvertingSpotifyPlaylist', function (id) { +socket.on('startConvertingSpotifyPlaylist', function(id) { toast('Converting spotify tracks to deezer tracks', 'loading', false, 'spotifyplaylist_' + id) }) -socket.on('finishConvertingSpotifyPlaylist', function (id) { +socket.on('finishConvertingSpotifyPlaylist', function(id) { toast('Spotify playlist converted', 'done', true, 'spotifyplaylist_' + id) }) -socket.on('errorMessage', function (error) { +socket.on('errorMessage', function(error) { toast(error, 'error') }) -socket.on('alreadyInQueue', function (data) { +socket.on('alreadyInQueue', function(data) { toast(`${data.title} is already in queue!`, 'playlist_add_check') }) diff --git a/src/js/modules/components/LoadingPlaceholder.js b/src/js/components/LoadingPlaceholder.js similarity index 100% rename from src/js/modules/components/LoadingPlaceholder.js rename to src/js/components/LoadingPlaceholder.js diff --git a/src/js/modules/components/TestComponent.vue b/src/js/components/TestComponent.vue similarity index 100% rename from src/js/modules/components/TestComponent.vue rename to src/js/components/TestComponent.vue diff --git a/src/js/modules/components/artist-tab.js b/src/js/components/artist-tab.js similarity index 92% rename from src/js/modules/components/artist-tab.js rename to src/js/components/artist-tab.js index 14bc849..3438200 100644 --- a/src/js/modules/components/artist-tab.js +++ b/src/js/components/artist-tab.js @@ -1,9 +1,9 @@ import { isEmpty, orderBy } from 'lodash-es' import Vue from 'vue' -import { socket } from '../socket.js' -import Downloads from '../downloads.js' -import QualityModal from '../quality-modal.js' -import { showView } from '../tabs.js' +import { socket } from '@/js/socket.js' +import Downloads from '@/js/downloads.js' +import QualityModal from '@/js/quality-modal.js' +import { showView } from '@/js/tabs.js' const ArtistTab = new Vue({ data() { diff --git a/src/js/modules/components/charts-tab.js b/src/js/components/charts-tab.js similarity index 86% rename from src/js/modules/components/charts-tab.js rename to src/js/components/charts-tab.js index 0eb3d77..7f66931 100644 --- a/src/js/modules/components/charts-tab.js +++ b/src/js/components/charts-tab.js @@ -1,10 +1,10 @@ import Vue from 'vue' -import { socket } from '../socket.js' -import { showView } from '../tabs.js' -import Downloads from '../downloads.js' -import QualityModal from '../quality-modal.js' -import TrackPreview from '../track-preview.js' -import Utils from '../utils.js' +import { socket } from '@/js/socket.js' +import { showView } from '@/js/tabs.js' +import Downloads from '@/js/downloads.js' +import QualityModal from '@/js/quality-modal.js' +import TrackPreview from '@/js/track-preview.js' +import Utils from '@/js/utils.js' const ChartsTab = new Vue({ data() { diff --git a/src/js/modules/components/errors-tab.js b/src/js/components/errors-tab.js similarity index 100% rename from src/js/modules/components/errors-tab.js rename to src/js/components/errors-tab.js diff --git a/src/js/modules/components/favorites-tab.js b/src/js/components/favorites-tab.js similarity index 89% rename from src/js/modules/components/favorites-tab.js rename to src/js/components/favorites-tab.js index 6cacd3b..3f5846b 100644 --- a/src/js/modules/components/favorites-tab.js +++ b/src/js/components/favorites-tab.js @@ -1,11 +1,11 @@ import Vue from 'vue' -import { socket } from '../socket.js' -import { showView } from '../tabs.js' -import Downloads from '../downloads.js' -import QualityModal from '../quality-modal.js' -import TrackPreview from '../track-preview.js' -import Utils from '../utils.js' -import { toast } from '../toasts' +import { socket } from '@/js/socket.js' +import { showView } from '@/js/tabs.js' +import Downloads from '@/js/downloads.js' +import QualityModal from '@/js/quality-modal.js' +import TrackPreview from '@/js/track-preview.js' +import Utils from '@/js/utils.js' +import { toast } from '@/js/toasts' const FavoritesTab = new Vue({ data() { diff --git a/src/js/modules/components/home-tab.js b/src/js/components/home-tab.js similarity index 77% rename from src/js/modules/components/home-tab.js rename to src/js/components/home-tab.js index 2bd49e5..3a2c68c 100644 --- a/src/js/modules/components/home-tab.js +++ b/src/js/components/home-tab.js @@ -1,10 +1,8 @@ import Vue from 'vue' -import { socket } from '../socket.js' -import { showView } from '../tabs.js' -import Downloads from '../downloads.js' -import QualityModal from '../quality-modal.js' -// import TrackPreview from '../track-preview.js' -// import Utils from '../utils.js' +import { socket } from '@/js/socket.js' +import { showView } from '@/js/tabs.js' +import Downloads from '@/js/downloads.js' +import QualityModal from '@/js/quality-modal.js' const HomeTab = new Vue({ data() { diff --git a/src/js/modules/components/link-analyzer-tab.js b/src/js/components/link-analyzer-tab.js similarity index 92% rename from src/js/modules/components/link-analyzer-tab.js rename to src/js/components/link-analyzer-tab.js index de0bf14..23dc803 100644 --- a/src/js/modules/components/link-analyzer-tab.js +++ b/src/js/components/link-analyzer-tab.js @@ -1,7 +1,7 @@ import Vue from 'vue' -import { socket } from '../socket.js' -import { showView } from '../tabs.js' -import Utils from '../utils.js' +import { socket } from '@/js/socket.js' +import { showView } from '@/js/tabs.js' +import Utils from '@/js/utils.js' const LinkAnalyzerTab = new Vue({ data() { @@ -65,7 +65,7 @@ const LinkAnalyzerTab = new Vue({ this.data = data this.id = id }, - notSupported(){ + notSupported() { this.link = 'error' } }, diff --git a/src/js/modules/components/main-search.js b/src/js/components/main-search.js similarity index 93% rename from src/js/modules/components/main-search.js rename to src/js/components/main-search.js index 1528db1..7b8c394 100644 --- a/src/js/modules/components/main-search.js +++ b/src/js/components/main-search.js @@ -1,10 +1,10 @@ import Vue from 'vue' -import { socket } from '../socket.js' -import { showView } from '../tabs.js' -import Downloads from '../downloads.js' -import QualityModal from '../quality-modal.js' -import TrackPreview from '../track-preview.js' -import Utils from '../utils.js' +import { socket } from '@/js/socket.js' +import { showView } from '@/js/tabs.js' +import Downloads from '@/js/downloads.js' +import QualityModal from '@/js/quality-modal.js' +import TrackPreview from '@/js/track-preview.js' +import Utils from '@/js/utils.js' const MainSearch = new Vue({ data: { diff --git a/src/js/modules/components/settings-tab.js b/src/js/components/settings-tab.js similarity index 94% rename from src/js/modules/components/settings-tab.js rename to src/js/components/settings-tab.js index aad3a82..b5bb505 100644 --- a/src/js/modules/components/settings-tab.js +++ b/src/js/components/settings-tab.js @@ -1,7 +1,7 @@ import Vue from 'vue' -import { toast } from '../toasts.js' -import { socket } from '../socket.js' -import TestComponent from './TestComponent.vue' +import { toast } from '@/js/toasts.js' +import { socket } from '@/js/socket.js' +import TestComponent from '@components/TestComponent.vue' const SettingsTab = new Vue({ components: { @@ -81,7 +81,9 @@ const SettingsTab = new Vue({ }, accountChanged(user, accountNum) { this.$refs.username.innerText = user.name - this.$refs.userpicture.src = `https://e-cdns-images.dzcdn.net/images/user/${user.picture}/125x125-000000-80-0-0.jpg` + this.$refs.userpicture.src = `https://e-cdns-images.dzcdn.net/images/user/${ + user.picture + }/125x125-000000-80-0-0.jpg` this.accountNum = accountNum localStorage.setItem('accountNum', this.accountNum) }, diff --git a/src/js/modules/components/tracklist-tab.js b/src/js/components/tracklist-tab.js similarity index 93% rename from src/js/modules/components/tracklist-tab.js rename to src/js/components/tracklist-tab.js index 0a5f11f..604c121 100644 --- a/src/js/modules/components/tracklist-tab.js +++ b/src/js/components/tracklist-tab.js @@ -1,11 +1,11 @@ import { isEmpty } from 'lodash-es' import Vue from 'vue' -import { socket } from '../socket.js' -import { showView } from '../tabs.js' -import Downloads from '../downloads.js' -import QualityModal from '../quality-modal.js' -import TrackPreview from '../track-preview.js' -import Utils from '../utils.js' +import { socket } from '@/js/socket.js' +import { showView } from '@/js/tabs.js' +import Downloads from '@/js/downloads.js' +import QualityModal from '@/js/quality-modal.js' +import TrackPreview from '@/js/track-preview.js' +import Utils from '@/js/utils.js' const TracklistTab = new Vue({ data: () => ({ diff --git a/src/js/modules/downloads.js b/src/js/downloads.js similarity index 93% rename from src/js/modules/downloads.js rename to src/js/downloads.js index 1bb1ee2..7ded851 100644 --- a/src/js/modules/downloads.js +++ b/src/js/downloads.js @@ -1,7 +1,7 @@ import $ from 'jquery' -import { socket } from './socket.js' -import { toast } from './toasts.js' -import { showErrors } from './tabs.js' +import { socket } from '@/js/socket.js' +import { toast } from '@/js/toasts.js' +import { showErrors } from '@/js/tabs.js' /* ===== Locals ===== */ const tabMinWidth = 250 @@ -141,7 +141,9 @@ function addToQueue(queueItem, current = false) { $('#bar_' + queueItem.uuid).css('width', queueItem.progress + '%') if (queueItem.failed >= 1 && $('#download_' + queueItem.uuid + ' .queue_failed').length == 0) { $('#download_' + queueItem.uuid + ' .download_info_status').append( - `(${queueItem.failed}error_outline)` + `(${ + queueItem.failed + }error_outline)` ) } if (queueItem.downloaded + queueItem.failed == queueItem.size) { @@ -152,8 +154,8 @@ function addToQueue(queueItem, current = false) { let failed_button = $('#download_' + queueItem.uuid).find('.queue_failed_button') result_icon.addClass('clickable') failed_button.addClass('clickable') - result_icon.bind('click', {item:queueItem}, showErrors) - failed_button.bind('click', {item:queueItem}, showErrors) + result_icon.bind('click', { item: queueItem }, showErrors) + failed_button.bind('click', { item: queueItem }, showErrors) if (queueItem.failed >= queueItem.size) { result_icon.text('error') } else { @@ -254,8 +256,8 @@ function finishDownload(uuid) { let failed_button = $('#download_' + uuid).find('.queue_failed_button') result_icon.addClass('clickable') failed_button.addClass('clickable') - result_icon.bind('click', {item:queueList[uuid]}, showErrors) - failed_button.bind('click', {item:queueList[uuid]}, showErrors) + result_icon.bind('click', { item: queueList[uuid] }, showErrors) + failed_button.bind('click', { item: queueList[uuid] }, showErrors) if (queueList[uuid].failed >= queueList[uuid].size) { result_icon.text('error') } else { @@ -287,7 +289,7 @@ function removeAllDownloads(currentItem) { let tempQueueItem = queueList[currentItem] queueList = {} queueList[currentItem] = tempQueueItem - $('.download_object').each(function (index) { + $('.download_object').each(function(index) { if ($(this).attr('id') != 'download_' + currentItem) $(this).remove() }) } @@ -323,7 +325,7 @@ function updateQueue(update) { } else { $('#download_' + uuid + ' .queue_failed').text(queueList[uuid].failed) } - queueList[uuid].errors.push({message: update.error, data: update.data}) + queueList[uuid].errors.push({ message: update.error, data: update.data }) } if (progress) { queueList[uuid].progress = progress diff --git a/src/js/modules/quality-modal.js b/src/js/quality-modal.js similarity index 96% rename from src/js/modules/quality-modal.js rename to src/js/quality-modal.js index 61bdcc4..8cc2cf1 100644 --- a/src/js/modules/quality-modal.js +++ b/src/js/quality-modal.js @@ -1,4 +1,4 @@ -import Downloads from './downloads.js' +import Downloads from '@/js/downloads.js' const QualityModal = { // Defaults diff --git a/src/js/modules/search.js b/src/js/search.js similarity index 86% rename from src/js/modules/search.js rename to src/js/search.js index c1503a3..95ad02b 100644 --- a/src/js/modules/search.js +++ b/src/js/search.js @@ -1,9 +1,9 @@ -import MainSearch from './components/main-search.js' -import Utils from './utils.js' -import QualityModal from './quality-modal.js' -import Downloads from './downloads.js' -import { socket } from './socket.js' -import Tabs from './tabs.js' +import MainSearch from '@components/main-search.js' +import Utils from '@/js/utils.js' +import QualityModal from '@/js/quality-modal.js' +import Downloads from '@/js/downloads.js' +import { socket } from '@/js/socket.js' +import Tabs from '@/js/tabs.js' function linkListeners() { document.getElementById('content').addEventListener('scroll', Utils.debounce(handleContentScroll, 100)) diff --git a/src/js/modules/socket.js b/src/js/socket.js similarity index 100% rename from src/js/modules/socket.js rename to src/js/socket.js diff --git a/src/js/modules/tabs.js b/src/js/tabs.js similarity index 93% rename from src/js/modules/tabs.js rename to src/js/tabs.js index e3c84a4..b3a0cf2 100644 --- a/src/js/modules/tabs.js +++ b/src/js/tabs.js @@ -1,11 +1,11 @@ -import ArtistTab from './components/artist-tab.js' -import TracklistTab from './components/tracklist-tab.js' -import LinkAnalyzerTab from './components/link-analyzer-tab.js' -import ErrorsTab from './components/errors-tab.js' -import { socket } from './socket.js' -import SettingsTab from './components/settings-tab.js' -import MainSearch from './components/main-search.js' -import TrackPreview from './track-preview.js' +import ArtistTab from '@components/artist-tab.js' +import TracklistTab from '@components/tracklist-tab.js' +import LinkAnalyzerTab from '@components/link-analyzer-tab.js' +import ErrorsTab from '@components/errors-tab.js' +import SettingsTab from '@components/settings-tab.js' +import MainSearch from '@components/main-search.js' +import { socket } from '@/js/socket.js' +import TrackPreview from '@/js/track-preview.js' /* ===== Globals ====== */ window.search_selected = '' @@ -242,7 +242,10 @@ function showTab(type, id, back = false) { if (windows_stack.length == 0) { windows_stack.push({ tab: main_selected }) } else if (!back) { - if (currentStack.type === 'artist') currentStack.selected = ArtistTab.getCurrentTab() + if (currentStack.type === 'artist') { + currentStack.selected = ArtistTab.getCurrentTab() + } + windows_stack.push(currentStack) } @@ -254,6 +257,7 @@ function showTab(type, id, back = false) { for (let i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = 'none' } + document.getElementById(tab).style.display = 'block' TrackPreview.stopStackedTabsPreview() } diff --git a/src/js/modules/toasts.js b/src/js/toasts.js similarity index 100% rename from src/js/modules/toasts.js rename to src/js/toasts.js diff --git a/src/js/modules/track-preview.js b/src/js/track-preview.js similarity index 100% rename from src/js/modules/track-preview.js rename to src/js/track-preview.js diff --git a/src/js/modules/utils.js b/src/js/utils.js similarity index 100% rename from src/js/modules/utils.js rename to src/js/utils.js