From a89d722edb7fc94ec88fb87aeb327745af5b61a7 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Fri, 27 Nov 2015 02:14:33 +0200 Subject: [PATCH] JS v1.4 New settings menu --- js/main.js | 324 ++++++++++++++++++++++++++++++++++--------------- js/main.min.js | 2 +- 2 files changed, 229 insertions(+), 97 deletions(-) diff --git a/js/main.js b/js/main.js index ca37d99c..76f6ce1a 100644 --- a/js/main.js +++ b/js/main.js @@ -6,16 +6,9 @@ * https://github.com/Jiiks/BetterDiscordApp */ -/* - * =Changelog= - * -v1.5 - * --Synchronized loading - * --jsv 1.3 - * --Voice mode - */ var settingsPanel, emoteModule, utils, quickEmoteMenu, opublicServers, voiceMode; -var jsVersion = 1.3; +var jsVersion = 1.4; var supportedVersion = "0.1.5"; var mainObserver; @@ -31,11 +24,12 @@ var mainCore; var settings = { "Save logs locally": { "id": "bda-gs-0", "info": "Saves chat logs locally", "implemented":false }, - "Public Servers": { "id": "bda-gs-1", "info": "BETA : Display public servers button", "implemented":true}, + "Public Servers": { "id": "bda-gs-1", "info": "Display public servers button", "implemented":true}, "Minimal Mode": { "id": "bda-gs-2", "info": "Hide elements and reduce the size of elements.", "implemented":true}, "Voice Mode": { "id": "bda-gs-4", "info": "Only show voice chat", "implemented":true}, "Hide Channels": { "id": "bda-gs-3", "info": "Hide channels in minimal mode", "implemented":true}, "Quick Emote Menu": { "id": "bda-es-0", "info": "Show quick emote menu for adding emotes", "implemented":true }, + "Show Emotes": { "id": "bda-es-7", "info": "Show any emotes", "implemented":true}, "FrankerFaceZ Emotes": { "id": "bda-es-1", "info": "Show FrankerFaceZ Emotes", "implemented":true }, "BetterTTV Emotes": { "id": "bda-es-2", "info": "Show BetterTTV Emotes", "implemented":true }, "Emote Autocomplete": { "id": "bda-es-3", "info": "Autocomplete emote commands", "implemented":false }, @@ -44,6 +38,12 @@ var settings = { "Show Names": { "id": "bda-es-6", "info": "Show emote names on hover", "implemented": true} }; +var links = { + "Jiiks.net": { "text": "Jiiks.net", "href": "http://jiiks.net", "target": "_blank" }, + "twitter": { "text": "Twitter", "href": "http://twitter.com/jiiksi", "target": "_blank" }, + "github": { "text": "Github", "href": "http://github.com/jiiks", "target": "_blank" } +}; + var defaultCookie = { "version":jsVersion, "bda-gs-0":false, @@ -57,7 +57,8 @@ var defaultCookie = { "bda-es-3":false, "bda-es-4":false, "bda-es-5":true, - "bda-es-6":true + "bda-es-6":true, + "bda-es-7":true }; var settingsCookie = {}; @@ -90,7 +91,7 @@ Core.prototype.init = function() { var guilds = $(".guilds li:first-child"); guilds.after($("
  • ", { 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" }))))); - guilds.after($("
  • ", {id:"tc-settings-li"}).append($("
    ", { class: "guild-inner" }).append($("").append($("
    ", { class: "avatar-small", id: "tc-settings-button" }))))); + // guilds.after($("
  • ", {id:"tc-settings-li"}).append($("
    ", { class: "guild-inner" }).append($("").append($("
    ", { class: "avatar-small", id: "tc-settings-button" }))))); settingsPanel = new SettingsPanel(); settingsPanel.init(); @@ -194,6 +195,8 @@ EmoteModule.prototype.getBlacklist = function() { EmoteModule.prototype.obsCallback = function(mutation) { var self = this; + if(!settingsCookie["bda-es-7"]) return; + for(var i = 0 ; i < mutation.addedNodes.length ; ++i) { var next = mutation.addedNodes.item(i); if(next) { @@ -584,60 +587,28 @@ QuickEmoteMenu.prototype.initEmoteList = function() { }; /* BetterDiscordApp Settings Panel JavaScript - * Version: 1.3 + * Version: 2.0 * Author: Jiiks | http://jiiks.net * Date: 26/08/2015 - 11:54 - * Last Update: 30/08/2015 - 12:16 + * Last Update: 27/11/2015 - 00:50 * https://github.com/Jiiks/BetterDiscordApp */ -var links = { "Jiiks.net": "http://jiiks.net", "Twitter": "http://twitter.com/jiiksi", "Github": "https://github.com/jiiks" }; +var settingsButton = null; +var panel = null; function SettingsPanel() { } -SettingsPanel.prototype.getPanel = function() { - return this.tcSettingsPanel; -}; - SettingsPanel.prototype.init = function() { var self = this; + + self.construct(); + + var body = $("body"); - this.tcSettingsPanel = $("
    ", { id: "tc-settings-panel", style: "display:none" }); - this.getPanel().append($("
    ", { id: "tc-settings-panel-header" }).append($("

    ", { text: "BetterDiscord - Settings" })).append($("", { id: "tc-settings-close", text: "X", style:"cursor:pointer;" }))); - - var settingsList = $("