This commit is contained in:
Jiiks 2015-10-25 21:19:11 +02:00
parent aff5e6aab7
commit c632d0ecb9
1 changed files with 32 additions and 30 deletions

View File

@ -27,6 +27,8 @@ var ffzEmoteUrlEnd = "/1";
var bttvEmoteUrlStart = ""; var bttvEmoteUrlStart = "";
var bttvEmoteUrlEnd = ""; var bttvEmoteUrlEnd = "";
var mainCore;
var settings = { var settings = {
"Save logs locally": { "id": "bda-gs-0", "info": "Saves chat logs locally", "implemented":false }, "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": "BETA : Display public servers button", "implemented":true},
@ -86,7 +88,7 @@ Core.prototype.init = function() {
var guilds = $(".guilds li:first-child"); var guilds = $(".guilds li:first-child");
guilds.after($("<li/>", { id: "bd-pub-li", css: { "height": "20px", "display": settingsCookie["bda-gs-1"] == true ? "" : "none" } }).append($("<div/>", { class: "guild-inner", css: { "height": "20px" } }).append($("<a/>").append($("<div/>", { css: { "line-height": "20px" }, text: "public", id: "bd-pub-button" }))))); guilds.after($("<li></li>", { id: "bd-pub-li", css: { "height": "20px", "display": settingsCookie["bda-gs-1"] == true ? "" : "none" } }).append($("<div/>", { class: "guild-inner", css: { "height": "20px" } }).append($("<a/>").append($("<div/>", { css: { "line-height": "20px" }, text: "public", id: "bd-pub-button" })))));
guilds.after($("<li/>", {id:"tc-settings-li"}).append($("<div/>", { class: "guild-inner" }).append($("<a/>").append($("<div/>", { class: "avatar-small", id: "tc-settings-button" }))))); guilds.after($("<li/>", {id:"tc-settings-li"}).append($("<div/>", { class: "guild-inner" }).append($("<a/>").append($("<div/>", { class: "avatar-small", id: "tc-settings-button" })))));
settingsPanel = new SettingsPanel(); settingsPanel = new SettingsPanel();
@ -97,8 +99,8 @@ Core.prototype.init = function() {
quickEmoteMenu.init(false); quickEmoteMenu.init(false);
$("#tc-settings-button").on("click", function(e) { settingsPanel.show(); }); $("#tc-settings-button").on("click", function() { settingsPanel.show(); });
$("#bd-pub-button").on("click", function(e) { opublicServers.show(); }); $("#bd-pub-button").on("click", function() { opublicServers.show(); });
} else { } else {
setTimeout(gwDefer(), 100); setTimeout(gwDefer(), 100);
@ -146,6 +148,7 @@ Core.prototype.initObserver = function() {
}); });
}); });
//noinspection JSCheckFunctionSignatures
mainObserver.observe(document, { childList: true, subtree: true }); mainObserver.observe(document, { childList: true, subtree: true });
}; };
@ -164,12 +167,9 @@ Core.prototype.initObserver = function() {
* --Twitchemotes.com api * --Twitchemotes.com api
*/ */
var autoCapitalize = true;
var ffzEnabled = false;
var bttvEnabled = false;
var emotesFfz = {}; var emotesFfz = {};
var emotesBTTV = {}; var emotesBTTV = {};
var emotesTwitch = {}; var emotesTwitch = { "emotes": { "emote": { "image_id": 0 } } }; //for ide
var subEmotesTwitch = {}; var subEmotesTwitch = {};
var twitchAc = {"4head":"4Head","anele":"ANELE","argieb8":"ArgieB8","arsonnosexy":"ArsonNoSexy","asianglow":"AsianGlow","atgl":"AtGL","athenapms":"AthenaPMS","ativy":"AtIvy","atww":"AtWW","babyrage":"BabyRage","batchest":"BatChest","bcwarrior":"BCWarrior","biblethump":"BibleThump","bigbrother":"BigBrother","bionicbunion":"BionicBunion","blargnaut":"BlargNaut","bloodtrail":"BloodTrail","bort":"BORT","brainslug":"BrainSlug","brokeback":"BrokeBack","buddhabar":"BuddhaBar","coolcat":"CoolCat","corgiderp":"CorgiDerp","cougarhunt":"CougarHunt","daesuppy":"DAESuppy","dansgame":"DansGame","dathass":"DatHass","datsheffy":"DatSheffy","dbstyle":"DBstyle","deexcite":"deExcite","deilluminati":"deIlluminati","dendiface":"DendiFace","dogface":"DogFace","doomguy":"DOOMGuy","eagleeye":"EagleEye","elegiggle":"EleGiggle","evilfetus":"EvilFetus","failfish":"FailFish","fpsmarksman":"FPSMarksman","frankerz":"FrankerZ","freakinstinkin":"FreakinStinkin","fungineer":"FUNgineer","funrun":"FunRun","fuzzyotteroo":"FuzzyOtterOO","gasjoker":"GasJoker","gingerpower":"GingerPower","grammarking":"GrammarKing","hassanchop":"HassanChop","heyguys":"HeyGuys","hotpokket":"HotPokket","humblelife":"HumbleLife","itsboshytime":"ItsBoshyTime","jebaited":"Jebaited","jkanstyle":"JKanStyle","joncarnage":"JonCarnage","kapow":"KAPOW","kappa":"Kappa","kappapride":"KappaPride","keepo":"Keepo","kevinturtle":"KevinTurtle","kippa":"Kippa","kreygasm":"Kreygasm","kzskull":"KZskull","mau5":"Mau5","mcat":"mcaT","mechasupes":"MechaSupes","mrdestructoid":"MrDestructoid","mvgame":"MVGame","nightbat":"NightBat","ninjatroll":"NinjaTroll","nonospot":"NoNoSpot","notatk":"NotATK","notlikethis":"NotLikeThis","omgscoots":"OMGScoots","onehand":"OneHand","opieop":"OpieOP","optimizeprime":"OptimizePrime","osbeaver":"OSbeaver","osbury":"OSbury","osdeo":"OSdeo","osfrog":"OSfrog","oskomodo":"OSkomodo","osrob":"OSrob","ossloth":"OSsloth","panicbasket":"panicBasket","panicvis":"PanicVis","pazpazowitz":"PazPazowitz","peopleschamp":"PeoplesChamp","permasmug":"PermaSmug","picomause":"PicoMause","pipehype":"PipeHype","pjharley":"PJHarley","pjsalt":"PJSalt","pmstwin":"PMSTwin","pogchamp":"PogChamp","poooound":"Poooound","praiseit":"PraiseIt","prchase":"PRChase","punchtrees":"PunchTrees","puppeyface":"PuppeyFace","raccattack":"RaccAttack","ralpherz":"RalpherZ","redcoat":"RedCoat","residentsleeper":"ResidentSleeper","ritzmitz":"RitzMitz","rulefive":"RuleFive","shadylulu":"ShadyLulu","shazam":"Shazam","shazamicon":"shazamicon","shazbotstix":"ShazBotstix","shibez":"ShibeZ","smorc":"SMOrc","smskull":"SMSkull","sobayed":"SoBayed","soonerlater":"SoonerLater","srihead":"SriHead","ssssss":"SSSsss","stonelightning":"StoneLightning","strawbeary":"StrawBeary","supervinlin":"SuperVinlin","swiftrage":"SwiftRage","tbbaconbiscuit":"tbBaconBiscuit","tbchickenbiscuit":"tbChickenBiscuit","tbquesarito":"tbQuesarito","tbsausagebiscuit":"tbSausageBiscuit","tbspicy":"tbSpicy","tbsriracha":"tbSriracha","tf2john":"TF2John","theking":"TheKing","theringer":"TheRinger","thetarfu":"TheTarFu","thething":"TheThing","thunbeast":"ThunBeast","tinyface":"TinyFace","toospicy":"TooSpicy","trihard":"TriHard","ttours":"TTours","uleetbackup":"UleetBackup","unclenox":"UncleNox","unsane":"UnSane","vaultboy":"VaultBoy","volcania":"Volcania","wholewheat":"WholeWheat","winwaker":"WinWaker","wtruck":"WTRuck","wutface":"WutFace","youwhy":"YouWHY"}; var twitchAc = {"4head":"4Head","anele":"ANELE","argieb8":"ArgieB8","arsonnosexy":"ArsonNoSexy","asianglow":"AsianGlow","atgl":"AtGL","athenapms":"AthenaPMS","ativy":"AtIvy","atww":"AtWW","babyrage":"BabyRage","batchest":"BatChest","bcwarrior":"BCWarrior","biblethump":"BibleThump","bigbrother":"BigBrother","bionicbunion":"BionicBunion","blargnaut":"BlargNaut","bloodtrail":"BloodTrail","bort":"BORT","brainslug":"BrainSlug","brokeback":"BrokeBack","buddhabar":"BuddhaBar","coolcat":"CoolCat","corgiderp":"CorgiDerp","cougarhunt":"CougarHunt","daesuppy":"DAESuppy","dansgame":"DansGame","dathass":"DatHass","datsheffy":"DatSheffy","dbstyle":"DBstyle","deexcite":"deExcite","deilluminati":"deIlluminati","dendiface":"DendiFace","dogface":"DogFace","doomguy":"DOOMGuy","eagleeye":"EagleEye","elegiggle":"EleGiggle","evilfetus":"EvilFetus","failfish":"FailFish","fpsmarksman":"FPSMarksman","frankerz":"FrankerZ","freakinstinkin":"FreakinStinkin","fungineer":"FUNgineer","funrun":"FunRun","fuzzyotteroo":"FuzzyOtterOO","gasjoker":"GasJoker","gingerpower":"GingerPower","grammarking":"GrammarKing","hassanchop":"HassanChop","heyguys":"HeyGuys","hotpokket":"HotPokket","humblelife":"HumbleLife","itsboshytime":"ItsBoshyTime","jebaited":"Jebaited","jkanstyle":"JKanStyle","joncarnage":"JonCarnage","kapow":"KAPOW","kappa":"Kappa","kappapride":"KappaPride","keepo":"Keepo","kevinturtle":"KevinTurtle","kippa":"Kippa","kreygasm":"Kreygasm","kzskull":"KZskull","mau5":"Mau5","mcat":"mcaT","mechasupes":"MechaSupes","mrdestructoid":"MrDestructoid","mvgame":"MVGame","nightbat":"NightBat","ninjatroll":"NinjaTroll","nonospot":"NoNoSpot","notatk":"NotATK","notlikethis":"NotLikeThis","omgscoots":"OMGScoots","onehand":"OneHand","opieop":"OpieOP","optimizeprime":"OptimizePrime","osbeaver":"OSbeaver","osbury":"OSbury","osdeo":"OSdeo","osfrog":"OSfrog","oskomodo":"OSkomodo","osrob":"OSrob","ossloth":"OSsloth","panicbasket":"panicBasket","panicvis":"PanicVis","pazpazowitz":"PazPazowitz","peopleschamp":"PeoplesChamp","permasmug":"PermaSmug","picomause":"PicoMause","pipehype":"PipeHype","pjharley":"PJHarley","pjsalt":"PJSalt","pmstwin":"PMSTwin","pogchamp":"PogChamp","poooound":"Poooound","praiseit":"PraiseIt","prchase":"PRChase","punchtrees":"PunchTrees","puppeyface":"PuppeyFace","raccattack":"RaccAttack","ralpherz":"RalpherZ","redcoat":"RedCoat","residentsleeper":"ResidentSleeper","ritzmitz":"RitzMitz","rulefive":"RuleFive","shadylulu":"ShadyLulu","shazam":"Shazam","shazamicon":"shazamicon","shazbotstix":"ShazBotstix","shibez":"ShibeZ","smorc":"SMOrc","smskull":"SMSkull","sobayed":"SoBayed","soonerlater":"SoonerLater","srihead":"SriHead","ssssss":"SSSsss","stonelightning":"StoneLightning","strawbeary":"StrawBeary","supervinlin":"SuperVinlin","swiftrage":"SwiftRage","tbbaconbiscuit":"tbBaconBiscuit","tbchickenbiscuit":"tbChickenBiscuit","tbquesarito":"tbQuesarito","tbsausagebiscuit":"tbSausageBiscuit","tbspicy":"tbSpicy","tbsriracha":"tbSriracha","tf2john":"TF2John","theking":"TheKing","theringer":"TheRinger","thetarfu":"TheTarFu","thething":"TheThing","thunbeast":"ThunBeast","tinyface":"TinyFace","toospicy":"TooSpicy","trihard":"TriHard","ttours":"TTours","uleetbackup":"UleetBackup","unclenox":"UncleNox","unsane":"UnSane","vaultboy":"VaultBoy","volcania":"Volcania","wholewheat":"WholeWheat","winwaker":"WinWaker","wtruck":"WTRuck","wutface":"WutFace","youwhy":"YouWHY"};
@ -244,9 +244,11 @@ EmoteModule.prototype.injectEmote = function(node) {
} }
} }
if(subEmotesTwitch.hasOwnProperty(word)) { if(!replaced) {
if (subEmotesTwitch.hasOwnProperty(word)) {
parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + twitchEmoteUrlStart + subEmotesTwitch[word] + twitchEmoteUrlEnd + " ><\/img>"); parentInnerHTML = parentInnerHTML.replace(word, "<img src=" + twitchEmoteUrlStart + subEmotesTwitch[word] + twitchEmoteUrlEnd + " ><\/img>");
} }
}
}); });
var oldHeight = parent.parentElement.offsetHeight; var oldHeight = parent.parentElement.offsetHeight;
@ -254,7 +256,7 @@ EmoteModule.prototype.injectEmote = function(node) {
var newHeight = parent.parentElement.offsetHeight; var newHeight = parent.parentElement.offsetHeight;
//Scrollfix //Scrollfix
var scrollPane = $($(".scroller.messages")[0]) var scrollPane = $($(".scroller.messages")[0]);
scrollPane.scrollTop(scrollPane.scrollTop() + (newHeight - oldHeight)); scrollPane.scrollTop(scrollPane.scrollTop() + (newHeight - oldHeight));
}; };
@ -294,7 +296,7 @@ EmoteModule.prototype.capitalize = function(value) {
* https://github.com/Jiiks/BetterDiscordApp * https://github.com/Jiiks/BetterDiscordApp
*/ */
var publicServers = {}; var publicServers = { "servers": { "server": { "code": 0, "icon": null, "title": "title", "language": "EN", "description": "description" } } }; //for ide
function PublicServers() { function PublicServers() {
@ -367,17 +369,16 @@ PublicServers.prototype.init = function() {
var servers = publicServers.servers; var servers = publicServers.servers;
for(var server in servers) { for(var server in servers) {
var name = server; if(servers.hasOwnProperty(server)) {
server = servers[server]; var s = servers[server];
var code = server.code; var code = s.code;
var icon = server.icon; var title = s.title;
var title = server.title; var language = s.language;
var language = server.language; var description = s.description;
var description = server.description;
this.addServer(name, code, title, language, description); this.addServer(server, code, title, language, description);
}
} }
}; };
PublicServers.prototype.addServer = function(name, code, title, language, description) { PublicServers.prototype.addServer = function(name, code, title, language, description) {
@ -432,9 +433,9 @@ function QuickEmoteMenu() {
} }
QuickEmoteMenu.prototype.init = function (reload) { QuickEmoteMenu.prototype.init = function() {
emoteBtn = null; var emoteBtn;
if(!emoteMenu) { if(!emoteMenu) {
this.initEmoteList(); this.initEmoteList();
@ -497,9 +498,11 @@ QuickEmoteMenu.prototype.initEmoteList = function() {
emoteMenu.append(emoteMenuBody); emoteMenu.append(emoteMenuBody);
for(var emote in emotesTwitch.emotes) { for(var emote in emotesTwitch.emotes) {
if(emotesTwitch.emotes.hasOwnProperty(emote)) {
var id = emotesTwitch.emotes[emote].image_id; var id = emotesTwitch.emotes[emote].image_id;
emoteMenuBody.append($("<div/>" , { class: "emote-container" }).append($("<img/>", { class: "emote-icon", id: emote, alt: "", src: "https://static-cdn.jtvnw.net/emoticons/v1/"+id+"/1.0", title: emote }))); emoteMenuBody.append($("<div/>" , { class: "emote-container" }).append($("<img/>", { class: "emote-icon", id: emote, alt: "", src: "https://static-cdn.jtvnw.net/emoticons/v1/"+id+"/1.0", title: emote })));
} }
}
}; };
/* BetterDiscordApp Settings Panel JavaScript /* BetterDiscordApp Settings Panel JavaScript
@ -555,7 +558,7 @@ SettingsPanel.prototype.init = function() {
body.append(this.getPanel()); body.append(this.getPanel());
$("#tc-settings-close").on("click", function(e) { self.show(); }); $("#tc-settings-close").on("click", function() { self.show(); });
$(".tc-switch").on("click", function() { self.handler($(this)) }); $(".tc-switch").on("click", function() { self.handler($(this)) });
if(settingsCookie["bda-es-0"]) { if(settingsCookie["bda-es-0"]) {
@ -652,22 +655,21 @@ function VoiceMode() {
} }
VoiceMode.prototype.enable = function() { VoiceMode.prototype.enable = function() {
$($(".scroller.guild-channels ul")[0]).css("display", "none"); $($(".scroller.guild-channels ul")[0]).css("display", "none");
$($(".scroller.guild-channels header")[0]).css("display", "none"); $($(".scroller.guild-channels header")[0]).css("display", "none");
$($(".flex-vertical.flex-spacer")[0]).css("overflow", "hidden"); $($(".flex-vertical.flex-spacer")[0]).css("overflow", "hidden");
$($(".chat.flex-vertical.flex-spacer")[0]).css("visibility", "hidden"); $($(".chat.flex-vertical.flex-spacer")[0]).css("visibility", "hidden").css("min-width", "0px");
$($(".chat.flex-vertical.flex-spacer")[0]).css("min-width", "0px");
$($(".flex-vertical.channels-wrap")[0]).css("width", "100%"); $($(".flex-vertical.channels-wrap")[0]).css("width", "100%");
$($(".guild-header .btn.btn-hamburger")[0]).css("visibility", "hidden"); $($(".guild-header .btn.btn-hamburger")[0]).css("visibility", "hidden");
} };
VoiceMode.prototype.disable = function() { VoiceMode.prototype.disable = function() {
$($(".scroller.guild-channels ul")[0]).css("display", ""); $($(".scroller.guild-channels ul")[0]).css("display", "");
$($(".scroller.guild-channels header")[0]).css("display", ""); $($(".scroller.guild-channels header")[0]).css("display", "");
$($(".flex-vertical.flex-spacer")[0]).css("overflow", ""); $($(".flex-vertical.flex-spacer")[0]).css("overflow", "");
$($(".chat.flex-vertical.flex-spacer")[0]).css("visibility", ""); $($(".chat.flex-vertical.flex-spacer")[0]).css("visibility", "").css("min-width", "");
$($(".chat.flex-vertical.flex-spacer")[0]).css("min-width", "");
$($(".flex-vertical.channels-wrap")[0]).css("width", ""); $($(".flex-vertical.channels-wrap")[0]).css("width", "");
$($(".guild-header .btn.btn-hamburger")[0]).css("visibility", ""); $($(".guild-header .btn.btn-hamburger")[0]).css("visibility", "");
}; };