feat(showcase): skip wallpaper engin init
This commit is contained in:
@@ -41,7 +41,9 @@ export default class Settings {
|
|||||||
#doNotTrack = false
|
#doNotTrack = false
|
||||||
#lastFunctionInsights = null
|
#lastFunctionInsights = null
|
||||||
|
|
||||||
|
|
||||||
constructor(el, logoEl) {
|
constructor(el, logoEl) {
|
||||||
|
this.isWallpaperEngine = false
|
||||||
this.#el = el
|
this.#el = el
|
||||||
this.#logoEl = logoEl
|
this.#logoEl = logoEl
|
||||||
this.spinePlayer = null
|
this.spinePlayer = null
|
||||||
@@ -71,6 +73,7 @@ export default class Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
insights(isWallpaperEngine, doNotTrack) {
|
insights(isWallpaperEngine, doNotTrack) {
|
||||||
|
this.isWallpaperEngine = isWallpaperEngine
|
||||||
if (this.#isInsightsInited || import.meta.env.MODE === 'development') return
|
if (this.#isInsightsInited || import.meta.env.MODE === 'development') return
|
||||||
this.#isInsightsInited = true
|
this.#isInsightsInited = true
|
||||||
this.#doNotTrack = doNotTrack
|
this.#doNotTrack = doNotTrack
|
||||||
@@ -78,8 +81,8 @@ export default class Settings {
|
|||||||
window.umami?.trackView(`/${import.meta.env.VITE_LINK}${isWallpaperEngine ? "?steam" : ""}`);
|
window.umami?.trackView(`/${import.meta.env.VITE_LINK}${isWallpaperEngine ? "?steam" : ""}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
functionInsights(functionName) {
|
functionInsights(functionName, toSkip = false) {
|
||||||
if (!this.#isInsightsInited || this.#doNotTrack || import.meta.env.MODE === 'development' || functionName === this.#lastFunctionInsights) return
|
if (!this.#isInsightsInited || this.#doNotTrack || import.meta.env.MODE === 'development' || functionName === this.#lastFunctionInsights || toSkip) return
|
||||||
this.#lastFunctionInsights = functionName
|
this.#lastFunctionInsights = functionName
|
||||||
window.umami?.trackEvent(`${functionName}`);
|
window.umami?.trackEvent(`${functionName}`);
|
||||||
}
|
}
|
||||||
@@ -87,12 +90,12 @@ export default class Settings {
|
|||||||
setFPS(value) {
|
setFPS(value) {
|
||||||
this.#fps = value
|
this.#fps = value
|
||||||
this.spinePlayer.setFps(value)
|
this.spinePlayer.setFps(value)
|
||||||
this.functionInsights("setFPS")
|
this.functionInsights("setFPS", this.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
setLogoDisplay(flag) {
|
setLogoDisplay(flag) {
|
||||||
this.#logoEl.hidden = flag;
|
this.#logoEl.hidden = flag;
|
||||||
this.functionInsights("setLogoDisplay")
|
this.functionInsights("setLogoDisplay", this.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
#resize(_this, value) {
|
#resize(_this, value) {
|
||||||
@@ -113,7 +116,7 @@ export default class Settings {
|
|||||||
this.#logoEl.src = src
|
this.#logoEl.src = src
|
||||||
this.#resize()
|
this.#resize()
|
||||||
this.#setLogoInvertFilter(invert_filter)
|
this.#setLogoInvertFilter(invert_filter)
|
||||||
this.functionInsights("setLogo")
|
this.functionInsights("setLogo", this.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
#readFile(e, onload, callback) {
|
#readFile(e, onload, callback) {
|
||||||
@@ -144,18 +147,18 @@ export default class Settings {
|
|||||||
setLogoRatio(value) {
|
setLogoRatio(value) {
|
||||||
this.#ratio = value
|
this.#ratio = value
|
||||||
this.#resize(this, value)
|
this.#resize(this, value)
|
||||||
this.functionInsights("setLogoRatio")
|
this.functionInsights("setLogoRatio", this.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
setLogoOpacity(value) {
|
setLogoOpacity(value) {
|
||||||
this.#logoEl.style.opacity = value / 100
|
this.#logoEl.style.opacity = value / 100
|
||||||
this.#opacity = value
|
this.#opacity = value
|
||||||
this.functionInsights("setLogoOpacity")
|
this.functionInsights("setLogoOpacity", this.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
setBackgoundImage(v, skipInsights = false) {
|
setBackgoundImage(v, skipInsights = false) {
|
||||||
document.body.style.backgroundImage = v
|
document.body.style.backgroundImage = v
|
||||||
if (!skipInsights) this.functionInsights("setBackgoundImage");
|
if (!skipInsights) this.functionInsights("setBackgoundImage", this.isWallpaperEngine);
|
||||||
}
|
}
|
||||||
|
|
||||||
setDefaultBackground(e) {
|
setDefaultBackground(e) {
|
||||||
@@ -164,7 +167,7 @@ export default class Settings {
|
|||||||
this.setBackgoundImage(backgroundURL, true)
|
this.setBackgoundImage(backgroundURL, true)
|
||||||
}
|
}
|
||||||
this.#defaultBackgroundImage = backgroundURL
|
this.#defaultBackgroundImage = backgroundURL
|
||||||
this.functionInsights("setDefaultBackground")
|
this.functionInsights("setDefaultBackground", this.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
setBackground(e) {
|
setBackground(e) {
|
||||||
@@ -215,7 +218,7 @@ export default class Settings {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.loadViewport()
|
this.loadViewport()
|
||||||
this.functionInsights("positionPadding")
|
this.functionInsights("positionPadding", this.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
positionReset() {
|
positionReset() {
|
||||||
@@ -261,7 +264,7 @@ export default class Settings {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.elementPosition(this.#logoEl, this.#logoX, this.#logoY)
|
this.elementPosition(this.#logoEl, this.#logoX, this.#logoY)
|
||||||
this.functionInsights("logoPadding")
|
this.functionInsights("logoPadding", this.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
logoReset() {
|
logoReset() {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export default class Voice {
|
|||||||
set useSubtitle(show) {
|
set useSubtitle(show) {
|
||||||
this.#useSubtitle = show
|
this.#useSubtitle = show
|
||||||
this.#el.hidden = !show
|
this.#el.hidden = !show
|
||||||
window.settings.functionInsights("useSubtitle")
|
window.settings.functionInsights("useSubtitle", window.settings.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
get useSubtitle() {
|
get useSubtitle() {
|
||||||
@@ -72,7 +72,7 @@ export default class Voice {
|
|||||||
* @param {boolean} show
|
* @param {boolean} show
|
||||||
*/
|
*/
|
||||||
set useVoice(show) {
|
set useVoice(show) {
|
||||||
window.settings.functionInsights("useVoice")
|
window.settings.functionInsights("useVoice", window.settings.isWallpaperEngine)
|
||||||
this.#useVoice = show
|
this.#useVoice = show
|
||||||
this.#el.hidden = !show
|
this.#el.hidden = !show
|
||||||
this.#playEntryVoice()
|
this.#playEntryVoice()
|
||||||
@@ -91,7 +91,7 @@ export default class Voice {
|
|||||||
set useVoiceActor(show) {
|
set useVoiceActor(show) {
|
||||||
this.#useVoiceActor = show
|
this.#useVoiceActor = show
|
||||||
document.getElementById('voice_actor_box').hidden = !show
|
document.getElementById('voice_actor_box').hidden = !show
|
||||||
window.settings.functionInsights("useVoiceActor")
|
window.settings.functionInsights("useVoiceActor", window.settings.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
get useVoiceActor() {
|
get useVoiceActor() {
|
||||||
@@ -107,7 +107,7 @@ export default class Voice {
|
|||||||
} else {
|
} else {
|
||||||
this.#subtitleLang = this.#defaultRegion
|
this.#subtitleLang = this.#defaultRegion
|
||||||
}
|
}
|
||||||
window.settings.functionInsights("subtitleLanguage")
|
window.settings.functionInsights("subtitleLanguage", window.settings.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
get subtitleLanguage() {
|
get subtitleLanguage() {
|
||||||
@@ -144,7 +144,7 @@ export default class Voice {
|
|||||||
|
|
||||||
#updateSubtitlePosition() {
|
#updateSubtitlePosition() {
|
||||||
window.settings.elementPosition(this.#el, this.#subtitleX, this.#subtitleY)
|
window.settings.elementPosition(this.#el, this.#subtitleX, this.#subtitleY)
|
||||||
window.settings.functionInsights("subtitlePosition")
|
window.settings.functionInsights("subtitlePosition", window.settings.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -156,7 +156,7 @@ export default class Voice {
|
|||||||
} else {
|
} else {
|
||||||
this.#voiceLang = this.#defaultVoiceLang
|
this.#voiceLang = this.#defaultVoiceLang
|
||||||
}
|
}
|
||||||
window.settings.functionInsights("language")
|
window.settings.functionInsights("language", window.settings.isWallpaperEngine)
|
||||||
const availableSubtitleLang = this.#getSubtitleLanguages()
|
const availableSubtitleLang = this.#getSubtitleLanguages()
|
||||||
if (!availableSubtitleLang.includes(this.#subtitleLang)) {
|
if (!availableSubtitleLang.includes(this.#subtitleLang)) {
|
||||||
this.#subtitleLang = availableSubtitleLang[0]
|
this.#subtitleLang = availableSubtitleLang[0]
|
||||||
@@ -180,7 +180,7 @@ export default class Voice {
|
|||||||
this.#idleDuration = duration * 60 * 1000
|
this.#idleDuration = duration * 60 * 1000
|
||||||
this.#initIdleVoiceTimer()
|
this.#initIdleVoiceTimer()
|
||||||
}
|
}
|
||||||
window.settings.functionInsights("idleDuration")
|
window.settings.functionInsights("idleDuration", window.settings.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
get idleDuration() {
|
get idleDuration() {
|
||||||
@@ -196,7 +196,7 @@ export default class Voice {
|
|||||||
this.#nextDuration = duration * 60 * 1000
|
this.#nextDuration = duration * 60 * 1000
|
||||||
this.#initNextVoiceTimer()
|
this.#initNextVoiceTimer()
|
||||||
}
|
}
|
||||||
window.settings.functionInsights("nextDuration")
|
window.settings.functionInsights("nextDuration", window.settings.isWallpaperEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
get nextDuration() {
|
get nextDuration() {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ window.wallpaperPropertyListener = {
|
|||||||
applyGeneralProperties: function (properties) {
|
applyGeneralProperties: function (properties) {
|
||||||
if (properties.fps) {
|
if (properties.fps) {
|
||||||
window.settings.setFPS(properties.fps)
|
window.settings.setFPS(properties.fps)
|
||||||
|
window.settings.functionInsights("setFPS", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
applyUserProperties: function (properties) {
|
applyUserProperties: function (properties) {
|
||||||
@@ -10,68 +11,86 @@ window.wallpaperPropertyListener = {
|
|||||||
}
|
}
|
||||||
if (properties.logo) {
|
if (properties.logo) {
|
||||||
window.settings.setLogoDisplay(!properties.logo.value)
|
window.settings.setLogoDisplay(!properties.logo.value)
|
||||||
|
window.settings.functionInsights("setLogoDisplay", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.logoratio) {
|
if (properties.logoratio) {
|
||||||
if (properties.logoratio.value) {
|
if (properties.logoratio.value) {
|
||||||
window.settings.setLogoRatio(properties.logoratio.value)
|
window.settings.setLogoRatio(properties.logoratio.value)
|
||||||
|
window.settings.functionInsights("setLogoRatio", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (properties.logoopacity) {
|
if (properties.logoopacity) {
|
||||||
if (properties.logoopacity.value) {
|
if (properties.logoopacity.value) {
|
||||||
window.settings.setLogoOpacity(properties.logoopacity.value)
|
window.settings.setLogoOpacity(properties.logoopacity.value)
|
||||||
|
window.settings.functionInsights("setLogoOpacity", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (properties.logoimage) {
|
if (properties.logoimage) {
|
||||||
if (properties.logoimage.value) {
|
if (properties.logoimage.value) {
|
||||||
window.settings.setLogo('file:///' + properties.logoimage.value)
|
window.settings.setLogo('file:///' + properties.logoimage.value)
|
||||||
|
window.settings.functionInsights("setLogo", Object.keys(properties) !== 1)
|
||||||
} else {
|
} else {
|
||||||
window.settings.resetLogoImage()
|
window.settings.resetLogoImage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (properties.logox) {
|
if (properties.logox) {
|
||||||
window.settings.logoPadding("x", properties.logox.value)
|
window.settings.logoPadding("x", properties.logox.value)
|
||||||
|
window.settings.functionInsights("logoPaddingX", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.logoy) {
|
if (properties.logoy) {
|
||||||
window.settings.logoPadding("y", properties.logoy.value)
|
window.settings.logoPadding("y", properties.logoy.value)
|
||||||
|
window.settings.functionInsights("logoPaddingY", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.defaultbackground) {
|
if (properties.defaultbackground) {
|
||||||
if (properties.defaultbackground.value) {
|
if (properties.defaultbackground.value) {
|
||||||
window.settings.setDefaultBackground(properties.defaultbackground.value)
|
window.settings.setDefaultBackground(properties.defaultbackground.value)
|
||||||
|
window.settings.functionInsights("setDefaultBackground", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (properties.background) {
|
if (properties.background) {
|
||||||
if (properties.background.value) {
|
if (properties.background.value) {
|
||||||
window.settings.setBackgoundImage(`url('file:///${properties.background.value}`)
|
window.settings.setBackgoundImage(`url('file:///${properties.background.value}`)
|
||||||
|
window.settings.functionInsights("setBackgoundImage", Object.keys(properties) !== 1)
|
||||||
} else {
|
} else {
|
||||||
window.settings.resetBackground()
|
window.settings.resetBackground()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (properties.voicetitle) {
|
if (properties.voicetitle) {
|
||||||
window.voice.useVoice = properties.voicetitle.value
|
window.voice.useVoice = properties.voicetitle.value
|
||||||
|
window.settings.functionInsights("useVoice", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.voicelanguage) {
|
if (properties.voicelanguage) {
|
||||||
window.voice.language = properties.voicelanguage.value
|
window.voice.language = properties.voicelanguage.value
|
||||||
|
window.settings.functionInsights("language", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.voiceidle) {
|
if (properties.voiceidle) {
|
||||||
window.voice.idleDuration = parseInt(properties.voiceidle.value)
|
window.voice.idleDuration = parseInt(properties.voiceidle.value)
|
||||||
|
window.settings.functionInsights("idleDuration", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.voicenext) {
|
if (properties.voicenext) {
|
||||||
window.voice.nextDuration = parseInt(properties.voicenext.value)
|
window.voice.nextDuration = parseInt(properties.voicenext.value)
|
||||||
|
window.settings.functionInsights("nextDuration", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.voicesubtitle) {
|
if (properties.voicesubtitle) {
|
||||||
window.voice.useSubtitle = properties.voicesubtitle.value
|
window.voice.useSubtitle = properties.voicesubtitle.value
|
||||||
|
window.settings.functionInsights("useSubtitle", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.voicesubtitlelanguage) {
|
if (properties.voicesubtitlelanguage) {
|
||||||
window.voice.subtitleLanguage = properties.voicesubtitlelanguage.value
|
window.voice.subtitleLanguage = properties.voicesubtitlelanguage.value
|
||||||
|
window.settings.functionInsights("subtitleLanguage", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.voicesubtitlex) {
|
if (properties.voicesubtitlex) {
|
||||||
window.voice.subtitleX = properties.voicesubtitlex.value
|
window.voice.subtitleX = properties.voicesubtitlex.value
|
||||||
|
window.settings.functionInsights("subtitleX", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.voicesubtitley) {
|
if (properties.voicesubtitley) {
|
||||||
window.voice.subtitleY = properties.voicesubtitley.value
|
window.voice.subtitleY = properties.voicesubtitley.value
|
||||||
|
window.settings.functionInsights("subtitleY", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.voiceactor) {
|
if (properties.voiceactor) {
|
||||||
window.voice.useVoiceActor = properties.voiceactor.value
|
window.voice.useVoiceActor = properties.voiceactor.value
|
||||||
|
console.log(properties)
|
||||||
|
window.settings.functionInsights("useVoiceActor", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.position) {
|
if (properties.position) {
|
||||||
if (!properties.position.value) {
|
if (!properties.position.value) {
|
||||||
@@ -87,15 +106,19 @@ window.wallpaperPropertyListener = {
|
|||||||
}
|
}
|
||||||
if (properties.paddingleft) {
|
if (properties.paddingleft) {
|
||||||
window.settings.positionPadding("left", properties.paddingleft.value)
|
window.settings.positionPadding("left", properties.paddingleft.value)
|
||||||
|
window.settings.functionInsights("positionPaddingLeft", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.paddingright) {
|
if (properties.paddingright) {
|
||||||
window.settings.positionPadding("right", properties.paddingright.value)
|
window.settings.positionPadding("right", properties.paddingright.value)
|
||||||
|
window.settings.functionInsights("positionPaddingRight", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.paddingtop) {
|
if (properties.paddingtop) {
|
||||||
window.settings.positionPadding("top", properties.paddingtop.value)
|
window.settings.positionPadding("top", properties.paddingtop.value)
|
||||||
|
window.settings.functionInsights("positionPaddingTop", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
if (properties.paddingbottom) {
|
if (properties.paddingbottom) {
|
||||||
window.settings.positionPadding("bottom", properties.paddingbottom.value)
|
window.settings.positionPadding("bottom", properties.paddingbottom.value)
|
||||||
|
window.settings.functionInsights("positionPaddingBottom", Object.keys(properties) !== 1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user