!function(t){!functione(t,s,n){functioni(a,r){if(!s[a]){if(!t[a]){vard="function"==typeofrequire&&require;if(!r&&d)returnd(a,!0);if(o)returno(a,!0);thrownewError("Cannot find module '"+a+"'")}varu=s[a]={exports:{}};t[a][0].call(u.exports,function(e){vars=t[a][1][e];returni(s?s:e)},u,u.exports,e,t,s,n)}returns[a].exports}for(varo="function"==typeofrequire&&require,a=0;a<n.length;a++)i(n[a]);returni}({1:[function(e,s){varn=n||function(t){"use strict";if("undefined"==typeofnavigator||!/MSIE [1-9]\./.test(navigator.userAgent)){vare=t.document,s=function(){returnt.URL||t.webkitURL||t},n=e.createElementNS("http://www.w3.org/1999/xhtml","a"),i="download"inn,o=function(t){vare=newMouseEvent("click");t.dispatchEvent(e)},a=t.webkitRequestFileSystem,r=t.requestFileSystem||a||t.mozRequestFileSystem,d=function(e){(t.setImmediate||t.setTimeout)(function(){throwe},0)},u="application/octet-stream",c=0,l=500,h=function(e){varn=function(){"string"==typeofe?s().revokeObjectURL(e):e.remove()};t.chrome?n():setTimeout(n,l)},f=function(t,e,s){e=[].concat(e);for(varn=e.length;n--;){vari=t["on"+e[n]];if("function"==typeofi)try{i.call(t,s||t)}catch(o){d(o)}}},m=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?newBlob(["",t],{type:t.type}):t},_=function(e,d,l){l||(e=m(e));var_,p,g,v=this,b=e.type,y=!1,w=function(){f(v,"writestart progress write writeend".split(" "))},z=function(){if((y||!_)&&(_=s().createObjectURL(e)),p)p.location.href=_;else{varn=t.open(_,"_blank");void0==n&&"undefined"!=typeofsafari&&(t.location.href=_)}v.readyState=v.DONE,w(),h(_)},k=function(t){returnfunction(){returnv.readyState!==v.DONE?t.apply(this,arguments):void0}},E={create:!0,exclusive:!1};returnv.readyState=v.INIT,d||(d="download"),i?(_=s().createObjectURL(e),n.href=_,n.download=d,voidsetTimeout(function(){o(n),w(),h(_),v.readyState=v.DONE})):(t.chrome&&b&&b!==u&&(g=e.slice||e.webkitSlice,e=g.call(e,0,e.size,u),y=!0),a&&"download"!==d&&(d+=".download"),(b===u||a)&&(p=t),r?(c+=e.size,voidr(t.TEMPORARY,c,k(function(t){t.root.getDirectory("saved",E,k(function(t){vars=function(){t.getFile(d,E,k(function(t){t.createWriter(k(function(s){s.onwriteend=function(e){p.location.href=t.toURL(),v.readyState=v.DONE,f(v,"writeend",e),h(t)},s.onerror=function(){vart=s.error;t.code!==t.ABORT_ERR&&z()},"writestart progress write abort".split(" ").forEach(function(t){s["on"+t]=v["on"+t]}),s.write(e),v.abort=function(){s.abort(),v.readyState=v.DONE},v.readyState=v.WRITING}),z)}),z)};t.getFile(d,{create:!1},k(function(t){t.remove(),s()}),k(function(t){t.code===t.NOT_FOUND_ERR?s():z()}))}),z)}),z)):voidz())},p=_.prototype,g=function(t,e,s){returnnew_(t,e,s)};return"undefined"!=typeofnavigator&&navigator.msSaveOrOpenBlob?function(t,e,s){returns||(t=m(t)),navigator.msSaveOrOpenBlob(t,e||"download")}:(p.abort=function(){vart=this;t.readyState=t.DONE,f(t,"abort")},p.readyState=p.INIT=0,p.WRITING=1,p.DONE=2,p.error=p.onwritestart=p.onprogress=p.onwrite=p.onabort=p.onerror=p.onwriteend=null,g)}}("undefined"!=typeofself&&self||"undefined"!=typeoft&&t||this.content);"undefined"!=typeofs&&s.exports?s.exports.saveAs=n:"undefined"!=typeofdefine&&null!==define&&null!=define.amd&&define([],function(){returnn})},{}],2:[function(e){vars=t.FrankerFaceZ,n=e("./constants"),i=e("./utils");s.settings_info.show_badges={type:"boolean",value:!0,category:"Chat Appearance",name:"Additional Badges",help:"Show additional badges for bots, FrankerFaceZ donors, and other special users."},s.settings_info.transparent_badges={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"Transparent Badges",help:"Make chat badges transparent for a nice, clean look. On light chat, non-subscriber badges are inverted to remain visible.",on_update:function(t){this.has_bttv||document.body.classList.toggle("ffz-transparent-badges",t)}},s.prototype.setup_badges=function(){this.has_bttv||document.body.classList.toggle("ffz-transparent-badges",this.settings.transparent_badges),this.log("Preparing badge system."),t
},{}],6:[function(){vare=t.FrankerFaceZ;e.settings_info.developer_mode={type:"boolean",value:!1,storage_key:"ffzDebugMode",visible:function(){returnthis.settings.developer_mode||Date.now()-parseInt(localStorage.ffzLastDevMode||"0")<6048e5},category:"Debugging",name:"Developer Mode",help:"Load FrankerFaceZ from the local development server instead of the CDN. Please refresh after changing this setting.",on_update:function(){localStorage.ffzLastDevMode=Date.now()}},e.ffz_commands.developer_mode=function(t,e){vars,e=e&&e.length?e[0].toLowerCase():null;return"y"==e||"yes"==e||"true"==e||"on"==e?s=!0:("n"==e||"no"==e||"false"==e||"off"==e)&&(s=!1),void0===s?"Developer Mode is currently "+(this.settings.developer_mode?"enabled.":"disabled."):(this.settings.set("developer_mode",s),"Developer Mode is now "+(s?"enabled":"disabled")+". Please refresh your browser.")},e.ffz_commands.developer_mode.help="Usage: /ffz developer_mode <on|off>\nEnable or disable Developer Mode. When Developer Mode is enabled, the script will be reloaded from //localhost:8000/script.js instead of from the CDN."},{}],7:[function(e){vars=t.FrankerFaceZ,n=e("../utils"),i=e("../constants");s.prototype.setup_channel=function(){this.log("Creating channel style element.");vart=this._channel_style=document.createElement("style");t.id="ffz-channel-css",document.head.appendChild(t),document.body.classList.toggle("ffz-hide-view-count",!this.settings.channel_views),this.log("Creating channel style element.");vart=this._channel_style=document.createElement("style");t.id="ffz-channel-css",document.head.appendChild(t),this.log("Hooking the Ember Channel Index view.");vare=App.__container__.resolve("view:channel/index"),n=this;if(e){this._modify_cindex(e);try{e.create().destroy()}catch(i){}for(varoinEmber.View.views)if(Ember.View.views.hasOwnProperty(o)){vara=Ember.View.views[o];ainstanceofe&&(this.log("Manually updating Channel Index view.",a),this._modify_cindex(a),a.ffzInit())}this.log("Hooking the Ember Channel model."),e=App.__container__.resolve("model:channel"),e&&(e.reopen({ffz_host_target:void0,setHostMode:function(t){returnn.settings.hosted_channels?(this.set("ffz_host_target",t.target),this._super(t)):(this.set("ffz_host_target",void0),this._super({target:void0,delay:0}))}}),this.log("Hooking the Ember Channel controller."),e=App.__container__.lookup("controller:channel"),e&&(e.reopen({ffzUpdateUptime:function(){n._cindex&&n._cindex.ffzUpdateUptime()}.observes("isLive","content.id"),ffzUpdateInfo:function(){this._ffz_update_timer&&clearTimeout(this._ffz_update_timer),this.get("content.id")&&(this._ffz_update_timer=setTimeout(this.ffzCheckUpdate.bind(this),6e4))}.observes("content.id"),ffzCheckUpdate:function(){vart=this,e=t.get("content.id");e&&Twitch.api&&Twitch.api.get("streams/"+e,{},{version:3}).done(function(e){if(!e||!e.stream)returnt.set("stream.created_at",null),voidt.set("stream.viewers",0);t.set("stream.created_at",e.stream.created_at||null),t.set("stream.viewers",e.stream.viewers||0);vars=e.stream.game||e.stream.channel&&e.stream.channel.game;s&&(t.set("game",s),t.set("rollbackData.game",s)),e.stream.channel&&(e.stream.channel.status&&t.set("status",e.stream.channel.status),e.stream.channel.views&&t.set("views",e.stream.channel.views),e.stream.channel.followers&&t.get("content.followers.isLoaded")&&t.set("content.followers.total",e.stream.channel.followers))}).always(function(){t.ffzUpdateInfo()})},ffzUpdateTitle:function(){vart=this.get("content.name"),e=this.get("content.display_name");e&&(s.capitalization[t]=[e,Date.now()]),n._cindex&&n._cindex.ffzFixTitle()}.observes("content.status","content.id"),ffzHostTarget:function(){vart=this.get("content.hostModeTarget"),e=t&&t.get("name"),i=t&&t.get("id"),o=t&&t.get("display_name");i!==n.__old_host_target&&(n.__old_host_target&&n.ws_send("unsub_channel",n.__old_host_target),i?(n.ws_send("sub_channel",i),n.__old_host_target=i):deleten.__old_host_target),o&&(s.capitalization[e]=[o,Date.now()]),n.settings.group_tabs&&n._chatv&&n._chatv.ffzRebuildTabs(),n.settings.follow_buttons&&n
if(o){varr=n.format_unread(t===i?0:o.room.get("unreadCount"));a.querySelector("span").innerHTML=r}}}}},ffzBuildTab:function(t,o,a,r){{vard,u,c=document.createElement("span"),l="",h=o.get("id"),f=o.get("isGroupRoom"),m=o===t.get("controller.currentRoom");m||-1!==e.settings.visible_rooms.indexOf(h)}returnc.setAttribute("data-room",o.id),c.className="ffz-chat-tab tooltip",c.classList.toggle("current-channel",a),c.classList.toggle("host-channel",r),c.classList.toggle("group-chat",f),c.classList.toggle("active",m),u=n.format_unread(m?0:o.get("unreadCount")),d=o.get("tmiRoom.displayName")||(f?o.get("tmiRoom.name"):s.get_capitalization(o.get("id"),function(t){u=n.format_unread(m?0:o.get("unreadCount")),c.innerHTML=l+n.sanitize(t)+"<span>"+u+"</span>"})),a?(l=i.CAMERA,c.title="Current Channel"):r?(l=i.EYE,c.title="Hosted Channel"):c.title=f?"Group Chat":"Pinned Channel",c.innerHTML=l+n.sanitize(d)+"<span>"+u+"</span>",c.addEventListener("click",function(){vare=t.get("controller");e.focusRoom(o),e.set("showList",!1)}),o._ffz_tab=c,c},ffzDisableTabs:function(){this._ffz_tabs&&(this._ffz_tabs.parentElement.removeChild(this._ffz_tabs),deletethis._ffz_tabs,deletethis._ffz_invite),this._ffz_host&&(-1===e.settings.pinned_rooms.indexOf(this._ffz_host)&&this._ffz_host_room&&(this.get("controller.currentRoom")===this._ffz_host_room&&this.get("controller").blurRoom(),this._ffz_host_room.destroy()),deletethis._ffz_host,deletethis._ffz_host_room),this.$(".chat-room").css("top",""),this.$(".chat-header").removeClass("hidden")}})},s.prototype.connect_extra_chat=function(){vart=this.get_user();if(t&&t.login&&(!this.rooms[t.login]||this.rooms[t.login].room)){vare=App.__container__.resolve("model:room");e&&e.findOne(t.login)}if(!this.has_bttv){for(vars=0;s<this.settings.pinned_rooms.length;s++)this._join_room(this.settings.pinned_rooms[s],!0);this._chatv&&(!this.has_bttv&&this.settings.group_tabs&&this._chatv.ffzRebuildTabs(),this._chatv.ffzRebuildMenu())}},s.prototype._join_room=function(t,e){vars=!1;if(-1===this.settings.pinned_rooms.indexOf(t)&&(this.settings.pinned_rooms.push(t),this.settings.set("pinned_rooms",this.settings.pinned_rooms),s=!0),this.rooms[t]&&this.rooms[t].room)returns&&!e&&!this.has_bttv&&this._chatv&&this.settings.group_tabs&&this._chatv.ffzRebuildTabs(),s;{varn=App.__container__.resolve("model:room");n&&n.findOne(t)}return!e&&!this.has_bttv&&this._chatv&&this.settings.group_tabs&&this._chatv.ffzRebuildTabs(),!e&&this._chatv&&this._chatv.ffzRebuildMenu(),s},s.prototype._leave_room=function(t,e){vars=!1;if(-1!==this.settings.pinned_rooms.indexOf(t)&&(this.settings.pinned_rooms.removeObject(t),this.settings.set("pinned_rooms",this.settings.pinned_rooms),s=!0),!this.rooms[t]||!this.rooms[t].room)returns;varn=App.__container__.lookup("controller:chat"),i=this.rooms[t].room,o=this.get_user();return!n||n.get("currentChannelRoom.id")===t||this._chatv&&this._chatv._ffz_host===t?s:(n.get("currentRoom.id")===t&&n.blurRoom(),o&&o.login===t||i.destroy(),!e&&!this.has_bttv&&this._chatv&&this.settings.group_tabs&&this._chatv.ffzRebuildTabs(),!e&&this._chatv&&this._chatv.ffzRebuildMenu(),s)},s.chat_commands.join=function(t,e){if(!e||!e.length||e.length>1)return"Join Usage: /join <channel>";vars=e[0].toLowerCase();return"#"===s.charAt(0)&&(s=s.substr(1)),this._join_room(s)?"Joining "+s+". You will always connect to this channel's chat unless you later /part from it.":"You have already joined "+s+'. Please use "/part '+s+'" to leave it.'},s.chat_commands.part=function(t,e){if(!e||!e.length||e.length>1)return"Part Usage: /part <channel>";vars=e[0].toLowerCase();return"#"===s.charAt(0)&&(s=s.substr(1)),this._leave_room(s)?"Leaving "+s+".":this.rooms[s]?"You do not have "+s+" pinned and you cannot leave the current channel or hosted channels via /part.":"You are not in "+s+"."}},{"../constants":5,"../utils":35}],10:[function(){vare=t.FrankerFaceZ;e.settings_info.swap_sidebars={type:"boolean",value:!1,category:"Appearance",no_mobile:!0,no_bttv:!0,name:"Swap Sidebar Positions",help:"Swapthepositionsoftheleftandrights
return65536>e?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))};s.prototype.setup_emoticons=function(){this.log("Preparing emoticon system."),this.emoji_data={},this.emoji_names={},this.emote_sets={},this.global_sets=[],this.default_sets=[],this._last_emote_id=0,this.emote_usage={},this.log("Creating emoticon style element.");vart=this._emote_style=document.createElement("style");t.id="ffz-emoticon-css",document.head.appendChild(t),this.log("Loading global emote sets."),this.load_global_sets(),this.log("Loading emoji data."),this.load_emoji_data(),this.log("Watching Twitch emoticon parser to ensure it loads."),this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4)},s.prototype.add_usage=function(t,e,s){varn=this.emote_usage[e]=this.emote_usage[e]||{};n[t]=(n[t]||0)+(s||1),this._emote_report_scheduled||(this._emote_report_scheduled=setTimeout(this._report_emotes.bind(this),3e4))},s.prototype._report_emotes=function(){this._emote_report_scheduled&&deletethis._emote_report_scheduled;vart=this.emote_usage;this.emote_usage={},this.ws_send("emoticon_uses",[t],function(){},!0)},s.prototype.check_twitch_emotes=function(){this._twitch_emote_check&&(clearTimeout(this._twitch_emote_check),deletethis._twitch_emote_check);vart;if(this.rooms)for(vareinthis.rooms)if(this.rooms.hasOwnProperty(e)){t=this.rooms[e];break}if(!t||!t.room||!t.room.tmiSession)returnvoid(this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4));vars=t.room.tmiSession._emotesParser,n=Object.keys(s.emoticonRegexToIds).length;if(!(n>0)){vari=s.emoticonSetIds;s.emoticonSetIds="",s.updateEmoticons(i),this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4)}},s.prototype.getEmotes=function(t,e){vars=this.users&&this.users[t],n=this.rooms&&this.rooms[e];return_.union(s&&s.sets||[],n&&n.set&&[n.set]||[],n&&n.extra_sets||[],this.default_sets)},s.ws_commands.reload_set=function(t){this.emote_sets.hasOwnProperty(t)&&this.load_set(t)},s.ws_commands.load_set=function(t){this.load_set(t)},s.prototype._emote_tooltip=function(t){if(!t)returnnull;if(t._tooltip)returnt._tooltip;vare=this.emote_sets[t.set_id],s=t.owner,n=e&&e.title||"Global";returnt._tooltip="Emoticon: "+(t.hidden?"???":t.name)+"\nFFZ "+n+(s?"\nBy: "+s.display_name:""),t._tooltip},s.prototype.load_emoji_data=function(t,e){vars=this;jQuery.getJSON(n.SERVER+"emoji/emoji.json").done(function(e){vari={},o={};for(varaine){varr=e[a];a=a.toLowerCase(),r.code=a,i[a]=r,o[r.short_name]=a,r.raw=_.map(r.code.split("-"),d).join(""),r.src=n.SERVER+"emoji/"+a+"-1x.png",r.srcSet=r.src+" 1x, "+n.SERVER+"emoji/"+a+"-2x.png 2x, "+n.SERVER+"emoji/"+a+"-4x.png 4x",r.token={srcSet:r.srcSet,emoticonSrc:r.src,ffzEmoji:a,altText:r.raw}}s.emoji_data=i,s.emoji_names=o,s.log("Loaded data on "+Object.keys(i).length+" emoji."),"function"==typeoft&&t(!0,e)}).fail(function(n){return404===n.status?"function"==typeoft&&t(!1):(e=(e||0)+1,50>e?s.load_emoji(t,e):"function"==typeoft&&t(!1))})},s.prototype.load_global_sets=function(t,e){vars=this;jQuery.getJSON(((e||0)%2===0?n.API_SERVER:n.API_SERVER_2)+"v1/set/global").done(function(t){s.default_sets=t.default_sets;vare=s.global_sets=[],n=t.sets||{};s.feature_friday&&s.feature_friday.set&&(-1===s.global_sets.indexOf(s.feature_friday.set)&&s.global_sets.push(s.feature_friday.set),-1===s.default_sets.indexOf(s.feature_friday.set)&&s.default_sets.push(s.feature_friday.set));for(variinn)if(n.hasOwnProperty(i)){varo=n[i];e.push(i),s._load_set_json(i,void0,o)}}).fail(function(n){return404==n.status?"function"==typeoft&&t(!1):(e=e||0,e++,50>e?s.load_global_sets(t,e):"function"==typeoft&&t(!1))})},s.prototype.load_set=function(t,e,s){vari=this;jQuery.getJSON(((s||0)%2===0?n.API_SERVER:n.API_SERVER_2)+"v1/set/"+t).done(function(s){i._load_set_json(t,e,s&&s.set)}).fail(function(n){return404==n.status?"function"==typeofe&&e(!1):(s=s||0,s++,10>s?i.load_set(t,e,s):"function"==typeofe&&e(!1))})},s.prototype.unload_set=function(t){vare=this.emote_sets[t];e&&(this.log("Unloadi
e.prototype._ws_open=!1,e.prototype._ws_delay=0,e.prototype._ws_last_iframe=0,e.ws_commands={},e.ws_on_close=[],e.prototype.ws_iframe=function(){this._ws_last_iframe=Date.now();vart=document.createElement("iframe"),e=this;t.src="http://catbag.frankerfacez.com",t.style.visibility="hidden",document.body.appendChild(t),setTimeout(function(){document.body.removeChild(t),e._ws_open||e.ws_create()},2e3)},e.prototype.ws_create=function(){vars,n=this;this._ws_last_req=0,this._ws_callbacks={},this._ws_pending=this._ws_pending||[];try{s=this._ws_sock=newWebSocket("ws://catbag.frankerfacez.com/")}catch(i){returnthis._ws_exists=!1,this.log("Error Creating WebSocket: "+i)}this._ws_exists=!0,s.onopen=function(){n._ws_open=!0,n._ws_delay=0,n._ws_last_iframe=Date.now(),n.log("Socket connected.");vars=t.RequestFileSystem||t.webkitRequestFileSystem;s?s(t.TEMPORARY,100,n.ws_send.bind(n,"hello",["ffz_"+e.version_info,localStorage.ffzClientId],n._ws_on_hello.bind(n)),n.log.bind(n,"Operating in Incognito Mode.")):n.ws_send("hello",["ffz_"+e.version_info,localStorage.ffzClientId],n._ws_on_hello.bind(n));vari=n.get_user();if(i&&n.ws_send("setuser",i.login),n.is_dashboard){varo=location.pathname.match(/\/([^\/]+)/);o&&(n.ws_send("sub",o[1]),n.ws_send("sub_channel",o[1]))}for(varainn.rooms)n.rooms.hasOwnProperty(a)&&n.rooms[a]&&(n.ws_send("sub",a),n.rooms[a].needs_history&&(n.rooms[a].needs_history=!1,!n.has_bttv&&n.settings.chat_history&&n.ws_send("chat_history",[a,25],n._load_history.bind(n,a))));if(n._cindex){varr=n._cindex.get("controller.id"),d=n._cindex.get("controller.hostModeTarget.id");r&&n.ws_send("sub_channel",r),d&&n.ws_send("sub_channel",d)}varu=n._ws_pending;n._ws_pending=[];for(varc=0;c<u.length;c++){varl=u[c];n.ws_send(l[0],l[1],l[2])}},s.onclose=function(t){n.log("Socket closed. (Code: "+t.code+", Reason: "+t.reason+")"),n._ws_open=!1;for(vars=0;s<e.ws_on_close.length;s++)try{e.ws_on_close[s].bind(n)()}catch(i){n.log("Error on Socket Close Callback: "+i)}if(n._ws_delay>1e4){varo=navigator.userAgent.toLowerCase();if(Date.now()-n._ws_last_iframe>18e5&&(-1!==o.indexOf("chrome")||-1===o.indexOf("safari")))returnn.ws_iframe()}n._ws_delay<6e4?n._ws_delay+=1e3*(Math.floor(10*Math.random())+5):n._ws_delay=1e3*(Math.floor(60*Math.random())+30),setTimeout(n.ws_create.bind(n),n._ws_delay)},s.onmessage=function(t){vars,i,o=t.data.indexOf(" "),a=t.data.substr(o+1),r=parseInt(t.data.slice(0,o));if(o=a.indexOf(" "),-1===o&&(o=a.length),s=a.slice(0,o),a=a.substr(o+1),a&&(i=JSON.parse(a)),-1===r){vard=e.ws_commands[s];d?d.bind(n)(i):n.log("Invalid command: "+s,i,!1,!0)}else{varu="True"===s,c="function"==typeofn._ws_callbacks[r];if(c){try{n._ws_callbacks[r](u,i)}catch(l){n.error("Callback for "+r+": "+l)}n._ws_callbacks[r]=void0}elsen.log("Socket Reply to "+r+" - "+(u?"SUCCESS":"FAIL"),i,!1,!0)}}},e.prototype.ws_send=function(t,e,s,n){if(!this._ws_open){if(n){vari=this._ws_pending=this._ws_pending||[];returni.push([t,e,s]),!0}return!1}varo=++this._ws_last_req;e=void0!==e?" "+JSON.stringify(e):"",s&&(this._ws_callbacks[o]=s);try{this._ws_sock.send(o+" "+t+e)}catch(a){returnthis.log("Socket Send Error: "+a),!1}returno},e.prototype._ws_on_hello=function(t,s){if(!t)returnthis.log("Error Saying Hello: "+s);localStorage.ffzClientId=s,this.log("Client ID: "+s);varn={},i=n.settings={};for(varoine.settings_info)i[o]=this.settings[o];i.keywords=this.settings.keywords.length,i.banned_words=this.settings.banned_words.length,n.bttv=this.has_bttv||!!document.head.querySelector('script[src*="betterttv"]'),n["user-agent"]=navigator.userAgent,n.screen=[screen.width,screen.height],n.language=navigator.language,n.platform=navigator.platform,this.ws_send("survey",[n])},e.ws_commands.do_authorize=function(t){vars;for(varninthis.rooms)if(this.rooms.hasOwnProperty(n)){vari=this.rooms[n];if(i&&i.room&&!i.room.get("roomProperties.eventchat")&&!i.room.get("isGroupRoom")&&i.room.tmiRoom){varo=i.room.tmiRoom._getConnection();if(o.isConnected){s=o;break}}}s?s._send("PRIVMSG #frankerfacezauthorizer :AUTH "+t):setTimeout(e.ws_commands.do
if(r&&r.length)for(varu=0,c=0,l=r.length;l>c;c++){varh=r[c];if(h&&h.channel){if(u+=1,u>a){e+="<hr><span>And "+n.number_commas(d-a)+" more...</span>";break}varf=this.settings.stream_uptime&&h.created_at&&n.parse_date(h.created_at),m=f&&Math.floor((Date.now()-f.getTime())/1e3)||0,_=Math.floor(m/60)%60,p=Math.floor(m/3600);e+=(0===c?"<hr>":"")+(m>0?'<span class="stat">'+i.CLOCK+" "+(p>0?p+"h":"")+_+"m</span>":"")+'<span class="stat">'+i.LIVE+" "+n.number_commas(h.viewers)+"</span><b>"+n.sanitize(h.channel.display_name||h.channel.name)+'</b><br><span class="playing">'+(h.channel.game?"Playing "+n.sanitize(h.channel.game):"Not Playing")+"</span>"}}elsee+="<hr>No one you're following is online.";returnsetTimeout(function(){vart=document.querySelector(".tipsy"),e=t.getBoundingClientRect(),s=parseInt(t.style.left||"0"),n=e.left+t.scrollWidth;e.left<5?t.style.left=s-e.left+5+"px":n>document.body.clientWidth-5&&(t.style.left=s-(5+n-document.body.clientWidth)+"px")}),e},s.prototype._install_following_tooltips=function(){vart=this,e={html:!0,className:function(){returna(t,this)},title:function(){returnt._build_following_tooltip(this)}},s=jQuery('#small_nav ul.game_filters li[data-name="following"] a');if(s&&s.length){varn=s.data("tipsy");n&&n.options?(n.options=_.extend(n.options,e),n.options.gravity=function(){returno(t,this)}):s.tipsy(_.extend({gravity:function(){returno(t,this)}},e))}vari=jQuery('#large_nav #nav_personal li[data-name="following"] a');if(i&&i.length){varn=i.data("tipsy");n&&n.options?n.options=_.extend(n.options,e):i.tipsy(e)}varr=jQuery("#header_actions #header_following");if(r&&r.length){varn=r.data("tipsy");n&&n.options?n.options=_.extend(n.options,e):r.tipsy(e)}},s.prototype._draw_following_channels=function(t,e){this._tooltip_streams=t,this._tooltip_total=e},s.prototype._draw_following_count=function(t){vare=document.querySelector('#small_nav ul.game_filters li[data-name="following"] a');if(e){vars=e.querySelector(".ffz-follow-count");this.has_bttv||!this.settings.following_count?s&&s.parentElement.removeChild(s):(s||(s=document.createElement("span"),s.className="ffz-follow-count",e.appendChild(s)),s.innerHTML=t?n.format_unread(t):"")}vari=document.querySelector('#large_nav #nav_personal li[data-name="following"] a');if(i){vars=i.querySelector(".ffz-follow-count");this.has_bttv||!this.settings.following_count?s&&s.parentElement.removeChild(s):(s||(s=document.createElement("span"),s.className="ffz-follow-count",i.appendChild(s)),s.innerHTML=t?n.format_unread(t):"")}varo=document.querySelector("#header_actions #header_following");if(o){vars=o.querySelector(".ffz-follow-count");this.has_bttv||!this.settings.following_count?s&&s.parentElement.removeChild(s):(s||(s=document.createElement("span"),s.className="ffz-follow-count",o.appendChild(s)),s.innerHTML=t?n.format_unread(t):"")}}},{"../constants":5,"../utils":35}],26:[function(e){vars=t.FrankerFaceZ,n=e("../utils"),i=/^[A-Za-z0-9_]+$/,o=/^(?:https?:\/\/)?(?:www\.)?twitch\.tv\/([A-Za-z0-9_]+)/i;s.prototype.setup_following=function(){this.log("Initializing following support."),this.follow_data={},this.follow_sets={}},s.settings_info.follow_buttons={type:"boolean",value:!0,no_mobile:!0,category:"Channel Metadata",name:"Relevant Follow Buttons",help:"Display additional Follow buttons for channels relevant to the stream, such as people participating in co-operative gameplay.",on_update:function(){this.rebuild_following_ui()}},s.ffz_commands.following=function(t,e){e=e.join(" ").trim().toLowerCase().split(/[ ,]+/);for(vars=[],n=0,i=e.length;i>n;n++){vara=e[n],r=a.match(o);r&&(a=r[1]),""!==a&&-1===s.indexOf(a)&&s.push(a)}vard=this.get_user(),u=this;return!d||d.login!==t.id&&"sirstendec"!==d.login&&"dansalvato"!==d.login?"You must be logged in as the broadcaster to use this command.":this.ws_send("update_follow_buttons",[t.id,s],function(e,s){returne?void(s?u.room_message(t,"The following buttons have been updated."):u.room_message(t,"The following buttons have been disabled.")):voidu.room_message(t,"Therewasanerrorupdatingthefollowing
vard={lang:"en-US",dir:"ltr",body:t,tag:n||"FrankerFaceZ",icon:"http://cdn.frankerfacez.com/icon32.png"},u=this,c=newNotification(s,d),l=e._last_notification++;returne._notifications[l]=c,c.addEventListener("click",function(){deletee._notifications[l],o&&o.bind(u)()}),c.addEventListener("close",function(){deletee._notifications[l],a&&a.bind(u)()}),void("number"==typeofi&&c.addEventListener("show",function(){setTimeout(function(){deletee._notifications[l],c.close()},i)}))}varu=this;Notification.requestPermission(function(){u.show_notification(t,s,n)})},e.prototype.show_message=function(e){t.noty({text:e,theme:"ffzTheme",layout:"bottomCenter",closeWith:["button"]}).show()}},{}],31:[function(e){vars=t.FrankerFaceZ,n=e("../utils");s.prototype.setup_races=function(){this.log("Initializing race support."),this.srl_races={}},s.settings_info.srl_races={type:"boolean",value:!0,no_mobile:!0,category:"Channel Metadata",name:"SRL Race Information",help:'Display information about <a href="http://www.speedrunslive.com/" target="_new">SpeedRunsLive</a> races under channels.',on_update:function(){this.rebuild_race_ui()}},s.ws_on_close.push(function(){vare=t.App&&App.__container__.lookup("controller:channel"),s=e&&e.get("id"),n=e&&e.get("hostModeTarget.id"),i=!1;if(e){for(varointhis.srl_races)deletethis.srl_races[o],(o===s||o===n)&&(i=!0);i&&this.rebuild_race_ui()}}),s.ws_commands.srl_race=function(t){vare=App.__container__.lookup("controller:channel"),s=e&&e.get("id"),n=e&&e.get("hostModeTarget.id"),i=!1;this.srl_races=this.srl_races||{};for(varo=0;o<t[0].length;o++){vara=t[0][o];this.srl_races[a]=t[1],(a===s||a===n)&&(i=!0)}if(t[1]){varr=t[1],d=r.twitch_entrants={};for(varuinr.entrants)r.entrants.hasOwnProperty(u)&&(r.entrants[u].channel&&(d[r.entrants[u].channel]=u),r.entrants[u].name=u)}i&&this.rebuild_race_ui()},s.prototype.rebuild_race_ui=function(){vart=App.__container__.lookup("controller:channel"),e=t&&t.get("id"),s=t&&t.get("hostModeTarget.id");if(this._cindex){if(e){varn=this.srl_races&&this.srl_races[e],i=this._cindex.get("element"),o=i&&i.querySelector(".stats-and-actions .channel-actions"),a=o&&o.querySelector("#ffz-ui-race");if(o&&this.settings.srl_races&&n){if(!a){a=document.createElement("span"),a.id="ffz-ui-race",a.setAttribute("data-channel",e);varr=document.createElement("span");r.className="button drop action",r.title="SpeedRunsLive Race",r.innerHTML='<span class="logo"></span>',r.addEventListener("click",this._build_race_popup.bind(this,a,e)),a.appendChild(r),o.appendChild(a)}this._update_race(a,!0)}elsea&&a.parentElement.removeChild(a)}if(s){varn=this.srl_races&&this.srl_races[s],i=this._cindex.get("element"),o=i&&i.querySelector("#hostmode .channel-actions"),a=o&&o.querySelector("#ffz-ui-race");if(o&&this.settings.srl_races&&n){if(!a){a=document.createElement("span"),a.id="ffz-ui-race",a.setAttribute("data-channel",s);varr=document.createElement("span");r.className="button drop action",r.title="SpeedRunsLive Race",r.innerHTML='<span class="logo"></span>',r.addEventListener("click",this._build_race_popup.bind(this,a,s)),a.appendChild(r),o.appendChild(a)}this._update_race(a,!0)}elsea&&a.parentElement.removeChild(a)}}},s.prototype._race_kill=function(){this._race_timer&&(clearTimeout(this._race_timer),deletethis._race_timer),deletethis._race_game,deletethis._race_goal},s.prototype._build_race_popup=function(t,e){varn=this._popup;if((!n||(n.parentElement.removeChild(n),deletethis._popup,this._popup_kill&&this._popup_kill(),deletethis._popup_kill,"ffz-race-popup"!==n.id||n.getAttribute("data-channel")!==e))&&t){vari=t.querySelector(".button"),o=i.offsetLeft+i.offsetWidth,a=this.srl_races[e],n=document.createElement("div"),r="";n.id="ffz-race-popup",n.setAttribute("data-channel",e),n.className=(o>=300?"right":"left")+" share dropmenu",this._popup_kill=this._race_kill.bind(this),this._popup=n;vard="http://kadgar.net/live",u=!1;for(varcina.entrants){varl=a.entrants[c].state;a.entrants.hasOwnProperty(c)&&a.entrants[c].channel&&("racing"==l||"entered"==l)&&(d+="/"+a.entrants[c].chann