From 59964c3fbff02402bef333922568f28ee98ec985 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 27 Apr 2017 16:07:53 +0200 Subject: [PATCH] Code cleanup --- .../WoltLabSuite/Core/Acp/Ui/Style/Editor.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Style/Editor.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Style/Editor.js index 61f041a709..edc7aae4f6 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Style/Editor.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Style/Editor.js @@ -11,6 +11,7 @@ define(['Ajax', 'Core', 'Dictionary', 'Dom/Util', 'EventHandler', 'Ui/Screen'], var _stylePreviewRegions = new Dictionary(); var _stylePreviewRegionMarker = null; + var _stylePreviewWindow = elById('spWindow'); var _isVisible = true; var _updateRegionMarker = null; @@ -123,10 +124,9 @@ define(['Ajax', 'Core', 'Dictionary', 'Dom/Util', 'EventHandler', 'Ui/Screen'], }, _initVisualEditor: function(styleRuleMap) { - var regions = elBySelAll('#spWindow [data-region]'); - for (var i = 0, length = regions.length; i < length; i++) { - _stylePreviewRegions.set(elData(regions[i], 'region'), regions[i]); - } + elBySelAll('[data-region]', _stylePreviewWindow, function(region) { + _stylePreviewRegions.set(elData(region, 'region'), region); + }); _stylePreviewRegionMarker = elCreate('div'); _stylePreviewRegionMarker.id = 'stylePreviewRegionMarker'; @@ -187,7 +187,7 @@ define(['Ajax', 'Core', 'Dictionary', 'Dom/Util', 'EventHandler', 'Ui/Screen'], fromTop = maxHeight - wrapperHeight; } - variablesWrapper.style.setProperty('transform', 'translateY(' + fromTop + 'px)'); + variablesWrapper.style.setProperty('transform', 'translateY(' + fromTop + 'px)', ''); } } @@ -230,15 +230,13 @@ define(['Ajax', 'Core', 'Dictionary', 'Dom/Util', 'EventHandler', 'Ui/Screen'], elData(style, 'created-by', 'WoltLab/Acp/Ui/Style/Editor'); document.head.appendChild(style); - function updateCSSRule(identifier, value, isInit) { + function updateCSSRule(identifier, value) { if (styleRuleMap[identifier] === undefined) { - console.debug("Unknown style identifier: " + identifier); return; } var rule = styleRuleMap[identifier].replace(/VALUE/g, value + ' !important'); if (!rule) { - console.debug("Invalid style rule for " + identifier); return; } @@ -284,13 +282,13 @@ define(['Ajax', 'Core', 'Dictionary', 'Dom/Util', 'EventHandler', 'Ui/Screen'], }, hideVisualEditor: function() { - elHide(elById('spWindow')); + elHide(_stylePreviewWindow); elById('spVariablesWrapper').style.removeProperty('transform'); elHide(elById('stylePreviewRegionMarker')); }, showVisualEditor: function() { - elShow(elById('spWindow')); + elShow(_stylePreviewWindow); window.setTimeout(function() { Core.triggerEvent(elById('spCategories'), 'change'); -- 2.20.1