Merge branch 'develop' of https://github.com/ciderapp/Cider into develop

This commit is contained in:
booploops 2022-02-09 17:22:00 -08:00
commit 62ac278a85
13 changed files with 118 additions and 55 deletions

View file

@ -3578,6 +3578,27 @@ const app = new Vue({
R.push(arr.slice(i, i + chunkSize));
}
return R;
},
SpacePause() {
const elems = document.querySelectorAll('input');
for (elem of elems){
if (elem === document.activeElement) {
return;
}
}
if (!this.isDev) // disable in dev mode to keep my sanity
MusicKitInterop.playPause();
},
MKJSLang(){
let u = this.cfg.general.language;
let langcodes = ['af', 'sq', 'ar', 'eu', 'bg', 'be', 'ca', 'zh', 'zh-tw', 'zh-cn', 'zh-hk', 'zh-sg', 'hr', 'cs', 'da', 'nl', 'nl-be', 'en', 'en-us', 'en-eg', 'en-au', 'en-gb', 'en-ca', 'en-nz', 'en-ie', 'en-za', 'en-jm', 'en-bz', 'en-tt', 'en-001', 'et', 'fo', 'fa', 'fi', 'fr', 'fr-ca', 'gd', 'de', 'de-ch', 'el', 'he', 'hi', 'hu', 'is', 'id', 'it', 'ja', 'ko', 'lv', 'lt', 'mk', 'mt', 'no', 'nb', 'nn', 'pl', 'pt-br', 'pt', 'rm', 'ro', 'ru', 'sr', 'sk', 'sl', 'es', 'es-mx', 'es-419', 'sv', 'th', 'ts', 'tn', 'tr', 'uk', 'ur', 've', 'vi', 'xh', 'yi', 'zu', 'ms', 'iw', 'lo', 'tl', 'kk', 'ta', 'te', 'bn', 'ga', 'ht', 'la', 'pa', 'sa'];
let sellang = "en"
if (u && langcodes.includes(u.toLowerCase().replace('_', "-"))) {
sellang = ((u.toLowerCase()).replace('_', "-"))
} else if (u && u.includes('_') && langcodes.includes(((u.toLowerCase()).replace('_', "-")).split("-")[0])) {
sellang = ((u.toLowerCase()).replace('_', "-")).split("-")[0]
}
return sellang
}
}
})

View file

@ -16,9 +16,12 @@
<template v-if="isVisible">
<div class="isLibrary" v-if="showLibraryStatus == true">
<div v-if="showInLibrary" :style="{display: (showInLibrary ? 'block' : 'none'), 'margin-left':'11px'}">
<button @click="addToLibrary()" v-if="!addedToLibrary">
<button @click="addToLibrary()" v-if="!addedToLibrary && (showIndex == false ||(showIndex == true && showIndexPlaylist != false))">
<div class="svg-icon" :style="{'--color': 'var(--keyColor)', '--url': 'url(./assets/feather/plus.svg)'}"></div>
</button>
<button v-else @click="playTrack()" style="width: 44px;margin-left: -11px;">
<%- include("../svg/play.svg") %>
</button>
</div>
<div v-if="!(app.mk.isPlaying && (((app.mk.nowPlayingItem._songId ?? app.mk.nowPlayingItem.id ) == item.attributes.playParams.id) || (app.mk.nowPlayingItem.id == item.id ))) && showIndex" :style="{display: ((showIndex && !showInLibrary) ? 'block' : 'none'), 'margin-left':'11px'}">
<div>

View file

@ -88,7 +88,7 @@
<mediaitem-square :kind="'385'" size="600"
:item="item ? (item.attributes.kind ? item : ((item.relationships && item.relationships.contents ) ? item.relationships.contents.data[0] : item)) : []"
:imagesize="800"
v-for="item in categoriesView[1].relationships.contents.data.filter(item => item.type != 'editorial-items')">
v-for="item of getFlattenedCategories()">
</div>
</div>
</div>
@ -118,9 +118,22 @@
if (this.categoriesView != [] && this.categoriesView.length > 0) { this.categoriesReady = true; return await true; } else {
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`);
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;
}
}
})