From c4e52e0edc2d76483cd40f4203e50ddb570ba2af Mon Sep 17 00:00:00 2001 From: mattpass Date: Sat, 19 Sep 2020 10:06:40 +0100 Subject: [PATCH] Removed 4 x themes, sorted light/dark, settings object --- assets/css/theme/3024-day.css | 41 ------------ assets/css/theme/ambiance-mobile.css | 5 -- assets/css/theme/paraiso-light.css | 38 ------------ assets/css/theme/yeti.css | 44 ------------- assets/js/icecoder.js | 93 ++++++++++++++-------------- editor.php | 9 ++- lib/settings-update.php | 52 ++++++++-------- 7 files changed, 79 insertions(+), 203 deletions(-) delete mode 100644 assets/css/theme/3024-day.css delete mode 100644 assets/css/theme/ambiance-mobile.css delete mode 100644 assets/css/theme/paraiso-light.css delete mode 100644 assets/css/theme/yeti.css diff --git a/assets/css/theme/3024-day.css b/assets/css/theme/3024-day.css deleted file mode 100644 index 7132655..0000000 --- a/assets/css/theme/3024-day.css +++ /dev/null @@ -1,41 +0,0 @@ -/* - - Name: 3024 day - Author: Jan T. Sott (http://github.com/idleberg) - - CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) - Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) - -*/ - -.cm-s-3024-day.CodeMirror { background: #f7f7f7; color: #3a3432; } -.cm-s-3024-day div.CodeMirror-selected { background: #d6d5d4; } - -.cm-s-3024-day .CodeMirror-line::selection, .cm-s-3024-day .CodeMirror-line > span::selection, .cm-s-3024-day .CodeMirror-line > span > span::selection { background: #d6d5d4; } -.cm-s-3024-day .CodeMirror-line::-moz-selection, .cm-s-3024-day .CodeMirror-line > span::-moz-selection, .cm-s-3024-day .CodeMirror-line > span > span::selection { background: #d9d9d9; } - -.cm-s-3024-day .CodeMirror-gutters { background: #f7f7f7; border-right: 0px; } -.cm-s-3024-day .CodeMirror-guttermarker { color: #db2d20; } -.cm-s-3024-day .CodeMirror-guttermarker-subtle { color: #807d7c; } -.cm-s-3024-day .CodeMirror-linenumber { color: #807d7c; } - -.cm-s-3024-day .CodeMirror-cursor { border-left: 1px solid #5c5855; } - -.cm-s-3024-day span.cm-comment { color: #cdab53; } -.cm-s-3024-day span.cm-atom { color: #a16a94; } -.cm-s-3024-day span.cm-number { color: #a16a94; } - -.cm-s-3024-day span.cm-property, .cm-s-3024-day span.cm-attribute { color: #01a252; } -.cm-s-3024-day span.cm-keyword { color: #db2d20; } -.cm-s-3024-day span.cm-string { color: #fded02; } - -.cm-s-3024-day span.cm-variable { color: #01a252; } -.cm-s-3024-day span.cm-variable-2 { color: #01a0e4; } -.cm-s-3024-day span.cm-def { color: #e8bbd0; } -.cm-s-3024-day span.cm-bracket { color: #3a3432; } -.cm-s-3024-day span.cm-tag { color: #db2d20; } -.cm-s-3024-day span.cm-link { color: #a16a94; } -.cm-s-3024-day span.cm-error { background: #db2d20; color: #5c5855; } - -.cm-s-3024-day .CodeMirror-activeline-background { background: #e8f2ff; } -.cm-s-3024-day .CodeMirror-matchingbracket { text-decoration: underline; color: #a16a94 !important; } diff --git a/assets/css/theme/ambiance-mobile.css b/assets/css/theme/ambiance-mobile.css deleted file mode 100644 index 88d332e..0000000 --- a/assets/css/theme/ambiance-mobile.css +++ /dev/null @@ -1,5 +0,0 @@ -.cm-s-ambiance.CodeMirror { - -webkit-box-shadow: none; - -moz-box-shadow: none; - box-shadow: none; -} diff --git a/assets/css/theme/paraiso-light.css b/assets/css/theme/paraiso-light.css deleted file mode 100644 index ae0c755..0000000 --- a/assets/css/theme/paraiso-light.css +++ /dev/null @@ -1,38 +0,0 @@ -/* - - Name: ParaĆ­so (Light) - Author: Jan T. Sott - - Color scheme by Jan T. Sott (https://github.com/idleberg/Paraiso-CodeMirror) - Inspired by the art of Rubens LP (http://www.rubenslp.com.br) - -*/ - -.cm-s-paraiso-light.CodeMirror { background: #e7e9db; color: #41323f; } -.cm-s-paraiso-light div.CodeMirror-selected { background: #b9b6b0; } -.cm-s-paraiso-light .CodeMirror-line::selection, .cm-s-paraiso-light .CodeMirror-line > span::selection, .cm-s-paraiso-light .CodeMirror-line > span > span::selection { background: #b9b6b0; } -.cm-s-paraiso-light .CodeMirror-line::-moz-selection, .cm-s-paraiso-light .CodeMirror-line > span::-moz-selection, .cm-s-paraiso-light .CodeMirror-line > span > span::-moz-selection { background: #b9b6b0; } -.cm-s-paraiso-light .CodeMirror-gutters { background: #e7e9db; border-right: 0px; } -.cm-s-paraiso-light .CodeMirror-guttermarker { color: black; } -.cm-s-paraiso-light .CodeMirror-guttermarker-subtle { color: #8d8687; } -.cm-s-paraiso-light .CodeMirror-linenumber { color: #8d8687; } -.cm-s-paraiso-light .CodeMirror-cursor { border-left: 1px solid #776e71; } - -.cm-s-paraiso-light span.cm-comment { color: #e96ba8; } -.cm-s-paraiso-light span.cm-atom { color: #815ba4; } -.cm-s-paraiso-light span.cm-number { color: #815ba4; } - -.cm-s-paraiso-light span.cm-property, .cm-s-paraiso-light span.cm-attribute { color: #48b685; } -.cm-s-paraiso-light span.cm-keyword { color: #ef6155; } -.cm-s-paraiso-light span.cm-string { color: #fec418; } - -.cm-s-paraiso-light span.cm-variable { color: #48b685; } -.cm-s-paraiso-light span.cm-variable-2 { color: #06b6ef; } -.cm-s-paraiso-light span.cm-def { color: #f99b15; } -.cm-s-paraiso-light span.cm-bracket { color: #41323f; } -.cm-s-paraiso-light span.cm-tag { color: #ef6155; } -.cm-s-paraiso-light span.cm-link { color: #815ba4; } -.cm-s-paraiso-light span.cm-error { background: #ef6155; color: #776e71; } - -.cm-s-paraiso-light .CodeMirror-activeline-background { background: #CFD1C4; } -.cm-s-paraiso-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; } diff --git a/assets/css/theme/yeti.css b/assets/css/theme/yeti.css deleted file mode 100644 index c70d4d2..0000000 --- a/assets/css/theme/yeti.css +++ /dev/null @@ -1,44 +0,0 @@ -/* - - Name: yeti - Author: Michael Kaminsky (http://github.com/mkaminsky11) - - Original yeti color scheme by Jesse Weed (https://github.com/jesseweed/yeti-syntax) - -*/ - - -.cm-s-yeti.CodeMirror { - background-color: #ECEAE8 !important; - color: #d1c9c0 !important; - border: none; -} - -.cm-s-yeti .CodeMirror-gutters { - color: #adaba6; - background-color: #E5E1DB; - border: none; -} -.cm-s-yeti .CodeMirror-cursor { border-left: solid thin #d1c9c0; } -.cm-s-yeti .CodeMirror-linenumber { color: #adaba6; } -.cm-s-yeti.CodeMirror-focused div.CodeMirror-selected { background: #DCD8D2; } -.cm-s-yeti .CodeMirror-line::selection, .cm-s-yeti .CodeMirror-line > span::selection, .cm-s-yeti .CodeMirror-line > span > span::selection { background: #DCD8D2; } -.cm-s-yeti .CodeMirror-line::-moz-selection, .cm-s-yeti .CodeMirror-line > span::-moz-selection, .cm-s-yeti .CodeMirror-line > span > span::-moz-selection { background: #DCD8D2; } -.cm-s-yeti span.cm-comment { color: #d4c8be; } -.cm-s-yeti span.cm-string, .cm-s-yeti span.cm-string-2 { color: #96c0d8; } -.cm-s-yeti span.cm-number { color: #a074c4; } -.cm-s-yeti span.cm-variable { color: #55b5db; } -.cm-s-yeti span.cm-variable-2 { color: #a074c4; } -.cm-s-yeti span.cm-def { color: #55b5db; } -.cm-s-yeti span.cm-operator { color: #9fb96e; } -.cm-s-yeti span.cm-keyword { color: #9fb96e; } -.cm-s-yeti span.cm-atom { color: #a074c4; } -.cm-s-yeti span.cm-meta { color: #96c0d8; } -.cm-s-yeti span.cm-tag { color: #96c0d8; } -.cm-s-yeti span.cm-attribute { color: #9fb96e; } -.cm-s-yeti span.cm-qualifier { color: #96c0d8; } -.cm-s-yeti span.cm-property { color: #a074c4; } -.cm-s-yeti span.cm-builtin { color: #a074c4; } -.cm-s-yeti span.cm-variable-3 { color: #96c0d8; } -.cm-s-yeti .CodeMirror-activeline-background { background: #E7E4E0; } -.cm-s-yeti .CodeMirror-matchingbracket { text-decoration: underline; } diff --git a/assets/js/icecoder.js b/assets/js/icecoder.js index 5359344..f783a2c 100644 --- a/assets/js/icecoder.js +++ b/assets/js/icecoder.js @@ -3661,73 +3661,74 @@ var ICEcoder = { }, // Update the settings used when we make a change to them - useNewSettings: function(themeURL,codeAssist,lockedNav,tagWrapperCommand,autoComplete,visibleTabs,fontSize,lineWrapping,lineNumbers,showTrailingSpace,matchBrackets,autoCloseTags,autoCloseBrackets,indentType,indentAuto,indentSize,pluginPanelAligned,scrollbarStyle,bugFilePaths,bugFileCheckTimer,bugFileMaxLines,updateDiffOnSave,autoLogoutMins,refreshFM) { - var styleNode, thisCSS, strCSS, activeLineBG; + useNewSettings: function(settings) { + let styleNode, thisCSS, strCSS, activeLineBG; - // cut out ?microtime= at the end - var cleanThemeUrl = themeURL.slice(0, themeURL.lastIndexOf("?")); - // find out new theme name without leading path and trailing ".css" - var newTheme = cleanThemeUrl.slice(cleanThemeUrl.lastIndexOf("/")+1,cleanThemeUrl.lastIndexOf(".")); - // if theme was not changed - no need to do all these tricks + // Cut out path prefix, .css file extension and ?microtime= querystring + const newTheme = settings.themeURL.replace(/.+\/|.css.+/g, ""); + // If theme was not changed - no need to do all these tricks if (this.theme !== newTheme){ // Add new stylesheet for selected theme to editor this.theme = newTheme; - if (this.theme=="editor") {this.theme="icecoder"}; styleNode = document.createElement('link'); styleNode.setAttribute('rel', 'stylesheet'); styleNode.setAttribute('type', 'text/css'); - styleNode.setAttribute('href', themeURL); + styleNode.setAttribute('href', settings.themeURL); this.content.contentWindow.document.getElementsByTagName('head')[0].appendChild(styleNode); - if (["3024-day","base16-light","eclipse","elegant","mdn-like","neat","neo","paraiso-light","solarized","the-matrix","xq-light"].indexOf(this.theme)>-1) { - activeLineBG = "#ccc"; - } else if (["3024-night","blackboard","colorforth","liquibyte","night","tomorrow-night-bright","tomorrow-night-eighties","vibrant-ink"].indexOf(this.theme)>-1) { - activeLineBG = "#888"; - } else { - activeLineBG = "#000"; - } + activeLineBG = + // Light themes + -1 < ["base16-light", "duotone-light", "eclipse", "elegant", "mdn-like", "neat", "neo", "solarized", "ttcn", "xq-light"].indexOf(this.theme) + ? "#ccc" + // Dark themes + : -1 < ["3024-night", "blackboard", "colorforth", "isotope", "liquibyte", "night", "the-matrix", "tomorrow-night-bright", "tomorrow-night-eighties", "vibrant-ink", "xq-dark", "zenburn"].indexOf(this.theme) + ? "#222" + // Other themes + : "#000"; this.switchTab(this.selectedTab); } // Check/uncheck Code Assist setting - if (codeAssist != this.codeAssist) { + if (settings.codeAssist !== this.codeAssist) { this.codeAssistToggle(); } // Unlock/lock the file manager - if (lockedNav != this.lockedNav) { + if (settings.lockedNav !== this.lockedNav) { this.lockUnlockNav(); - this.changeFilesW(!lockedNav ? 'contract' : 'expand'); + this.changeFilesW(!settings.lockedNav ? 'contract' : 'expand'); this.hideFileMenu(); }; // Update font size at top level thisCSS = document.styleSheets[0]; strCSS = thisCSS.rules ? 'rules' : 'cssRules'; - thisCSS[strCSS][0].style['fontSize'] = fontSize; + thisCSS[strCSS][0].style['fontSize'] = settings.fontSize; // Update font size in file manager thisCSS = this.filesFrame.contentWindow.document.styleSheets[3]; strCSS = thisCSS.rules ? 'rules' : 'cssRules'; - thisCSS[strCSS][0].style['fontSize'] = fontSize; + thisCSS[strCSS][0].style['fontSize'] = settings.fontSize; // Update styles in editor thisCSS = this.content.contentWindow.document.styleSheets[6]; strCSS = thisCSS.rules ? 'rules' : 'cssRules'; - thisCSS[strCSS][0].style['fontSize'] = fontSize; - thisCSS[strCSS][4].style['border-left-width'] = visibleTabs ? '1px' : '0'; - thisCSS[strCSS][4].style['margin-left'] = visibleTabs ? '-1px' : '0'; + thisCSS[strCSS][0].style['fontSize'] = settings.fontSize; + thisCSS[strCSS][4].style['border-left-width'] = settings.visibleTabs ? '1px' : '0'; + thisCSS[strCSS][4].style['margin-left'] = settings.visibleTabs ? '-1px' : '0'; thisCSS[strCSS][2].style.cssText = "background-color: " + activeLineBG + " !important"; - this.lineWrapping = lineWrapping; - this.lineNumbers = lineNumbers; - this.showTrailingSpace = showTrailingSpace; - this.matchBrackets = matchBrackets; - this.autoCloseTags = autoCloseTags; - this.autoCloseBrackets = autoCloseBrackets; - this.indentType = indentType; - this.indentSize = indentSize; - this.indentAuto = indentAuto; - this.scrollbarStyle = scrollbarStyle; + // Set many of the ICEcoder settings + this.lineWrapping = settings.lineWrapping; + this.lineNumbers = settings.lineNumbers; + this.showTrailingSpace = settings.showTrailingSpace; + this.matchBrackets = settings.matchBrackets; + this.autoCloseTags = settings.autoCloseTags; + this.autoCloseBrackets = settings.autoCloseBrackets; + this.indentType = settings.indentType; + this.indentSize = settings.indentSize; + this.indentAuto = settings.indentAuto; + this.scrollbarStyle = settings.scrollbarStyle; + // Then apply the settings to each editor instance for (var i=0;iparent.ICEcoder.settingsScreen(true); parent.ICEcoder.useNewSettings('" . - $themeURL . "'," . - (true === $ICEcoder["codeAssist"] ? "true" : "false") . "," . - (true === $ICEcoder["lockedNav"] ? "true" : "false") . ",'" . - $ICEcoder["tagWrapperCommand"] . "','" . - (true === $ICEcoder["autoComplete"] ? "true" : "false") . "'," . - (true === $ICEcoder["visibleTabs"] ? "true" : "false") . ",'" . - $ICEcoder["fontSize"] . "'," . - (true === $ICEcoder["lineWrapping"] ? "true" : "false") . "," . - (true === $ICEcoder["lineNumbers"] ? "true" : "false") . "," . - (true === $ICEcoder["showTrailingSpace"] ? "true" : "false") . "," . - (true === $ICEcoder["matchBrackets"] ? "true" : "false") . "," . - (true === $ICEcoder["autoCloseTags"] ? "true" : "false") . "," . - (true === $ICEcoder["autoCloseBrackets"] ? "true" : "false") . ",'" . - $ICEcoder["indentType"] . "'," . - (true === $ICEcoder["indentAuto"] ? "true" : "false") . "," . - $ICEcoder["indentSize"] . ",'" . - $ICEcoder["pluginPanelAligned"] . "','" . - $ICEcoder["scrollbarStyle"] . "'," . - $jsBugFilePaths . "," . - $ICEcoder["bugFileCheckTimer"] . "," . - $ICEcoder["bugFileMaxLines"] . "," . - (true === $ICEcoder["updateDiffOnSave"] ? "true" : "false") . "," . - $ICEcoder["autoLogoutMins"] . "," . - $refreshFM . - "); iceRoot = '" . $ICEcoder["root"] . + echo ""; }