From 4f00f748598313bacfbb1c70175ba6ec9e6765c3 Mon Sep 17 00:00:00 2001 From: kilo Date: Thu, 17 Aug 2017 03:35:18 +0200 Subject: [PATCH] change position of return (#1374) --- public/js/main.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/public/js/main.js b/public/js/main.js index ded9676b..40255fc4 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -6,14 +6,17 @@ function switchThemes() { var themeName = document.getElementById("theme-selector").value var head = document.getElementsByTagName("head")[0] + + if (themeName === "") { + return + } + // Remove the theme in place, it fails if one isn't set try { head.removeChild(document.getElementById("theme")) } catch (err) {} // Don't add a node if we don't want extra styling - if (themeName === "") { - return - } + // Create the new one and put it back var newTheme = document.createElement("link") newTheme.setAttribute("rel", "stylesheet")