CHONKY BOY

This commit is contained in:
Core 2022-08-04 05:27:29 +01:00
parent 31ed921a1a
commit c15f55d0ee
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
213 changed files with 64188 additions and 55736 deletions

View file

@ -1,6 +1,6 @@
<script type="text/x-template" id="cider-search">
<div class="content-inner search-page">
<div class="search-input-container fs-search" v-if="$root.appMode == 'fullscreen'" >
<div class="search-input-container fs-search" v-if="$root.appMode == 'fullscreen'">
<div class="search-input--icon"></div>
<input type="search" spellcheck="false" @focus="$root.search.showHints = true"
@blur="$root.setTimeout(()=>{$root.search.showHints = false}, 300)"
@ -20,10 +20,14 @@
<div class="btn-group searchToggle">
<button
@click="searchType = 'catalog'"
class="md-btn md-btn-small" :class="{'md-btn-primary': searchType == 'catalog'}">{{ $root.getLz("term.appleMusic") }}</button>
class="md-btn md-btn-small" :class="{'md-btn-primary': searchType == 'catalog'}">{{
$root.getLz("term.appleMusic") }}
</button>
<button
@click="searchType = 'library';"
class="md-btn md-btn-small" :class="{'md-btn-primary': searchType == 'library'}">{{ $root.getLz("term.library") }}</button>
class="md-btn md-btn-small" :class="{'md-btn-primary': searchType == 'library'}">{{
$root.getLz("term.library") }}
</button>
</div>
<div v-if="search != null && search != [] && search.term != ''">
<template v-if="searchType == 'catalog'">
@ -55,14 +59,16 @@
<template v-if="search.results['meta'] != null">
<template
v-for="section in search.results.meta.results.order" v-if="section != 'song' && section != 'top'">
v-for="section in search.results.meta.results.order"
v-if="section != 'song' && section != 'top'">
<div class="row">
<div class="col">
<h3>{{ app.friendlyTypes(section) }}</h3>
</div>
<div class="col-auto cider-flex-center" v-if="search.results[section].data.length >= 10">
<button class="cd-btn-seeall"
@click="app.showSearchView(app.search.term, section, app.friendlyTypes(section))">{{app.getLz('term.seeAll')}}
@click="app.showSearchView(app.search.term, section, app.friendlyTypes(section))">
{{app.getLz('term.seeAll')}}
</button>
</div>
</div>
@ -83,7 +89,8 @@
</div>
<div class="col-auto cider-flex-center" v-if="search.resultsSocial.playlist.data.length >= 10">
<button class="cd-btn-seeall"
@click="app.showCollection(search.resultsSocial.playlist, 'Shared Playlists', 'default')">{{app.getLz('term.seeAll')}}
@click="app.showCollection(search.resultsSocial.playlist, 'Shared Playlists', 'default')">
{{app.getLz('term.seeAll')}}
</button>
</div>
</div>
@ -97,7 +104,8 @@
</div>
<div class="col-auto cider-flex-center" v-if="search.resultsSocial.profile.data.length >= 10">
<button class="cd-btn-seeall"
@click="app.showCollection(search.resultsSocial.profile, 'People', 'default')">{{app.getLz('term.seeAll')}}
@click="app.showCollection(search.resultsSocial.profile, 'People', 'default')">
{{app.getLz('term.seeAll')}}
</button>
</div>
</div>
@ -119,79 +127,83 @@
</div>
</template>
</div>
<div v-else >
<div v-if="categoriesReady || getCategories()">
<div v-else>
<div v-if="categoriesReady || getCategories()">
<div>
<div class="col" v-if="categoriesView != null && categoriesView != [] && categoriesView[0].attributes != null && categoriesView[0].attributes.title != null">
<div class="col"
v-if="categoriesView != null && categoriesView != [] && categoriesView[0].attributes != null && categoriesView[0].attributes.title != null">
<h3>{{$root.getLz('home.recentlyPlayed')}}</h3>
<div class="mediaitem-list-item__grid">
<listitem-horizontal :items="recentlyPlayed.limit(10)">
</listitem-horizontal>
</div>
<!-- <mediaitem-square :kind="'385'" size="600" v-for="item in recentlyPlayed.limit(10)" :item="item" :imagesize="800"></mediaitem-square>-->
<listitem-horizontal :items="recentlyPlayed.limit(10)">
</listitem-horizontal>
</div>
<!-- <mediaitem-square :kind="'385'" size="600" v-for="item in recentlyPlayed.limit(10)" :item="item" :imagesize="800"></mediaitem-square>-->
<h3>{{categoriesView[0].attributes.title.stringForDisplay ?? ""}}</h3>
</div>
</div>
</div>
<div class="categories">
<mediaitem-square :kind="'385'" :imageformat="'bb'" size="600"
:item="item ? (item.attributes.kind ? item : ((item.relationships && item.relationships.contents ) ? item.relationships.contents.data[0] : item)) : []"
:imagesize="800"
v-for="item of getFlattenedCategories()">
:item="item ? (item.attributes.kind ? item : ((item.relationships && item.relationships.contents ) ? item.relationships.contents.data[0] : item)) : []"
:imagesize="800"
v-for="item of getFlattenedCategories()">
</div>
</div>
</div>
</div>
</div>
</div>
</script>
<script>
Vue.component('cider-search', {
template: "#cider-search",
props: ['search'],
data: function () {
return {
app: this.$root,
recentlyPlayed: [],
categoriesView: [],
categoriesReady: false,
searchType: "catalog",
}
},
methods: {
getTopResult() {
try {
return this.search.results[this.search.results.meta.results.order[0]]["data"][0]
} catch (error) {
return false
}
},
async seeAllHistory() {
let hist = await app.mk.api.v3.music(`/v1/me/recent/played/tracks`, {
l: this.$root.mklang
})
this.recentlyPlayed = hist.data.data
},
async getCategories() {
if (this.categoriesView != [] && this.categoriesView.length > 0) { this.categoriesReady = true; return await true; } else {
await this.seeAllHistory()
let response = await this.app.mk.api.v3.music(`/v1/recommendations/${this.app.mk.storefrontId}?timezone=${encodeURIComponent(this.app.formatTimezoneOffset())}&name=search-landing&platform=web&extend=editorialArtwork&art%5Burl%5D=f%2Cc&types=editorial-items%2Capple-curators%2Cactivities&l=${this.$root.mklang}`);
this.categoriesView = response.data.data;
console.log(this.categoriesView)
this.categoriesReady = true;
return await true;
}
},
getFlattenedCategories() {
let flattened = [];
for (let i = 0; i < this.categoriesView.length; i++) {
if (this.categoriesView[i].relationships && this.categoriesView[i].relationships.contents && this.categoriesView[i].relationships.contents.data) {
for (let j = 0; j < this.categoriesView[i].relationships.contents.data.length; j++) {
if (this.categoriesView[i].relationships.contents.data[j].type != 'editorial-items')
flattened.push(this.categoriesView[i].relationships.contents.data[j])
}
}
}
return flattened;
}
Vue.component('cider-search', {
template: "#cider-search",
props: ['search'],
data: function() {
return {
app: this.$root,
recentlyPlayed: [],
categoriesView: [],
categoriesReady: false,
searchType: "catalog",
}
},
methods: {
getTopResult() {
try {
return this.search.results[this.search.results.meta.results.order[0]]["data"][0]
} catch (error) {
return false
}
})
</script>
},
async seeAllHistory() {
let hist = await app.mk.api.v3.music(`/v1/me/recent/played/tracks`, {
l: this.$root.mklang
})
this.recentlyPlayed = hist.data.data
},
async getCategories() {
if (this.categoriesView != [] && this.categoriesView.length > 0) {
this.categoriesReady = true;
return await true;
} else {
await this.seeAllHistory()
let response = await this.app.mk.api.v3.music(`/v1/recommendations/${this.app.mk.storefrontId}?timezone=${encodeURIComponent(this.app.formatTimezoneOffset())}&name=search-landing&platform=web&extend=editorialArtwork&art%5Burl%5D=f%2Cc&types=editorial-items%2Capple-curators%2Cactivities&l=${this.$root.mklang}`);
this.categoriesView = response.data.data;
console.log(this.categoriesView)
this.categoriesReady = true;
return await true;
}
},
getFlattenedCategories() {
let flattened = [];
for (let i = 0; i < this.categoriesView.length; i++) {
if (this.categoriesView[i].relationships && this.categoriesView[i].relationships.contents && this.categoriesView[i].relationships.contents.data) {
for (let j = 0; j < this.categoriesView[i].relationships.contents.data.length; j++) {
if (this.categoriesView[i].relationships.contents.data[j].type != 'editorial-items')
flattened.push(this.categoriesView[i].relationships.contents.data[j])
}
}
}
return flattened;
}
}
})
</script>