diff --git a/js/main.js b/js/main.js index 5e5aa6c..86e99d6 100644 --- a/js/main.js +++ b/js/main.js @@ -540,10 +540,8 @@ Core.prototype.alert = function (title, text) { var emotesFfz = {}; var emotesBTTV = {}; var emotesTwitch = { - "emotes": { - "emote": { - "image_id": 0 - } + "emote": { + "id": 0 } }; //for ide var subEmotesTwitch = {}; @@ -673,9 +671,9 @@ EmoteModule.prototype.injectEmote = function(node) { if ($.inArray(sw, bemotes) == -1) { if(typeof emotesTwitch !== 'undefined' && settingsCookie["bda-es-7"]) { - if(emotesTwitch.emotes.hasOwnProperty(sw) && sw.length >= 4) { + if(emotesTwitch.hasOwnProperty(sw) && sw.length >= 4) { if(text != null) { contents.splice(i + splice++, 0, document.createTextNode(text)); text = null;} - var url = twitchEmoteUrlStart + emotesTwitch.emotes[sw].image_id + twitchEmoteUrlEnd; + var url = twitchEmoteUrlStart + emotesTwitch[sw].id + twitchEmoteUrlEnd; contents.splice(i + splice++, 0, self.createEmoteElement(sw, url, emoteClass)); doInject = true; return; @@ -783,7 +781,7 @@ EmoteModule.prototype.autoCapitalize = function () { }; EmoteModule.prototype.capitalize = function (value) { - var res = emotesTwitch.emotes; + var res = emotesTwitch; for (var p in res) { if (res.hasOwnProperty(p) && value == (p + '').toLowerCase()) { return p; @@ -1304,9 +1302,9 @@ QuickEmoteMenu.prototype.init = function() { teContainer += "
"; teContainer += "
"; teContainer += "
"; - for (var emote in emotesTwitch.emotes) { - if (emotesTwitch.emotes.hasOwnProperty(emote)) { - var id = emotesTwitch.emotes[emote].image_id; + for (var emote in emotesTwitch) { + if (emotesTwitch.hasOwnProperty(emote)) { + var id = emotesTwitch[emote].id; teContainer += "
"; teContainer += " \"\""; teContainer += " "; diff --git a/js/main.min.js b/js/main.min.js index 25077e3..3dd4f3f 100644 --- a/js/main.min.js +++ b/js/main.min.js @@ -18,13 +18,13 @@ changeLog+='';} if(bdchangelog.upcoming!=null){changeLog+=''+'

'+' Coming Soon'+'

'+'
    ';for(var upc in bdchangelog.upcoming){upc=bdchangelog.upcoming[upc];changeLog+=''+'
  • '+' '+upc.title+''+'
    '+upc.text+'
    '+'
  • ';} changeLog+='
';} changeLog+=''+'
'+'
'+' '+'
'+'
'+'';return changeLog;};Core.prototype.alert=function(title,text){var id='';for(var i=0;i<5;i++) -id+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".length));var bdAlert=' ';$("body").append(bdAlert);utils.addBackdrop(id);};var emotesFfz={};var emotesBTTV={};var emotesTwitch={"emotes":{"emote":{"image_id":0}}};var subEmotesTwitch={};function EmoteModule(){} +id+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(Math.random()*"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".length));var bdAlert=' ';$("body").append(bdAlert);utils.addBackdrop(id);};var emotesFfz={};var emotesBTTV={};var emotesTwitch={"emote":{"id":0}};var subEmotesTwitch={};function EmoteModule(){} EmoteModule.prototype.init=function(){};EmoteModule.prototype.getBlacklist=function(){$.getJSON("https://cdn.rawgit.com/Jiiks/betterDiscordApp/"+_hash+"/data/emotefilter.json",function(data){bemotes=data.blacklist;});};EmoteModule.prototype.obsCallback=function(mutation){var self=this;for(var i=0;i-1){w=w.replace("[!s]","");parent.data("spoilered",false);parent.addClass("spoiler");} var allowedClasses=["flip","spin","pulse","spin2","spin3","1spin","2spin","3spin","tr","bl","br","shake","shake2","shake3","flap"];var useEmoteClass=false;var emoteClass="";var skipffz=false;var sw=w;if(w.indexOf(":")>-1){var split=w.split(":");if(split[0]!=""&&split[1]!=""){if(allowedClasses.indexOf(split[1])>-1){sw=split[0];emoteClass=settingsCookie["bda-es-8"]?"emote"+split[1]:"";} if(split[1]=="bttv"){sw=split[0];skipffz=true;}}} -if($.inArray(sw,bemotes)==-1){if(typeof emotesTwitch!=='undefined'&&settingsCookie["bda-es-7"]){if(emotesTwitch.emotes.hasOwnProperty(sw)&&sw.length>=4){if(text!=null){contents.splice(i+splice++,0,document.createTextNode(text));text=null;} -var url=twitchEmoteUrlStart+emotesTwitch.emotes[sw].image_id+twitchEmoteUrlEnd;contents.splice(i+splice++,0,self.createEmoteElement(sw,url,emoteClass));doInject=true;return;}} +if($.inArray(sw,bemotes)==-1){if(typeof emotesTwitch!=='undefined'&&settingsCookie["bda-es-7"]){if(emotesTwitch.hasOwnProperty(sw)&&sw.length>=4){if(text!=null){contents.splice(i+splice++,0,document.createTextNode(text));text=null;} +var url=twitchEmoteUrlStart+emotesTwitch[sw].id+twitchEmoteUrlEnd;contents.splice(i+splice++,0,self.createEmoteElement(sw,url,emoteClass));doInject=true;return;}} if(typeof subEmotesTwitch!=='undefined'&&settingsCookie["bda-es-7"]){if(subEmotesTwitch.hasOwnProperty(sw)&&sw.length>=4){if(text!=null){contents.splice(i+splice++,0,document.createTextNode(text));text=null;} var url=twitchEmoteUrlStart+subEmotesTwitch[sw]+twitchEmoteUrlEnd;contents.splice(i+splice++,0,self.createEmoteElement(sw,url,emoteClass));doInject=true;return;}} if(typeof emotesBTTV!=='undefined'&&settingsCookie["bda-es-2"]){if(emotesBTTV.hasOwnProperty(sw)&&sw.length>=4){if(text!=null){contents.splice(i+splice++,0,document.createTextNode(text));text=null;} @@ -35,7 +35,7 @@ if(typeof emotesBTTV2!=='undefined'&&settingsCookie["bda-es-2"]){if(emotesBTTV2. var url=bttvEmoteUrlStart+emotesBTTV2[sw]+bttvEmoteUrlEnd;if(skipffz&&emotesFfz.hasOwnProperty(sw))sw=sw+":bttv";contents.splice(i+splice++,0,self.createEmoteElement(sw,url,emoteClass));doInject=true;return;}}} if(text==null){text=w;}else{text+=""+w;} if(index===a.length-1){contents.splice(i+splice,0,document.createTextNode(text));}});if(doInject){var oldHeight=parent.outerHeight();parent.html(contents);var scrollPane=$(".scroller.messages").first();scrollPane.scrollTop(scrollPane.scrollTop()+(parent.outerHeight()-oldHeight));}});} -inject();if(parent.children().hasClass("edited")){setTimeout(inject,250);}};EmoteModule.prototype.createEmoteElement=function(word,url,mod){var len=Math.round(word.length / 4);var name=word.substr(0,len)+"\uFDD9"+word.substr(len,len)+"\uFDD9"+word.substr(len*2,len)+"\uFDD9"+word.substr(len*3);var html=''+name+'';return $.parseHTML(html.replace(new RegExp("\uFDD9","g"),""))[0];};EmoteModule.prototype.autoCapitalize=function(){var self=this;$('body').delegate($(".channel-text-area-default textarea:first"),'keyup change paste',function(){if(!settingsCookie["bda-es-4"])return;var text=$(".channel-text-area-default textarea:first").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-text-area-default textarea:first").val(text.replace(lastWord,ret));}}});};EmoteModule.prototype.capitalize=function(value){var res=emotesTwitch.emotes;for(var p in res){if(res.hasOwnProperty(p)&&value==(p+'').toLowerCase()){return p;}}};class PublicServers{constructor(){this.v2p=new V2_PublicServers();} +inject();if(parent.children().hasClass("edited")){setTimeout(inject,250);}};EmoteModule.prototype.createEmoteElement=function(word,url,mod){var len=Math.round(word.length / 4);var name=word.substr(0,len)+"\uFDD9"+word.substr(len,len)+"\uFDD9"+word.substr(len*2,len)+"\uFDD9"+word.substr(len*3);var html=''+name+'';return $.parseHTML(html.replace(new RegExp("\uFDD9","g"),""))[0];};EmoteModule.prototype.autoCapitalize=function(){var self=this;$('body').delegate($(".channel-text-area-default textarea:first"),'keyup change paste',function(){if(!settingsCookie["bda-es-4"])return;var text=$(".channel-text-area-default textarea:first").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-text-area-default textarea:first").val(text.replace(lastWord,ret));}}});};EmoteModule.prototype.capitalize=function(value){var res=emotesTwitch;for(var p in res){if(res.hasOwnProperty(p)&&value==(p+'').toLowerCase()){return p;}}};class PublicServers{constructor(){this.v2p=new V2_PublicServers();} get endPoint(){return'https://search.discordservers.com';} get button(){let self=this;let btn=$("
",{class:'guild',id:'bd-pub-li',css:{'height':'20px','display':settingsCookie['bda-gs-1']?"":"none"}}).append($("
",{class:'guild-inner',css:{'height':'20px','border-radius':'4px'}}).append($("",{}).append($("
",{text:'public',id:'bd-pub-button',css:{'line-height':'20px','font-size':'12px'},click:()=>{self.v2p.render();}}))));return btn;} init(){let self=this;let guilds=$(".guilds>:first-child");guilds.after(self.button);} @@ -60,7 +60,7 @@ escape(unsafe){console.log("pubs escape");} query(params){return require('querystring').stringify(params);}} function QuickEmoteMenu(){} QuickEmoteMenu.prototype.init=function(){$(document).on("mousedown",function(e){if(e.target.id!="rmenu")$("#rmenu").remove();});this.favoriteEmotes={};var fe=bdStorage.get("bdfavemotes");if(fe!==""&&fe!==null){this.favoriteEmotes=JSON.parse(atob(fe));} -var qmeHeader="";qmeHeader+="
";qmeHeader+="