From 40239dfc402aa340bc8dda4716af915f02409214 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Thu, 7 Jan 2016 10:01:20 +0200 Subject: [PATCH] Emotemenu random icon --- js/main.js | 3 +++ js/main.min.js | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/js/main.js b/js/main.js index 739f1f1b..963a9ee9 100644 --- a/js/main.js +++ b/js/main.js @@ -177,6 +177,7 @@ Core.prototype.init = function() { } $("head").append(""); + $("head").append(''); } else { setTimeout(gwDefer, 100); @@ -736,6 +737,7 @@ PublicServers.prototype.joinServer = function(code) { */ var emoteBtn, emoteMenu; +var eiarr = [1, 3, 4, 6, 7, 8, 10, 11, 12, 13, 14]; function QuickEmoteMenu() { @@ -761,6 +763,7 @@ QuickEmoteMenu.prototype.init = function(reload) { $("#twitchcord-button").on("click", function() { menuOpen = !menuOpen; if(menuOpen) { + $("#bdemotemenustyle").html('.twitchcord-button-open { background-image:url(https://static-cdn.jtvnw.net/emoticons/v1/'+eiarr[Math.floor(Math.random()*eiarr.length)]+'/1.0) !important; }'); emoteMenu.addClass("emotemenu-open"); $(this).addClass("twitchcord-button-open"); } else { diff --git a/js/main.min.js b/js/main.min.js index a9552773..dd1e86ce 100644 --- a/js/main.min.js +++ b/js/main.min.js @@ -3,7 +3,7 @@ var links={"Jiiks.net":{"text":"Jiiks.net","href":"http://jiiks.net","target":"_ Core.prototype.init=function(){var self=this;if(version
Please download the latest version from BetterDiscord.net");return;} utils=new Utils();var sock=new BdWSocket();sock.start();utils.getHash();emoteModule=new EmoteModule();quickEmoteMenu=new QuickEmoteMenu();voiceMode=new VoiceMode();emoteModule.init();this.initSettings();this.initObserver();function gwDefer(){console.log(new Date().getTime()+" Defer");if($(".guilds-wrapper .guilds").children().length>0){console.log(new Date().getTime()+" Defer Loaded");var guilds=$(".guilds li:first-child");guilds.after($("
  • ",{id:"bd-pub-li",css:{"height":"20px","display":settingsCookie["bda-gs-1"]==true?"":"none"}}).append($("
    ",{class:"guild-inner",css:{"height":"20px","border-radius":"4px"}}).append($("").append($("
    ",{css:{"line-height":"20px","font-size":"12px"},text:"public",id:"bd-pub-button"})))));var showChannelsButton=$("'+'
    '+'
    '+'
    ';if(bdchangelog.changes!=null){changeLog+=''+'

    '+' New Stuff'+'

    '+'
      ';for(var change in bdchangelog.changes){change=bdchangelog.changes[change];changeLog+=''+'
    • '+' '+change.title+''+'
      '+change.text+'
      '+'
    • ';} @@ -26,9 +26,9 @@ if(typeof emotesBTTV!=='undefined'&&settingsCookie["bda-es-2"]){if(emotesBTTV.ha if(typeof emotesBTTV2!=='undefined'&&settingsCookie["bda-es-2"]){if(emotesBTTV2.hasOwnProperty(word)){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 url=bttvEmoteUrlStart+emotesBTTV2[word]+bttvEmoteUrlEnd;parentInnerHTML=parentInnerHTML.replace(word,'
      '+name+'
      ');return;}} if(subEmotesTwitch.hasOwnProperty(word)){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 url=twitchEmoteUrlStart+subEmotesTwitch[word]+twitchEmoteUrlEnd;parentInnerHTML=parentInnerHTML.replace(word,'
      '+name+'
      ');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(!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=emotesTwitch.emotes;for(var p in res){if(res.hasOwnProperty(p)&&value==(p+'').toLowerCase()){return p;}}};var publicServers={"servers":{"server":{"code":0,"icon":null,"title":"title","language":"EN","description":"description"}}};function PublicServers(){} -PublicServers.prototype.getPanel=function(){return this.container;};PublicServers.prototype.init=function(){var self=this;this.container=$("
      ",{id:"bd-ps-container",style:"display:none"});var header=$("
      ",{id:"bd-ps-header"});$("

      ",{text:"Public Servers"}).appendTo(header);$("",{id:"bd-ps-close",style:"cursor:pointer;",text:"X"}).appendTo(header);header.appendTo(this.getPanel());var psbody=$("
      ",{id:"bd-ps-body"});psbody.appendTo(this.getPanel());var table=$("",{border:"0"});var thead=$("");thead.appendTo(table);var headers=$("",{}).append($("",{id:"bd-ps-tbody"});tbody.appendTo(table);table.appendTo(psbody);$("body").append(this.getPanel());$("#bd-ps-close").on("click",function(){self.show();});var servers=publicServers.servers;for(var server in servers){if(servers.hasOwnProperty(server)){var s=servers[server];var code=s.code;var title=s.title;var language=s.language;var description=s.description;this.addServer(server,code,title,language,description);}}};PublicServers.prototype.addServer=function(name,code,title,language,description){var self=this;var tableBody=$("#bd-ps-tbody");var desc=$("");tr.append($("
      ",{text:"Name"})).append($("",{text:"Code"})).append($("",{text:"Language"})).append($("",{text:"Description"})).append($("",{text:"Join"}));headers.appendTo(thead);var tbody=$("
      ").append($("
      ",{class:"bd-ps-description",text:description}));var tr=$("
      ",{text:title}));tr.append($("",{css:{"-webkit-user-select":"initial","user-select":"initial"},text:code}));tr.append($("",{text:language}));tr.append(desc);tr.append($("").append($("