add ability for loading screen to be disabled

This commit is contained in:
Send_Nukez 2021-11-22 02:13:35 +01:00
parent f0a562f70a
commit 4b251dfa8d
3 changed files with 11 additions and 3 deletions

View file

@ -1,5 +1,5 @@
Added:
- A spinning loader at startup while spotify is not ready
- A spinning loader at startup while spotify is not ready (Can be disabled in settings)
Fixed:
- Checking for update every 10 Minutes not working

View file

@ -442,7 +442,7 @@ export default class ConfigMenu {
const val = JSON.parse(this.#config[key]?.storageCache ?? localStorage.getItem(`dribbblish:config:${key}`) ?? null); // Turn undefined into null because `JSON.parse()` dosen't like undefined
if (val == null || val?.type != this.#config[key]?.type) {
localStorage.removeItem(`dribbblish:config:${key}`);
return defaultValueOverride ?? this.#config[key].defaultValue;
return defaultValueOverride ?? this.#config[key]?.defaultValue;
}
return val.value;
}

View file

@ -19,9 +19,17 @@ window.Dribbblish = Dribbblish;
const colorThief = new ColorThief();
Dribbblish.config.register({
type: "checkbox",
key: "showLoadingScreen",
name: "Show Loading Screen",
description: "Show a loading screen at startup while things are loaded in the background",
defaultValue: true
});
// In the future maybe have some useful info here
const loadingHints = ["Getting things ready...", "Starting up...", "Just one moment..."];
Dribbblish.loader.show(randomFromArray(loadingHints));
if (Dribbblish.config.get("showLoadingScreen")) Dribbblish.loader.show(randomFromArray(loadingHints));
Dribbblish.on("ready", () => {
setTimeout(() => Dribbblish.loader.hide(), 3000);