Changed if() to if ()

This commit is contained in:
Amaru8 2022-04-30 21:27:00 +02:00
parent 91ac19974c
commit 9c85fafd1d
22 changed files with 44 additions and 44 deletions

View file

@ -26,7 +26,7 @@ export class Plugins {
} }
public static getPluginFromMap(plugin: string): any { public static getPluginFromMap(plugin: string): any {
if(Plugins.PluginMap[plugin]) { if (Plugins.PluginMap[plugin]) {
return Plugins.PluginMap[plugin]; return Plugins.PluginMap[plugin];
}else{ }else{
return plugin; return plugin;

View file

@ -105,7 +105,7 @@ function fallbackinitMusicKit() {
}) })
setTimeout(() => { setTimeout(() => {
app.init() app.init()
if(app.cfg.visual.window_background_style == "mica" && !app.isDev) { if (app.cfg.visual.window_background_style == "mica" && !app.isDev) {
app.spawnMica() app.spawnMica()
} }
}, 1000) }, 1000)
@ -134,7 +134,7 @@ document.addEventListener('musickitloaded', function () {
function waitForApp() { function waitForApp() {
if (typeof app.init !== "undefined") { if (typeof app.init !== "undefined") {
app.init() app.init()
if(app.cfg.visual.window_background_style == "mica" && !app.isDev) { if (app.cfg.visual.window_background_style == "mica" && !app.isDev) {
app.spawnMica() app.spawnMica()
} }
} }

View file

@ -22,7 +22,7 @@ const Events = {
if (event.keyCode === 82 && event.ctrlKey) { if (event.keyCode === 82 && event.ctrlKey) {
event.preventDefault() event.preventDefault()
bootbox.confirm("Reload Cider?", (res)=>{ bootbox.confirm("Reload Cider?", (res)=>{
if(res) { if (res) {
window.location.reload() window.location.reload()
} }
}) })

View file

@ -251,7 +251,7 @@ function simulateGamepad () {
cursorPos[1] -= cursorSpeed cursorPos[1] -= cursorSpeed
// sounds.Hover.play() // sounds.Hover.play()
// if(intTabIndex <= 0) { // if (intTabIndex <= 0) {
// intTabIndex = 0 // intTabIndex = 0
// }else{ // }else{
// intTabIndex-- // intTabIndex--
@ -263,7 +263,7 @@ function simulateGamepad () {
e.preventDefault() e.preventDefault()
cursorPos[1] += cursorSpeed cursorPos[1] += cursorSpeed
// if(intTabIndex < tabbable.length) { // if (intTabIndex < tabbable.length) {
// intTabIndex++ // intTabIndex++
// }else{ // }else{
// intTabIndex = tabbable.length // intTabIndex = tabbable.length

View file

@ -1671,7 +1671,7 @@ const app = new Vue({
params["meta[albums:tracks]"] = 'popularity' params["meta[albums:tracks]"] = 'popularity'
params["fields[albums]"] = "artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialNotes,editorialVideo,name,playParams,releaseDate,url,copyright" params["fields[albums]"] = "artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialNotes,editorialVideo,name,playParams,releaseDate,url,copyright"
} }
if(kind.includes("playlist") || kind.includes("album")){ if (kind.includes("playlist") || kind.includes("album")){
app.page = (kind) + "_" + (id); app.page = (kind) + "_" + (id);
window.location.hash = `${kind}/${id}${isLibrary ? "/" + isLibrary : ''}` window.location.hash = `${kind}/${id}${isLibrary ? "/" + isLibrary : ''}`
app.getTypeFromID((kind), (id), (isLibrary), params); app.getTypeFromID((kind), (id), (isLibrary), params);

View file

@ -108,9 +108,9 @@ const wsapi = {
app.mk.isPlaying ? app.mk.pause() : app.mk.play() app.mk.isPlaying ? app.mk.pause() : app.mk.play()
}, },
toggleRepeat() { toggleRepeat() {
if(MusicKit.getInstance().repeatMode == 0) { if (MusicKit.getInstance().repeatMode == 0) {
MusicKit.getInstance().repeatMode = 1 MusicKit.getInstance().repeatMode = 1
}else if(MusicKit.getInstance().repeatMode == 1){ }else if (MusicKit.getInstance().repeatMode == 1){
MusicKit.getInstance().repeatMode = 2 MusicKit.getInstance().repeatMode = 2
}else{ }else{
MusicKit.getInstance().repeatMode = 0 MusicKit.getInstance().repeatMode = 0

View file

@ -133,7 +133,7 @@ app.mkapi("artists", false, "412778295", {
var library = [] var library = []
var downloaded = null; var downloaded = null;
function downloadChunk () { function downloadChunk () {
if(downloaded == null) { if (downloaded == null) {
app.mk.api.library.songs("", {limit: 100}, {includeResponseMeta: !0}).then((response)=>{ app.mk.api.library.songs("", {limit: 100}, {includeResponseMeta: !0}).then((response)=>{
processChunk(response) processChunk(response)
}) })

View file

@ -29,7 +29,7 @@
template: '#artist-chip', template: '#artist-chip',
async mounted() { async mounted() {
let artistId = this.item.id let artistId = this.item.id
if(typeof this.item.relationships == "object") { if (typeof this.item.relationships == "object") {
artistId = this.item.relationships.catalog.data[0].id artistId = this.item.relationships.catalog.data[0].id
} }
app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists/${artistId}`).then(response => { app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/artists/${artistId}`).then(response => {

View file

@ -54,7 +54,7 @@
app.modals.audioSettings = false app.modals.audioSettings = false
}, },
openSpatialAudio() { openSpatialAudio() {
if(app.cfg.audio.spatial === true && app.cfg.audio.maikiwiAudio.spatial === false) { if (app.cfg.audio.spatial === true && app.cfg.audio.maikiwiAudio.spatial === false) {
app.modals.spatialProperties = true app.modals.spatialProperties = true
app.modals.audioSettings = false app.modals.audioSettings = false
} else { } else {

View file

@ -115,7 +115,7 @@
}, },
methods: { methods: {
seekTo(startTime) { seekTo(startTime) {
if(startTime != 9999999) this.app.seekTo(startTime, false); if (startTime != 9999999) this.app.seekTo(startTime, false);
}, },
getActiveLyric() { getActiveLyric() {
const delayfix = 0.1 const delayfix = 0.1
@ -125,7 +125,7 @@
if (app.currentLyricsLine != i) { if (app.currentLyricsLine != i) {
app.currentLyricsLine = i; app.currentLyricsLine = i;
if (((app.lyricon && app.drawer.open) || app.appMode == 'fullscreen') && this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${i}"]`)) { if (((app.lyricon && app.drawer.open) || app.appMode == 'fullscreen') && this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${i}"]`)) {
if(this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${prevLine}"]`)) {this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${prevLine}"]`).classList.remove("active");} if (this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${prevLine}"]`)) {this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${prevLine}"]`).classList.remove("active");}
this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${i}"]`).classList.add("active") this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${i}"]`).classList.add("active")
if (this.checkIfScrollIsStatic) { if (this.checkIfScrollIsStatic) {
let lyricElement = this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${i}"]`) let lyricElement = this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${i}"]`)

View file

@ -76,7 +76,7 @@
}, event) }, event)
}, },
getVideoPriority() { getVideoPriority() {
if(app.cfg.visual.animated_artwork == "always") { if (app.cfg.visual.animated_artwork == "always") {
return true; return true;
}else if (this.videoPriority && app.cfg.visual.animated_artwork == "limited") { }else if (this.videoPriority && app.cfg.visual.animated_artwork == "limited") {
return true return true

View file

@ -152,7 +152,7 @@
}, },
getClasses() { getClasses() {
this.addClasses = {} this.addClasses = {}
if(typeof this.item.attributes.playParams == "undefined") { if (typeof this.item.attributes.playParams == "undefined") {
this.addClasses["disabled"] = true this.addClasses["disabled"] = true
} }
if (this.classList) { if (this.classList) {

View file

@ -27,7 +27,7 @@
<div class="title text-overflow-elipsis" @click='app.routeView(item)'> <div class="title text-overflow-elipsis" @click='app.routeView(item)'>
{{ item.attributes.name ?? '' }} {{ item.attributes.name ?? '' }}
</div> </div>
<div class="subtitle text-overflow-elipsis item-navigate" v-if="item.attributes.artistName" :style = "{'z-index': ((item.attributes.editorialNotes == null) && item.attributes.artistName) ? '4' : ''}" @click="if(item.attributes.artistName)app.searchAndNavigate(item,'artist')"> <div class="subtitle text-overflow-elipsis item-navigate" v-if="item.attributes.artistName" :style = "{'z-index': ((item.attributes.editorialNotes == null) && item.attributes.artistName) ? '4' : ''}" @click="if (item.attributes.artistName)app.searchAndNavigate(item,'artist')">
{{ item.attributes.artistName ?? '' }} {{ item.attributes.artistName ?? '' }}
</div> </div>

View file

@ -93,12 +93,12 @@
}, },
async mounted() { async mounted() {
await this.getBadges() await this.getBadges()
if(typeof this.item.attributes.playParams == "object") { if (typeof this.item.attributes.playParams == "object") {
if(this.item.attributes.playParams.kind.includes("radioStation") && (this.item.attributes.playParams.streamingKind == 1 || this.item.attributes.playParams.streamingKind == 2)) { if (this.item.attributes.playParams.kind.includes("radioStation") && (this.item.attributes.playParams.streamingKind == 1 || this.item.attributes.playParams.streamingKind == 2)) {
this.unavailable = true this.unavailable = true
} }
}else{ }else{
if(this.item.type == "music-movies" || this.item.type == "tv-episodes") { if (this.item.type == "music-movies" || this.item.type == "tv-episodes") {
this.unavailable = true this.unavailable = true
} }
} }
@ -116,7 +116,7 @@
} }
}, },
getSubtitle() { getSubtitle() {
if(this.kind == 'card') { if (this.kind == 'card') {
try { try {
if (typeof this.item.attributes.artistNames != "undefined") { if (typeof this.item.attributes.artistNames != "undefined") {
return this.item.attributes.artistNames return this.item.attributes.artistNames
@ -139,7 +139,7 @@
} }
}, },
getSubtitleNavigation() { getSubtitleNavigation() {
if(this.kind == 'card') { if (this.kind == 'card') {
try { try {
if (typeof this.item.attributes.artistNames != "undefined") { if (typeof this.item.attributes.artistNames != "undefined") {
return app.routeView(this.item) return app.routeView(this.item)
@ -224,7 +224,7 @@
}, },
getArtworkUrl(size = -1, includeUrl = false) { getArtworkUrl(size = -1, includeUrl = false) {
let artwork = this.item.attributes.artwork ? this.item.attributes.artwork.url : '' let artwork = this.item.attributes.artwork ? this.item.attributes.artwork.url : ''
if(size != -1) { if (size != -1) {
artwork = artwork.replace('{w}', size).replace('{h}', size).replace('{f}', "webp").replace('{c}', ((size === 900) ? "sr" : "cc")) artwork = artwork.replace('{w}', size).replace('{h}', size).replace('{f}', "webp").replace('{c}', ((size === 900) ? "sr" : "cc"))
} }
switch (this.kind) { switch (this.kind) {
@ -232,7 +232,7 @@
artwork = this.item.attributes.editorialArtwork?.subscriptionHero?.url ?? (this.item.attributes.artwork?.url ?? (this.item.relationships?.contents?.data[0]?.attributes?.editorialArtwork?.subscriptionHero?.url ?? '')) artwork = this.item.attributes.editorialArtwork?.subscriptionHero?.url ?? (this.item.attributes.artwork?.url ?? (this.item.relationships?.contents?.data[0]?.attributes?.editorialArtwork?.subscriptionHero?.url ?? ''))
break; break;
} }
if(!includeUrl) { if (!includeUrl) {
return artwork return artwork
}else{ }else{
return `url("${artwork}")` return `url("${artwork}")`
@ -471,7 +471,7 @@
try { try {
await this.isInLibrary().then((_) => { await this.isInLibrary().then((_) => {
if(self.addedToLibrary) { if (self.addedToLibrary) {
menus.normal.items.find(x => x.id == 'addToLibrary').hidden = true menus.normal.items.find(x => x.id == 'addToLibrary').hidden = true
menus.normal.items.find(x => x.id == 'removeFromLibrary').hidden = false menus.normal.items.find(x => x.id == 'removeFromLibrary').hidden = false
}else{ }else{
@ -530,7 +530,7 @@
} }
} }
} }
if(self.app.cfg.home.followedArtists.includes(this.item.id)) { if (self.app.cfg.home.followedArtists.includes(this.item.id)) {
followAction = "unfollow" followAction = "unfollow"
} }
app.showMenuPanel({ app.showMenuPanel({

View file

@ -70,8 +70,8 @@
this.history = history.data.data this.history = history.data.data
}, },
select(e, position) { select(e, position) {
if(e.ctrlKey || e.shiftKey) { if (e.ctrlKey || e.shiftKey) {
if(this.selectedItems.indexOf(position) == -1) { if (this.selectedItems.indexOf(position) == -1) {
this.selectedItems.push(position) this.selectedItems.push(position)
} else { } else {
this.selectedItems.splice(this.selectedItems.indexOf(position), 1) this.selectedItems.splice(this.selectedItems.indexOf(position), 1)
@ -83,7 +83,7 @@
queueContext(event, item, position) { queueContext(event, item, position) {
let self = this let self = this
let useMenu = "single" let useMenu = "single"
if(this.selectedItems.length > 1) { if (this.selectedItems.length > 1) {
useMenu = "multiple" useMenu = "multiple"
} }
let menus = { let menus = {

View file

@ -63,7 +63,7 @@
}, },
methods: { methods: {
playlistSelect(playlist) { playlistSelect(playlist) {
if(playlist.type != "library-playlist-folders") { if (playlist.type != "library-playlist-folders") {
this.addToPlaylist(playlist.id) this.addToPlaylist(playlist.id)
} }
}, },

View file

@ -294,7 +294,7 @@
this.room_materials = JSON.parse(JSON.stringify(this.$root.cfg.audio.spatial_properties.room_materials)) this.room_materials = JSON.parse(JSON.stringify(this.$root.cfg.audio.spatial_properties.room_materials))
this.audio_position = JSON.parse(JSON.stringify(this.$root.cfg.audio.spatial_properties.audio_position)) this.audio_position = JSON.parse(JSON.stringify(this.$root.cfg.audio.spatial_properties.audio_position))
this.listener_position = JSON.parse(JSON.stringify(this.$root.cfg.audio.spatial_properties.listener_position)) this.listener_position = JSON.parse(JSON.stringify(this.$root.cfg.audio.spatial_properties.listener_position))
if(typeof this.app.mk.nowPlayingItem != "undefined") { if (typeof this.app.mk.nowPlayingItem != "undefined") {
this.setRoom() this.setRoom()
} }
this.ready = true this.ready = true
@ -320,7 +320,7 @@
}, },
objectContainerStyle() { objectContainerStyle() {
let scale = 1 let scale = 1
if(this.room_dimensions.width * this.visualMultiplier > 300) { if (this.room_dimensions.width * this.visualMultiplier > 300) {
scale = 300 / (this.room_dimensions.width * this.visualMultiplier) scale = 300 / (this.room_dimensions.width * this.visualMultiplier)
} }
let style = { let style = {
@ -346,7 +346,7 @@
window.CiderAudio.audioNodes.spatialNode.setRoomProperties(this.room_dimensions, this.room_materials); window.CiderAudio.audioNodes.spatialNode.setRoomProperties(this.room_dimensions, this.room_materials);
CiderAudio.audioNodes.spatialInput.setPosition(...this.audio_position) CiderAudio.audioNodes.spatialInput.setPosition(...this.audio_position)
CiderAudio.audioNodes.spatialNode.setListenerPosition(...this.listener_position) CiderAudio.audioNodes.spatialNode.setListenerPosition(...this.listener_position)
if(!this.app.cfg.audio.normalization) { if (!this.app.cfg.audio.normalization) {
window.CiderAudio.audioNodes.gainNode.gain.value = app.cfg.audio.spatial_properties.gain window.CiderAudio.audioNodes.gainNode.gain.value = app.cfg.audio.spatial_properties.gain
} }
} }

View file

@ -172,7 +172,7 @@
} }
} }
} }
if(this.app.cfg.home.followedArtists.includes(self.data.id)) { if (this.app.cfg.home.followedArtists.includes(self.data.id)) {
followAction = "unfollow" followAction = "unfollow"
} }
app.showMenuPanel({ app.showMenuPanel({

View file

@ -132,7 +132,7 @@
self.themes = [] self.themes = []
notyf.success(app.getLz('settings.notyf.visual.plugin.install.success')); notyf.success(app.getLz('settings.notyf.visual.plugin.install.success'));
bootbox.confirm(app.getLz("settings.prompt.visual.plugin.github.success"), (ok)=>{ bootbox.confirm(app.getLz("settings.prompt.visual.plugin.github.success"), (ok)=>{
if(ok) { if (ok) {
ipcRenderer.invoke("relaunchApp") ipcRenderer.invoke("relaunchApp")
}else{ }else{
return return
@ -154,7 +154,7 @@
if (arg.success) { if (arg.success) {
self.themes = ipcRenderer.sendSync("get-themes") self.themes = ipcRenderer.sendSync("get-themes")
bootbox.confirm(app.getLz("settings.prompt.visual.plugin.github.success"), (ok)=>{ bootbox.confirm(app.getLz("settings.prompt.visual.plugin.github.success"), (ok)=>{
if(ok) { if (ok) {
ipcRenderer.invoke("relaunchApp") ipcRenderer.invoke("relaunchApp")
}else{ }else{
return return

View file

@ -187,7 +187,7 @@
}, },
searchPodcasts() { searchPodcasts() {
let self = this let self = this
if(this.search.term == "") { if (this.search.term == "") {
return return
} }
app.mk.api.v3.podcasts("/v1/catalog/us/search", {term: this.search.term, types: ["podcasts"], limit: 25}).then(response => { app.mk.api.v3.podcasts("/v1/catalog/us/search", {term: this.search.term, types: ["podcasts"], limit: 25}).then(response => {
@ -227,7 +227,7 @@
async getNextEpisodes(next, podcastId) { async getNextEpisodes(next, podcastId) {
let podcastShow = await app.mk.api.v3.podcasts(next) let podcastShow = await app.mk.api.v3.podcasts(next)
if(podcastId != this.podcastSelected.id) { if (podcastId != this.podcastSelected.id) {
return return
} }
podcastShow.data.data.forEach(ep => { podcastShow.data.data.forEach(ep => {

View file

@ -90,7 +90,7 @@
return "https://beta.music.apple.com/assets/product/MissingArtworkMusic.svg" return "https://beta.music.apple.com/assets/product/MissingArtworkMusic.svg"
} }
height = parseInt(height * window.devicePixelRatio) height = parseInt(height * window.devicePixelRatio)
if(width) { if (width) {
width = parseInt(width * window.devicePixelRatio) width = parseInt(width * window.devicePixelRatio)
} }
let newurl = `${url.replace('{w}', width ?? height).replace('{h}', height).replace('{f}', "webp").replace('{c}', ((width === 900) ? "sr" : "cc"))}`; let newurl = `${url.replace('{w}', width ?? height).replace('{h}', height).replace('{f}', "webp").replace('{c}', ((width === 900) ? "sr" : "cc"))}`;

View file

@ -93,7 +93,7 @@
}, },
getSubtitle() { getSubtitle() {
if(this.kind == 'card') { if (this.kind == 'card') {
try { try {
if (typeof this.item.attributes.artistNames != "undefined") { if (typeof this.item.attributes.artistNames != "undefined") {
return this.item.attributes.artistNames return this.item.attributes.artistNames
@ -116,7 +116,7 @@
} }
}, },
getSubtitleNavigation() { getSubtitleNavigation() {
if(this.kind == 'card') { if (this.kind == 'card') {
try { try {
if (typeof this.item.attributes.artistNames != "undefined") { if (typeof this.item.attributes.artistNames != "undefined") {
return app.routeView(this.item) return app.routeView(this.item)
@ -200,7 +200,7 @@
}, },
getArtworkUrl(size = -1, includeUrl = false) { getArtworkUrl(size = -1, includeUrl = false) {
let artwork = this.item.attributes.artwork ? this.item.attributes.artwork.url : '' let artwork = this.item.attributes.artwork ? this.item.attributes.artwork.url : ''
if(size != -1) { if (size != -1) {
artwork = artwork.replace('{w}', size).replace('{h}', size).replace('{f}', "webp").replace('{c}', ((size === 900) ? "sr" : "cc")) artwork = artwork.replace('{w}', size).replace('{h}', size).replace('{f}', "webp").replace('{c}', ((size === 900) ? "sr" : "cc"))
} }
switch (this.kind) { switch (this.kind) {
@ -208,7 +208,7 @@
artwork = this.item.attributes.editorialArtwork.subscriptionHero.url artwork = this.item.attributes.editorialArtwork.subscriptionHero.url
break; break;
} }
if(!includeUrl) { if (!includeUrl) {
return artwork return artwork
}else{ }else{
return `url("${artwork}")` return `url("${artwork}")`
@ -423,7 +423,7 @@
try { try {
await this.isInLibrary().then((_) => { await this.isInLibrary().then((_) => {
if(self.addedToLibrary) { if (self.addedToLibrary) {
menus.normal.items.find(x => x.id == 'addToLibrary').hidden = true menus.normal.items.find(x => x.id == 'addToLibrary').hidden = true
menus.normal.items.find(x => x.id == 'removeFromLibrary').hidden = false menus.normal.items.find(x => x.id == 'removeFromLibrary').hidden = false
}else{ }else{