From d364eb96682666febb711202dbee6b1e875b1a38 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 28 Apr 2020 18:39:31 -0400 Subject: [PATCH] Minor code review --- src/css/popup-fenix.css | 2 +- src/js/advanced-settings.js | 32 ++++++++++++++------------------ src/popup-fenix.html | 4 ++-- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/css/popup-fenix.css b/src/css/popup-fenix.css index f35032f0b..9c7b5f071 100644 --- a/src/css/popup-fenix.css +++ b/src/css/popup-fenix.css @@ -52,7 +52,7 @@ hr { top: 0; z-index: 100; } -#basicTools { +#stickyTools { align-items: stretch; display: flex; justify-content: space-between; diff --git a/src/js/advanced-settings.js b/src/js/advanced-settings.js index 2b41f80b6..57f53763c 100644 --- a/src/js/advanced-settings.js +++ b/src/js/advanced-settings.js @@ -41,26 +41,22 @@ CodeMirror.defineMode('raw-settings', function() { return { token: function(stream) { if ( stream.sol() ) { - const match = stream.match(/\s*\S+/); - if ( match !== null ) { - lastSetting = match[0].trim(); - if ( defaultSettings.has(lastSetting) ) { - return 'keyword'; - } - } - lastSetting = ''; - stream.skipToEnd(); - return 'error'; - } - if ( lastSetting !== '' ) { stream.eatSpace(); - const match = stream.match(/\S+.*$/); - if ( match !== null ) { - if ( match[0] !== defaultSettings.get(lastSetting) ) { - return 'strong'; - } + const match = stream.match(/\S+/); + if ( match !== null && defaultSettings.has(match[0]) ) { + lastSetting = match[0]; + return 'keyword'; } - lastSetting = ''; + stream.skipToEnd(); + return 'line-cm-error'; + } + stream.eatSpace(); + const match = stream.match(/.*$/); + if ( + match !== null && + match[0].trim() !== defaultSettings.get(lastSetting) + ) { + return 'line-cm-strong'; } stream.skipToEnd(); return null; diff --git a/src/popup-fenix.html b/src/popup-fenix.html index 2c6634025..0c080b4bf 100644 --- a/src/popup-fenix.html +++ b/src/popup-fenix.html @@ -14,7 +14,7 @@
-
+
lock eraser @@ -44,7 +44,7 @@ code

-
+
bolt eye-dropper list-alt