diff --git a/js/main.js b/js/main.js index 7c6ef1ae..1a182534 100644 --- a/js/main.js +++ b/js/main.js @@ -1,6 +1,6 @@ /* BetterDiscordApp Core JavaScript - * Version: 1.53 + * Version: 1.78 * Author: Jiiks | http://jiiks.net * Date: 27/08/2015 - 16:36 * Last Update: 01/05/2016 @@ -57,6 +57,13 @@ })(); +(() => { + let v2Loader = document.createElement('div'); + v2Loader.className = "bd-loaderv2"; + v2Loader.title = "BetterDiscord is loading..."; + document.body.appendChild(v2Loader); +})(); + window.bdStorage = {}; window.bdStorage.get = function(i) { return betterDiscordIPC.sendSync('synchronous-message', { 'arg': 'storage', 'cmd': 'get', 'var': i }); @@ -78,7 +85,7 @@ betterDiscordIPC.on('asynchronous-reply', (event, arg) => { }); var settingsPanel, emoteModule, utils, quickEmoteMenu, opublicServers, voiceMode, pluginModule, themeModule, customCssEditor, dMode; -var jsVersion = 1.77; +var jsVersion = 1.78; var supportedVersion = "0.2.81"; var mainObserver; @@ -105,6 +112,7 @@ var settings = { "Custom css auto udpate": { "id": "bda-css-1", "info": "", "implemented": true, "hidden": true, "cat": "core"}, "24 Hour Timestamps": { "id": "bda-gs-6", "info": "Replace 12hr timestamps with proper ones", "implemented": true, "hidden": false, "cat": "core"}, "Coloured Text": { "id": "bda-gs-7", "info": "Make text colour the same as role colour", "implemented": true, "hidden": false, "cat": "core"}, + "BetterDiscord Blue": { "id": "bda-gs-b", "info": "Replace Discord blue with BD Blue", "implemented": true, "hidden": false, "cat": "core"}, "Developer Mode": { "id": "bda-gs-8", "info": "Developer Mode", "implemented": true, "hidden": false, "cat": "core"}, "Twitch Emotes": { "id": "bda-es-7", "info": "Show Twitch emotes", "implemented": true, "hidden": false, "cat": "emote"}, @@ -143,6 +151,7 @@ var defaultCookie = { "bda-es-5": true, "bda-es-6": true, "bda-es-7": true, + "bda-gs-b": true, "bda-es-8": true, "bda-jd": true, "bda-es-8": true, @@ -155,25 +164,23 @@ var defaultCookie = { var bdchangelog = { "changes": { "0a": { - "title": "1.77 : Local storage proxy", - "text": "Implemented a local storage proxy for old plugin support. Do not use it for new plugins! use the bdPluginStorage.get and bdPluginStorage.set", + "title": "1.78 : Temp support for new settingspanel", + "text": "Added temp support for Discord's new settingspanel until v2.", "img": "" }, "0b": { - "title": "1.76 : Alternate Storage", - "text": "https://gist.github.com/Jiiks/267113ecb1685f39f4dc4646f9380d55", - "img": "" - } - }, - "fixes": { - "0a": { - "title": "1.77 : Custom css and favourite emote loading", - "text": "Fixed custom css and favourite emote loading when they are not present", + "title": "1.78 : New loading icon", + "text": "New loading icon will now display in bottom right when BD is loading.", "img": "" }, - "0b": { - "title": "1.76 : Alternate Storage", - "text": "Both BetterDiscord and plugins now use alternate storage", + "0c": { + "title": "1.78 : New CustomCSS editor look", + "text": "Updated CustomCSS editor with dark theme", + "img": "" + }, + "0d": { + "title": "1.78 : BetterDiscord Blue", + "text": "Replace Discord blue with BetterDiscord blue!", "img": "" } } @@ -273,7 +280,7 @@ Core.prototype.init = function () { $("head").append(""); $("head").append(''); - + document.getElementsByClassName("bd-loaderv2")[0].remove(); } else { setTimeout(gwDefer, 100); } @@ -768,424 +775,477 @@ EmoteModule.prototype.capitalize = function (value) { * https://github.com/Jiiks/BetterDiscordApp */ -function PublicServers() { +class PublicServers { + + constructor() { + this.v2p = new V2_PublicServers(); + } + + get endPoint() { + return 'https://search.discordservers.com'; + } + + get button() { + let self = this; + let btn = $("
", { + class: 'guild', + id: 'bd-pub-li', + css: { + 'height': '20px', + 'display': settingsCookie['bda-gs-1'] ? "" : "none" + } + }).append($("
", { + class: 'guild-inner', + css: { + 'height': '20px', + 'border-radius': '4px' + } + }).append($("", { + + }).append($("
", { + text: 'public', + id: 'bd-pub-button', + css: { + 'line-height': '20px', + 'font-size': '12px' + }, + click: () => { self.v2p.render(); } + })))); + + return btn; + } + + init() { + let self = this; + + let guilds = $(".guilds>:first-child"); + guilds.after(self.button); + + } + + get layer() { + let self = this; + let layer = ``; + + layer = $(layer); + + layer.on("blur", e => { + if(e.relatedTarget.id === 'bd-pubs-search') return; + layer.focus(); + console.log("blur:"); + console.log(e); + }); + + layer.on("keydown", e => { + if(e.which === 13 && e.target.id === 'bd-pubs-search') { + let category = $("#bd-pubs-layer .ui-tab-bar-item.selected").text(); + if(category === 'All') category = ''; + self.search(self.query({'term': e.target.value, 'category': category}), true); + return; + } + if(e.which !== 27) return; + self.hide(); + }); + + layer.find('.btn-close').on('click', e => { self.hide(); }); + + layer.find('.ui-tab-bar.SIDE .ui-tab-bar-item').on('click', e => { + let category = e.target.textContent; + if(category === 'All') category = ''; + self.search(self.query({'term': $("#bd-pubs-search").val(), 'category': category}), true); + }); + + return layer; + } + + serverCard(serverInfo) { + return `
+
+
+
+
+
+
+
+
${serverInfo.name}
+
+
+
${serverInfo.online}/${serverInfo.members} Members
+
+
+
+
+
+
+ ${serverInfo.description} +
+
+
+
+
+
${serverInfo.categories.join(" ,")}
+ +
+
+
+
`; + } + + get bdServerCard() { + + let serverInfo = { + 'name': 'BetterDiscord', + 'icon': 'https://cdn.discordapp.com/icons/86004744966914048/c8d49dc02248e1f55caeb897c3e1a26e.webp', + 'online': '7500+', + 'members': '20000+', + 'description': 'Official BetterDiscord support server' + }; + + return `
+
+
+
+
+
+
+
+
${serverInfo.name}
+
+
+
Too many members
+
+
+
+
+
+
+ ${serverInfo.description} +
+
+
+
+
+
+ +
+
+
+
`; + } + + + getPanel() { + console.log("pubs get panel"); + return '
'; + } + + getPinnedServer() { + console.log("pubs get pinned server"); + return '
'; + } + + hidePinnedServer() { + console.log("pubs hide pinned server"); + } + + showPinnedServer() { + console.log("pubs show pinned server"); + } + + show() { + let self = this; + $(".layers").append(self.layer); + //self.search("", true); + } + + hide() { + $("#bd-pubs-layer").remove(); + } + + loadServers(dataset, search, clear) { + console.log("pubs load servers"); + } + + search(query, clear) { + + let self = this; + let $list = $("#bd-pubs-listing"); + if(clear) { + $list.empty(); + $("#bd-pubs-listing-container").hide(); + $("#bd-pubs-bg-spinner").show(); + } + $.ajax({ + method: 'GET', + url: `${self.endPoint}?${query}`, + success: data => { + $list.append(self.bdServerCard); + data.results.map(server => { + $list.append(self.serverCard(server)); + }); + $("#bd-pubs-listing-container").show(); + $("#bd-pubs-bg-spinner").hide(); + self.setSearchText(1, $(".bd-server-card").size(), data.total, null, $("#bd-pubs-search").val()); + } + }); + } + + setSearchText(start, end, total, category, term) { + if(!category) category = $("#bd-pubs-layer .ui-tab-bar-item.selected").text(); + let text = `Showing ${start}-${end} of ${total} results in ${category}`; + if(term && term.length) text += ` for: ${term}`; + $("#bd-pubs-results").text(text); + } + + get next() { + let self = this; + if(!self.next) return null; + } + + joinServer(code) { + console.log("pubs join"); + } + + joinServerDirect(code) { + console.log("pubs join direct"); + } + + escape(unsafe) { + console.log("pubs escape"); + } + + query(params) { + return require('querystring').stringify(params); + } } -PublicServers.prototype.getPanel = function () { - return this.container; -}; - -PublicServers.prototype.init = function () { - this.filtered = ["134680912691462144", "86004744966914048"]; - this.bdServer = null; - this.loadingServers = false; - var self = this; - - var guilds = $(".guilds>:first-child"); - - guilds.after($("
", { - class: "guild", - id: "bd-pub-li", - css: { - "height": "20px", - "display": settingsCookie["bda-gs-1"] == true ? "" : "none" - } - }).append($("
", { - class: "guild-inner", - css: { - "height": "20px", - "border-radius": "4px" - } - }).append($("").append($("
", { - css: { - "line-height": "20px", - "font-size": "12px" - }, - text: "public", - id: "bd-pub-button" - }))))); - - $("#bd-pub-button").on("click", function () { - self.show(); - }); - var panelBase = '\ -
\ -
\ - \ - \ - \ - \ - \ - \ -
\ -
\ -

Public Servers

\ - \ - \ -
\ - \ -
\ -
    \ -
  • All
  • \ -
  • FPS Games
  • \ -
  • MMO Games
  • \ -
  • MOBA Games
  • \ -
  • Strategy Games
  • \ -
  • Sports Games
  • \ -
  • Puzzle Games
  • \ -
  • Retro Games
  • \ -
  • Party Games
  • \ -
  • Tabletop Games
  • \ -
  • Sandbox Games
  • \ -
  • Simulation Games
  • \ -
  • Community
  • \ -
  • Language
  • \ -
  • Programming
  • \ -
  • Other
  • \ -
\ -
\ -
\ -
\ - \ -
\ -
\ -
\ -
\ - \ -
\ -
\ -
\ - '; - - this.container = panelBase; - - if($("#bd-pub-li").length < 1) { - setTimeout(function() { - self.init(); - }, 250); - } -}; - -PublicServers.prototype.getPinnedServer = function() { - var self = this; - var dataset = { - "sort": [{"online": "desc"}], - "size": 1, - "query": { - "query_string": { - "default_operator": "AND", - "query": "BetterDiscord" - } - } - }; - - $.ajax({ - type: "POST", - dataType: "json", - url: "https://69ccb59e91f99116aae036ddceae21b3.us-east-1.aws.found.io:9243/_search", - crossDomain: true, - data: JSON.stringify(dataset), - success: function(data) { - try { - var s = data.hits.hits[0]._source; - if(s.identifier == "86004744966914048") { - self.bdServer = s; - self.showPinnedServer(); - } - }catch(err) { - self.bdServer = null; - } - } - }); -}; - -PublicServers.prototype.hidePinnedServer = function() { - $("#pubs-container .scroller-wrap").css({"margin-top": "0", "height": "500px"}); - $(".server-pinned").hide(); -}; - -PublicServers.prototype.showPinnedServer = function() { - $(".server-pinned .server-icon").css("background-image", "url("+this.bdServer.icon+")"); - $(".server-pinned .server-members span").text(this.bdServer.online + "/"+this.bdServer.members+" Members"); - $(".server-pinned .server-region span").text(this.bdServer.region); - $(".server-pinned .server-info button").data("server-invite-code", this.bdServer.invite_code); - $("#pubs-container .scroller-wrap").css({"margin-top": "75px", "height": "425px"}); - $(".server-pinned").show(); -}; - -PublicServers.prototype.show = function () { - var self = this; - this.hidePinnedServer(); - $("#pubs-cat-select").text("All"); - this.selectedCategory = "all"; - $("#pubs-container .scroller-wrap").css({"margin-top": "0", "height": "500px"}); - $(".server-pinned").hide(); - - $(".app").append(this.getPanel()); - - if(this.bdServer == null) { - this.getPinnedServer(); - } else { - this.showPinnedServer(); - } - - self.search(0, true); - - $("#pubs-searchbtn").off("click").on("click", function() { - self.search(); - }); - $("#pubs-sterm").off("keyup").on("keyup", function(e) { - if (e.keyCode == 13) { - self.search(0, true); - } - }); - $("#pubs-cat-select").off("click").on("click", function() { - $("#pubs-select-dropdown").addClass("open"); - }); - $(".pubs-cat-select-li").off("click").on("click", function() { - $("#pubs-select-dropdown").removeClass("open"); - $("#pubs-cat-select").text($(this).text()); - if(self.selectedCategory != $(this).data("val")) { - self.selectedCategory = $(this).data("val"); - self.search(0, true); - } - }); - $("#pubs-container").off("mouseup").on("mouseup", function() { - $("#pubs-select-dropdown").removeClass("open"); - }); - - var self = this; - $(document).on("mouseup.bdps",function(e) { - if(!$("#bd-pub-button").is(e.target) && !$("#pubs-container").is(e.target) && $("#pubs-container").has(e.target).length === 0) { - self.hide(); - } - }); - - $("#pubs-scroller").off("scroll.pubs").on("scroll.pubs", function() { - if(self.loadingServers) return; - var list = $("#pubs-list"); - if($(this).scrollTop() + 550 < list.height()) return; - if(list.children().length % 20 != 0) return; - - self.loadingServers = true; - $("#pubs-spinner-bottom").show(); - self.search(list.children().length, false); - }); - - $("button[data-server-invite-code=0Tmfo5ZbORCRqbAd]").off("click").on("click", function(){ - self.joinServerDirect("0Tmfo5ZbORCRqbAd"); - }); -}; - -PublicServers.prototype.hide = function() { - $("#pubs-container").remove(); - $(document).off("mouseup.bdps"); -}; -PublicServers.prototype.loadServers = function(dataset, search, clear) { - this.loadingServers = true; - var self = this; - $("#pubs-searchbtn").prop("disabled", true); - $("#pubs-sterm").prop("disabled", true); - if(clear) $("#pubs-list").empty(); - $("#pubs-spinner").show(); - $.ajax({ - type: "POST", - dataType: "json", - url: "https://69ccb59e91f99116aae036ddceae21b3.us-east-1.aws.found.io:9243/_search", - crossDomain: true, - data: JSON.stringify(dataset), - success: function(data) { - var hits = data.hits.hits; - - if(search) { - $("#pubs-header-title").text("Public Servers - Search Results: " + hits.length); - } else { - $("#pubs-header-title").text("Public Servers"); - } - - hits.forEach(function(hit) { - var source = hit._source; - // if(source.invite_code === undefined) return; - // var icode = source.invite_code.replace(/ /g,''); - // icode = self.escape(icode).replace(/[^A-z0-9]/g,''); - var icode = source.identifier; - var html = '
'; - html += '
'; - html += '
'; - html += '
'; - - if(source.is_official) { - html += 'Official!'; - } - - html += '' + self.escape(source.name) + ''; - - var tags = []; - source.tags.forEach(function(tag) { - tags.push(self.escape(tag.name)); - }); - - var desc = - - html += ''+tags.join(", ")+''; - html += ''+(source.description == undefined ? "No Description" : self.escape(source.description)) +''; - html += '
'; - html += '
'; - html += '
'; - html += '' + source.online + '/' + source.members + ' Members'; - html += '
'; - html += '
'; - html += '' + source.region + ''; - html += '
'; - html += '
'; - html += ''; - html += '
'; - html += '
'; - $("#pubs-list").append(html); - $("button[data-server-invite-code="+icode+"]").on("click", function(){ - self.joinServer(icode); - }); - }); - - if(search) { - $("#pubs-header-title").text("Public Servers - Search Results: " + $("#pubs-list").children().length); - } - }, - done: function() { - $("#pubs-spinner").hide(); - $("#pubs-spinner-bottom").hide(); - $("#pubs-searchbtn").prop("disabled", false); - $("#pubs-sterm").prop("disabled", false); - self.loadingServers = false; - }, - always: function() { - $("#pubs-spinner").hide(); - $("#pubs-spinner-bottom").hide(); - $("#pubs-searchbtn").prop("disabled", false); - $("#pubs-sterm").prop("disabled", false); - self.loadingServers = false; - }, - error: function() { - $("#pubs-spinner").hide(); - $("#pubs-spinner-bottom").hide(); - $("#pubs-searchbtn").prop("disabled", false); - $("#pubs-sterm").prop("disabled", false); - self.loadingServers = false; - }, - complete: function() { - $("#pubs-spinner").hide(); - $("#pubs-spinner-bottom").hide(); - $("#pubs-searchbtn").prop("disabled", false); - $("#pubs-sterm").prop("disabled", false); - self.loadingServers = false; - } - }); -}; - -PublicServers.prototype.search = function(start, clear) { - var sterm = $("#pubs-sterm").val(); - - /*var dataset = { - "sort": [{ "online": "desc" }], - "from": start, - "size": 20, - "query": { - "filtered": { - "query": { - "query_string": { - "default_operator": "AND", - "query": sterm ? sterm : "*" - } - }, - "filter": { - "bool": { - "must_not": [{ - "terms": { - "identifier": this.filtered - } - }] - } - } - } - } - };*/ - - var dataset = { - "sort": [{ "online": "desc" }], - "from": start, - "size": 20, - "query": { - "bool": { - "must": [ - {"query_string": { - "default_operator": "AND", - "query": sterm ? sterm : "*" - }} - ], - "must_not": [ - {"terms": { "identifier": this.filtered }} - ] - } - } - }; - if(this.selectedCategory != "all") { - dataset.query.bool.must.push({ "match_phrase": { "categories": this.selectedCategory } }); - } - - this.loadServers(dataset, true, clear); -}; -//Workaround for joining a server -PublicServers.prototype.joinServer = function (code) { - require('electron').shell.openExternal("https://www.discordservers.com/join/" + code); - this.hide(); -}; -PublicServers.prototype.joinServerDirect = function(code) { - $(".guilds-add").click(); - $(".action.join .btn").click(); - $(".create-guild-container input").val(code); - $(".form.join-server .btn-primary").click(); - this.hide(); -}; -PublicServers.prototype.escape = function(unsafe) { - if(unsafe === undefined) return ""; - return unsafe - .replace(/&/g, "&") - .replace(//g, ">") - .replace(/"/g, """) - .replace(/'/g, "'"); -}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /* BetterDiscordApp QuickEmoteMenu JavaScript * Version: 1.3 * Author: Jiiks | http://jiiks.net @@ -1379,7 +1439,8 @@ self.editor = CodeMirror.fromTextArea(document.getElementById("bd-custom-css-ta" lineNumbers: true, mode: 'css', indentUnit: 4, - theme: 'neat' + theme: 'material', + scrollbarStyle: 'simple' }); self.editor.on("change", function (cm) { @@ -1481,13 +1542,17 @@ 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.injectJs("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/codemirror.min.js"); + utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/mode/css/css.min.js"); + utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/addon/scroll/simplescrollbars.min.js"); + utils.injectCss("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/addon/scroll/simplescrollbars.min.css"); + utils.injectCss("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/theme/material.min.css"); utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.4.2/Sortable.min.js"); } SettingsPanel.prototype.init = function () { var self = this; + self.v2SettingsPanel = new V2_SettingsPanel(); self.construct(); var body = $("body"); @@ -1539,6 +1604,12 @@ SettingsPanel.prototype.init = function () { } else { dMode.disable(); } + + if(settingsCookie["bda-gs-b"]) { + $("body").addClass("bd-blue"); + } else { + $("body").removeClass("bd-blue"); + } }; var customCssInitialized = false; @@ -1599,6 +1670,7 @@ SettingsPanel.prototype.updateSetting = function (checkbox) { mainCore.alert("Developer Mode Enabled", "Use F8 to break/resume execution
More coming soon") } + settingsCookie[id] = enabled; this.updateSettings(); @@ -1611,6 +1683,12 @@ SettingsPanel.prototype.updateSettings = function() { $("#twitchcord-button-container").hide(); } + if(settingsCookie["bda-gs-b"]) { + $("body").addClass("bd-blue"); + } else { + $("body").removeClass("bd-blue"); + } + if (settingsCookie["bda-gs-2"]) { $("body").addClass("bd-minimal"); } else { @@ -1910,6 +1988,7 @@ SettingsPanel.prototype.construct = function () { }; SettingsPanel.prototype.inject = function(mutation) { + if(this.injectNew(mutation)) return; if(mutation.type != "childList") return; if(mutation.addedNodes.length <= 0) return; if($(mutation.addedNodes[0]).find(".user-settings-modal").length <= 0) return; @@ -1928,6 +2007,372 @@ SettingsPanel.prototype.inject = function(mutation) { $(".form .settings-right .settings-inner").last().after(self.panel); $("#bd-settings-new").removeClass("selected"); }; + +/*New settingspanel temp until v2*/ + +SettingsPanel.prototype.injectNew = function(mutation) { + let self = this; + if(!mutation.target.classList.contains("layers")) return; + if(!$(".ui-tab-bar-header:contains('App Settings')").length) return; + if($("#bd-settings-sidebar").length) return; + self.v2SettingsPanel.renderSidebar(); + /*$(".ui-tab-bar-item").off("click.bd").on("click.bd", e => { + $(".ui-tab-bar-item").removeClass("selected"); + $(e.target).addClass("selected"); + self.hideBdSettingsPane(); + }); + let changeLogBtn = $(".ui-tab-bar-item:contains('Change Log')"); + let bdBtn = $("
", { + class: 'ui-tab-bar-item', + text: 'BetterDiscord', + click: function() { + $(".ui-tab-bar-item").removeClass("selected"); + $(this).addClass("selected"); + self.showBdSettingsPane(); + } + }); + let separator = $("
", { + class: 'ui-tab-bar-separator margin-top-8 margin-bottom-8' + }); + separator.insertBefore(changeLogBtn.prev()); + bdBtn.insertBefore(changeLogBtn.prev()); + + $(".ui-standard-sidebar-view").last().append(self.settingsPaneNew()); + $(".bd-pane").hide(); + $(".bd-pane").first().show(); + $(".bd-tab").removeClass("selected"); + $("#bd-core").addClass("selected"); + $("#bd-settingspane").hide(); + + $(".ui-standard-sidebar-view>.sidebar-region").append(self.versionInfo());*/ + + return true; +}; + +SettingsPanel.prototype.versionInfo = function() { + let self = this; + let element = $("
", { + class: 'bd-versioninfo-wrapper' + }).append($("", { + text: `BetterDiscord v${(typeof(version) === "undefined" ? bdVersion : version)}:${jsVersion} by ` + })).append($("", { + text: 'Jiiks', + href: 'https://google.com', + target: '_blank' + })); + return element; +} + +SettingsPanel.prototype.tabBarNew = function() { + let self = this; + let _tabBar = $("
", { + class: 'tab-bar TOP', + style: 'border-bottom:none' + }); + + let items = [ + { 'id': 'bd-core', 'text': 'Core' }, + { 'id': 'bd-emotes', 'text': 'Emotes' }, + { 'id': 'bd-customcss', 'text': 'Custom CSS' }, + { 'id': 'bd-plugins', 'text': 'Plugins' }, + { 'id': 'bd-themes', 'text': 'Themes' } + ]; + + items.map(value => { + _tabBar.append($("
", { + class: 'tab-bar-item bd-tab', + text: value.text, + id: value.id, + click: () => self.changeTabNew(value.id) + })); + }); + + return _tabBar; +} + +SettingsPanel.prototype.changeTabNew = function(id) { + $(".bd-tab").removeClass("selected"); + $(`#${id}`).addClass("selected"); + $(".bd-pane").hide(); + $(`#${id}-pane`).show(); + + if(id === 'bd-customcss') { + if (!customCssInitialized) { + customCssEditor.init(); + customCssInitialized = true; + } + } + +} + +SettingsPanel.prototype.updateSettingNew = function (id, checked) { + + if(id == "bda-css-2") { + $("#app-mount").removeClass("bd-hide-bd"); + customCssEditor.hideBackdrop = checked; + if(checked) { + $("#app-mount").addClass("bd-hide-bd") + } + } + if(id == "bda-gs-8" && checked) { + mainCore.alert("Developer Mode Enabled", "Use F8 to break/resume execution
More coming soon") + } + + settingsCookie[id] = checked; + + this.updateSettings(); +}; + +SettingsPanel.prototype.settingsSwitch = function(key) { + let self = this; + let setting = settings[key]; + return $("
", { + class: 'ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item' + }).append($("
", { + class: 'ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap' + }).append($("

", { + class: 'ui-form-title h3 margin-reset margin-reset ui-flex-child', + text: key + })).append($("