Revert changes for now
This commit is contained in:
parent
9d50d8c1c8
commit
7be821f9a5
265
dev/js/00core.js
265
dev/js/00core.js
|
@ -1,265 +0,0 @@
|
||||||
/* BetterDiscordApp Core JavaScript
|
|
||||||
* Version: 1.53
|
|
||||||
* Author: Jiiks | http://jiiks.net
|
|
||||||
* Date: 27/08/2015 - 16:36
|
|
||||||
* Last Update: 02/04/2016
|
|
||||||
* https://github.com/Jiiks/BetterDiscordApp
|
|
||||||
*/
|
|
||||||
|
|
||||||
var BD;
|
|
||||||
|
|
||||||
function Core() {
|
|
||||||
BD = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
Core.prototype.init = function () {
|
|
||||||
var self = this;
|
|
||||||
this.version = version;
|
|
||||||
|
|
||||||
if (this.version < bdConfig.versionInfo.supportedVersion) {
|
|
||||||
this.alert("Not Supported", "BetterDiscord v" + this.version + "(your version)" + " is not supported by the latest js(" + bdConfig.versionInfo.version + ").<br><br> Please download the latest version from <a href='https://betterdiscord.net' target='_blank'>BetterDiscord.net</a>");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.modules = {
|
|
||||||
emoteModule: new EmoteModule(),
|
|
||||||
publicServers: new PublicServers(),
|
|
||||||
emoteMenu: new QuickEmoteMenu(),
|
|
||||||
cssEditor: new customCssEditor(),
|
|
||||||
settingsPanel: new SettingsPanel(),
|
|
||||||
utils: new Utils(),
|
|
||||||
voiceMode: new VoiceMode(),
|
|
||||||
pluginModule: new pluginModule(),
|
|
||||||
themeModule: new ThemeModule()
|
|
||||||
}
|
|
||||||
|
|
||||||
this.modules.utils.getHash();
|
|
||||||
|
|
||||||
this.modules.emoteModule.init();
|
|
||||||
|
|
||||||
this.initSettings();
|
|
||||||
this.initObserver();
|
|
||||||
|
|
||||||
|
|
||||||
//Incase were too fast
|
|
||||||
function gwDefer() {
|
|
||||||
self.modules.utils.log(new Date().getTime() + " Defer");
|
|
||||||
|
|
||||||
if ($(".guilds-wrapper .guilds").children().length > 0) {
|
|
||||||
self.modules.utils.log(new Date().getTime() + " Defer Loaded");
|
|
||||||
var guilds = $(".guilds>li:first-child");
|
|
||||||
|
|
||||||
var showChannelsButton = $("<button/>", {
|
|
||||||
class: "btn",
|
|
||||||
id: "bd-show-channels",
|
|
||||||
text: "R",
|
|
||||||
css: {
|
|
||||||
"cursor": "pointer"
|
|
||||||
},
|
|
||||||
click: function () {
|
|
||||||
self.settingsCookie["bda-gs-3"] = false;
|
|
||||||
$("body").removeClass("bd-minimal-chan");
|
|
||||||
self.saveSettings();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".guilds-wrapper").prepend(showChannelsButton);
|
|
||||||
|
|
||||||
self.modules.pluginModule.loadPlugins();
|
|
||||||
|
|
||||||
if (typeof (themesupport2) !== "undefined") {
|
|
||||||
self.modules.themeModule.loadThemes();
|
|
||||||
}
|
|
||||||
|
|
||||||
self.modules.settingsPanel.init();
|
|
||||||
|
|
||||||
self.modules.quickEmoteMenu.init(false);
|
|
||||||
|
|
||||||
window.addEventListener("beforeunload", function(){
|
|
||||||
if(self.settingsCookie["bda-dc-0"]){
|
|
||||||
$('.btn.btn-disconnect').click();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
self.modules.publicServers.init();
|
|
||||||
self.modules.emoteModule.autoCapitalize();
|
|
||||||
|
|
||||||
/*Display new features in BetterDiscord*/
|
|
||||||
if (self.settingsCookie["version"] < bdConfig.versionInfo.version) {
|
|
||||||
var cl = self.constructChangelog();
|
|
||||||
$("body").append(cl);
|
|
||||||
self.settingsCookie["version"] = bdConfig.versionInfo.version;
|
|
||||||
self.saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
$("head").append("<style>.CodeMirror{ min-width:100%; }</style>");
|
|
||||||
$("head").append('<style id="bdemotemenustyle"></style>');
|
|
||||||
|
|
||||||
} else {
|
|
||||||
setTimeout(gwDefer, 100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
|
||||||
setTimeout(gwDefer, 1000);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Core.prototype.initSettings = function () {
|
|
||||||
if ($.cookie("better-discord") == undefined) {
|
|
||||||
this.settingsCookie = bdConfig.defaults;
|
|
||||||
this.saveSettings();
|
|
||||||
} else {
|
|
||||||
this.loadSettings();
|
|
||||||
|
|
||||||
for (var setting in defaultCookie) {
|
|
||||||
if (this.settingsCookie[setting] == undefined) {
|
|
||||||
this.settingsCookie[setting] = bdConfig.defaults[setting];
|
|
||||||
this.saveSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Core.prototype.saveSettings = function () {
|
|
||||||
$.cookie("better-discord", JSON.stringify(this.settingsCookie), {
|
|
||||||
expires: 365,
|
|
||||||
path: '/'
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Core.prototype.loadSettings = function () {
|
|
||||||
this.settingsCookie = JSON.parse($.cookie("better-discord"));
|
|
||||||
};
|
|
||||||
|
|
||||||
Core.prototype.initObserver = function () {
|
|
||||||
var self = this;
|
|
||||||
this.observer = new MutationObserver(function (mutations) {
|
|
||||||
mutations.forEach(function (mutation) {
|
|
||||||
if($(mutation.target).find(".emoji-picker").length) {
|
|
||||||
var fc = mutation.target.firstChild;
|
|
||||||
if(fc.classList.contains("popout")) {
|
|
||||||
self.modules.quickEmoteMenu.obsCallback($(fc));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (typeof pluginModule !== "undefined") self.modules.pluginModule.rawObserver(mutation);
|
|
||||||
if (mutation.target.getAttribute('class') != null) {
|
|
||||||
//console.log(mutation.target)
|
|
||||||
if(mutation.target.classList.contains('title-wrap') || mutation.target.classList.contains('chat')){
|
|
||||||
// quickEmoteMenu.obsCallback();
|
|
||||||
self.modules.voiceMode.obsCallback();
|
|
||||||
if (typeof pluginModule !== "undefined") self.modules.pluginModule.channelSwitch();
|
|
||||||
}
|
|
||||||
if (mutation.target.getAttribute('class').indexOf('scroller messages') != -1) {
|
|
||||||
if (typeof self.modules.pluginModule !== "undefined") self.modules.pluginModule.newMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.modules.emoteModule.obsCallback(mutation);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//noinspection JSCheckFunctionSignatures
|
|
||||||
mainObserver.observe(document, {
|
|
||||||
childList: true,
|
|
||||||
subtree: true
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Core.prototype.constructChangelog = function () {
|
|
||||||
var changeLog = '' +
|
|
||||||
'<div id="bd-wn-modal" class="modal" style="opacity:1;">' +
|
|
||||||
' <div class="modal-inner">' +
|
|
||||||
' <div id="bdcl" class="markdown-modal change-log"> ' +
|
|
||||||
' <div class="markdown-modal-header">' +
|
|
||||||
' <strong>What\'s new in BetterDiscord JS' + jsVersion + '</strong>' +
|
|
||||||
' <button class="markdown-modal-close" onclick=\'$("#bd-wn-modal").remove();\'></button>' +
|
|
||||||
' </div><!--header-->' +
|
|
||||||
' <div class="scroller-wrap">' +
|
|
||||||
' <div class="scroller">';
|
|
||||||
|
|
||||||
if (bdConfig.changelog.changes != null) {
|
|
||||||
changeLog += '' +
|
|
||||||
'<h1 class="changelog-added">' +
|
|
||||||
' <span>New Stuff</span>' +
|
|
||||||
'</h1>' +
|
|
||||||
'<ul>';
|
|
||||||
|
|
||||||
for (var change in bdConfig.changelog.changes) {
|
|
||||||
change = bdConfig.changelog.changes[change];
|
|
||||||
|
|
||||||
changeLog += '' +
|
|
||||||
'<li>' +
|
|
||||||
' <strong>' + change.title + '</strong>' +
|
|
||||||
' <div>' + change.text + '</div>' +
|
|
||||||
'</li>';
|
|
||||||
}
|
|
||||||
|
|
||||||
changeLog += '</ul>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bdConfig.changelog.fixes != null) {
|
|
||||||
changeLog += '' +
|
|
||||||
'<h1 class="changelog-fixed">' +
|
|
||||||
' <span>Fixed</span>' +
|
|
||||||
'</h1>' +
|
|
||||||
'<ul>';
|
|
||||||
|
|
||||||
for (var fix in bdConfig.changelog.fixes) {
|
|
||||||
fix = bdConfig.changelog.fixes[fix];
|
|
||||||
|
|
||||||
changeLog += '' +
|
|
||||||
'<li>' +
|
|
||||||
' <strong>' + fix.title + '</strong>' +
|
|
||||||
' <div>' + fix.text + '</div>' +
|
|
||||||
'</li>';
|
|
||||||
}
|
|
||||||
|
|
||||||
changeLog += '</ul>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bdConfig.changelog.upcoming != null) {
|
|
||||||
changeLog += '' +
|
|
||||||
'<h1 class="changelog-in-progress">' +
|
|
||||||
' <span>Coming Soon</span>' +
|
|
||||||
'</h1>' +
|
|
||||||
'<ul>';
|
|
||||||
|
|
||||||
for (var upc in bdConfig.changelog.upcoming) {
|
|
||||||
upc = bdConfig.changelog.upcoming[upc];
|
|
||||||
|
|
||||||
changeLog += '' +
|
|
||||||
'<li>' +
|
|
||||||
' <strong>' + upc.title + '</strong>' +
|
|
||||||
' <div>' + upc.text + '</div>' +
|
|
||||||
'</li>';
|
|
||||||
}
|
|
||||||
|
|
||||||
changeLog += '</ul>';
|
|
||||||
}
|
|
||||||
|
|
||||||
changeLog += '' +
|
|
||||||
' </div><!--scoller-->' +
|
|
||||||
' </div><!--scroller-wrap-->' +
|
|
||||||
' <div class="footer">' +
|
|
||||||
' </div><!--footer-->' +
|
|
||||||
' </div><!--change-log-->' +
|
|
||||||
' </div><!--modal-inner-->' +
|
|
||||||
'</div><!--modal-->';
|
|
||||||
|
|
||||||
return changeLog;
|
|
||||||
};
|
|
||||||
|
|
||||||
Core.prototype.alert = function (title, text) {
|
|
||||||
$("body").append('' +
|
|
||||||
'<div class="bd-alert">' +
|
|
||||||
' <div class="bd-alert-header">' +
|
|
||||||
' <span>' + title + '</span>' +
|
|
||||||
' <div class="bd-alert-closebtn" onclick="$(this).parent().parent().remove();">×</div>' +
|
|
||||||
' </div>' +
|
|
||||||
' <div class="bd-alert-body">' +
|
|
||||||
' <div class="scroller-wrap dark fade">' +
|
|
||||||
' <div class="scroller">' + text + '</div>' +
|
|
||||||
' </div>' +
|
|
||||||
' </div>' +
|
|
||||||
'</div>');
|
|
||||||
};
|
|
|
@ -1,121 +0,0 @@
|
||||||
var bdConfig = (function() {
|
|
||||||
return {
|
|
||||||
versionInfo: {
|
|
||||||
version: 1.63,
|
|
||||||
supportedVersion: "0.2.5"
|
|
||||||
},
|
|
||||||
defaults: {
|
|
||||||
"version": 1.63,
|
|
||||||
"bda-gs-0": false,
|
|
||||||
"bda-gs-1": true,
|
|
||||||
"bda-gs-2": false,
|
|
||||||
"bda-gs-3": false,
|
|
||||||
"bda-gs-4": false,
|
|
||||||
"bda-gs-5": true,
|
|
||||||
"bda-es-0": true,
|
|
||||||
"bda-es-1": true,
|
|
||||||
"bda-es-2": true,
|
|
||||||
"bda-es-3": false,
|
|
||||||
"bda-es-4": false,
|
|
||||||
"bda-es-5": true,
|
|
||||||
"bda-es-6": true,
|
|
||||||
"bda-es-7": true,
|
|
||||||
"bda-es-8": true,
|
|
||||||
"bda-jd": true,
|
|
||||||
"bda-es-8": true,
|
|
||||||
"bda-dc-0": false,
|
|
||||||
"bda-css-0": false,
|
|
||||||
"bda-css-1": false,
|
|
||||||
"bda-es-9": true
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
"Save logs locally": { "id": "bda-gs-0", "info": "Saves chat logs locally", "implemented": false, "hidden": false, "cat": "core"},
|
|
||||||
"Public Servers": { "id": "bda-gs-1", "info": "Display public servers button", "implemented": true, "hidden": false, "cat": "core"},
|
|
||||||
"Minimal Mode": { "id": "bda-gs-2", "info": "Hide elements and reduce the size of elements.", "implemented": true, "hidden": false, "cat": "core"},
|
|
||||||
"Voice Mode": { "id": "bda-gs-4", "info": "Only show voice chat", "implemented": true, "hidden": false, "cat": "core"},
|
|
||||||
"Hide Channels": { "id": "bda-gs-3", "info": "Hide channels in minimal mode", "implemented": true, "hidden": false, "cat": "core"},
|
|
||||||
"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"},
|
|
||||||
|
|
||||||
"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"},
|
|
||||||
"BetterTTV Emotes": { "id": "bda-es-2", "info": "Show BetterTTV Emotes", "implemented": true, "hidden": false, "cat": "emote"},
|
|
||||||
"Emote Menu": { "id": "bda-es-0", "info": "Show Twitch/Favourite emotes in emote menu", "implemented": true, "hidden": false, "cat": "emote"},
|
|
||||||
"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 emote modifiers": { "id": "bda-es-8", "info": "Enable emote mods", "implemented": true, "hidden": false, "cat": "emote"},
|
|
||||||
},
|
|
||||||
links: {
|
|
||||||
"Jiiks.net": { "text": "Jiiks.net", "href": "https://jiiks.net", "target": "_blank" },
|
|
||||||
"twitter": { "text": "Twitter", "href": "https://twitter.com/jiiksi", "target": "_blank" },
|
|
||||||
"github": { "text": "Github", "href": "https://github.com/jiiks", "target": "_blank" },
|
|
||||||
"betterdiscord.net": { "text": "BetterDiscord.net", "href": "https://betterdiscord.net", "target": "_blank" }
|
|
||||||
},
|
|
||||||
changelog: {
|
|
||||||
"changes": {
|
|
||||||
"darkmode": {
|
|
||||||
"title": "v1.63 : Dark Mode",
|
|
||||||
"text": "Dark mode makes certain elements dark by default(currently only applies to emote menu)",
|
|
||||||
"img": ""
|
|
||||||
},
|
|
||||||
"emotemenu": {
|
|
||||||
"title": "v1.62 : Brand new emote menu that fits in Discord emoji menu!",
|
|
||||||
"text": "The emote menu has been replaced by a new one that injects itself in the Discord emoji menu!",
|
|
||||||
"img": ""
|
|
||||||
},
|
|
||||||
"cccss": {
|
|
||||||
"title": "v1.61 : New custom CSS editor",
|
|
||||||
"text": "The custom CSS editor now has options and can be detached!",
|
|
||||||
"img": ""
|
|
||||||
},
|
|
||||||
"vdc": {
|
|
||||||
"title": "v1.61 : Voice Disconnect",
|
|
||||||
"text": "Disconnect from voice server when closing Discord!",
|
|
||||||
"img": ""
|
|
||||||
},
|
|
||||||
"pslist": {
|
|
||||||
"title": "v1.60 : New public server list!",
|
|
||||||
"text": 'New and shiny public server list powered by <a href="https://www.discordservers.com/" target="_blank">DiscordServers.com</a>!',
|
|
||||||
"img": ""
|
|
||||||
},
|
|
||||||
"api": {
|
|
||||||
"title": "v1.59 : New plugin api callback",
|
|
||||||
"text": "Use the `observer(e)` callback instead of creating your own MutationObserver",
|
|
||||||
"img": ""
|
|
||||||
},
|
|
||||||
"emotemods": {
|
|
||||||
"title": "v1.59 : New emote mods!",
|
|
||||||
"text": "The following emote mods have been added: :shake2, :shake3, :flap",
|
|
||||||
"img": ""
|
|
||||||
},
|
|
||||||
"minmode": {
|
|
||||||
"title": "v1.59: Minimal mode",
|
|
||||||
"text": "Minimal mode embed fixed size has been removed",
|
|
||||||
"img": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"fixes": {
|
|
||||||
"modal": {
|
|
||||||
"title": "v1.62 : Fixed modals",
|
|
||||||
"text": "Fixed broken modal introduced by 0.0.287",
|
|
||||||
"imt": ""
|
|
||||||
},
|
|
||||||
"emotes": {
|
|
||||||
"title": "v1.59 : Native sub emote mods",
|
|
||||||
"text": "Emote mods now work with native sub emotes!",
|
|
||||||
"img": ""
|
|
||||||
},
|
|
||||||
"emotes2": {
|
|
||||||
"title": "v1.59 : Emote mods and custom emotes",
|
|
||||||
"text": "Emote mods will no longer interfere with custom emotes using :",
|
|
||||||
"img": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})();
|
|
141
dev/js/01core.js
141
dev/js/01core.js
|
@ -5,18 +5,43 @@
|
||||||
* Last Update: 02/04/2016
|
* Last Update: 02/04/2016
|
||||||
* https://github.com/Jiiks/BetterDiscordApp
|
* https://github.com/Jiiks/BetterDiscordApp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var BD;
|
|
||||||
|
|
||||||
var settingsPanel, emoteModule, utils, quickEmoteMenu, opublicServers, voiceMode, pluginModule, themeModule, customCssEditor;
|
var settingsPanel, emoteModule, utils, quickEmoteMenu, opublicServers, voiceMode, pluginModule, themeModule, customCssEditor;
|
||||||
var jsVersion = 1.63;
|
var jsVersion = 1.63;
|
||||||
var supportedVersion = "0.2.5";
|
var supportedVersion = "0.2.5";
|
||||||
|
|
||||||
var mainObserver;
|
var mainObserver;
|
||||||
|
|
||||||
|
var twitchEmoteUrlStart = "https://static-cdn.jtvnw.net/emoticons/v1/";
|
||||||
|
var twitchEmoteUrlEnd = "/1.0";
|
||||||
|
var ffzEmoteUrlStart = "https://cdn.frankerfacez.com/emoticon/";
|
||||||
|
var ffzEmoteUrlEnd = "/1";
|
||||||
|
var bttvEmoteUrlStart = "https://cdn.betterttv.net/emote/";
|
||||||
|
var bttvEmoteUrlEnd = "/1x";
|
||||||
|
|
||||||
var mainCore;
|
var mainCore;
|
||||||
|
|
||||||
|
var settings = {
|
||||||
|
"Save logs locally": { "id": "bda-gs-0", "info": "Saves chat logs locally", "implemented": false, "hidden": false, "cat": "core"},
|
||||||
|
"Public Servers": { "id": "bda-gs-1", "info": "Display public servers button", "implemented": true, "hidden": false, "cat": "core"},
|
||||||
|
"Minimal Mode": { "id": "bda-gs-2", "info": "Hide elements and reduce the size of elements.", "implemented": true, "hidden": false, "cat": "core"},
|
||||||
|
"Voice Mode": { "id": "bda-gs-4", "info": "Only show voice chat", "implemented": true, "hidden": false, "cat": "core"},
|
||||||
|
"Hide Channels": { "id": "bda-gs-3", "info": "Hide channels in minimal mode", "implemented": true, "hidden": false, "cat": "core"},
|
||||||
|
"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"},
|
||||||
|
|
||||||
|
"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"},
|
||||||
|
"BetterTTV Emotes": { "id": "bda-es-2", "info": "Show BetterTTV Emotes", "implemented": true, "hidden": false, "cat": "emote"},
|
||||||
|
"Emote Menu": { "id": "bda-es-0", "info": "Show Twitch/Favourite emotes in emote menu", "implemented": true, "hidden": false, "cat": "emote"},
|
||||||
|
"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 emote modifiers": { "id": "bda-es-8", "info": "Enable emote mods", "implemented": true, "hidden": false, "cat": "emote"},
|
||||||
|
};
|
||||||
|
|
||||||
var links = {
|
var links = {
|
||||||
"Jiiks.net": { "text": "Jiiks.net", "href": "http://jiiks.net", "target": "_blank" },
|
"Jiiks.net": { "text": "Jiiks.net", "href": "http://jiiks.net", "target": "_blank" },
|
||||||
|
@ -24,94 +49,6 @@ var links = {
|
||||||
"github": { "text": "Github", "href": "http://github.com/jiiks", "target": "_blank" }
|
"github": { "text": "Github", "href": "http://github.com/jiiks", "target": "_blank" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var bdConfig = (function() {
|
|
||||||
|
|
||||||
return {
|
|
||||||
versionInfo: {
|
|
||||||
version: 1.63,
|
|
||||||
supportedVersion: "0.2.5"
|
|
||||||
},
|
|
||||||
defaults: {
|
|
||||||
"version": 1.63,
|
|
||||||
"bda-gs-0": false,
|
|
||||||
"bda-gs-1": true,
|
|
||||||
"bda-gs-2": false,
|
|
||||||
"bda-gs-3": false,
|
|
||||||
"bda-gs-4": false,
|
|
||||||
"bda-gs-5": true,
|
|
||||||
"bda-es-0": true,
|
|
||||||
"bda-es-1": true,
|
|
||||||
"bda-es-2": true,
|
|
||||||
"bda-es-3": false,
|
|
||||||
"bda-es-4": false,
|
|
||||||
"bda-es-5": true,
|
|
||||||
"bda-es-6": true,
|
|
||||||
"bda-es-7": true,
|
|
||||||
"bda-es-8": true,
|
|
||||||
"bda-jd": true,
|
|
||||||
"bda-es-8": true,
|
|
||||||
"bda-dc-0": false,
|
|
||||||
"bda-css-0": false,
|
|
||||||
"bda-css-1": false,
|
|
||||||
"bda-es-9": true
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
"Save logs locally": { "id": "bda-gs-0", "info": "Saves chat logs locally", "implemented": false, "hidden": false, "cat": "core"},
|
|
||||||
"Public Servers": { "id": "bda-gs-1", "info": "Display public servers button", "implemented": true, "hidden": false, "cat": "core"},
|
|
||||||
"Minimal Mode": { "id": "bda-gs-2", "info": "Hide elements and reduce the size of elements.", "implemented": true, "hidden": false, "cat": "core"},
|
|
||||||
"Voice Mode": { "id": "bda-gs-4", "info": "Only show voice chat", "implemented": true, "hidden": false, "cat": "core"},
|
|
||||||
"Hide Channels": { "id": "bda-gs-3", "info": "Hide channels in minimal mode", "implemented": true, "hidden": false, "cat": "core"},
|
|
||||||
"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"},
|
|
||||||
|
|
||||||
"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"},
|
|
||||||
"BetterTTV Emotes": { "id": "bda-es-2", "info": "Show BetterTTV Emotes", "implemented": true, "hidden": false, "cat": "emote"},
|
|
||||||
"Emote Menu": { "id": "bda-es-0", "info": "Show Twitch/Favourite emotes in emote menu", "implemented": true, "hidden": false, "cat": "emote"},
|
|
||||||
"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 emote modifiers": { "id": "bda-es-8", "info": "Enable emote mods", "implemented": true, "hidden": false, "cat": "emote"},
|
|
||||||
},
|
|
||||||
links: {
|
|
||||||
"Jiiks.net": { "text": "Jiiks.net", "href": "https://jiiks.net", "target": "_blank" },
|
|
||||||
"twitter": { "text": "Twitter", "href": "https://twitter.com/jiiksi", "target": "_blank" },
|
|
||||||
"github": { "text": "Github", "href": "https://github.com/jiiks", "target": "_blank" },
|
|
||||||
"betterdiscord.net": { "text": "BetterDiscord.net", "href": "https://betterdiscord.net", "target": "_blank" }
|
|
||||||
},
|
|
||||||
urls: {
|
|
||||||
twitch: {
|
|
||||||
home: "https://twitch.tv/",
|
|
||||||
emotes: {
|
|
||||||
start: "https://static-cdn.jtvnw.net/emoticons/v1/",
|
|
||||||
end: "/1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
bttv: {
|
|
||||||
home: "https://betterttv.net",
|
|
||||||
emotes: {
|
|
||||||
start: "https://cdn.betterttv.net/emote/",
|
|
||||||
end: "/1x"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
ffz: {
|
|
||||||
home: "https://frankerfacez.com/",
|
|
||||||
emotes: {
|
|
||||||
start: "https://cdn.frankerfacez.com/emoticon/",
|
|
||||||
end: "/1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
|
||||||
|
|
||||||
|
|
||||||
var defaultCookie = {
|
var defaultCookie = {
|
||||||
"version": jsVersion,
|
"version": jsVersion,
|
||||||
"bda-gs-0": false,
|
"bda-gs-0": false,
|
||||||
|
@ -129,7 +66,7 @@ var defaultCookie = {
|
||||||
"bda-es-6": true,
|
"bda-es-6": true,
|
||||||
"bda-es-7": true,
|
"bda-es-7": true,
|
||||||
"bda-es-8": true,
|
"bda-es-8": true,
|
||||||
"bda-jd": true,
|
"bda-jd": true,
|
||||||
"bda-es-8": true,
|
"bda-es-8": true,
|
||||||
"bda-dc-0": false,
|
"bda-dc-0": false,
|
||||||
"bda-css-0": false,
|
"bda-css-0": false,
|
||||||
|
@ -201,22 +138,19 @@ var bdchangelog = {
|
||||||
|
|
||||||
var settingsCookie = {};
|
var settingsCookie = {};
|
||||||
|
|
||||||
function Core() {
|
function Core() {}
|
||||||
BD = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
Core.prototype.init = function () {
|
Core.prototype.init = function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.version = version;
|
|
||||||
this.jsVersion = jsVersion;
|
if (version < supportedVersion) {
|
||||||
if (this.version < supportedVersion) {
|
this.alert("Not Supported", "BetterDiscord v" + version + "(your version)" + " is not supported by the latest js(" + jsVersion + ").<br><br> Please download the latest version from <a href='https://betterdiscord.net' target='_blank'>BetterDiscord.net</a>");
|
||||||
this.alert("Not Supported", "BetterDiscord v" + this.version + "(your version)" + " is not supported by the latest js(" + this.jsVersion + ").<br><br> Please download the latest version from <a href='https://betterdiscord.net' target='_blank'>BetterDiscord.net</a>");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.utils = new Utils();
|
|
||||||
|
|
||||||
utils = new Utils();
|
utils = new Utils();
|
||||||
|
var sock = new BdWSocket();
|
||||||
|
sock.start();
|
||||||
utils.getHash();
|
utils.getHash();
|
||||||
emoteModule = new EmoteModule();
|
emoteModule = new EmoteModule();
|
||||||
quickEmoteMenu = new QuickEmoteMenu();
|
quickEmoteMenu = new QuickEmoteMenu();
|
||||||
|
@ -327,6 +261,7 @@ Core.prototype.loadSettings = function () {
|
||||||
settingsCookie = JSON.parse($.cookie("better-discord"));
|
settingsCookie = JSON.parse($.cookie("better-discord"));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var botlist = ["119598467310944259"]; //Temp
|
||||||
Core.prototype.initObserver = function () {
|
Core.prototype.initObserver = function () {
|
||||||
mainObserver = new MutationObserver(function (mutations) {
|
mainObserver = new MutationObserver(function (mutations) {
|
||||||
mutations.forEach(function (mutation) {
|
mutations.forEach(function (mutation) {
|
||||||
|
@ -456,8 +391,4 @@ Core.prototype.alert = function (title, text) {
|
||||||
' </div>' +
|
' </div>' +
|
||||||
' </div>' +
|
' </div>' +
|
||||||
'</div>');
|
'</div>');
|
||||||
};
|
|
||||||
|
|
||||||
Core.prototype.getUtils = function() {
|
|
||||||
return this.utils;
|
|
||||||
};
|
};
|
|
@ -1,274 +0,0 @@
|
||||||
/* BetterDiscordApp EmoteModule JavaScript
|
|
||||||
* Version: 1.5
|
|
||||||
* Author: Jiiks | http://jiiks.net
|
|
||||||
* Date: 26/08/2015 - 15:29
|
|
||||||
* Last Update: 14/10/2015 - 09:48
|
|
||||||
* https://github.com/Jiiks/BetterDiscordApp
|
|
||||||
* Note: Due to conflicts autocapitalize only supports global emotes
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* =Changelog=
|
|
||||||
* -v1.5
|
|
||||||
* --Twitchemotes.com api
|
|
||||||
*/
|
|
||||||
|
|
||||||
function EmoteModule() {
|
|
||||||
this.blacklist = [];
|
|
||||||
this.spoilered = [];
|
|
||||||
this.emotes = {
|
|
||||||
twitchGlobal: emotesTwitch,
|
|
||||||
twitchSub: subEmotesTwitch,
|
|
||||||
bttvGlobal: emotesBTTV,
|
|
||||||
bttvUser: emotesBTTV2,
|
|
||||||
ffz: emotesFfz
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
EmoteModule.prototype.init = function () {
|
|
||||||
this.config = {
|
|
||||||
twitch: {
|
|
||||||
url: {
|
|
||||||
start: "https://static-cdn.jtvnw.net/emoticons/v1/",
|
|
||||||
end: "/1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
ffz: {
|
|
||||||
url: {
|
|
||||||
start: "https://cdn.frankerfacez.com/emoticon/",
|
|
||||||
end: "/1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
bttv: {
|
|
||||||
url: {
|
|
||||||
start: "https://cdn.betterttv.net/emote/",
|
|
||||||
end: "/1x"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EmoteModule.prototype.getBlacklist = function () {
|
|
||||||
var self = this;
|
|
||||||
$.getJSON("https://cdn.rawgit.com/Jiiks/betterDiscordApp/" + _hash + "/data/emotefilter.json", function (data) {
|
|
||||||
self.blacklist = data.blacklist;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
EmoteModule.prototype.obsCallback = function (mutation) {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
if (!BD.settingsCookie["bda-es-7"]) return;
|
|
||||||
|
|
||||||
$(".emoji").each(function () {
|
|
||||||
var t = $(this);
|
|
||||||
if (t.attr("src").indexOf(".png") != -1) {
|
|
||||||
|
|
||||||
var next = t.next();
|
|
||||||
var newText = t.attr("alt");
|
|
||||||
if(next.size() > 0) {
|
|
||||||
if(next.prop("tagName") == "SPAN") {
|
|
||||||
newText += next.text();
|
|
||||||
next.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(t.parent().prop("tagName") != "SPAN") {
|
|
||||||
t.replaceWith("<span>" + newText + "</span>");
|
|
||||||
} else {
|
|
||||||
t.replaceWith(newText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
for (var i = 0; i < mutation.addedNodes.length; ++i) {
|
|
||||||
var next = mutation.addedNodes.item(i);
|
|
||||||
if (next) {
|
|
||||||
var nodes = self.getNodes(next);
|
|
||||||
for (var node in nodes) {
|
|
||||||
if (nodes.hasOwnProperty(node)) {
|
|
||||||
self.injectEmote(nodes[node]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EmoteModule.prototype.getNodes = function (node) {
|
|
||||||
var next;
|
|
||||||
var nodes = [];
|
|
||||||
|
|
||||||
var treeWalker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT, null, false);
|
|
||||||
|
|
||||||
while (next = treeWalker.nextNode()) {
|
|
||||||
nodes.push(next);
|
|
||||||
}
|
|
||||||
|
|
||||||
return nodes;
|
|
||||||
};
|
|
||||||
|
|
||||||
EmoteModule.prototype.injectEmote = function (node) {
|
|
||||||
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
if (typeof emotesTwitch === 'undefined') return;
|
|
||||||
|
|
||||||
if (!node.parentElement) return;
|
|
||||||
|
|
||||||
var parent = node.parentElement;
|
|
||||||
|
|
||||||
if (parent.tagName != "SPAN") return;
|
|
||||||
if (!$(parent.parentElement).hasClass("markup") && !$(parent.parentElement).hasClass("message-content")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var edited = false;
|
|
||||||
|
|
||||||
if ($(parent.parentElement).hasClass("edited")) {
|
|
||||||
parent = parent.parentElement.parentElement.firstChild;
|
|
||||||
edited = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function inject() {
|
|
||||||
var parentInnerHTML = parent.innerHTML;
|
|
||||||
var words = parentInnerHTML.split(/\s+/g);
|
|
||||||
|
|
||||||
if (!words) return;
|
|
||||||
|
|
||||||
words.some(function (word) {
|
|
||||||
if (word.slice(0, 4) == "[!s]") {
|
|
||||||
|
|
||||||
parentInnerHTML = parentInnerHTML.replace("[!s]", "");
|
|
||||||
var markup = $(parent).parent();
|
|
||||||
var reactId = markup.attr("data-reactid");
|
|
||||||
|
|
||||||
if (self.spoilered.indexOf(reactId) > -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
markup.addClass("spoiler");
|
|
||||||
markup.on("click", function () {
|
|
||||||
$(this).removeClass("spoiler");
|
|
||||||
self.spoilered.push($(this).attr("data-reactid"));
|
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (word.length < 4) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (word == "ClauZ") {
|
|
||||||
parentInnerHTML = parentInnerHTML.replace("ClauZ", '<img src="https://cdn.frankerfacez.com/emoticon/70852/1" style="width:25px; transform:translate(-29px, -14px);"></img>');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var useEmoteCss = false;
|
|
||||||
var sWord = word;
|
|
||||||
var emoteClass = "";
|
|
||||||
var allowedClasses = ["emoteflip", "emotespin", "emotepulse", "emotespin2", "emotespin3", "emote1spin", "emote2spin", "emote3spin", "emotetr", "emotebl", "emotebr", "emoteshake", "emoteshake2", "emoteshake3", "emoteflap"];
|
|
||||||
if(word.indexOf(":") > -1) {
|
|
||||||
var split = word.split(/:(?!.*:)/);
|
|
||||||
if (split[0] != "" && split[1] != "") {
|
|
||||||
userEmoteCss = true;
|
|
||||||
sWord = split[0];
|
|
||||||
if(BD.settingsCookie["bda-es-8"]) {
|
|
||||||
emoteClass = "emote" + split[1];
|
|
||||||
if(allowedClasses.indexOf(emoteClass) < 0) {
|
|
||||||
emoteClass = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($.inArray(sWord, self.blacklist) != -1) return;
|
|
||||||
|
|
||||||
var len = Math.round(sWord.length / 4);
|
|
||||||
var name = sWord.substr(0, len) + "\uFDD9" + sWord.substr(len, len) + "\uFDD9" + sWord.substr(len * 2, len) + "\uFDD9" + sWord.substr(len * 3);
|
|
||||||
var cfg = self.config;
|
|
||||||
if (self.emotes.twitchGlobal.emotes.hasOwnProperty(sWord)) {
|
|
||||||
var url = cfg.twitch.url.start + self.emotes.twitchGlobal.emotes[sWord].image_id + cfg.twitch.url.end;
|
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self.emotes.twitchSub.hasOwnProperty(sWord)) {
|
|
||||||
var url = cfg.twitch.url.start + self.emotes.twitchSub[sWord] + cfg.twitch.url.end;
|
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof self.emotes.bttvGlobal !== 'undefined' && BD.settingsCookie["bda-es-2"]) {
|
|
||||||
if (self.emotes.bttvGlobal.hasOwnProperty(sWord)) {
|
|
||||||
var url = self.emotes.bttvGlobal[sWord];
|
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof self.emotes.bttvUser !== 'undefined' && BD.settingsCookie["bda-es-2"]) {
|
|
||||||
if (self.emotes.bttvUser.hasOwnProperty(sWord)) {
|
|
||||||
var url = cfg.bttv.url.start + self.emotes.bttvUser[sWord] + cfg.bttv.url.end;
|
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof self.emotes.ffz !== 'undefined' && BD.settingsCookie["bda-es-1"]) {
|
|
||||||
if (self.emotes.ffz.hasOwnProperty(sWord)) {
|
|
||||||
var url = cfg.ffz.url.start + self.emotes.ffz[sWord] + cfg.ffz.url.end;
|
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
if (parent.parentElement == null) return;
|
|
||||||
|
|
||||||
var oldHeight = parent.parentElement.offsetHeight;
|
|
||||||
parent.innerHTML = parentInnerHTML.replace(new RegExp("\uFDD9", "g"), "");
|
|
||||||
var newHeight = parent.parentElement.offsetHeight;
|
|
||||||
|
|
||||||
var scrollPane = $(".scroller.messages").first();
|
|
||||||
scrollPane.scrollTop(scrollPane.scrollTop() + (newHeight - oldHeight));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (edited) {
|
|
||||||
setTimeout(inject, 250);
|
|
||||||
} else {
|
|
||||||
inject();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EmoteModule.prototype.autoCapitalize = function () {
|
|
||||||
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
$('body').delegate($(".channel-textarea-inner textarea"), 'keyup change paste', function () {
|
|
||||||
if (!BD.settingsCookie["bda-es-4"]) return;
|
|
||||||
|
|
||||||
var text = $(".channel-textarea-inner textarea").val();
|
|
||||||
|
|
||||||
if (text == undefined) return;
|
|
||||||
|
|
||||||
var lastWord = text.split(" ").pop();
|
|
||||||
if (lastWord.length > 3) {
|
|
||||||
if (lastWord == "danSgame") return;
|
|
||||||
var ret = self.capitalize(lastWord.toLowerCase());
|
|
||||||
if (ret !== null && ret !== undefined) {
|
|
||||||
$(".channel-textarea-inner textarea").val(text.replace(lastWord, ret));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
EmoteModule.prototype.capitalize = function (value) {
|
|
||||||
var res = this.emotes.twitchGlobal.emotes;
|
|
||||||
for (var p in res) {
|
|
||||||
if (res.hasOwnProperty(p) && value == (p + '').toLowerCase()) {
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -26,28 +26,7 @@ var subEmotesTwitch = {};
|
||||||
|
|
||||||
function EmoteModule() {}
|
function EmoteModule() {}
|
||||||
|
|
||||||
EmoteModule.prototype.init = function () {
|
EmoteModule.prototype.init = function () {};
|
||||||
this.config = {
|
|
||||||
twitch: {
|
|
||||||
url: {
|
|
||||||
start: "https://static-cdn.jtvnw.net/emoticons/v1/",
|
|
||||||
end: "/1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
ffz: {
|
|
||||||
url: {
|
|
||||||
start: "https://cdn.frankerfacez.com/emoticon/",
|
|
||||||
end: "/1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
bttv: {
|
|
||||||
url: {
|
|
||||||
start: "https://cdn.betterttv.net/emote/",
|
|
||||||
end: "/1x"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EmoteModule.prototype.getBlacklist = function () {
|
EmoteModule.prototype.getBlacklist = function () {
|
||||||
$.getJSON("https://cdn.rawgit.com/Jiiks/betterDiscordApp/" + _hash + "/data/emotefilter.json", function (data) {
|
$.getJSON("https://cdn.rawgit.com/Jiiks/betterDiscordApp/" + _hash + "/data/emotefilter.json", function (data) {
|
||||||
|
@ -112,8 +91,6 @@ var spoilered = [];
|
||||||
|
|
||||||
EmoteModule.prototype.injectEmote = function (node) {
|
EmoteModule.prototype.injectEmote = function (node) {
|
||||||
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
if (typeof emotesTwitch === 'undefined') return;
|
if (typeof emotesTwitch === 'undefined') return;
|
||||||
|
|
||||||
if (!node.parentElement) return;
|
if (!node.parentElement) return;
|
||||||
|
@ -186,23 +163,36 @@ EmoteModule.prototype.injectEmote = function (node) {
|
||||||
}
|
}
|
||||||
if ($.inArray(sWord, bemotes) != -1) return;
|
if ($.inArray(sWord, bemotes) != -1) return;
|
||||||
|
|
||||||
var len = Math.round(sWord.length / 4);
|
|
||||||
var name = sWord.substr(0, len) + "\uFDD9" + sWord.substr(len, len) + "\uFDD9" + sWord.substr(len * 2, len) + "\uFDD9" + sWord.substr(len * 3);
|
|
||||||
var cfg = self.config;
|
|
||||||
if (emotesTwitch.emotes.hasOwnProperty(sWord)) {
|
if (emotesTwitch.emotes.hasOwnProperty(sWord)) {
|
||||||
var url = cfg.twitch.url.start + emotesTwitch.emotes[sWord].image_id + cfg.twitch.url.end;
|
var len = Math.round(sWord.length / 4);
|
||||||
|
var name = sWord.substr(0, len) + "\uFDD9" + sWord.substr(len, len) + "\uFDD9" + sWord.substr(len * 2, len) + "\uFDD9" + sWord.substr(len * 3);
|
||||||
|
var url = twitchEmoteUrlStart + emotesTwitch.emotes[sWord].image_id + twitchEmoteUrlEnd;
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subEmotesTwitch.hasOwnProperty(sWord)) {
|
if (subEmotesTwitch.hasOwnProperty(sWord)) {
|
||||||
var url = cfg.twitch.url.start + subEmotesTwitch[sWord] + cfg.twitch.url.end;
|
var len = Math.round(sWord.length / 4);
|
||||||
|
var name = sWord.substr(0, len) + "\uFDD9" + sWord.substr(len, len) + "\uFDD9" + sWord.substr(len * 2, len) + "\uFDD9" + sWord.substr(len * 3);
|
||||||
|
var url = twitchEmoteUrlStart + subEmotesTwitch[sWord] + twitchEmoteUrlEnd;
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof emotesFfz !== 'undefined' && settingsCookie["bda-es-1"]) {
|
||||||
|
if (emotesFfz.hasOwnProperty(sWord)) {
|
||||||
|
var len = Math.round(sWord.length / 4);
|
||||||
|
var name = sWord.substr(0, len) + "\uFDD9" + sWord.substr(len, len) + "\uFDD9" + sWord.substr(len * 2, len) + "\uFDD9" + sWord.substr(len * 3);
|
||||||
|
var url = ffzEmoteUrlStart + emotesFfz[sWord] + ffzEmoteUrlEnd;
|
||||||
|
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof emotesBTTV !== 'undefined' && settingsCookie["bda-es-2"]) {
|
if (typeof emotesBTTV !== 'undefined' && settingsCookie["bda-es-2"]) {
|
||||||
if (emotesBTTV.hasOwnProperty(sWord)) {
|
if (emotesBTTV.hasOwnProperty(sWord)) {
|
||||||
|
var len = Math.round(sWord.length / 4);
|
||||||
|
var name = sWord.substr(0, len) + "\uFDD9" + sWord.substr(len, len) + "\uFDD9" + sWord.substr(len * 2, len) + "\uFDD9" + sWord.substr(len * 3);
|
||||||
var url = emotesBTTV[sWord];
|
var url = emotesBTTV[sWord];
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
||||||
return;
|
return;
|
||||||
|
@ -211,15 +201,9 @@ EmoteModule.prototype.injectEmote = function (node) {
|
||||||
|
|
||||||
if (typeof emotesBTTV2 !== 'undefined' && settingsCookie["bda-es-2"]) {
|
if (typeof emotesBTTV2 !== 'undefined' && settingsCookie["bda-es-2"]) {
|
||||||
if (emotesBTTV2.hasOwnProperty(sWord)) {
|
if (emotesBTTV2.hasOwnProperty(sWord)) {
|
||||||
var url = cfg.bttv.url.start + emotesBTTV2[sWord] + cfg.bttv.url.end;
|
var len = Math.round(sWord.length / 4);
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
var name = sWord.substr(0, len) + "\uFDD9" + sWord.substr(len, len) + "\uFDD9" + sWord.substr(len * 2, len) + "\uFDD9" + sWord.substr(len * 3);
|
||||||
return;
|
var url = bttvEmoteUrlStart + emotesBTTV2[sWord] + bttvEmoteUrlEnd;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof emotesFfz !== 'undefined' && settingsCookie["bda-es-1"]) {
|
|
||||||
if (emotesFfz.hasOwnProperty(sWord)) {
|
|
||||||
var url = cfg.ffz.url.start + emotesFfz[sWord] + cfg.ffz.url.end;
|
|
||||||
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
parentInnerHTML = parentInnerHTML.replace(word, '<div class="emotewrapper"><img class="emote '+emoteClass+'" alt="' + name + '" src="' + url + '"/><input onclick=\'quickEmoteMenu.favorite(\"' + name + '\", \"' + url + '\");\' class="fav" title="Favorite!" type="button"></div>');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,4 +222,4 @@ PublicServers.prototype.joinServer = function (code) {
|
||||||
$(".action.join .btn").click();
|
$(".action.join .btn").click();
|
||||||
$(".create-guild-container input").val(code);
|
$(".create-guild-container input").val(code);
|
||||||
$(".form.join-server .btn-primary").click();
|
$(".form.join-server .btn-primary").click();
|
||||||
};
|
};
|
|
@ -15,7 +15,7 @@ QuickEmoteMenu.prototype.init = function() {
|
||||||
$(document).on("mousedown", function(e) {
|
$(document).on("mousedown", function(e) {
|
||||||
if(e.target.id != "rmenu") $("#rmenu").remove();
|
if(e.target.id != "rmenu") $("#rmenu").remove();
|
||||||
});
|
});
|
||||||
|
this.favoriteEmotes = {};
|
||||||
var fe = localStorage["bdfavemotes"];
|
var fe = localStorage["bdfavemotes"];
|
||||||
if (fe != undefined) {
|
if (fe != undefined) {
|
||||||
this.favoriteEmotes = JSON.parse(atob(fe));
|
this.favoriteEmotes = JSON.parse(atob(fe));
|
||||||
|
|
|
@ -2,10 +2,13 @@
|
||||||
* Version: 2.0
|
* Version: 2.0
|
||||||
* Author: Jiiks | http://jiiks.net
|
* Author: Jiiks | http://jiiks.net
|
||||||
* Date: 26/08/2015 - 11:54
|
* Date: 26/08/2015 - 11:54
|
||||||
* Last Update: 10/04/2016
|
* Last Update: 27/11/2015 - 00:50
|
||||||
* https://github.com/Jiiks/BetterDiscordApp
|
* https://github.com/Jiiks/BetterDiscordApp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var settingsButton = null;
|
||||||
|
var panel = null;
|
||||||
|
|
||||||
function SettingsPanel() {
|
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/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.9.0/mode/css/css.min.js");
|
||||||
|
@ -14,7 +17,7 @@ function SettingsPanel() {
|
||||||
|
|
||||||
SettingsPanel.prototype.init = function () {
|
SettingsPanel.prototype.init = function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.constructPanel();
|
self.construct();
|
||||||
var body = $("body");
|
var body = $("body");
|
||||||
|
|
||||||
if (settingsCookie["bda-es-0"]) {
|
if (settingsCookie["bda-es-0"]) {
|
||||||
|
@ -45,7 +48,7 @@ SettingsPanel.prototype.init = function () {
|
||||||
if (settingsCookie["bda-es-6"]) {
|
if (settingsCookie["bda-es-6"]) {
|
||||||
//Pretty emote titles
|
//Pretty emote titles
|
||||||
emoteNamePopup = $("<div class='tipsy tipsy-se' style='display: block; top: 82px; left: 1630.5px; visibility: visible; opacity: 0.8;'><div class='tipsy-inner'></div></div>");
|
emoteNamePopup = $("<div class='tipsy tipsy-se' style='display: block; top: 82px; left: 1630.5px; visibility: visible; opacity: 0.8;'><div class='tipsy-inner'></div></div>");
|
||||||
$(document).off("mouseover.etitles").on("mouseover.etitles", ".emote", function () {
|
$(document).on("mouseover", ".emote", function () {
|
||||||
var x = $(this).offset();
|
var x = $(this).offset();
|
||||||
var title = $(this).attr("alt");
|
var title = $(this).attr("alt");
|
||||||
$(emoteNamePopup).find(".tipsy-inner").text(title);
|
$(emoteNamePopup).find(".tipsy-inner").text(title);
|
||||||
|
@ -53,40 +56,110 @@ SettingsPanel.prototype.init = function () {
|
||||||
$(emoteNamePopup).css('top', x.top - 32);
|
$(emoteNamePopup).css('top', x.top - 32);
|
||||||
$("div[data-reactid='.0.1.1']").append($(emoteNamePopup));
|
$("div[data-reactid='.0.1.1']").append($(emoteNamePopup));
|
||||||
});
|
});
|
||||||
$(document).off("mouseleave.etitles").on("mouseleave.etitles", ".emote", function () {
|
$(document).on("mouseleave", ".emote", function () {
|
||||||
$(".tipsy").remove();
|
$(".tipsy").remove();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$(document).off("mouseover.etitles");
|
$(document).off('mouseover', '.emote');
|
||||||
$(document).off("mouseleave.etitles");
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsPanel.prototype.changeTab = function(tab) {
|
var customCssInitialized = false;
|
||||||
this.lastTab = tab;
|
var lastTab = "";
|
||||||
tab = $(tab).prop("id");
|
|
||||||
|
SettingsPanel.prototype.changeTab = function (tab) {
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
lastTab = tab;
|
||||||
|
|
||||||
|
var controlGroups = $("#bd-control-groups");
|
||||||
$(".bd-tab").removeClass("selected");
|
$(".bd-tab").removeClass("selected");
|
||||||
$(".bd-pane").hide();
|
$(".bd-pane").hide();
|
||||||
$("#" + tab).addClass("selected");
|
$("#" + tab).addClass("selected");
|
||||||
$("#" + tab.replace("tab", "pane")).show();
|
$("#" + tab.replace("tab", "pane")).show();
|
||||||
|
|
||||||
switch(tab) {
|
switch (tab) {
|
||||||
|
case "bd-settings-tab":
|
||||||
|
break;
|
||||||
case "bd-customcss-tab":
|
case "bd-customcss-tab":
|
||||||
if(!this.customCssInitialized) {
|
if (!customCssInitialized) {
|
||||||
customCssEditor.init();
|
customCssEditor.init();
|
||||||
this.customCssInitialized = true;
|
customCssInitialized = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsPanel.prototype.updateSetting = function(checkbox) {
|
SettingsPanel.prototype.updateSetting = function (checkbox) {
|
||||||
console.log("Working?");
|
var cb = $(checkbox).children().find('input[type="checkbox"]');
|
||||||
|
var enabled = !cb.is(":checked");
|
||||||
|
var id = cb.attr("id");
|
||||||
|
cb.prop("checked", enabled);
|
||||||
|
|
||||||
|
if(id == "bda-css-2") {
|
||||||
|
$("#app-mount").removeClass("bd-hide-bd");
|
||||||
|
customCssEditor.hideBackdrop = enabled;
|
||||||
|
if(enabled) {
|
||||||
|
$("#app-mount").addClass("bd-hide-bd")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settingsCookie[id] = enabled;
|
||||||
|
|
||||||
|
if (settingsCookie["bda-es-0"]) {
|
||||||
|
$("#twitchcord-button-container").show();
|
||||||
|
} else {
|
||||||
|
$("#twitchcord-button-container").hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settingsCookie["bda-gs-2"]) {
|
||||||
|
$("body").addClass("bd-minimal");
|
||||||
|
} else {
|
||||||
|
$("body").removeClass("bd-minimal");
|
||||||
|
}
|
||||||
|
if (settingsCookie["bda-gs-3"]) {
|
||||||
|
$("body").addClass("bd-minimal-chan");
|
||||||
|
} else {
|
||||||
|
$("body").removeClass("bd-minimal-chan");
|
||||||
|
}
|
||||||
|
if (settingsCookie["bda-gs-1"]) {
|
||||||
|
$("#bd-pub-li").show();
|
||||||
|
} else {
|
||||||
|
$("#bd-pub-li").hide();
|
||||||
|
}
|
||||||
|
if (settingsCookie["bda-gs-4"]) {
|
||||||
|
voiceMode.enable();
|
||||||
|
} else {
|
||||||
|
voiceMode.disable();
|
||||||
|
}
|
||||||
|
$("#app-mount").removeClass("bda-dark");
|
||||||
|
if(settingsCookie["bda-gs-5"]) {
|
||||||
|
$("#app-mount").addClass("bda-dark");
|
||||||
|
}
|
||||||
|
if (settingsCookie["bda-es-6"]) {
|
||||||
|
//Pretty emote titles
|
||||||
|
emoteNamePopup = $("<div class='tipsy tipsy-se' style='display: block; top: 82px; left: 1630.5px; visibility: visible; opacity: 0.8;'><div class='tipsy-inner'></div></div>");
|
||||||
|
$(document).on("mouseover", ".emote", function () {
|
||||||
|
var x = $(this).offset();
|
||||||
|
var title = $(this).attr("alt");
|
||||||
|
$(emoteNamePopup).find(".tipsy-inner").text(title);
|
||||||
|
$(emoteNamePopup).css('left', x.left - 25);
|
||||||
|
$(emoteNamePopup).css('top', x.top - 32);
|
||||||
|
$("div[data-reactid='.0.1.1']").append($(emoteNamePopup));
|
||||||
|
});
|
||||||
|
$(document).on("mouseleave", ".emote", function () {
|
||||||
|
$(".tipsy").remove();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$(document).off('mouseover', '.emote');
|
||||||
|
}
|
||||||
|
|
||||||
|
mainCore.saveSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsPanel.prototype.constructPanel = function() {
|
SettingsPanel.prototype.construct = function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.lastTab = "";
|
|
||||||
|
|
||||||
panel = $("<div/>", {
|
panel = $("<div/>", {
|
||||||
id: "bd-pane",
|
id: "bd-pane",
|
||||||
|
@ -96,138 +169,164 @@ SettingsPanel.prototype.constructPanel = function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var panelHtml = '\
|
var settingsInner = '' +
|
||||||
<div class="scroller-wrap">\
|
'<div class="scroller-wrap">' +
|
||||||
<div class="scroller settings-wrapper settings-panel">\
|
' <div class="scroller settings-wrapper settings-panel">' +
|
||||||
<div class="tab-bar TOP">\
|
' <div class="tab-bar TOP">' +
|
||||||
<div class="tab-bar-item bd-tab selected" id="bd-settings-tab" onclick="settingsPanel.changeTab(this);">Core</div>\
|
' <div class="tab-bar-item bd-tab" id="bd-settings-tab" onclick="settingsPanel.changeTab(\'bd-settings-tab\');">Core</div>' +
|
||||||
<div class="tab-bar-item bd-tab" id="bd-emotes-tab" onclick="settingsPanel.changeTab(this);">Emotes</div>\
|
' <div class="tab-bar-item bd-tab" id="bd-emotes-tab" onclick="settingsPanel.changeTab(\'bd-emotes-tab\');">Emotes</div>' +
|
||||||
<div class="tab-bar-item bd-tab" id="bd-customcss-tab" onclick="settingsPanel.changeTab(this);">Custom CSS</div>\
|
' <div class="tab-bar-item bd-tab" id="bd-customcss-tab" onclick="settingsPanel.changeTab(\'bd-customcss-tab\');">Custom CSS</div>' +
|
||||||
<div class="tab-bar-item bd-tab" id="bd-plugins-tab" onclick="settingsPanel.changeTab(this);">Plugins</div>\
|
' <div class="tab-bar-item bd-tab" id="bd-plugins-tab" onclick="settingsPanel.changeTab(\'bd-plugins-tab\');">Plugins</div>' +
|
||||||
<div class="tab-bar-item bd-tab" id="bd-themes-tab" onclick="settingsPanel.changeTab(this);">Themes</div>\
|
' <div class="tab-bar-item bd-tab" id="bd-themes-tab" onclick="settingsPanel.changeTab(\'bd-themes-tab\');">Themes</div>' +
|
||||||
</div>\
|
' </div>' +
|
||||||
<div class="bd-settings">\
|
' <div class="bd-settings">' +
|
||||||
<div class="bd-pane control-group" id="bd-settings-pane" style="">\
|
' <div class="bd-pane control-group" id="bd-settings-pane" style="display:none;">' +
|
||||||
<ul class="checkbox-group">\
|
' <ul class="checkbox-group">';
|
||||||
';
|
|
||||||
|
|
||||||
//Core settings
|
for (var setting in settings) {
|
||||||
for(var setting in bdConfig.options) {
|
|
||||||
var sett = bdConfig.options[setting];
|
var sett = settings[setting];
|
||||||
var id = sett["id"];
|
var id = sett["id"];
|
||||||
if(sett["cat"] != "core" || !sett["implemented"] || sett["hidden"]) continue;
|
if(sett["cat"] != "core") continue;
|
||||||
|
|
||||||
panelHtml += '\
|
if (sett["implemented"] && !sett["hidden"]) {
|
||||||
<li>\
|
|
||||||
<div class="checkbox" onclick="settingsPanel.updateSetting(this);">\
|
settingsInner += '' +
|
||||||
<div class="checkbox-inner">\
|
'<li>' +
|
||||||
<input type="checkbox" id="'+id+'" '+(settingsCookie[id] ? "checked" : "")+'>\
|
'<div class="checkbox" onclick="settingsPanel.updateSetting(this);" >' +
|
||||||
<span></span>\
|
'<div class="checkbox-inner">' +
|
||||||
</div>\
|
'<input type="checkbox" id="' + id + '" ' + (settingsCookie[id] ? "checked" : "") + '>' +
|
||||||
<span>\
|
'<span></span>' +
|
||||||
'+setting+' - '+sett["info"]+'\
|
'</div>' +
|
||||||
</span>\
|
'<span>' + setting + " - " + sett["info"] +
|
||||||
</div>\
|
'</span>' +
|
||||||
</li>\
|
'</div>' +
|
||||||
';
|
'</li>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
panelHtml += '\
|
settingsInner += ' </ul>' +
|
||||||
</ul>\
|
' </div>';
|
||||||
</div>\
|
|
||||||
<div class="bd-pane control-group" id="bd-emotes-pane" style="display:none;">\
|
|
||||||
<ul class="checkbox-group">\
|
|
||||||
';
|
|
||||||
|
|
||||||
//Emote settings
|
|
||||||
for(var setting in bdConfig.options) {
|
settingsInner += '<div class="bd-pane control-group" id="bd-emotes-pane" style="display:none;">' +
|
||||||
var sett = bdConfig.options[setting];
|
' <ul class="checkbox-group">';
|
||||||
|
|
||||||
|
for (var setting in settings) {
|
||||||
|
|
||||||
|
var sett = settings[setting];
|
||||||
var id = sett["id"];
|
var id = sett["id"];
|
||||||
if(sett["cat"] != "emote" || !sett["implemented"] || sett["hidden"]) continue;
|
if(sett["cat"] != "emote") continue;
|
||||||
|
|
||||||
panelHtml += '\
|
if (sett["implemented"] && !sett["hidden"]) {
|
||||||
<li>\
|
|
||||||
'+
|
settingsInner += '' +
|
||||||
utils.getDiscordCheckbox({
|
'<li>' +
|
||||||
onClick: "settingsPanel.updateSetting(this)",
|
'<div class="checkbox" onclick="settingsPanel.updateSetting(this);" >' +
|
||||||
id: id,
|
'<div class="checkbox-inner">' +
|
||||||
checked: settingsCookie[id],
|
'<input type="checkbox" id="' + id + '" ' + (settingsCookie[id] ? "checked" : "") + '>' +
|
||||||
text: setting + " - " + sett["info"]
|
'<span></span>' +
|
||||||
})
|
'</div>' +
|
||||||
+'\
|
'<span>' + setting + " - " + sett["info"] +
|
||||||
</li>\
|
'</span>' +
|
||||||
';
|
'</div>' +
|
||||||
|
'</li>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settingsInner += ' </ul>' +
|
||||||
|
' </div>';
|
||||||
|
|
||||||
|
|
||||||
var ccss = atob(localStorage.getItem("bdcustomcss"));
|
var ccss = atob(localStorage.getItem("bdcustomcss"));
|
||||||
customCssEditor.applyCustomCss(ccss, true, false);
|
customCssEditor.applyCustomCss(ccss, true, false);
|
||||||
|
|
||||||
panelHtml += '\
|
settingsInner += '' +
|
||||||
</ul>\
|
' <div class="bd-pane control-group" id="bd-customcss-pane" style="display:none;">' +
|
||||||
</div>\
|
' <div id="editor-detached" style="display:none;">' +
|
||||||
<div class="bd-pane control-group" id="bd-customcss-pane" style="display:none;">\
|
' <h3>Editor Detached</h3>' +
|
||||||
<div id="editor-detached" style="display:none;">\
|
' <button class="btn btn-primary" onclick="customCssEditor.attach(); return false;">Attach</button>' +
|
||||||
<h3>Editor Detached</h3>\
|
' </div>' +
|
||||||
<button class="btn btn-primary" onclick="customCssEditor.attach(); return false;">Attach</button>\
|
' <div id="bd-customcss-innerpane"><textarea id="bd-custom-css-ta">' + ccss + '</textarea></div>' +
|
||||||
</div>\
|
' </div>' +
|
||||||
<div id="bd-customcss-innerpane">\
|
'' +
|
||||||
<textarea id="bd-custom-css-ta">'+ccss+'</textarea>\
|
' <div class="bd-pane control-group" id="bd-plugins-pane" style="display:none;">' +
|
||||||
</div>\
|
' <table class="bd-g-table">' +
|
||||||
</div>\
|
' <thead><tr><th>Name</th><th>Description</th><th>Author</th><th>Version</th><th></th><th></th></tr></thead><tbody>';
|
||||||
<div class="bd-pane control-group" id="bd-plugins-pane" style="display:none;">\
|
|
||||||
<ul class="bda-slist">\
|
|
||||||
';
|
|
||||||
|
|
||||||
|
$.each(bdplugins, function () {
|
||||||
//Plugins
|
|
||||||
$.each(bdplugins, function() {
|
|
||||||
var plugin = this["plugin"];
|
var plugin = this["plugin"];
|
||||||
panelHtml += '\
|
settingsInner += '' +
|
||||||
<li>\
|
'<tr>' +
|
||||||
<div class="bda-left">\
|
' <td>' + plugin.getName() + '</td>' +
|
||||||
<div class="bda-name">\
|
' <td width="99%"><textarea>' + plugin.getDescription() + '</textarea></td>' +
|
||||||
'+plugin.getName() + ' v' + plugin.getVersion() + ' by ' + plugin.getAuthor() +'\
|
' <td>' + plugin.getAuthor() + '</td>' +
|
||||||
</div>\
|
' <td>' + plugin.getVersion() + '</td>' +
|
||||||
<div class="bda-description">\
|
' <td><button class="bd-psb" onclick="pluginModule.showSettings(\'' + plugin.getName() + '\'); return false;"></button></td>' +
|
||||||
'+plugin.getDescription()+'\
|
' <td>' +
|
||||||
</div>\
|
' <div class="checkbox" onclick="pluginModule.handlePlugin(this);">' +
|
||||||
</div>\
|
' <div class="checkbox-inner">' +
|
||||||
<div class="bda-right">\
|
' <input id="' + plugin.getName() + '" type="checkbox" ' + (pluginCookie[plugin.getName()] ? "checked" : "") + '>' +
|
||||||
<div class="checkbox">\
|
' <span></span>' +
|
||||||
<div class="checkbox-inner">\
|
' </div>' +
|
||||||
<input type="checkbox">\
|
' </div>' +
|
||||||
<span></span>\
|
' </td>' +
|
||||||
</div>\
|
'</tr>';
|
||||||
</div>\
|
|
||||||
<button class="btn btn-primary">Settings</button>\
|
|
||||||
</div>\
|
|
||||||
</li>\
|
|
||||||
';
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
settingsInner += '</tbody></table>' +
|
||||||
|
' </div>' +
|
||||||
|
' <div class="bd-pane control-group" id="bd-themes-pane" style="display:none;">';
|
||||||
|
|
||||||
panelHtml += '\
|
|
||||||
</ul>\
|
|
||||||
</div>\
|
|
||||||
<div class="bd-pane control-group" id="bd-themes-pane" style="display:none;">\
|
|
||||||
</div>\
|
|
||||||
</div>\
|
|
||||||
</div>\
|
|
||||||
<div style="background:#2E3136; color:#ADADAD; height:30px; position:absolute; bottom:0; left:0; right:0;"> <span style="line-height:30px;margin-left:10px;">BetterDiscord v'+BdApi.getCore().version+'(JSv'+BdApi.getCore().jsVersion+') by Jiiks</span> <span style="float:right;line-height:30px;margin-right:10px;"><a href="http://betterdiscord.net" target="_blank">BetterDiscord.net</a></span> </div>\
|
|
||||||
</div>\
|
|
||||||
';
|
|
||||||
|
|
||||||
panel.html(panelHtml);
|
if (typeof (themesupport2) === "undefined") {
|
||||||
|
settingsInner += '' +
|
||||||
|
' Your version does not support themes. Download the latest version.';
|
||||||
|
} else {
|
||||||
|
settingsInner += '' +
|
||||||
|
' <table class="bd-g-table">' +
|
||||||
|
' <thead><tr><th>Name</th><th>Description</th><th>Author</th><th>Version</th><th></th></tr></thead><tbody>';
|
||||||
|
$.each(bdthemes, function () {
|
||||||
|
settingsInner += '' +
|
||||||
|
'<tr>' +
|
||||||
|
' <td>' + this["name"].replace(/_/g, " ") + '</td>' +
|
||||||
|
' <td width="99%"><textarea>' + this["description"] + '</textarea></td>' +
|
||||||
|
' <td>' + this["author"] + '</td>' +
|
||||||
|
' <td>' + this["version"] + '</td>' +
|
||||||
|
' <td>' +
|
||||||
|
' <div class="checkbox" onclick="themeModule.handleTheme(this);">' +
|
||||||
|
' <div class="checkbox-inner">' +
|
||||||
|
' <input id="ti' + this["name"] + '" type="checkbox" ' + (themeCookie[this["name"]] ? "checked" : "") + '>' +
|
||||||
|
' <span></span>' +
|
||||||
|
' </div>' +
|
||||||
|
' </div>' +
|
||||||
|
' </td>' +
|
||||||
|
'</tr>';
|
||||||
|
});
|
||||||
|
settingsInner += '</tbody></table>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
settingsInner += '' +
|
||||||
|
' </div>' +
|
||||||
|
'' +
|
||||||
|
' </div>' +
|
||||||
|
' </div>' +
|
||||||
|
' <div style="background:#2E3136; color:#ADADAD; height:30px; position:absolute; bottom:0; left:0; right:0;">' +
|
||||||
|
' <span style="line-height:30px;margin-left:10px;">BetterDiscord v' + version + '(JSv' + jsVersion + ') by Jiiks</span>' +
|
||||||
|
' <span style="float:right;line-height:30px;margin-right:10px;"><a href="http://betterdiscord.net" target="_blank">BetterDiscord.net</a></span>' +
|
||||||
|
' </div>' +
|
||||||
|
'</div>';
|
||||||
|
|
||||||
function showSettings() {
|
function showSettings() {
|
||||||
$(".tab-bar-item").removeClass("selected");
|
$(".tab-bar-item").removeClass("selected");
|
||||||
settingsButton.addClass("selected");
|
settingsButton.addClass("selected");
|
||||||
$(".form .settings-right .settings-inner").first().hide();
|
$(".form .settings-right .settings-inner").first().hide();
|
||||||
panel.show();
|
panel.show();
|
||||||
if (self.lastTab == "") {
|
if (lastTab == "") {
|
||||||
self.changeTab({id:"bd-settings-tab"});
|
self.changeTab("bd-settings-tab");
|
||||||
} else {
|
} else {
|
||||||
self.changeTab(self.lastTab);
|
self.changeTab(lastTab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,34 +337,36 @@ SettingsPanel.prototype.constructPanel = function() {
|
||||||
click: showSettings
|
click: showSettings
|
||||||
});
|
});
|
||||||
|
|
||||||
|
panel.html(settingsInner);
|
||||||
|
|
||||||
(function defer() {
|
function defer() {
|
||||||
if($(".btn.btn-settings").length < 1) {
|
if ($(".btn.btn-settings").length < 1) {
|
||||||
setTimeout(defer, 100);
|
setTimeout(defer, 100);
|
||||||
return;
|
} else {
|
||||||
}
|
$(".btn.btn-settings").first().on("click", function () {
|
||||||
|
|
||||||
$(".btn.btn-settings").first().off("click.bda").on("click.bda", function() {
|
function innerDefer() {
|
||||||
(function defer() {
|
if ($(".modal-inner").first().is(":visible")) {
|
||||||
if(!$(".modal-inner").first().is(":visible")) {
|
|
||||||
setTimeout(defer, 100);
|
panel.hide();
|
||||||
return;
|
var tabBar = $(".tab-bar.SIDE").first();
|
||||||
|
|
||||||
|
$(".tab-bar.SIDE .tab-bar-item").click(function () {
|
||||||
|
$(".form .settings-right .settings-inner").first().show();
|
||||||
|
$("#bd-settings-new").removeClass("selected");
|
||||||
|
panel.hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
tabBar.append(settingsButton);
|
||||||
|
$(".form .settings-right .settings-inner").last().after(panel);
|
||||||
|
$("#bd-settings-new").removeClass("selected");
|
||||||
|
} else {
|
||||||
|
setTimeout(innerDefer, 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
innerDefer();
|
||||||
panel.hide();
|
});
|
||||||
var tabBar = $(".tab-bar.SIDE").first();
|
}
|
||||||
|
}
|
||||||
$(".tab-bar.SIDE .tab-bar-item").click(function () {
|
defer();
|
||||||
$(".form .settings-right .settings-inner").first().show();
|
|
||||||
$("#bd-settings-new").removeClass("selected");
|
|
||||||
panel.hide();
|
|
||||||
});
|
|
||||||
|
|
||||||
tabBar.append(settingsButton);
|
|
||||||
$(".form .settings-right .settings-inner").last().after(panel);
|
|
||||||
$("#bd-settings-new").removeClass("selected");
|
|
||||||
|
|
||||||
})();
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
};
|
};
|
|
@ -64,17 +64,4 @@ Utils.prototype.log = function (message) {
|
||||||
|
|
||||||
Utils.prototype.err = function (message) {
|
Utils.prototype.err = function (message) {
|
||||||
console.info("%c[BetterDiscord]%c " + message, "color:red; font-weight:bold;", "");
|
console.info("%c[BetterDiscord]%c " + message, "color:red; font-weight:bold;", "");
|
||||||
};
|
|
||||||
|
|
||||||
//Html generation utils
|
|
||||||
Utils.prototype.getDiscordCheckbox = function(data) {
|
|
||||||
return '\
|
|
||||||
<div class="checkbox" onclick="'+data.onClick+'">\
|
|
||||||
<div class="checkbox-inner">\
|
|
||||||
<input type="checkbox" id="'+data.id+'" '+(data.checked ? "checked" : "")+'>\
|
|
||||||
<span></span>\
|
|
||||||
</div>\
|
|
||||||
<span>'+data.text+'</span>\
|
|
||||||
</div>\
|
|
||||||
';
|
|
||||||
};
|
};
|
|
@ -61,4 +61,4 @@ ThemeModule.prototype.saveThemeData = function () {
|
||||||
expires: 365,
|
expires: 365,
|
||||||
path: '/'
|
path: '/'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue