diff --git a/js/main.js b/js/main.js index 75f944b..245cb90 100644 --- a/js/main.js +++ b/js/main.js @@ -170,8 +170,6 @@ Core.prototype.init = function() { $("head").append(''); //By http://www.somethinghitme.com - // utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.9.0/codemirror.min.js"); - // utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.9.0/mode/css/css.min.js"); $("head").append(""); @@ -806,23 +804,13 @@ var settingsButton = null; var panel = null; function SettingsPanel() { - utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.9.0/codemirror.min.js"); utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.9.0/mode/css/css.min.js"); - //utils.injectCss("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.9.0/codemirror.min.css"); - } SettingsPanel.prototype.init = function() { - console.log("SETTINGSPANEL INIT"); - - - var self = this; - self.construct(); - - var body = $("body"); if(settingsCookie["bda-es-0"]) { @@ -877,6 +865,8 @@ var lastTab = ""; SettingsPanel.prototype.changeTab = function(tab) { + var self = this; + lastTab = tab; var controlGroups = $("#bd-control-groups"); @@ -890,9 +880,16 @@ SettingsPanel.prototype.changeTab = function(tab) { break; case "bd-customcss-tab": if(!customCssInitialized) { - CodeMirror.fromTextArea(document.getElementById("customcss-editor"), { + var editor = CodeMirror.fromTextArea(document.getElementById("bd-custom-css-ta"), { lineNumbers: true, mode: 'css', indentUnit: 4, theme: 'neat' }); + + + editor.on("change", function(cm) { + var css = cm.getValue(); + self.applyCustomCss(css); + }); + customCssInitialized = true; } break; @@ -953,9 +950,6 @@ SettingsPanel.prototype.updateSetting = function(checkbox) { } SettingsPanel.prototype.construct = function() { - - console.log("SETTINGSPANEL CONSTRUCT"); - var self = this; panel = $("
", { @@ -1004,13 +998,15 @@ SettingsPanel.prototype.construct = function() { } + var ccss = atob(localStorage.getItem("bdcustomcss")); + self.applyCustomCss(ccss); settingsInner += '' + ' ' + '' + ' ' + '' + '