From 0d1a8fcddf33e339a66f4f4a11d7920c2ac27c4e Mon Sep 17 00:00:00 2001 From: tehcneko Date: Sun, 25 May 2025 17:38:29 +0800 Subject: [PATCH] apply suggections Co-authored-by: Chocobo1 --- src/webui/www/private/scripts/progressbar.js | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/webui/www/private/scripts/progressbar.js b/src/webui/www/private/scripts/progressbar.js index a0bdd2041..90844e964 100644 --- a/src/webui/www/private/scripts/progressbar.js +++ b/src/webui/www/private/scripts/progressbar.js @@ -38,9 +38,7 @@ window.qBittorrent.ProgressBar ??= (() => { class ProgressBar extends HTMLElement { static #progressBarUniqueId = 0; - - #value = 0; - #styles = { + static #styles = { height: 12, darkbg: "var(--color-background-blue)", darkfg: "var(--color-text-white)", @@ -48,6 +46,8 @@ window.qBittorrent.ProgressBar ??= (() => { lightfg: "var(--color-text-default)", }; + #value = 0; + #id = ++ProgressBar.#progressBarUniqueId; #light = document.createElement("div"); @@ -57,33 +57,33 @@ window.qBittorrent.ProgressBar ??= (() => { super(); this.#dark.style.width = "100%"; - this.#dark.style.height = `${this.#styles.height}px`; - this.#dark.style.background = this.#styles.darkbg; + this.#dark.style.height = `${ProgressBar.#styles.height}px`; + this.#dark.style.background = ProgressBar.#styles.darkbg; this.#dark.style.boxSizing = "content-box"; - this.#dark.style.color = this.#styles.darkfg; + this.#dark.style.color = ProgressBar.#styles.darkfg; this.#dark.style.position = "absolute"; this.#dark.style.textAlign = "center"; this.#dark.style.left = "0"; this.#dark.style.top = "0"; - this.#dark.style.lineHeight = `${this.#styles.height}px`; + this.#dark.style.lineHeight = `${ProgressBar.#styles.height}px`; this.#light.style.width = "100%"; - this.#light.style.height = `${this.#styles.height}px`; - this.#light.style.background = this.#styles.lightbg; + this.#light.style.height = `${ProgressBar.#styles.height}px`; + this.#light.style.background = ProgressBar.#styles.lightbg; this.#light.style.boxSizing = "content-box"; - this.#light.style.color = this.#styles.lightfg; + this.#light.style.color = ProgressBar.#styles.lightfg; this.#light.style.position = "absolute"; this.#light.style.textAlign = "center"; this.#light.style.left = "0"; this.#light.style.top = "0"; - this.#light.style.lineHeight = `${this.#styles.height}px`; + this.#light.style.lineHeight = `${ProgressBar.#styles.height}px`; this.attachShadow({ mode: "open" }); this.shadowRoot.host.id = this.#id; this.shadowRoot.host.style.display = "block"; this.shadowRoot.host.style.border = "1px solid var(--color-border-default)"; this.shadowRoot.host.style.boxSizing = "content-box"; - this.shadowRoot.host.style.height = `${this.#styles.height}px`; + this.shadowRoot.host.style.height = `${ProgressBar.#styles.height}px`; this.shadowRoot.host.style.position = "relative"; this.shadowRoot.host.style.margin = "0 auto"; this.shadowRoot.appendChild(this.#dark);