diff --git a/js/main.js b/js/main.js index 5d600a9f..c03d82cf 100644 --- a/js/main.js +++ b/js/main.js @@ -6,7 +6,7 @@ * https://github.com/Jiiks/BetterDiscordApp */ var settingsPanel, emoteModule, utils, quickEmoteMenu, opublicServers, voiceMode, pluginModule, themeModule, customCssEditor; -var jsVersion = 1.64; +var jsVersion = 1.70; var supportedVersion = "0.2.5"; var mainObserver; @@ -29,8 +29,10 @@ var settings = { "Dark Mode": { "id": "bda-gs-5", "info": "Make certain elements dark by default(wip)", "implemented": true, "hidden": false, "cat": "core"}, "Override Default Emotes": { "id": "bda-es-5", "info": "Override default emotes", "implemented": false, "hidden": false, "cat": "core"}, "Voice Disconnect": { "id": "bda-dc-0", "info": "Disconnect from voice server when closing Discord", "implemented": true, "hidden": false, "cat": "core"}, - "Custom css live update": { "id": "bda-css-0", "info": "", "implemented": true, "hidden": true , "cat": "core"}, - "Custom css auto udpate": { "id": "bda-css-1", "info": "", "implemented": true, "hidden": true , "cat": "core"}, + "Custom css live update": { "id": "bda-css-0", "info": "", "implemented": true, "hidden": true, "cat": "core"}, + "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"}, "Show Emotes": { "id": "bda-es-7", "info": "Show any emotes", "implemented": true, "hidden": false, "cat": "emote"}, "FrankerFaceZ Emotes": { "id": "bda-es-1", "info": "Show FrankerFaceZ Emotes", "implemented": true, "hidden": false, "cat": "emote"}, @@ -39,7 +41,7 @@ var settings = { "Emoji Menu": { "id": "bda-es-9", "info": "Show Discord emoji menu", "implemented": true, "hidden": false, "cat": "emote"}, "Emote Autocomplete": { "id": "bda-es-3", "info": "Autocomplete emote commands", "implemented": false, "hidden": false, "cat": "emote"}, "Emote Auto Capitalization": { "id": "bda-es-4", "info": "Autocapitalize emote commands", "implemented": true, "hidden": false, "cat": "emote"}, - "Show Names": { "id": "bda-es-6", "info": "Show emote names on hover", "implemented": true, "hidden": false, "cat": "emote"}, + "Show Names": { "id": "bda-es-6", "info": "Show emote names trueon hover", "implemented": true, "hidden": false, "cat": "emote"}, "Show emote modifiers": { "id": "bda-es-8", "info": "Enable emote mods", "implemented": true, "hidden": false, "cat": "emote"}, }; @@ -57,6 +59,8 @@ var defaultCookie = { "bda-gs-3": false, "bda-gs-4": false, "bda-gs-5": true, + "bda-gs-6": false, + "bda-gs-7": false, "bda-es-0": true, "bda-es-1": true, "bda-es-2": true, @@ -77,14 +81,29 @@ var defaultCookie = { var bdchangelog = { "changes": { "028s": { - "title": "v1.64 : 0.2.8 Support", - "text": "Added support for Core version 0.2.8", + "title": "v1.70 : 0.2.8 Support", + "text": "Added support for Core version 0.2.8.", + "img": "" + }, + "importexport": { + "title": "v1.70 : Setting Import/Export", + "text": "You can now import and export your settings!", "img": "" }, "infscroll": { - "title": "v1.64 : Public Server List Infinite Scroll", + "title": "v1.70 : Public Server List Infinite Scroll", "text": "Public server list now has the ability to load more than 20 servers.", "img": "" + }, + "tstamps": { + "title": "v1.70 : 24 hour timestamps", + "text": "Replace 12 hour timestamp with 24 hour timestamps!", + "img": "" + }, + "ctext": { + "title": "v1.70 : Coloured text", + "text": "Make text colour the same as role colour!", + "img": "" } }, "fixes": { @@ -169,6 +188,11 @@ Core.prototype.init = function () { $('.btn.btn-disconnect').click(); } }); + + $(document).on("mousedown", function(e) { + //bd modal hiders + + }); opublicServers.init(); @@ -244,6 +268,38 @@ Core.prototype.initObserver = function () { if (mutation.target.getAttribute('class').indexOf('scroller messages') != -1) { if (typeof pluginModule !== "undefined") pluginModule.newMessage(); } + + if(settingsCookie["bda-gs-6"]) { + $(".timestamp").not("[data-24]").each(function() { + var t = $(this); + t.attr("data-24", true); + var text = t.text(); + var matches = /(.*)?at\s+(\d{1,2}):(\d{1,2})\s+(.*)/.exec(text); + if(matches == null) return true; + if(matches.length < 5) return true; + + var h = parseInt(matches[2]); + if(matches[4] == "AM") { + if(h == 12) h -= 12; + }else if(matches[4] == "PM") { + if(h < 12) h += 12; + } + + matches[2] = ('0' + h).slice(-2); + t.text(matches[1] + matches[2] + ":" + matches[3]); + }); + } + if(settingsCookie["bda-gs-7"]) { + $(".user-name").not("[data-colour]").each(function() { + var t = $(this); + var color = t.css("color"); + if(color == "rgb(255, 255, 255)") return true; + t.closest(".message-group").find(".markup").not("[data-colour]").each(function() { + $(this).attr("data-colour", true); + $(this).css("color", color); + }); + }); + } } emoteModule.obsCallback(mutation); }); @@ -341,31 +397,32 @@ Core.prototype.constructChangelog = function () { }; Core.prototype.alert = function (title, text) { - var id = 'bdalert-'; + var id = ''; for( var i=0; i < 5; i++ ) id += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(Math.random() * "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".length)); var bdAlert = '\ -