From 29303ea92a8e59cebbb6d9f2ffde04f9505ee751 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Sun, 1 May 2016 00:25:14 +0300 Subject: [PATCH] New alert modal and support for 0.2.8 vars --- js/main.js | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/js/main.js b/js/main.js index bc7fcd06..c96b97a8 100644 --- a/js/main.js +++ b/js/main.js @@ -2,7 +2,7 @@ * Version: 1.53 * Author: Jiiks | http://jiiks.net * Date: 27/08/2015 - 16:36 - * Last Update: 02/04/2016 + * Last Update: 01/05/2016 * https://github.com/Jiiks/BetterDiscordApp */ var settingsPanel, emoteModule, utils, quickEmoteMenu, opublicServers, voiceMode, pluginModule, themeModule, customCssEditor; @@ -143,8 +143,10 @@ function Core() {} Core.prototype.init = function () { var self = this; - if (version < supportedVersion) { - this.alert("Not Supported", "BetterDiscord v" + version + "(your version)" + " is not supported by the latest js(" + jsVersion + ").

Please download the latest version from BetterDiscord.net"); + var lVersion = (typeof(version) === "undefined") ? bdVersion : version; + + if (lVersion < supportedVersion) { + this.alert("Not Supported", "BetterDiscord v" + lVersion + "(your version)" + " is not supported by the latest js(" + jsVersion + ").

Please download the latest version from BetterDiscord.net"); return; } @@ -379,18 +381,31 @@ Core.prototype.constructChangelog = function () { }; Core.prototype.alert = function (title, text) { - $("body").append('' + - '
' + - '
' + - ' ' + title + '' + - '
×
' + - '
' + - '
' + - '
' + - '
' + text + '
' + - '
' + - '
' + - '
'); + var id = 'bdalert-'; + for( var i=0; i < 5; i++ ) + id += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(Math.random() * "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".length)); + var bdAlert = '\ +
\ +
\ +
\ +
\ + BetterDiscord - '+title+'\ + \ + \ +
\ +
\ +
'+text+'
\ +
\ +
\ + for support.\ + #support\ + Join \ +
\ +
\ +
\ +
\ + '; + $("body").append(bdAlert); }; /* BetterDiscordApp EmoteModule JavaScript @@ -1496,7 +1511,7 @@ SettingsPanel.prototype.construct = function () { ' ' + ' ' + '
' + - ' BetterDiscord v' + version + '(JSv' + jsVersion + ') by Jiiks' + + ' BetterDiscord v' + ((typeof(version) == "undefined") ? bdVersion : version) + '(JSv' + jsVersion + ') by Jiiks' + ' BetterDiscord.net' + '
' + '';