This commit is contained in:
yazninja 2022-09-04 01:04:25 +08:00
commit 6374e04b5d
13 changed files with 184 additions and 97 deletions

View file

@ -2002,14 +2002,18 @@ const app = new Vue({
}
if (kind.toString().includes("apple-curator")) {
kind = "appleCurator";
app.getTypeFromID("appleCurator", id, false, {
platform: "web",
include: "grouping,playlists",
extend: "editorialArtwork",
"art[url]": "f",
});
window.location.hash = `${kind}/${id}`;
document.querySelector("#app-content").scrollTop = 0;
app
.getTypeFromID("appleCurator", id, false, {
platform: "web",
include: "grouping,playlists",
extend: "editorialArtwork",
"art[url]": "f",
})
.then(() => {
kind = "appleCurator";
window.location.hash = `${kind}/${id}`;
document.querySelector("#app-content").scrollTop = 0;
});
} else if (kind == "editorial-elements" || kind == "editorial-items") {
console.debug(item);
if (item.relationships?.contents?.data != null && item.relationships?.contents?.data.length > 0) {
@ -4022,23 +4026,28 @@ const app = new Vue({
}
},
getMediaItemArtwork(url, height = 64, width) {
if (typeof url == "undefined" || url == "") {
try {
if (typeof url == "undefined" || url == "") {
return "./assets/MissingArtwork.svg";
}
height = parseInt(height * window.devicePixelRatio);
if (width) {
width = parseInt(width * window.devicePixelRatio);
}
let newurl = `${(url ?? "")
.replace("{w}", width ?? height)
.replace("{h}", height)
.replace("{f}", "webp")
.replace("{c}", width === 900 || width === 380 || width === 600 ? "sr" : "cc")}`;
if (newurl.includes("900x516")) {
newurl = newurl.replace("900x516cc", "900x516sr").replace("900x516bb", "900x516sr");
}
return newurl;
} catch (e) {
console.log(url);
return "./assets/MissingArtwork.svg";
}
height = parseInt(height * window.devicePixelRatio);
if (width) {
width = parseInt(width * window.devicePixelRatio);
}
let newurl = `${url
.replace("{w}", width ?? height)
.replace("{h}", height)
.replace("{f}", "webp")
.replace("{c}", width === 900 || width === 380 || width === 600 ? "sr" : "cc")}`;
if (newurl.includes("900x516")) {
newurl = newurl.replace("900x516cc", "900x516sr").replace("900x516bb", "900x516sr");
}
return newurl;
},
_rgbToRgb(rgb = [0, 0, 0]) {
// if rgb

View file

@ -15,7 +15,7 @@
</div>
<div class="artwork">
<mediaitem-artwork
:url="item.attributes?.editorialArtwork.subscriptionHero.url ?? item.attributes?.artwork"
:url="item.attributes?.editorialArtwork?.subscriptionHero?.url ?? item.attributes?.artwork?.url"
:video="(item.attributes != null && item.attributes?.editorialVideo != null) ? (item.attributes?.editorialVideo?.motionDetailSquare ? item.attributes?.editorialVideo?.motionDetailSquare?.video : (item.attributes?.editorialVideo?.motionSquareVideo1x1 ? item?.attributes?.editorialVideo?.motionSquareVideo1x1?.video : '')) : '' "
:size="516" :width="900"
></mediaitem-artwork>

View file

@ -45,9 +45,9 @@
<div class="title"
:title="item.attributes?.name ?? (item.relationships?.contents?.data[0]?.attributes?.name ?? (item.attributes?.editorialNotes?.name ?? ''))"
v-if="item.attributes.artistNames == null || kind != 'card'" @click='app.routeView(item)'>
<div class="item-navigate text-overflow-elipsis">{{ item.attributes?.name.replace(/&nbsp;/g, ' ').replace(/Apple Music |^Apple |/g, '') ??
<div class="item-navigate text-overflow-elipsis">{{ (item.attributes?.editorialElementKind == "394" && item.relationships?.contents?.data[0]?.attributes?.shortName != null ) ? item.relationships?.contents?.data[0]?.attributes?.shortName : (item.attributes?.name ? ((removeamtext ) ? item.attributes?.name.replace(/&nbsp;/g, ' ').replace(/Apple Music |^Apple |/g, '') : item.attributes?.name.replace(/&nbsp;/g, ' ')) :
(item.relationships?.contents?.data[0]?.attributes?.name ??
(item.attributes?.editorialNotes?.name ?? '')) }}
(item.attributes?.editorialNotes?.name ?? ''))) }}
</div>
<div class="explicit-icon" v-if="item.attributes && item.attributes.contentRating == 'explicit'"
style="background-image: url(./assets/explicit.svg);height: 12px;width: 12px;filter: contrast(0);background-repeat: no-repeat;margin-top: 2.63px;margin-left: 4px;"></div>
@ -98,6 +98,11 @@ Vue.component('mediaitem-square', {
default: 'cc',
required: false
},
removeamtext: {
type: Boolean,
default: false,
required: false
},
'contextExt': { type: Object, required: false },
},
data: function () {

View file

@ -1,6 +1,6 @@
<script type="text/x-template" id="cider-applecurator">
<div class="content-inner">
<h1 class="header-text">{{ data.attributes.shortName ?? data.attributes.name}}</h1>
<h1 class="header-text">{{ data.attributes?.shortName ?? data.attributes.name}}</h1>
<template v-if="data.relationships && data.relationships.grouping">
<template
v-for="(recom,index) in data.relationships.grouping.data[0].relationships.tabs.data[0].relationships.children.data">
@ -43,6 +43,9 @@
return {
app: this.$root
}
}
},
mounted() {
console.log('ping')
},
})
</script>

View file

@ -142,10 +142,10 @@
</div>
</div>
<div class="categories">
<mediaitem-square :kind="'385'" :imageformat="'bb'" size="600"
<mediaitem-square :kind="'385'" :imageformat="'bb'" size="600" :removeamtext="true"
:item="item ? (item.attributes.kind ? item : ((item.relationships && item.relationships.contents ) ? item.relationships.contents.data[0] : item)) : []"
:imagesize="800"
v-for="item of getFlattenedCategories()">
v-for="item of getFlattenedCategories()"/>
</div>
</div>
</div>