Bot icon bug fix

This commit is contained in:
Jiiks 2016-01-10 11:38:27 +02:00
parent a1cc5218ed
commit 26ae69ed77
2 changed files with 3 additions and 1 deletions

View File

@ -264,9 +264,11 @@ Core.prototype.initObserver = function () {
if (lastMessage != undefined) {
var a = lastMessage.find(".avatar-large");
if (a.length > 0) {
try {
if (botlist.indexOf(a.css("background-image").match(/\d+/).toString()) > -1) {
lastMessage.find(".user-name").addClass("boticon");
}
}catch(err) {}
}
}
if (typeof pluginModule !== "undefined") pluginModule.newMessage();

2
js/main.min.js vendored
View File

@ -4,7 +4,7 @@ utils=new Utils();var sock=new BdWSocket();sock.start();utils.getHash();emoteMod
settingsPanel=new SettingsPanel();settingsPanel.init();quickEmoteMenu.init(false);$("#tc-settings-button").on("click",function(){settingsPanel.show();});$("#bd-pub-button").on("click",function(){opublicServers.show();});opublicServers.init();emoteModule.autoCapitalize();if(settingsCookie["version"]<jsVersion){var cl=self.constructChangelog();$("body").append(cl);settingsCookie["version"]=jsVersion;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){settingsCookie=defaultCookie;this.saveSettings();}else{this.loadSettings();for(var setting in defaultCookie){if(settingsCookie[setting]==undefined){settingsCookie[setting]=defaultCookie[setting];this.saveSettings();}}}};Core.prototype.saveSettings=function(){$.cookie("better-discord",JSON.stringify(settingsCookie),{expires:365,path:'/'});};Core.prototype.loadSettings=function(){settingsCookie=JSON.parse($.cookie("better-discord"));};var botlist=["119598467310944259"];Core.prototype.initObserver=function(){mainObserver=new MutationObserver(function(mutations){mutations.forEach(function(mutation){if(mutation.target.getAttribute('class')!=null){if(mutation.target.getAttribute('class').indexOf("titlebar")!=-1){quickEmoteMenu.obsCallback();voiceMode.obsCallback();if(typeof pluginModule!=="undefined")pluginModule.channelSwitch();$(".message-group").each(function(){var a=$(this).find(".avatar-large");if(a.length>0){try{var b=a.css("background-image").match(/\d+/).toString();if(botlist.indexOf(a)>-1){$(this).find(".user-name").addClass("boticon");}}catch(err){}}});}
if(mutation.target.getAttribute('class').indexOf('scroller messages')!=-1){var lastMessage=$(".message-group").last();if(lastMessage!=undefined){var a=lastMessage.find(".avatar-large");if(a.length>0){if(botlist.indexOf(a.css("background-image").match(/\d+/).toString())>-1){lastMessage.find(".user-name").addClass("boticon");}}}
if(mutation.target.getAttribute('class').indexOf('scroller messages')!=-1){var lastMessage=$(".message-group").last();if(lastMessage!=undefined){var a=lastMessage.find(".avatar-large");if(a.length>0){try{if(botlist.indexOf(a.css("background-image").match(/\d+/).toString())>-1){lastMessage.find(".user-name").addClass("boticon");}}catch(err){}}}
if(typeof pluginModule!=="undefined")pluginModule.newMessage();}}
emoteModule.obsCallback(mutation);});});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="change-log"> '+' <div class="header">'+' <strong>What\'s new in BetterDiscord JS v1.53&'+jsVersion+'</strong>'+' <button class="close" onclick=\'$("#bd-wn-modal").remove();\'></button>'+' </div><!--header-->'+' <div class="scroller-wrap">'+' <div class="scroller">';if(bdchangelog.changes!=null){changeLog+=''+'<h1 class="changelog-added">'+' <span>New Stuff</span>'+'</h1>'+'<ul>';for(var change in bdchangelog.changes){change=bdchangelog.changes[change];changeLog+=''+'<li>'+' <strong>'+change.title+'</strong>'+' <div>'+change.text+'</div>'+'</li>';}
changeLog+='</ul>';}