diff --git a/js/main.js b/js/main.js index 3563155..ca37d99 100644 --- a/js/main.js +++ b/js/main.js @@ -40,7 +40,8 @@ var settings = { "BetterTTV Emotes": { "id": "bda-es-2", "info": "Show BetterTTV Emotes", "implemented":true }, "Emote Autocomplete": { "id": "bda-es-3", "info": "Autocomplete emote commands", "implemented":false }, "Emote Auto Capitalization": { "id": "bda-es-4", "info": "Autocapitalize emote commands", "implemented":true }, - "Override Default Emotes": { "id": "bda-es-5", "info": "Override default emotes", "implemented":false } + "Override Default Emotes": { "id": "bda-es-5", "info": "Override default emotes", "implemented":false }, + "Show Names": { "id": "bda-es-6", "info": "Show emote names on hover", "implemented": true} }; var defaultCookie = { @@ -55,7 +56,8 @@ var defaultCookie = { "bda-es-2":false, "bda-es-3":false, "bda-es-4":false, - "bda-es-5":true + "bda-es-5":true, + "bda-es-6":true }; var settingsCookie = {}; @@ -144,7 +146,7 @@ Core.prototype.initObserver = function() { if(mutation.target.getAttribute('class') != null) { if(mutation.target.getAttribute('class').indexOf("titlebar") != -1) { quickEmoteMenu.obsCallback(); - voiceMode.obsCallback(); + voiceMode.obsCallback(); } } emoteModule.obsCallback(mutation); @@ -239,39 +241,64 @@ EmoteModule.prototype.injectEmote = function(node) { words.some(function(word) { if($.inArray(word, bemotes) != -1) return; - - if(word.length < 4) { - return; - } + + if(word.length < 4) { + return; + } if(emotesTwitch.emotes.hasOwnProperty(word)) { - parentInnerHTML = parentInnerHTML.replace(word, "<\/img>"); - return; + if (settingsCookie["bda-es-6"]) { + parentInnerHTML = parentInnerHTML.replace(word, ''); + return; + } + else { + parentInnerHTML = parentInnerHTML.replace(word, "<\/img>"); + return; + } } if(typeof emotesFfz !== 'undefined' && settingsCookie["bda-es-1"]) { if(emotesFfz.hasOwnProperty(word)) { - parentInnerHTML = parentInnerHTML.replace(word, "<\/img>"); - return; + if (settingsCookie["bda-es-6"]) { + parentInnerHTML = parentInnerHTML.replace(word, ''); + return; + } + else { + parentInnerHTML = parentInnerHTML.replace(word, "<\/img>"); + return; + } } } if(typeof emotesBTTV !== 'undefined' && settingsCookie["bda-es-2"]) { if(emotesBTTV.hasOwnProperty(word)) { - parentInnerHTML = parentInnerHTML.replace(word, "<\/img>"); - return; + if (settingsCookie["bda-es-6"]) { + parentInnerHTML = parentInnerHTML.replace(word, ''); + return; + } + else { + parentInnerHTML = parentInnerHTML.replace(word, "<\/img>"); + return; + } } } if (subEmotesTwitch.hasOwnProperty(word)) { - parentInnerHTML = parentInnerHTML.replace(word, "<\/img>"); + if (settingsCookie["bda-es-6"]) { + parentInnerHTML = parentInnerHTML.replace(word, ''); + return; + } + else { + parentInnerHTML = parentInnerHTML.replace(word, "<\/img>"); + return; + } } }); if(parent.parentElement == null) return; var oldHeight = parent.parentElement.offsetHeight; - parent.innerHTML = parentInnerHTML; + parent.innerHTML = parentInnerHTML.replace(new RegExp("\uFDD9", "g"), ""); var newHeight = parent.parentElement.offsetHeight; //Scrollfix @@ -735,15 +762,15 @@ function VoiceMode() { } VoiceMode.prototype.obsCallback = function() { - console.log("voiceMode obs"); - var self = this; - if(settingsCookie["bda-gs-4"]) { - self.disable(); - setTimeout(function() { - self.enable(); - }, 300); - - } + console.log("voiceMode obs"); + var self = this; + if(settingsCookie["bda-gs-4"]) { + self.disable(); + setTimeout(function() { + self.enable(); + }, 300); + + } } VoiceMode.prototype.enable = function() { @@ -760,8 +787,8 @@ VoiceMode.prototype.disable = function() { $(".scroller.guild-channels ul").first().css("display", ""); $(".scroller.guild-channels header").first().css("display", ""); //$(".flex-vertical.flex-spacer").first().css("overflow", ""); - $(".app.flex-vertical").first().css("overflow", ""); + $(".app.flex-vertical").first().css("overflow", ""); $(".chat.flex-vertical.flex-spacer").first().css("visibility", "").css("min-width", ""); $(".flex-vertical.channels-wrap").first().css("flex-grow", ""); $(".guild-header .btn.btn-hamburger").first().css("visibility", ""); -}; \ No newline at end of file +}; diff --git a/js/main.min.js b/js/main.min.js index 3eb59b7..4cd1232 100644 --- a/js/main.min.js +++ b/js/main.min.js @@ -1 +1 @@ -function Core(){}function EmoteModule(){}function PublicServers(){}function QuickEmoteMenu(){}function SettingsPanel(){}function Utils(){}function VoiceMode(){}var settingsPanel,emoteModule,utils,quickEmoteMenu,opublicServers,voiceMode,jsVersion=1.3,supportedVersion="0.1.5",mainObserver,twitchEmoteUrlStart="https://static-cdn.jtvnw.net/emoticons/v1/",twitchEmoteUrlEnd="/1.0",ffzEmoteUrlStart="https://cdn.frankerfacez.com/emoticon/",ffzEmoteUrlEnd="/1",bttvEmoteUrlStart="",bttvEmoteUrlEnd="",mainCore,settings={"Save logs locally":{id:"bda-gs-0",info:"Saves chat logs locally",implemented:!1},"Public Servers":{id:"bda-gs-1",info:"BETA : Display public servers button",implemented:!0},"Minimal Mode":{id:"bda-gs-2",info:"Hide elements and reduce the size of elements.",implemented:!0},"Voice Mode":{id:"bda-gs-4",info:"Only show voice chat",implemented:!0},"Hide Channels":{id:"bda-gs-3",info:"Hide channels in minimal mode",implemented:!0},"Quick Emote Menu":{id:"bda-es-0",info:"Show quick emote menu for adding emotes",implemented:!0},"FrankerFaceZ Emotes":{id:"bda-es-1",info:"Show FrankerFaceZ Emotes",implemented:!0},"BetterTTV Emotes":{id:"bda-es-2",info:"Show BetterTTV Emotes",implemented:!0},"Emote Autocomplete":{id:"bda-es-3",info:"Autocomplete emote commands",implemented:!1},"Emote Auto Capitalization":{id:"bda-es-4",info:"Autocapitalize emote commands",implemented:!0},"Override Default Emotes":{id:"bda-es-5",info:"Override default emotes",implemented:!1}},defaultCookie={version:jsVersion,"bda-gs-0":!1,"bda-gs-1":!0,"bda-gs-2":!1,"bda-gs-3":!1,"bda-gs-4":!1,"bda-es-0":!0,"bda-es-1":!1,"bda-es-2":!1,"bda-es-3":!1,"bda-es-4":!1,"bda-es-5":!0},settingsCookie={};Core.prototype.init=function(){function e(){if(console.log((new Date).getTime()+" Defer"),$(".guilds-wrapper .guilds").children().length>0){console.log((new Date).getTime()+" Defer Loaded");var t=$(".guilds li:first-child");t.after($("
  • ",{id:"bd-pub-li",css:{height:"20px",display:1==settingsCookie["bda-gs-1"]?"":"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"}))))),t.after($("
  • ",{id:"tc-settings-li"}).append($("
    ",{"class":"guild-inner"}).append($("").append($("
    ",{"class":"avatar-small",id:"tc-settings-button"}))))),settingsPanel=new SettingsPanel,settingsPanel.init(),quickEmoteMenu.init(!1),$("#tc-settings-button").on("click",function(){settingsPanel.show()}),$("#bd-pub-button").on("click",function(){opublicServers.show()}),opublicServers=new PublicServers,opublicServers.init(),emoteModule.autoCapitalize()}else setTimeout(e,100)}return version")):"undefined"!=typeof emotesFfz&&settingsCookie["bda-es-1"]&&emotesFfz.hasOwnProperty(e)?void(i=i.replace(e,"")):"undefined"!=typeof emotesBTTV&&settingsCookie["bda-es-2"]&&emotesBTTV.hasOwnProperty(e)?void(i=i.replace(e,"")):void(subEmotesTwitch.hasOwnProperty(e)&&(i=i.replace(e,"")))}),null!=t.parentElement)){var n=t.parentElement.offsetHeight;t.innerHTML=i;var a=t.parentElement.offsetHeight,s=$(".scroller.messages").first();s.scrollTop(s.scrollTop()+(a-n))}}}},EmoteModule.prototype.autoCapitalize=function(){var e=this;$("body").delegate($(".channel-textarea-inner textarea"),"keyup change paste",function(){if(settingsCookie["bda-es-4"]){var t=$(".channel-textarea-inner textarea").val();if(void 0!=t){var i=t.split(" ").pop();if(i.length>3){var o=e.capitalize(i.toLowerCase());null!=o&&$(".channel-textarea-inner textarea").val(t.replace(i,o))}}}})},EmoteModule.prototype.capitalize=function(e){return twitchAc.hasOwnProperty(e)?twitchAc[e]:null};var publicServers={servers:{server:{code:0,icon:null,title:"title",language:"EN",description:"description"}}};PublicServers.prototype.getPanel=function(){return this.container},PublicServers.prototype.init=function(){var e=this;this.container=$("
    ",{id:"bd-ps-container",style:"display:none"});var t=$("
    ",{id:"bd-ps-header"});$("

    ",{text:"Public Servers"}).appendTo(t),$("",{id:"bd-ps-close",style:"cursor:pointer;",text:"X"}).appendTo(t),t.appendTo(this.getPanel());var i=$("
    ",{id:"bd-ps-body"});i.appendTo(this.getPanel());var o=$("",{border:"0"}),n=$("");n.appendTo(o);var a=$("",{}).append($("",{id:"bd-ps-tbody"});s.appendTo(o),o.appendTo(i),$("body").append(this.getPanel()),$("#bd-ps-close").on("click",function(){e.show()});var r=publicServers.servers;for(var l in r)if(r.hasOwnProperty(l)){var c=r[l],d=c.code,p=c.title,u=c.language,m=c.description;this.addServer(l,d,p,u,m)}},PublicServers.prototype.addServer=function(e,t,i,o,n){var a=this,s=$("#bd-ps-tbody"),r=$("");l.append($("
    ",{text:"Name"})).append($("",{text:"Code"})).append($("",{text:"Language"})).append($("",{text:"Description"})).append($("",{text:"Join"}));a.appendTo(n);var s=$("
    ").append($("
    ",{"class":"bd-ps-description",text:n})),l=$("
    ",{text:i})),l.append($("",{css:{"-webkit-user-select":"initial","user-select":"initial"},text:t})),l.append($("",{text:o})),l.append(r),l.append($("").append($("