From 064c3b29bce07c42d88a9eefaef37f5297631450 Mon Sep 17 00:00:00 2001 From: Roberto Tonino Date: Sat, 26 Sep 2020 19:48:30 +0200 Subject: [PATCH] chore: removed main_selected global; perf: added route links instead of showView method and removed tabs.js --- public/js/bundle.js | 6 +- rollup.config.js | 4 - src/components/ArtistTab.vue | 15 ++-- src/components/TheChartsTab.vue | 21 ++--- src/components/TheContextMenu.vue | 12 +-- src/components/TheFavoritesTab.vue | 109 +++++++++++++----------- src/components/TheHomeTab.vue | 28 +++--- src/components/TheLinkAnalyzerTab.vue | 44 ++++++---- src/components/TheMainSearch.vue | 7 -- src/components/TheSearchBar.vue | 2 +- src/components/TracklistTab.vue | 46 +++++----- src/components/search/ResultsTracks.vue | 27 ++---- src/{js => data}/qualities.js | 2 +- src/js/tabs.js | 20 ----- src/jsconfig.json | 1 - 15 files changed, 158 insertions(+), 186 deletions(-) rename src/{js => data}/qualities.js (92%) delete mode 100644 src/js/tabs.js diff --git a/public/js/bundle.js b/public/js/bundle.js index 8307f68..3122c1b 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -8,7 +8,7 @@ var e=Object.freeze({});function t(e){return null==e}function a(e){return null!= * vuex v3.5.1 * (c) 2020 Evan You * @license MIT - */var uo=("undefined"!=typeof window?window:"undefined"!=typeof global?global:{}).__VUE_DEVTOOLS_GLOBAL_HOOK__;function po(e,t){if(void 0===t&&(t=[]),null===e||"object"!=typeof e)return e;var a,n=(a=function(t){return t.original===e},t.filter(a)[0]);if(n)return n.copy;var i=Array.isArray(e)?[]:{};return t.push({original:e,copy:i}),Object.keys(e).forEach((function(a){i[a]=po(e[a],t)})),i}function ho(e,t){Object.keys(e).forEach((function(a){return t(e[a],a)}))}function mo(e){return null!==e&&"object"==typeof e}var go=function(e,t){this.runtime=t,this._children=Object.create(null),this._rawModule=e;var a=e.state;this.state=("function"==typeof a?a():a)||{}},fo={namespaced:{configurable:!0}};fo.namespaced.get=function(){return!!this._rawModule.namespaced},go.prototype.addChild=function(e,t){this._children[e]=t},go.prototype.removeChild=function(e){delete this._children[e]},go.prototype.getChild=function(e){return this._children[e]},go.prototype.hasChild=function(e){return e in this._children},go.prototype.update=function(e){this._rawModule.namespaced=e.namespaced,e.actions&&(this._rawModule.actions=e.actions),e.mutations&&(this._rawModule.mutations=e.mutations),e.getters&&(this._rawModule.getters=e.getters)},go.prototype.forEachChild=function(e){ho(this._children,e)},go.prototype.forEachGetter=function(e){this._rawModule.getters&&ho(this._rawModule.getters,e)},go.prototype.forEachAction=function(e){this._rawModule.actions&&ho(this._rawModule.actions,e)},go.prototype.forEachMutation=function(e){this._rawModule.mutations&&ho(this._rawModule.mutations,e)},Object.defineProperties(go.prototype,fo);var vo,bo=function(e){this.register([],e,!1)};bo.prototype.get=function(e){return e.reduce((function(e,t){return e.getChild(t)}),this.root)},bo.prototype.getNamespace=function(e){var t=this.root;return e.reduce((function(e,a){return e+((t=t.getChild(a)).namespaced?a+"/":"")}),"")},bo.prototype.update=function(e){!function e(t,a,n){if(a.update(n),n.modules)for(var i in n.modules){if(!a.getChild(i))return;e(t.concat(i),a.getChild(i),n.modules[i])}}([],this.root,e)},bo.prototype.register=function(e,t,a){var n=this;void 0===a&&(a=!0);var i=new go(t,a);0===e.length?this.root=i:this.get(e.slice(0,-1)).addChild(e[e.length-1],i);t.modules&&ho(t.modules,(function(t,i){n.register(e.concat(i),t,a)}))},bo.prototype.unregister=function(e){var t=this.get(e.slice(0,-1)),a=e[e.length-1],n=t.getChild(a);n&&n.runtime&&t.removeChild(a)},bo.prototype.isRegistered=function(e){var t=this.get(e.slice(0,-1)),a=e[e.length-1];return t.hasChild(a)};var yo=function(e){var t=this;void 0===e&&(e={}),!vo&&"undefined"!=typeof window&&window.Vue&&So(window.Vue);var a=e.plugins;void 0===a&&(a=[]);var n=e.strict;void 0===n&&(n=!1),this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new bo(e),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._watcherVM=new vo,this._makeLocalGettersCache=Object.create(null);var i=this,r=this.dispatch,s=this.commit;this.dispatch=function(e,t){return r.call(i,e,t)},this.commit=function(e,t,a){return s.call(i,e,t,a)},this.strict=n;var o=this._modules.root.state;Co(this,o,[],this._modules.root),wo(this,o),a.forEach((function(e){return e(t)})),(void 0!==e.devtools?e.devtools:vo.config.devtools)&&function(e){uo&&(e._devtoolHook=uo,uo.emit("vuex:init",e),uo.on("vuex:travel-to-state",(function(t){e.replaceState(t)})),e.subscribe((function(e,t){uo.emit("vuex:mutation",e,t)}),{prepend:!0}),e.subscribeAction((function(e,t){uo.emit("vuex:action",e,t)}),{prepend:!0}))}(this)},_o={state:{configurable:!0}};function ko(e,t,a){return t.indexOf(e)<0&&(a&&a.prepend?t.unshift(e):t.push(e)),function(){var a=t.indexOf(e);a>-1&&t.splice(a,1)}}function Ao(e,t){e._actions=Object.create(null),e._mutations=Object.create(null),e._wrappedGetters=Object.create(null),e._modulesNamespaceMap=Object.create(null);var a=e.state;Co(e,a,[],e._modules.root,!0),wo(e,a,t)}function wo(e,t,a){var n=e._vm;e.getters={},e._makeLocalGettersCache=Object.create(null);var i=e._wrappedGetters,r={};ho(i,(function(t,a){r[a]=function(e,t){return function(){return e(t)}}(t,e),Object.defineProperty(e.getters,a,{get:function(){return e._vm[a]},enumerable:!0})}));var s=vo.config.silent;vo.config.silent=!0,e._vm=new vo({data:{$$state:t},computed:r}),vo.config.silent=s,e.strict&&function(e){e._vm.$watch((function(){return this._data.$$state}),(function(){}),{deep:!0,sync:!0})}(e),n&&(a&&e._withCommit((function(){n._data.$$state=null})),vo.nextTick((function(){return n.$destroy()})))}function Co(e,t,a,n,i){var r=!a.length,s=e._modules.getNamespace(a);if(n.namespaced&&(e._modulesNamespaceMap[s],e._modulesNamespaceMap[s]=n),!r&&!i){var o=xo(t,a.slice(0,-1)),l=a[a.length-1];e._withCommit((function(){vo.set(o,l,n.state)}))}var c=n.context=function(e,t,a){var n=""===t,i={dispatch:n?e.dispatch:function(a,n,i){var r=To(a,n,i),s=r.payload,o=r.options,l=r.type;return o&&o.root||(l=t+l),e.dispatch(l,s)},commit:n?e.commit:function(a,n,i){var r=To(a,n,i),s=r.payload,o=r.options,l=r.type;o&&o.root||(l=t+l),e.commit(l,s,o)}};return Object.defineProperties(i,{getters:{get:n?function(){return e.getters}:function(){return function(e,t){if(!e._makeLocalGettersCache[t]){var a={},n=t.length;Object.keys(e.getters).forEach((function(i){if(i.slice(0,n)===t){var r=i.slice(n);Object.defineProperty(a,r,{get:function(){return e.getters[i]},enumerable:!0})}})),e._makeLocalGettersCache[t]=a}return e._makeLocalGettersCache[t]}(e,t)}},state:{get:function(){return xo(e.state,a)}}}),i}(e,s,a);n.forEachMutation((function(t,a){!function(e,t,a,n){(e._mutations[t]||(e._mutations[t]=[])).push((function(t){a.call(e,n.state,t)}))}(e,s+a,t,c)})),n.forEachAction((function(t,a){var n=t.root?a:s+a,i=t.handler||t;!function(e,t,a,n){(e._actions[t]||(e._actions[t]=[])).push((function(t){var i,r=a.call(e,{dispatch:n.dispatch,commit:n.commit,getters:n.getters,state:n.state,rootGetters:e.getters,rootState:e.state},t);return(i=r)&&"function"==typeof i.then||(r=Promise.resolve(r)),e._devtoolHook?r.catch((function(t){throw e._devtoolHook.emit("vuex:error",t),t})):r}))}(e,n,i,c)})),n.forEachGetter((function(t,a){!function(e,t,a,n){if(e._wrappedGetters[t])return;e._wrappedGetters[t]=function(e){return a(n.state,n.getters,e.state,e.getters)}}(e,s+a,t,c)})),n.forEachChild((function(n,r){Co(e,t,a.concat(r),n,i)}))}function xo(e,t){return t.reduce((function(e,t){return e[t]}),e)}function To(e,t,a){return mo(e)&&e.type&&(a=t,t=e,e=e.type),{type:e,payload:t,options:a}}function So(e){vo&&e===vo||function(e){if(Number(e.version.split(".")[0])>=2)e.mixin({beforeCreate:a});else{var t=e.prototype._init;e.prototype._init=function(e){void 0===e&&(e={}),e.init=e.init?[a].concat(e.init):a,t.call(this,e)}}function a(){var e=this.$options;e.store?this.$store="function"==typeof e.store?e.store():e.store:e.parent&&e.parent.$store&&(this.$store=e.parent.$store)}}(vo=e)}_o.state.get=function(){return this._vm._data.$$state},_o.state.set=function(e){},yo.prototype.commit=function(e,t,a){var n=this,i=To(e,t,a),r=i.type,s=i.payload,o={type:r,payload:s},l=this._mutations[r];l&&(this._withCommit((function(){l.forEach((function(e){e(s)}))})),this._subscribers.slice().forEach((function(e){return e(o,n.state)})))},yo.prototype.dispatch=function(e,t){var a=this,n=To(e,t),i=n.type,r=n.payload,s={type:i,payload:r},o=this._actions[i];if(o){try{this._actionSubscribers.slice().filter((function(e){return e.before})).forEach((function(e){return e.before(s,a.state)}))}catch(e){}var l=o.length>1?Promise.all(o.map((function(e){return e(r)}))):o[0](r);return new Promise((function(e,t){l.then((function(t){try{a._actionSubscribers.filter((function(e){return e.after})).forEach((function(e){return e.after(s,a.state)}))}catch(e){}e(t)}),(function(e){try{a._actionSubscribers.filter((function(e){return e.error})).forEach((function(t){return t.error(s,a.state,e)}))}catch(e){}t(e)}))}))}},yo.prototype.subscribe=function(e,t){return ko(e,this._subscribers,t)},yo.prototype.subscribeAction=function(e,t){return ko("function"==typeof e?{before:e}:e,this._actionSubscribers,t)},yo.prototype.watch=function(e,t,a){var n=this;return this._watcherVM.$watch((function(){return e(n.state,n.getters)}),t,a)},yo.prototype.replaceState=function(e){var t=this;this._withCommit((function(){t._vm._data.$$state=e}))},yo.prototype.registerModule=function(e,t,a){void 0===a&&(a={}),"string"==typeof e&&(e=[e]),this._modules.register(e,t),Co(this,this.state,e,this._modules.get(e),a.preserveState),wo(this,this.state)},yo.prototype.unregisterModule=function(e){var t=this;"string"==typeof e&&(e=[e]),this._modules.unregister(e),this._withCommit((function(){var a=xo(t.state,e.slice(0,-1));vo.delete(a,e[e.length-1])})),Ao(this)},yo.prototype.hasModule=function(e){return"string"==typeof e&&(e=[e]),this._modules.isRegistered(e)},yo.prototype.hotUpdate=function(e){this._modules.update(e),Ao(this,!0)},yo.prototype._withCommit=function(e){var t=this._committing;this._committing=!0,e(),this._committing=t},Object.defineProperties(yo.prototype,_o);var zo=Lo((function(e,t){var a={};return $o(t).forEach((function(t){var n=t.key,i=t.val;a[n]=function(){var t=this.$store.state,a=this.$store.getters;if(e){var n=No(this.$store,"mapState",e);if(!n)return;t=n.context.state,a=n.context.getters}return"function"==typeof i?i.call(this,t,a):t[i]},a[n].vuex=!0})),a})),Mo=Lo((function(e,t){var a={};return $o(t).forEach((function(t){var n=t.key,i=t.val;a[n]=function(){for(var t=[],a=arguments.length;a--;)t[a]=arguments[a];var n=this.$store.commit;if(e){var r=No(this.$store,"mapMutations",e);if(!r)return;n=r.context.commit}return"function"==typeof i?i.apply(this,[n].concat(t)):n.apply(this.$store,[i].concat(t))}})),a})),Do=Lo((function(e,t){var a={};return $o(t).forEach((function(t){var n=t.key,i=t.val;i=e+i,a[n]=function(){if(!e||No(this.$store,"mapGetters",e))return this.$store.getters[i]},a[n].vuex=!0})),a})),Po=Lo((function(e,t){var a={};return $o(t).forEach((function(t){var n=t.key,i=t.val;a[n]=function(){for(var t=[],a=arguments.length;a--;)t[a]=arguments[a];var n=this.$store.dispatch;if(e){var r=No(this.$store,"mapActions",e);if(!r)return;n=r.context.dispatch}return"function"==typeof i?i.apply(this,[n].concat(t)):n.apply(this.$store,[i].concat(t))}})),a}));function $o(e){return function(e){return Array.isArray(e)||mo(e)}(e)?Array.isArray(e)?e.map((function(e){return{key:e,val:e}})):Object.keys(e).map((function(t){return{key:t,val:e[t]}})):[]}function Lo(e){return function(t,a){return"string"!=typeof t?(a=t,t=""):"/"!==t.charAt(t.length-1)&&(t+="/"),e(t,a)}}function No(e,t,a){return e._modulesNamespaceMap[a]}function Ro(e,t,a){var n=a?e.groupCollapsed:e.group;try{n.call(e,t)}catch(a){e.log(t)}}function Io(e){try{e.groupEnd()}catch(t){e.log("—— log end ——")}}function Fo(){var e=new Date;return" @ "+Eo(e.getHours(),2)+":"+Eo(e.getMinutes(),2)+":"+Eo(e.getSeconds(),2)+"."+Eo(e.getMilliseconds(),3)}function Eo(e,t){return function(e,t){return new Array(t+1).join(e)}("0",t-e.toString().length)+e}var jo={Store:yo,install:So,version:"3.5.1",mapState:zo,mapMutations:Mo,mapGetters:Do,mapActions:Po,createNamespacedHelpers:function(e){return{mapState:zo.bind(null,e),mapGetters:Do.bind(null,e),mapMutations:Mo.bind(null,e),mapActions:Po.bind(null,e)}},createLogger:function(e){void 0===e&&(e={});var t=e.collapsed;void 0===t&&(t=!0);var a=e.filter;void 0===a&&(a=function(e,t,a){return!0});var n=e.transformer;void 0===n&&(n=function(e){return e});var i=e.mutationTransformer;void 0===i&&(i=function(e){return e});var r=e.actionFilter;void 0===r&&(r=function(e,t){return!0});var s=e.actionTransformer;void 0===s&&(s=function(e){return e});var o=e.logMutations;void 0===o&&(o=!0);var l=e.logActions;void 0===l&&(l=!0);var c=e.logger;return void 0===c&&(c=console),function(e){var d=po(e.state);void 0!==c&&(o&&e.subscribe((function(e,r){var s=po(r);if(a(e,d,s)){var o=Fo(),l=i(e),u="mutation "+e.type+o;Ro(c,u,t),c.log("%c prev state","color: #9E9E9E; font-weight: bold",n(d)),c.log("%c mutation","color: #03A9F4; font-weight: bold",l),c.log("%c next state","color: #4CAF50; font-weight: bold",n(s)),Io(c)}d=s})),l&&e.subscribeAction((function(e,a){if(r(e,a)){var n=Fo(),i=s(e),o="action "+e.type+n;Ro(c,o,t),c.log("%c action","color: #03A9F4; font-weight: bold",i),Io(c)}})))}}};var Oo={state:{currentCommit:null,latestCommit:null,updateAvailable:!1,deemixVersion:null},getters:{getAboutInfo:e=>e},actions:{setAboutInfo({commit:e},t){e("SET_CURRENT_COMMIT",t.currentCommit),e("SET_LATEST_COMMIT",t.latestCommit),e("SET_UPDATE_AVAILABLE",t.updateAvailable),e("SET_DEEMIX_VERSION",t.deemixVersion)}},mutations:{SET_CURRENT_COMMIT:(e,t)=>{e.currentCommit=t},SET_LATEST_COMMIT:(e,t)=>{e.latestCommit=t},SET_UPDATE_AVAILABLE:(e,t)=>{e.updateAvailable=t},SET_DEEMIX_VERSION:(e,t)=>{e.deemixVersion=t}}};const Bo=()=>({arl:localStorage.getItem("arl")||"",status:null,user:{id:null,name:"",picture:""},clientMode:!1});var Uo={state:Bo(),getters:{getARL:e=>e.arl,getUser:e=>e.user,getClientMode:e=>e.clientMode,isLoggedIn:e=>!!e.arl},actions:{login({commit:e,dispatch:t},a){const{arl:n,user:i,status:r}=a;t("setARL",{arl:n}),e("SET_USER",i),e("SET_STATUS",r)},logout({commit:e}){localStorage.removeItem("arl"),e("RESET_LOGIN")},setARL({commit:e},t){let{arl:a,saveOnLocalStorage:n}=t;n=void 0===n||n,e("SET_ARL",a),n&&localStorage.setItem("arl",a)},removeARL({commit:e}){e("SET_ARL",""),localStorage.removeItem("arl")},setUser({commit:e},t){e("SET_USER",t)},setClientMode({commit:e},t){e("SET_CLIENT_MODE",t)}},mutations:{SET_ARL(e,t){e.arl=t},SET_STATUS(e,t){e.status=t},SET_USER(e,t){e.user=t},SET_CLIENT_MODE(e,t){e.clientMode=t},RESET_LOGIN(e){let t=e.clientMode;Object.assign(e,Bo()),e.clientMode=t}}};var qo={state:{artist:"",bitrate:"",cover:"",downloaded:0,errors:[],failed:0,id:"",progress:0,silent:!0,size:0,title:"",type:"",uuid:""},getters:{getErrors:e=>e},actions:{setErrors({commit:e},t){e("SET_ERRORS",t)}},mutations:{SET_ERRORS(e,t){for(const a in e)if(e.hasOwnProperty(a)){const n=t[a];e[a]=n}}}};_a.use(jo);var Vo=new jo.Store({modules:{about:Oo,login:Uo,errors:qo},strict:!1});const Go=io.connect(window.location.href);function Ho(e,t=null){e&&Go.emit("addToQueue",{url:e,bitrate:t},()=>{})}Go.on("connect",()=>{document.getElementById("start_app_placeholder").classList.add("loading_placeholder--hidden")}),Go.on("init_update",e=>{Vo.dispatch("setAboutInfo",e)});var Wo={sendAddToQueue:Ho};const Ko={data:()=>({open:!1,url:""}),mounted(){this.$root.$on("QualityModal:open",this.openModal),this.$refs.modal.addEventListener("webkitAnimationEnd",this.handleAnimationEnd)},methods:{tryToDownloadTrack(e){const{target:t}=e;this.$refs.modal.classList.add("animated","fadeOut"),t.matches(".quality-button")&&Wo.sendAddToQueue(this.url,t.dataset.qualityValue)},openModal(e){this.url=e,this.open=!0,this.$refs.modal.classList.add("animated","fadeIn")},handleAnimationEnd(e){const{animationName:t}=e;this.$refs.modal.classList.remove("animated",t),"fadeIn"!==t&&(this.open=!1)}}};var Qo=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{directives:[{name:"show",rawName:"v-show",value:e.open,expression:"open"}],ref:"modal",staticClass:"smallmodal",attrs:{id:"modal_quality"},on:{click:function(t){return e.tryToDownloadTrack(t)}}},[a("div",{staticClass:"smallmodal-content"},[a("button",{staticClass:"quality-button",attrs:{"data-quality-value":"9"}},[e._v(e._s(e.$t("globals.download",{thing:"FLAC"})))]),e._v(" "),a("button",{staticClass:"quality-button",attrs:{"data-quality-value":"3"}},[e._v(e._s(e.$t("globals.download",{thing:"MP3 320kbps"})))]),e._v(" "),a("button",{staticClass:"quality-button",attrs:{"data-quality-value":"1"}},[e._v(e._s(e.$t("globals.download",{thing:"MP3 128kbps"})))]),e._v(" "),a("button",{staticClass:"quality-button",attrs:{"data-quality-value":"15"}},[e._v("\n\t\t\t"+e._s(e.$t("globals.download",{thing:"360 Reality Audio [HQ]"}))+"\n\t\t")]),e._v(" "),a("button",{staticClass:"quality-button",attrs:{"data-quality-value":"14"}},[e._v("\n\t\t\t"+e._s(e.$t("globals.download",{thing:"360 Reality Audio [MQ]"}))+"\n\t\t")]),e._v(" "),a("button",{staticClass:"quality-button",attrs:{"data-quality-value":"13"}},[e._v("\n\t\t\t"+e._s(e.$t("globals.download",{thing:"360 Reality Audio [LQ]"}))+"\n\t\t")])])])};Qo._withStripped=!0;var Yo=function(e,t,a,n,i,r,s,o){const l=("function"==typeof a?a.options:a)||{};l.__file="C:\\Users\\Roberto\\Dev\\repos\\deemix-pyweb\\webui\\src\\components\\TheQualityModal.vue",l.render||(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=n;{let e;if(t&&(e=function(e){t.call(this,s(e))}),void 0!==e)if(l.functional){const t=l.render;l.render=function(a,n){return e.call(n),t(a,n)}}else{const t=l.beforeCreate;l.beforeCreate=t?[].concat(t,e):[e]}}return l}({render:Qo,staticRenderFns:[]},(function(e){e&&e("data-v-48a043f0_0",{source:"\n.smallmodal {\r\n\tposition: fixed;\r\n\tz-index: 1250;\r\n\tleft: 0;\r\n\ttop: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\toverflow: auto;\r\n\tbackground-color: hsla(0, 0%, 0%, 0.4);\r\n\tanimation-duration: 0.3s;\n}\n.smallmodal-content {\r\n\tbackground-color: transparent;\r\n\tmargin: auto;\r\n\twidth: var(--modal-content-width);\r\n\tposition: relative;\r\n\ttop: 50%;\r\n\ttransform: translateY(-50%);\n}\n.smallmodal-content button {\r\n\twidth: 100%;\r\n\tmargin-bottom: 8px;\n}\r\n",map:{version:3,sources:["C:\\Users\\Roberto\\Dev\\repos\\deemix-pyweb\\webui/C:\\Users\\Roberto\\Dev\\repos\\deemix-pyweb\\webui\\src\\components\\TheQualityModal.vue"],names:[],mappings:";AAmBA;CACA,eAAA;CACA,aAAA;CACA,OAAA;CACA,MAAA;CACA,WAAA;CACA,YAAA;CACA,cAAA;CACA,sCAAA;CACA,wBAAA;AACA;AAEA;CACA,6BAAA;CACA,YAAA;CACA,iCAAA;CACA,kBAAA;CACA,QAAA;CACA,2BAAA;AACA;AAEA;CACA,WAAA;CACA,kBAAA;AACA",file:"TheQualityModal.vue",sourcesContent:["\r\n\r\n