From 88d51e5774ff6f73fc00618180a0f2eda9e27562 Mon Sep 17 00:00:00 2001 From: Mel Massadian Date: Mon, 9 Sep 2024 05:13:04 +0200 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A7=B9=20remove=20dupe=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/comfy_shared.js | 33 --------------------------------- web/mtb_ui.js | 3 +-- 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/web/comfy_shared.js b/web/comfy_shared.js index ca54474..5912efc 100644 --- a/web/comfy_shared.js +++ b/web/comfy_shared.js @@ -631,39 +631,6 @@ export const loadScript = ( }) } -export function defineClass(className, classStyles) { - const styleSheets = document.styleSheets - - // Helper function to check if the class exists in a style sheet - function classExistsInStyleSheet(styleSheet) { - const rules = styleSheet.rules || styleSheet.cssRules - for (const rule of rules) { - if (rule.selectorText === `.${className}`) { - return true - } - } - return false - } - - // Check if the class is already defined in any of the style sheets - let classExists = false - for (const styleSheet of styleSheets) { - if (classExistsInStyleSheet(styleSheet)) { - classExists = true - break - } - } - - // If the class doesn't exist, add the new class definition to the first style sheet - if (!classExists) { - if (styleSheets[0].insertRule) { - styleSheets[0].insertRule(`.${className} { ${classStyles} }`, 0) - } else if (styleSheets[0].addRule) { - styleSheets[0].addRule(`.${className}`, classStyles, 0) - } - } -} - // #endregion // #region documentation widget diff --git a/web/mtb_ui.js b/web/mtb_ui.js index fa076bc..901ec0e 100644 --- a/web/mtb_ui.js +++ b/web/mtb_ui.js @@ -140,8 +140,7 @@ export const ensureMTBStyles = () => { /* progress */ -.mtb_slider[type="range"]::-moz-range-progress, -.mtb_slider[type="range"]::-ms-fill-upper { +.mtb_slider[type="range"]::-moz-range-progress { background-color: ${S.accent}; height:10px; border-radius: 5px;