From 88da8376637e67bb4c843f067ad6111e7fb2de96 Mon Sep 17 00:00:00 2001 From: Roberto Tonino Date: Fri, 20 Nov 2020 18:18:19 +0100 Subject: [PATCH] feat: added tracks preview to all tab in Search page; style: track covers are now as abig as tracks tab ones in Search page; build: v1.4.0 --- package.json | 2 +- public/js/bundle.js | 6 +++--- src/data/search.js | 4 ++-- src/utils/utils.js | 5 +++++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 3a557f9..c858a54 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "deemix-webui", - "version": "1.3.6", + "version": "1.4.0", "scripts": { "clean": "rimraf public/js/bundle.js public/js/bundle.temp.js public/js/bundle.js.map", "clean-temp": "rimraf public/js/bundle.temp.js", diff --git a/public/js/bundle.js b/public/js/bundle.js index 7579c68..74f2fe7 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -2698,7 +2698,7 @@ PERFORMANCE OF THIS SOFTWARE. `+e._s(e.$t("about.appStatus."+(e.isOnline?"online":"offline")))+` `)])]),e._v(" "),a("ul",[a("li",[e._v(` `+e._s(e.$t("about.updates.currentWebuiVersion"))+`: - `),a("span",[e._v(e._s("1.3.6"))])]),e._v(" "),a("li",[e._v(` + `),a("span",[e._v(e._s("1.4.0"))])]),e._v(" "),a("li",[e._v(` `+e._s(e.$t("about.updates.currentVersion"))+`: `),a("span",[e._v(e._s(e.current||e.$t("about.updates.versionNotAvailable")))])]),e._v(" "),a("li",[e._v(e._s(e.$t("about.updates.deemixVersion"))+": "+e._s(e.deemixVersion))]),e._v(" "),e.updateAvailable&&e.latest?a("li",[e._v(e._s(e.$t("about.updates.updateAvailable",{version:e.latest})))]):e._e()]),e._v(" "),a("ul",[a("li",{domProps:{innerHTML:e._s(e.$t("about.usesLibrary"))}}),e._v(" "),a("li",{domProps:{innerHTML:e._s(e.$t("about.thanks"))}}),e._v(" "),a("i18n",{attrs:{path:"about.upToDate.text",tag:"li"},scopedSlots:e._u([{key:"newsChannel",fn:function(){return[a("a",{attrs:{href:"https://t.me/RemixDevNews",target:"_blank"}},[e._v(e._s(e.$t("about.upToDate.newsChannel")))])]},proxy:!0}])})],1),e._v(" "),a("h2",[e._v(e._s(e.$t("about.titles.usefulLinks")))]),e._v(" "),a("ul",{staticClass:"no-dots"},[a("li",[a("a",{attrs:{href:"https://www.reddit.com/r/deemix",target:"_blank"}},[e._v("\u{1F916} "+e._s(e.$t("about.officialSubreddit")))])]),e._v(" "),a("li",[a("a",{attrs:{href:"https://t.me/RemixDevNews",target:"_blank"}},[e._v("\u{1F4F0} "+e._s(e.$t("about.newsChannel")))])])]),e._v(" "),a("h2",[e._v(` `+e._s(e.$t("about.titles.bugReports"))+` @@ -2725,7 +2725,7 @@ PERFORMANCE OF THIS SOFTWARE. `)])]),e._v(" "),a("ul",[a("li",{domProps:{innerHTML:e._s(e.$t("about.itsFree"))}}),e._v(" "),a("li",[e._v(` `+e._s(e.$t("about.notObligated"))+` `)])]),e._v(" "),a("ul",[a("li",[a("i",{domProps:{innerHTML:e._s(e.paypal)}}),e._v(" "),a("strong",[e._v("PayPal:")]),e._v(" "),a("a",{attrs:{href:"https://paypal.me/RemixDev",target:"_blank"}},[e._v("PayPal.me/RemixDev")])]),e._v(" "),a("li",[a("i",{staticClass:"ethereum",domProps:{innerHTML:e._s(e.ethereum)}}),e._v(" "),a("strong",[e._v("Ethereum:")]),e._v(` 0x1d2aa67e671485CD4062289772B662e0A6Ff976c - `)])]),e._v(" "),a("h2",[e._v(e._s(e.$t("about.titles.license")))]),e._v(" "),e._m(0),e._v(" "),a("i18n",{attrs:{path:"about.lincensedUnder.text",tag:"p"},scopedSlots:e._u([{key:"gpl3",fn:function(){return[a("a",{attrs:{rel:"license",href:"https://www.gnu.org/licenses/gpl-3.0.en.html",target:"_blank"}},[e._v(e._s(e.$t("about.lincensedUnder.gpl3")))])]},proxy:!0}])})],1)},__vue_staticRenderFns__$b=[function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("p",[a("a",{attrs:{rel:"license",href:"https://www.gnu.org/licenses/gpl-3.0.en.html",target:"_blank"}},[a("img",{staticStyle:{"border-width":"0"},attrs:{alt:"GNU General Public License",src:"https://www.gnu.org/graphics/gplv3-127x51.png"}})])])}];const __vue_inject_styles__$b=function(e){if(!e)return;e("data-v-286bbbf6_0",{source:`@charset "UTF-8";a[data-v-286bbbf6],li[data-v-286bbbf6],p[data-v-286bbbf6]{letter-spacing:.4px;font-size:20px;line-height:1.2}i[data-v-286bbbf6]{vertical-align:middle}i[data-v-286bbbf6] svg{fill:#fff;width:20px}.ethereum[data-v-286bbbf6] svg{fill:var(--foreground)}[data-v-286bbbf6]:link{text-decoration:none}#about_tab[data-v-286bbbf6]{margin-bottom:40px}h2[data-v-286bbbf6]{text-transform:capitalize}h2[data-v-286bbbf6]:not(.page_heading){font-size:2rem;border-bottom:1px solid rgba(51,51,51,.25);padding-top:2rem;padding-bottom:1rem}h2 .subheading[data-v-286bbbf6]{display:block;font-size:.5em;margin-top:.5em;font-weight:400;opacity:.8;text-transform:none}p[data-v-286bbbf6]{margin:0!important}ul li[data-v-286bbbf6]{margin-bottom:7px}h2+ul[data-v-286bbbf6]{margin-top:1rem}ul+ul[data-v-286bbbf6]{margin-top:1.25rem}ul.no-dots[data-v-286bbbf6]{list-style-type:none}ul[data-v-286bbbf6]:not(.no-dots){list-style-type:none}ul:not(.no-dots) li[data-v-286bbbf6]{position:relative}ul:not(.no-dots) li[data-v-286bbbf6]::before{content:'\u2014';position:absolute;left:-30px;opacity:.25}`,map:void 0,media:void 0})},__vue_scope_id__$b="data-v-286bbbf6",__vue_module_identifier__$a=void 0,__vue_is_functional_template__$b=!1;function __vue_normalize__$b(e,n,a,r,i,s,l,c){const o=(typeof a=="function"?a.options:a)||{};o.__file="About.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r;{let u;if(n&&(u=function(d){n.call(this,l(d))}),u!==void 0)if(o.functional){const d=o.render;o.render=function(m,h){return u.call(h),d(m,h)}}else{const d=o.beforeCreate;o.beforeCreate=d?[].concat(d,u):[u]}}return o}function __vue_create_injector__$a(){const e=document.head||document.getElementsByTagName("head")[0],n=__vue_create_injector__$a.styles||(__vue_create_injector__$a.styles={}),a=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());return function(i,s){if(document.querySelector('style[data-vue-ssr-id~="'+i+'"]'))return;const l=a?s.media||"default":i,c=n[l]||(n[l]={ids:[],parts:[],element:void 0});if(!c.ids.includes(i)){let o=s.source,u=c.ids.length;if(c.ids.push(i),s.map&&(o+=` + `)])]),e._v(" "),a("h2",[e._v(e._s(e.$t("about.titles.license")))]),e._v(" "),e._m(0),e._v(" "),a("i18n",{attrs:{path:"about.lincensedUnder.text",tag:"p"},scopedSlots:e._u([{key:"gpl3",fn:function(){return[a("a",{attrs:{rel:"license",href:"https://www.gnu.org/licenses/gpl-3.0.en.html",target:"_blank"}},[e._v(e._s(e.$t("about.lincensedUnder.gpl3")))])]},proxy:!0}])})],1)},__vue_staticRenderFns__$b=[function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("p",[a("a",{attrs:{rel:"license",href:"https://www.gnu.org/licenses/gpl-3.0.en.html",target:"_blank"}},[a("img",{staticStyle:{"border-width":"0"},attrs:{alt:"GNU General Public License",src:"https://www.gnu.org/graphics/gplv3-127x51.png"}})])])}];const __vue_inject_styles__$b=function(e){if(!e)return;e("data-v-09a35aac_0",{source:`@charset "UTF-8";a[data-v-09a35aac],li[data-v-09a35aac],p[data-v-09a35aac]{letter-spacing:.4px;font-size:20px;line-height:1.2}i[data-v-09a35aac]{vertical-align:middle}i[data-v-09a35aac] svg{fill:#fff;width:20px}.ethereum[data-v-09a35aac] svg{fill:var(--foreground)}[data-v-09a35aac]:link{text-decoration:none}#about_tab[data-v-09a35aac]{margin-bottom:40px}h2[data-v-09a35aac]{text-transform:capitalize}h2[data-v-09a35aac]:not(.page_heading){font-size:2rem;border-bottom:1px solid rgba(51,51,51,.25);padding-top:2rem;padding-bottom:1rem}h2 .subheading[data-v-09a35aac]{display:block;font-size:.5em;margin-top:.5em;font-weight:400;opacity:.8;text-transform:none}p[data-v-09a35aac]{margin:0!important}ul li[data-v-09a35aac]{margin-bottom:7px}h2+ul[data-v-09a35aac]{margin-top:1rem}ul+ul[data-v-09a35aac]{margin-top:1.25rem}ul.no-dots[data-v-09a35aac]{list-style-type:none}ul[data-v-09a35aac]:not(.no-dots){list-style-type:none}ul:not(.no-dots) li[data-v-09a35aac]{position:relative}ul:not(.no-dots) li[data-v-09a35aac]::before{content:'\u2014';position:absolute;left:-30px;opacity:.25}`,map:void 0,media:void 0})},__vue_scope_id__$b="data-v-09a35aac",__vue_module_identifier__$a=void 0,__vue_is_functional_template__$b=!1;function __vue_normalize__$b(e,n,a,r,i,s,l,c){const o=(typeof a=="function"?a.options:a)||{};o.__file="About.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r;{let u;if(n&&(u=function(d){n.call(this,l(d))}),u!==void 0)if(o.functional){const d=o.render;o.render=function(m,h){return u.call(h),d(m,h)}}else{const d=o.beforeCreate;o.beforeCreate=d?[].concat(d,u):[u]}}return o}function __vue_create_injector__$a(){const e=document.head||document.getElementsByTagName("head")[0],n=__vue_create_injector__$a.styles||(__vue_create_injector__$a.styles={}),a=typeof navigator!="undefined"&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());return function(i,s){if(document.querySelector('style[data-vue-ssr-id~="'+i+'"]'))return;const l=a?s.media||"default":i,c=n[l]||(n[l]={ids:[],parts:[],element:void 0});if(!c.ids.includes(i)){let o=s.source,u=c.ids.length;if(c.ids.push(i),s.map&&(o+=` /*# sourceURL=`+s.map.sources[0]+" */",o+=` /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(s.map))))+" */"),a&&(c.element=c.element||document.querySelector("style[data-group="+l+"]")),!c.element){const d=c.element=document.createElement("style");d.type="text/css",s.media&&d.setAttribute("media",s.media),a&&(d.setAttribute("data-group",l),d.setAttribute("data-next-index","0")),e.appendChild(d)}if(a&&(u=parseInt(c.element.getAttribute("data-next-index")),c.element.setAttribute("data-next-index",u+1)),c.element.styleSheet)c.parts.push(o),c.element.styleSheet.cssText=c.parts.filter(Boolean).join(` `);else{const d=document.createTextNode(o),f=c.element.childNodes;f[u]&&c.element.removeChild(f[u]),f.length?c.element.insertBefore(d,f[u]):c.element.appendChild(d)}}}}var About=__vue_normalize__$b({render:__vue_render__$b,staticRenderFns:__vue_staticRenderFns__$b},__vue_inject_styles__$b,__vue_script__$9,__vue_scope_id__$b,__vue_is_functional_template__$b,__vue_module_identifier__$a,__vue_create_injector__$a),script$a={};const __vue_script__$a=script$a;var __vue_render__$c=function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("div",[a("h1",{staticClass:"mb-8 text-5xl"},[e._v(e._s(e.$t("settings.login.arl.question")))]),e._v(" "),e._m(0),e._v(" "),a("h3",{staticClass:"mt-6 text-3xl"},[e._v("Chrome (Easy way)")]),e._v(" "),e._m(1),e._v(" "),a("h3",{staticClass:"mt-6 text-3xl"},[e._v("Chrome")]),e._v(" "),e._m(2),e._v(" "),e._m(3),e._v(" "),a("h3",{staticClass:"mt-6 text-3xl"},[e._v("Firefox")]),e._v(" "),e._m(4)])},__vue_staticRenderFns__$c=[function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("p",{staticClass:"mb-2 text-base"},[e._v(` @@ -2820,7 +2820,7 @@ PERFORMANCE OF THIS SOFTWARE. `+e._s(e.fansNumber)+` `)]),e._v(" "),a("span",{staticClass:"p-1 px-2 text-xs text-center capitalize bg-primary rounded-xl"},[e._v(` `+e._s(e.$tc("globals.listTabs."+e.$attrs.info.type,1))+` - `)])],1)},__vue_staticRenderFns__$m=[];const __vue_inject_styles__$m=void 0,__vue_scope_id__$m=void 0,__vue_is_functional_template__$m=!1;function __vue_normalize__$m(e,n,a,r,i,s,l,c){const o=(typeof a=="function"?a.options:a)||{};return o.__file="TopResult.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r,o}var TopResult=__vue_normalize__$m({render:__vue_render__$m,staticRenderFns:__vue_staticRenderFns__$m},__vue_inject_styles__$m,__vue_script__$k,__vue_scope_id__$m,__vue_is_functional_template__$m);function formatSingleTrack(e){let n=getPropertyWithFallback(e,"explicit_lyrics","EXPLICIT_LYRICS");return typeof n=="string"&&(n=n!=="0"),{trackTitle:getPropertyWithFallback(e,"title","SNG_TITLE"),trackTitleVersion:getPropertyWithFallback(e,"title_version","VERSION"),trackPreview:getPropertyWithFallback(e,"preview"),trackDuration:getPropertyWithFallback(e,"duration","DURATION"),trackLink:getPropertyWithFallback(e,"link")||`https://www.deezer.com/track/${e.SNG_ID}`,isTrackExplicit:n,artistID:getPropertyWithFallback(e,"artist.id","ART_ID"),artistName:getPropertyWithFallback(e,"artist.name","ART_NAME"),albumID:getPropertyWithFallback(e,"album.id","ALB_ID"),albumTitle:getPropertyWithFallback(e,"album.title","ALB_TITLE"),albumPicture:getPropertyWithFallback(e,"album.cover_small")||`https://e-cdns-images.dzcdn.net/images/cover/${e.ALB_PICTURE}/32x32-000000-80-0-0.jpg`}}function formatAlbums(e){let n=getPropertyWithFallback(e,"explicit_lyrics","EXPLICIT_ALBUM_CONTENT.EXPLICIT_LYRICS_STATUS");return typeof n=="number"&&(n=n===1),{albumID:getPropertyWithFallback(e,"id","ALB_ID"),albumTitle:getPropertyWithFallback(e,"title","ALB_TITLE"),albumCoverMedium:getPropertyWithFallback(e,"cover_medium")||`https://e-cdns-images.dzcdn.net/images/cover/${e.ALB_PICTURE}/156x156-000000-80-0-0.jpg`,albumLink:getPropertyWithFallback(e,"link")||`https://deezer.com/album/${e.ALB_ID}`,albumTracks:getPropertyWithFallback(e,"nb_tracks","NUMBER_TRACK"),isAlbumExplicit:n,artistName:getPropertyWithFallback(e,"artist.name","ART_NAME")}}function formatArtist(e){return{artistID:getPropertyWithFallback(e,"id","ART_ID"),artistName:getPropertyWithFallback(e,"name","ART_NAME"),artistPictureMedium:getPropertyWithFallback(e,"picture_medium")||`https://e-cdns-images.dzcdn.net/images/artist/${e.ART_PICTURE}/156x156-000000-80-0-0.jpg`,artistLink:getPropertyWithFallback(e,"link")||`https://deezer.com/artist/${e.ART_ID}`,artistAlbumsNumber:getPropertyWithFallback(e,"nb_album","NB_FAN")}}function formatPlaylist(e){return{playlistID:getPropertyWithFallback(e,"id","PLAYLIST_ID"),playlistTitle:getPropertyWithFallback(e,"title","TITLE"),playlistPictureMedium:getPropertyWithFallback(e,"picture_medium")||`https://e-cdns-images.dzcdn.net/images/${e.PICTURE_TYPE}/${e.PLAYLIST_PICTURE}/156x156-000000-80-0-0.jpg`,playlistLink:getPropertyWithFallback(e,"link")||`https://deezer.com/playlist/${e.PLAYLIST_ID}`,playlistTracksNumber:getPropertyWithFallback(e,"nb_tracks","NB_SONG"),artistName:getPropertyWithFallback(e,"user.name")}}function formatTitle(e){const n=e.trackTitleVersion&&e.trackTitle.indexOf(e.trackTitleVersion)===-1;return`${e.trackTitle}${n?` ${e.trackTitleVersion}`:""}`}var script$l={components:{BaseLoadingPlaceholder,PreviewControls},props:{viewInfo:{validator:function(e){let n=Object.is(e,null),a=Object.prototype.toString.call(e)==="[object Object]";return n||a},required:!0},itemsToShow:{type:Number,required:!1},wantHeaders:{type:Boolean,required:!1,default:!1}},computed:{isLoading(){return!this.viewInfo||!this.viewInfo.hasLoaded}},methods:{convertDuration,formatTitle,playPausePreview(e){EventBus.$emit("trackPreview:playPausePreview",e)}}};const __vue_script__$l=script$l;var __vue_render__$n=function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("section",[e.isLoading?a("BaseLoadingPlaceholder"):[e.viewInfo.data.length===0?a("div",[a("h1",[e._v(e._s(e.$t("search.noResultsTrack")))])]):a("table",{staticClass:"table w-full table--tracks"},[e.wantHeaders?a("thead",[a("tr",{staticClass:"capitalize"},[a("th",{staticClass:"h-12 pb-3",attrs:{colspan:"2"}},[e._v(e._s(e.$tc("globals.listTabs.title",1)))]),e._v(" "),a("th",{staticClass:"h-12 pb-3"},[e._v(e._s(e.$tc("globals.listTabs.artist",1)))]),e._v(" "),a("th",{staticClass:"h-12 pb-3"},[e._v(e._s(e.$tc("globals.listTabs.album",1)))]),e._v(" "),a("th",{staticClass:"h-12 pb-3"},[a("i",{staticClass:"material-icons"},[e._v("timer")])]),e._v(" "),a("th",{staticClass:"h-12 pb-3",staticStyle:{width:"3.5rem"}})])]):e._e(),e._v(" "),a("tbody",e._l(e.viewInfo.data.slice(0,e.itemsToShow),function(r){return a("tr",{key:r.trackLink},[a("td",{staticClass:"table__icon table__icon--big"},[a("span",{staticClass:"relative inline-block rounded cursor-pointer",attrs:{"data-preview":r.trackPreview},on:{click:function(i){return e.playPausePreview(i)}}},[r.trackPreview?a("PreviewControls"):e._e(),e._v(" "),a("img",{staticClass:"rounded coverart",attrs:{src:r.albumPicture}})],1)]),e._v(" "),a("td",{staticClass:"table__cell table__cell--large"},[a("div",{staticClass:"break-words table__cell-content table__cell-content--vertical-center"},[r.isTrackExplicit?a("i",{staticClass:"material-icons title-icon"},[e._v("explicit")]):e._e(),e._v(` + `)])],1)},__vue_staticRenderFns__$m=[];const __vue_inject_styles__$m=void 0,__vue_scope_id__$m=void 0,__vue_is_functional_template__$m=!1;function __vue_normalize__$m(e,n,a,r,i,s,l,c){const o=(typeof a=="function"?a.options:a)||{};return o.__file="TopResult.vue",o.render||(o.render=e.render,o.staticRenderFns=e.staticRenderFns,o._compiled=!0,i&&(o.functional=!0)),o._scopeId=r,o}var TopResult=__vue_normalize__$m({render:__vue_render__$m,staticRenderFns:__vue_staticRenderFns__$m},__vue_inject_styles__$m,__vue_script__$k,__vue_scope_id__$m,__vue_is_functional_template__$m);function formatSingleTrack(e){let n=getPropertyWithFallback(e,"explicit_lyrics","EXPLICIT_LYRICS");return typeof n=="string"&&(n=n!=="0"),{trackTitle:getPropertyWithFallback(e,"title","SNG_TITLE"),trackTitleVersion:getPropertyWithFallback(e,"title_version","VERSION"),trackPreview:getPropertyWithFallback(e,"preview","MEDIA.0.HREF"),trackDuration:getPropertyWithFallback(e,"duration","DURATION"),trackLink:getPropertyWithFallback(e,"link")||`https://www.deezer.com/track/${e.SNG_ID}`,isTrackExplicit:n,artistID:getPropertyWithFallback(e,"artist.id","ART_ID"),artistName:getPropertyWithFallback(e,"artist.name","ART_NAME"),albumID:getPropertyWithFallback(e,"album.id","ALB_ID"),albumTitle:getPropertyWithFallback(e,"album.title","ALB_TITLE"),albumPicture:getPropertyWithFallback(e,"album.cover_small")||`https://e-cdns-images.dzcdn.net/images/cover/${e.ALB_PICTURE}/56x56-000000-80-0-0.jpg`}}function formatAlbums(e){let n=getPropertyWithFallback(e,"explicit_lyrics","EXPLICIT_ALBUM_CONTENT.EXPLICIT_LYRICS_STATUS");return typeof n=="number"&&(n=n===1),{albumID:getPropertyWithFallback(e,"id","ALB_ID"),albumTitle:getPropertyWithFallback(e,"title","ALB_TITLE"),albumCoverMedium:getPropertyWithFallback(e,"cover_medium")||`https://e-cdns-images.dzcdn.net/images/cover/${e.ALB_PICTURE}/156x156-000000-80-0-0.jpg`,albumLink:getPropertyWithFallback(e,"link")||`https://deezer.com/album/${e.ALB_ID}`,albumTracks:getPropertyWithFallback(e,"nb_tracks","NUMBER_TRACK"),isAlbumExplicit:n,artistName:getPropertyWithFallback(e,"artist.name","ART_NAME")}}function formatArtist(e){return{artistID:getPropertyWithFallback(e,"id","ART_ID"),artistName:getPropertyWithFallback(e,"name","ART_NAME"),artistPictureMedium:getPropertyWithFallback(e,"picture_medium")||`https://e-cdns-images.dzcdn.net/images/artist/${e.ART_PICTURE}/156x156-000000-80-0-0.jpg`,artistLink:getPropertyWithFallback(e,"link")||`https://deezer.com/artist/${e.ART_ID}`,artistAlbumsNumber:getPropertyWithFallback(e,"nb_album","NB_FAN")}}function formatPlaylist(e){return{playlistID:getPropertyWithFallback(e,"id","PLAYLIST_ID"),playlistTitle:getPropertyWithFallback(e,"title","TITLE"),playlistPictureMedium:getPropertyWithFallback(e,"picture_medium")||`https://e-cdns-images.dzcdn.net/images/${e.PICTURE_TYPE}/${e.PLAYLIST_PICTURE}/156x156-000000-80-0-0.jpg`,playlistLink:getPropertyWithFallback(e,"link")||`https://deezer.com/playlist/${e.PLAYLIST_ID}`,playlistTracksNumber:getPropertyWithFallback(e,"nb_tracks","NB_SONG"),artistName:getPropertyWithFallback(e,"user.name")}}function formatTitle(e){const n=e.trackTitleVersion&&e.trackTitle.indexOf(e.trackTitleVersion)===-1;return`${e.trackTitle}${n?` ${e.trackTitleVersion}`:""}`}var script$l={components:{BaseLoadingPlaceholder,PreviewControls},props:{viewInfo:{validator:function(e){let n=Object.is(e,null),a=Object.prototype.toString.call(e)==="[object Object]";return n||a},required:!0},itemsToShow:{type:Number,required:!1},wantHeaders:{type:Boolean,required:!1,default:!1}},computed:{isLoading(){return!this.viewInfo||!this.viewInfo.hasLoaded}},methods:{convertDuration,formatTitle,playPausePreview(e){EventBus.$emit("trackPreview:playPausePreview",e)}}};const __vue_script__$l=script$l;var __vue_render__$n=function(){var e=this,n=e.$createElement,a=e._self._c||n;return a("section",[e.isLoading?a("BaseLoadingPlaceholder"):[e.viewInfo.data.length===0?a("div",[a("h1",[e._v(e._s(e.$t("search.noResultsTrack")))])]):a("table",{staticClass:"table w-full table--tracks"},[e.wantHeaders?a("thead",[a("tr",{staticClass:"capitalize"},[a("th",{staticClass:"h-12 pb-3",attrs:{colspan:"2"}},[e._v(e._s(e.$tc("globals.listTabs.title",1)))]),e._v(" "),a("th",{staticClass:"h-12 pb-3"},[e._v(e._s(e.$tc("globals.listTabs.artist",1)))]),e._v(" "),a("th",{staticClass:"h-12 pb-3"},[e._v(e._s(e.$tc("globals.listTabs.album",1)))]),e._v(" "),a("th",{staticClass:"h-12 pb-3"},[a("i",{staticClass:"material-icons"},[e._v("timer")])]),e._v(" "),a("th",{staticClass:"h-12 pb-3",staticStyle:{width:"3.5rem"}})])]):e._e(),e._v(" "),a("tbody",e._l(e.viewInfo.data.slice(0,e.itemsToShow),function(r){return a("tr",{key:r.trackLink},[a("td",{staticClass:"table__icon table__icon--big"},[a("span",{staticClass:"relative inline-block rounded cursor-pointer",attrs:{"data-preview":r.trackPreview},on:{click:function(i){return e.playPausePreview(i)}}},[r.trackPreview?a("PreviewControls"):e._e(),e._v(" "),a("img",{staticClass:"rounded coverart",attrs:{src:r.albumPicture}})],1)]),e._v(" "),a("td",{staticClass:"table__cell table__cell--large"},[a("div",{staticClass:"break-words table__cell-content table__cell-content--vertical-center"},[r.isTrackExplicit?a("i",{staticClass:"material-icons title-icon"},[e._v("explicit")]):e._e(),e._v(` `+e._s(e.formatTitle(r))+` `)])]),e._v(" "),a("router-link",{staticClass:"break-words table__cell table__cell--medium table__cell--center",attrs:{tag:"td",to:{name:"Artist",params:{id:r.artistID}}}},[a("span",{staticClass:"cursor-pointer hover:underline"},[e._v(` `+e._s(r.artistName)+` diff --git a/src/data/search.js b/src/data/search.js index e84a49d..5c234c4 100644 --- a/src/data/search.js +++ b/src/data/search.js @@ -29,7 +29,7 @@ export function formatSingleTrack(track) { /* Track */ trackTitle: getPropertyWithFallback(track, 'title', 'SNG_TITLE'), trackTitleVersion: getPropertyWithFallback(track, 'title_version', 'VERSION'), - trackPreview: getPropertyWithFallback(track, 'preview'), + trackPreview: getPropertyWithFallback(track, 'preview', 'MEDIA.0.HREF'), trackDuration: getPropertyWithFallback(track, 'duration', 'DURATION'), trackLink: getPropertyWithFallback(track, 'link') || `https://www.deezer.com/track/${track.SNG_ID}`, isTrackExplicit, @@ -43,7 +43,7 @@ export function formatSingleTrack(track) { albumTitle: getPropertyWithFallback(track, 'album.title', 'ALB_TITLE'), albumPicture: getPropertyWithFallback(track, 'album.cover_small') || - `https://e-cdns-images.dzcdn.net/images/cover/${track.ALB_PICTURE}/32x32-000000-80-0-0.jpg` + `https://e-cdns-images.dzcdn.net/images/cover/${track.ALB_PICTURE}/56x56-000000-80-0-0.jpg` } } diff --git a/src/utils/utils.js b/src/utils/utils.js index 0bdc5d1..e04e4ae 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -96,6 +96,11 @@ export function copyToClipboard(text) { ghostInput.remove() } +/** + * @param {object|array} obj + * @param {...any} props + * @returns {any|null} property requested + */ export function getPropertyWithFallback(obj, ...props) { for (const prop of props) { // Example: this.is.an.example