From 82be20eec5be1b0522ad94482aab94fc5027dafe Mon Sep 17 00:00:00 2001 From: LazeMSS Date: Fri, 1 Jan 2021 15:54:22 +0100 Subject: [PATCH] Hotfix release --- .../static/js/uicustomizer.js | 25 ++++++++++++++++--- setup.py | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/octoprint_uicustomizer/static/js/uicustomizer.js b/octoprint_uicustomizer/static/js/uicustomizer.js index 941ec29..941f061 100644 --- a/octoprint_uicustomizer/static/js/uicustomizer.js +++ b/octoprint_uicustomizer/static/js/uicustomizer.js @@ -287,7 +287,17 @@ $(function() { var hasResponsive = $('body').hasClass('UICResponsiveMode'); var cleanRep = new RegExp('\.'+curTheme, "gi"); var newStyle = ''; - $.each($('link[href="/static/css/octoprint.css"][rel="stylesheet"]')[0].sheet.cssRules,function(){ + var styleSrc = false; + if ($('link[href^="/static/webassets/packed_core.css"][rel="stylesheet"]').length){ + styleSrc = $('link[href^="/static/webassets/packed_core.css"][rel="stylesheet"]'); + }else if ($('link[href="/static/css/octoprint.css"][rel="stylesheet"]').length){ + styleSrc = $('link[href="/static/css/octoprint.css"][rel="stylesheet"]'); + } + if (styleSrc == false){ + self.logToConsole("Standard theme css src not found!"); + return; + } + $.each(styleSrc[0].sheet.cssRules,function(){ var cssSel = this.selectorText; if (cssSel != undefined && cssSel.indexOf('#navbar .navbar-inner.'+curTheme) != -1){ newStyle += this.cssText.replace(/#navbar/gi,'#page-container-main > div.footer').replace(cleanRep,''); @@ -337,8 +347,17 @@ $(function() { var navbarClean = new RegExp('\.themeify\.'+curTheme+' #navbar', "gi"); var newStyle = ''; var bgcolor = ''; - // Todo fix for compacted - $.each($('link[href="/plugin/themeify/static/dist/themeify.min.css"][rel="stylesheet"]')[0].sheet.cssRules,function(){ + var styleSrc = false; + if ($('link[href^="/static/webassets/packed_plugins.css"][rel="stylesheet"]').length){ + styleSrc = $('link[href^="/static/webassets/packed_plugins.css"][rel="stylesheet"]'); + }else if ($('link[href="/plugin/themeify/static/dist/themeify.min.css"][rel="stylesheet"]').length){ + styleSrc = $('link[href="/plugin/themeify/static/dist/themeify.min.css"][rel="stylesheet"]'); + } + if (styleSrc == false){ + self.logToConsole("Themeify css src not found!"); + return; + } + $.each(styleSrc[0].sheet.cssRules,function(){ var cssSel = this.selectorText; if (cssSel != undefined && cssSel.indexOf('.themeify.'+curTheme+' #navbar .navbar-inner') != -1){ newStyle += this.cssText.replace(navbarClean,'#page-container-main > div.footer').replace(cleanRep,''); diff --git a/setup.py b/setup.py index e6df846..f3a85ed 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ plugin_name = "UI Customizer" # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module -plugin_version = "0.1.1.9" +plugin_version = "0.1.2.0" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module