mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-29 15:55:33 +00:00
7 lines
No EOL
209 KiB
JavaScript
7 lines
No EOL
209 KiB
JavaScript
!function(t){!function e(t,s,o){function n(a,r){if(!s[a]){if(!t[a]){var d="function"==typeof require&&require;if(!r&&d)return d(a,!0);if(i)return i(a,!0);throw new Error("Cannot find module '"+a+"'")}var u=s[a]={exports:{}};t[a][0].call(u.exports,function(e){var s=t[a][1][e];return n(s?s:e)},u,u.exports,e,t,s,o)}return s[a].exports}for(var i="function"==typeof require&&require,a=0;a<o.length;a++)n(o[a]);return n}({1:[function(e){var s=t.FrankerFaceZ,o=e("./constants"),n=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."),this.badges={},this.log("Creating badge style element.");var t=this._badge_style=document.createElement("style");t.id="ffz-badge-css",document.head.appendChild(t),this.log("Adding legacy donor badges."),this._legacy_add_donors()},s.ws_commands.reload_badges=function(){this._legacy_load_bots(),this._legacy_load_donors()},s.ws_commands.set_badge=function(t){var e=t[0],s=t[1],o=t[2],n=this.users[e]=this.users[e]||{},i=n.badges=n.badges||{};void 0===o||null===o?delete i[s]:i[s]=o};var i=function(t){var e=".badges .ffz-badge-"+t.id+" { background-color: "+t.color+'; background-image: url("'+t.image+'"); '+(t.extra_css||"")+"}";return t.transparent_image&&(e+=".ffz-transparent-badges .badges .ffz-badge-"+t.id+' { background-image: url("'+t.transparent_image+'"); }'),e};s.prototype.bttv_badges=function(t){if(this.settings.show_badges){var e=t.sender,s=this.users[e],o=[],n=-1,i=BetterTTV.settings.get("alphaTags");if(s&&s.badges){t.badges||(t.badges=[]);for(var a=0;a<t.badges.length;a++){var r=t.badges[a];if("subscriber"==r.type||"turbo"==r.type){n=a;break}}for(var d in s.badges)if(s.badges.hasOwnProperty(d)){var r=s.badges[d],u=this.badges[r.id]||{},c=r.title||u.title,l="";if(void 0!==u.visible){var h=u.visible;if("function"==typeof h&&(h=h.bind(this)(null,e)),!h)continue}if(u.replaces){for(var f=!1,a=0;a<t.badges.length;a++){var _=t.badges[a];if(_.type==u.replaces){_.type="ffz-badge-replacement "+_.type,_.description+=", "+(r.title||u.title)+'" style="background-image: url("'+(r.image||u.image)+"")",f=!0;break}}if(f)continue}r.image&&(l+="background-image: url(""+r.image+""); "),r.color&&!i&&(l+="background-color: "+r.color+"; "),r.extra_css&&(l+=r.extra_css),l&&(c+='" style="'+l),o.push([(-1==n?1:-1)*d,{type:"ffz-badge-"+r.id+(i?" alpha":""),name:"",description:c}])}if(o.sort(function(t,e){return t[0]-e[0]}),-1==n)for(;o.length;)t.badges.push(o.shift()[1]);else for(;o.length;)t.badges.insertAt(n,o.shift()[1])}}},s.prototype.render_badge=function(t){if(this.settings.show_badges){var e=t.get("msgObject.from"),s=App.__container__.lookup("controller:chat").get("currentRoom.id"),o=t.$(".badges"),n=this.users[e];if(n&&n.badges){if(!o.length){var i=document.createElement("span"),a=t.$(".from");if(i.className="badges float-left",!a)return;a.before(i),o=$(i)}var r=o.find(".badge").filter(function(){var t=this.title.toLowerCase();return"subscriber"==t||"turbo"==t}).first(),d=[],u=!!r.length;for(var c in n.badges)if(n.badges.hasOwnProperty(c)){var l=n.badges[c],h=this.badges[l.id]||{};if(void 0!==h.visible){var f=h.visible;if("function"==typeof f&&(f=f.bind(this)(s,e)),!f)continue}if(h.replaces){var _=o[0].querySelector(".badge."+h.replaces);if(_){_.style.backgroundImage='url("'+(l.image||h.image)+'")',_.classList.add("ffz-badge-replacement"),_.title+=", "+(l.title||h.title);continue}}var _=document.createElement("div");_.className="badge float-left tooltip ffz-badge-"+l.id,_.setAttribute("title",l.title||h.title),l.image&&(_.style.backgroundImage='url("'+l.image+'")'),l.color&&(_.style.backgroundColor=l.color),l.extra_css&&(_.style.cssText+=l.extra_css),d.push([(u?1:-1)*c,_])}if(d.sort(function(t,e){return t[0]-e[0]}),u)for(;d.length;)r.before(d.shift()[1]);else for(;d.length;)o.append(d.shift()[1])}}},s.bttv_known_bots=["nightbot","moobot","sourbot","xanbot","manabot","mtgbot","ackbot","baconrobot","tardisbot","deejbot","valuebot","stahpbot"],s.prototype._legacy_add_donors=function(){this.badges[0]={id:0,title:"FFZ Developer",color:"#FAAF19",image:"//cdn.frankerfacez.com/script/devicon.png",transparent_image:"//cdn.frankerfacez.com/script/devtransicon.png"},n.update_css(this._badge_style,0,i(this.badges[0])),this.badges[1]={id:1,title:"FFZ Donor",color:"#755000",image:"//cdn.frankerfacez.com/script/devicon.png"},n.update_css(this._badge_style,1,i(this.badges[1])),this.badges[2]={id:2,title:"Bot",color:"#595959",image:"//cdn.frankerfacez.com/script/boticon.png",replaces:"moderator",visible:function(t,e){return!(this.has_bttv&&-1!==s.bttv_known_bots.indexOf(e))}},n.update_css(this._badge_style,2,i(this.badges[2]));for(var t=0;t<s.bttv_known_bots.length;t++){var e=s.bttv_known_bots[t],o=this.users[e]=this.users[e]||{},a=o.badges=o.badges||{};a[0]||(a[0]={id:2})}this.users.sirstendec={badges:{1:{id:0}},sets:[4330]},this.users.zenwan={badges:{0:{id:2,image:"//cdn.frankerfacez.com/script/momiglee_badge.png",title:"WAN"}}},this._legacy_load_bots(),this._legacy_load_donors()},s.prototype._legacy_load_bots=function(t){jQuery.ajax(o.SERVER+"script/bots.txt",{cache:!1,context:this}).done(function(t){this._legacy_parse_badges(t,0,2)}).fail(function(e){404!=e.status&&(t=(t||0)+1,10>t&&this._legacy_load_bots(t))})},s.prototype._legacy_load_donors=function(t){jQuery.ajax(o.SERVER+"script/donors.txt",{cache:!1,context:this}).done(function(t){this._legacy_parse_badges(t,1,1)}).fail(function(e){return 404!=e.status?(t=(t||0)+1,10>t?this._legacy_load_donors(t):void 0):void 0})},s.prototype._legacy_parse_badges=function(t,e,s){var o=this.badges[s].title,i=0;if(ds=null,null!=t)for(var a=t.trim().split(/\W+/),r=0;r<a.length;r++){var d=a[r],u=this.users[d]=this.users[d]||{},c=u.badges=u.badges||{},l=u.sets=u.sets||[];null!==ds&&-1===l.indexOf(ds)&&l.push(ds),c[e]||(c[e]={id:s},i+=1)}this.log('Added "'+o+'" badge to '+n.number_commas(i)+" users.")}},{"./constants":4,"./utils":33}],2:[function(){var e=t.FrankerFaceZ,s=function(t,e,s){return 0>s&&(s+=1),s>1&&(s-=1),1/6>s?t+6*(e-t)*s:.5>s?e:2/3>s?t+(e-t)*(2/3-s)*6:t};e.settings_info.fix_color={type:"select",options:{"-1":"Disabled",0:"Default Colors",1:"Luv Adjustment",2:"HSL Adjustment (Depreciated)",3:"HSV Adjustment (Depreciated)",4:"RGB Adjustment (Depreciated)"},value:"1",category:"Chat Appearance",no_bttv:!0,name:"Username Colors - Brightness",help:"Ensure that username colors contrast with the background enough to be readable.",process_value:function(t){return t===!1?"0":t===!0?"1":t},on_update:function(t){document.body.classList.toggle("ffz-chat-colors",!this.has_bttv&&"-1"!==t),document.body.classList.toggle("ffz-chat-colors-gray",!this.has_bttv&&"-1"===t),this.has_bttv||"-1"===t||this._rebuild_colors()}},e.settings_info.color_blind={type:"select",options:{0:"Disabled",protanope:"Protanope",deuteranope:"Deuteranope",tritanope:"Tritanope"},value:"0",category:"Chat Appearance",no_bttv:!0,name:"Username Colors - Color Blindness",help:"Adjust username colors in an attempt to make them more distinct for people with color blindness.",on_update:function(){this.has_bttv||"-1"===this.settings.fix_color||this._rebuild_colors()}},e.prototype.setup_colors=function(){this.log("Preparing color-alteration style element."),this._colors={};var t=this._color_style=document.createElement("style");t.id="ffz-style-username-colors",t.type="text/css",document.head.appendChild(t)},e.Color={},e.Color.CVDMatrix={protanope:[0,2.02344,-2.52581,0,1,0,0,0,1],deuteranope:[1,0,0,.494207,0,1.24827,0,0,1],tritanope:[1,0,0,0,1,0,-.395913,.801109,0]};var o=e.Color.RGB=function(t,e,s){this.r=t||0,this.g=e||0,this.b=s||0},n=e.Color.HSV=function(t,e,s){this.h=t||0,this.s=e||0,this.v=s||0},i=e.Color.HSL=function(t,e,s){this.h=t||0,this.s=e||0,this.l=s||0},a=e.Color.XYZ=function(t,e,s){this.x=t||0,this.y=e||0,this.z=s||0},r=e.Color.LUV=function(t,e,s){this.l=t||0,this.u=e||0,this.v=s||0};o.prototype.eq=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},o.fromHex=function(t){var e=parseInt("#"===t.charAt(0)?t.substr(1):t,16);return new o(e>>16,e>>8&255,255&e)},o.fromHSV=function(t,e,s){var n,i,a,r=Math.floor(6*t),d=6*t-r,u=s*(1-e),c=s*(1-d*e),l=s*(1-(1-d)*e);switch(r%6){case 0:n=s,i=l,a=u;break;case 1:n=c,i=s,a=u;break;case 2:n=u,i=s,a=l;break;case 3:n=u,i=c,a=s;break;case 4:n=l,i=u,a=s;break;case 5:n=s,i=u,a=c}return new o(Math.round(Math.min(Math.max(0,255*n),255)),Math.round(Math.min(Math.max(0,255*i),255)),Math.round(Math.min(Math.max(0,255*a),255)))},o.fromXYZ=function(t,e,s){var n=3.240479*t-1.53715*e-.498535*s,i=-.969256*t+1.875992*e+.041556*s,r=.055648*t-.204043*e+1.057311*s;return new o(Math.max(0,Math.min(255,255*a.channelConverter(n))),Math.max(0,Math.min(255,255*a.channelConverter(i))),Math.max(0,Math.min(255,255*a.channelConverter(r))))},o.fromHSL=function(t,e,n){if(0===e){var i=Math.round(Math.min(Math.max(0,255*n),255));return new o(i,i,i)}var a=.5>n?n*(1+e):n+e-n*e,r=2*n-a;return new o(Math.round(Math.min(Math.max(0,255*s(r,a,t+1/3)),255)),Math.round(Math.min(Math.max(0,255*s(r,a,t)),255)),Math.round(Math.min(Math.max(0,255*s(r,a,t-1/3)),255)))},o.prototype.toHSV=function(){return n.fromRGB(this.r,this.g,this.b)},o.prototype.toHSL=function(){return i.fromRGB(this.r,this.g,this.b)},o.prototype.toCSS=function(){return"rgb("+Math.round(this.r)+","+Math.round(this.g)+","+Math.round(this.b)+")"},o.prototype.toXYZ=function(){return a.fromRGB(this.r,this.g,this.b)},o.prototype.toLUV=function(){return this.toXYZ().toLUV()},o.prototype.luminance=function(){for(var t=[this.r/255,this.g/255,this.b/255],e=0,s=t.length;s>e;e++)t[e]=t[e]<=.03928?t[e]/12.92:Math.pow((t[e]+.055)/1.055,2.4);return.2126*t[0]+.7152*t[1]+.0722*t[2]},o.prototype.brighten=function(t){return t="number"==typeof t?t:1,t=Math.round(255*(t/100)),new o(Math.max(0,Math.min(255,this.r+t)),Math.max(0,Math.min(255,this.g+t)),Math.max(0,Math.min(255,this.b+t)))},o.prototype.daltonize=function(t,s){s="number"==typeof s?s:1;var n;if("string"==typeof t){if(!e.Color.CVDMatrix.hasOwnProperty(t))throw"Invalid CVD matrix.";n=e.Color.CVDMatrix[t]}else n=t;var i,a,r,d,u,c,l,h,f,_,m,p,g=n[0],v=n[1],b=n[2],y=n[3],w=n[4],z=n[5],k=n[6],C=n[7],E=n[8];return i=17.8824*this.r+43.5161*this.g+4.11935*this.b,a=3.45565*this.r+27.1554*this.g+3.86714*this.b,r=.0299566*this.r+.184309*this.g+1.46709*this.b,d=g*i+v*a+b*r,u=y*i+w*a+z*r,c=k*i+C*a+E*r,l=.0809444479*d+-.130504409*u+.116721066*c,h=-.0102485335*d+.0540193266*u+-.113614708*c,f=-.000365296938*d+-.00412161469*u+.693511405*c,l=this.r-l,h=this.g-h,f=this.b-f,_=0*l+0*h+0*f,m=.7*l+1*h+0*f,p=.7*l+0*h+1*f,l=Math.min(Math.max(0,_+this.r),255),h=Math.min(Math.max(0,m+this.g),255),f=Math.min(Math.max(0,p+this.b),255),new o(l,h,f)},o.prototype._r=function(t){return new o(t,this.g,this.b)},o.prototype._g=function(t){return new o(this.r,t,this.b)},o.prototype._b=function(t){return new o(this.r,this.g,t)},i.prototype.eq=function(t){return t.h===this.h&&t.s===this.s&&t.l===this.l},i.fromRGB=function(t,e,s){t/=255,e/=255,s/=255;var o,n,a=Math.max(t,e,s),r=Math.min(t,e,s),d=Math.min(Math.max(0,(a+r)/2),1),u=Math.min(Math.max(0,a-r),1);if(0===u)o=n=0;else{switch(n=d>.5?u/(2-a-r):u/(a+r),a){case t:o=(e-s)/u+(s>e?6:0);break;case e:o=(s-t)/u+2;break;case s:o=(t-e)/u+4}o/=6}return new i(o,n,d)},i.prototype.toRGB=function(){return o.fromHSL(this.h,this.s,this.l)},i.prototype.toCSS=function(){return"hsl("+Math.round(360*this.h)+","+Math.round(100*this.s)+"%,"+Math.round(100*this.l)+"%)"},i.prototype.toHSV=function(){return o.fromHSL(this.h,this.s,this.l).toHSV()},i.prototype.toXYZ=function(){return o.fromHSL(this.h,this.s,this.l).toXYZ()},i.prototype.toLUV=function(){return o.fromHSL(this.h,this.s,this.l).toLUV()},i.prototype._h=function(t){return new i(t,this.s,this.l)},i.prototype._s=function(t){return new i(this.h,t,this.l)},i.prototype._l=function(t){return new i(this.h,this.s,t)},n.prototype.eq=function(t){return t.h===this.h&&t.s===this.s&&t.v===this.v},n.fromRGB=function(t,e,s){t/=255,e/=255,s/=255;var o,i=Math.max(t,e,s),a=Math.min(t,e,s),r=Math.min(Math.max(0,i-a),1),d=0===i?0:r/i,u=i;if(0===r)o=0;else{switch(i){case t:o=(e-s)/r+(s>e?6:0);break;case e:o=(s-t)/r+2;break;case s:o=(t-e)/r+4}o/=6}return new n(o,d,u)},n.prototype.toRGB=function(){return o.fromHSV(this.h,this.s,this.v)},n.prototype.toHSL=function(){return o.fromHSV(this.h,this.s,this.v).toHSL()},n.prototype.toXYZ=function(){return o.fromHSV(this.h,this.s,this.v).toXYZ()},n.prototype.toLUV=function(){return o.fromHSV(this.h,this.s,this.v).toLUV()},n.prototype._h=function(t){return new n(t,this.s,this.v)},n.prototype._s=function(t){return new n(this.h,t,this.v)},n.prototype._v=function(t){return new n(this.h,this.s,t)},o.channelConverter=function(t){return Math.pow(t,2.2)},a.channelConverter=function(t){return Math.pow(t,1/2.2)},a.prototype.eq=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},a.fromRGB=function(t,e,s){var n=o.channelConverter(t/255),i=o.channelConverter(e/255),r=o.channelConverter(s/255);return new a(.412453*n+.35758*i+.180423*r,.212671*n+.71516*i+.072169*r,.019334*n+.119193*i+.950227*r)},a.fromLUV=function(t,e,s){var o=1/(a.WHITE.x+15*a.WHITE.y+3*a.WHITE.z),n=4*a.WHITE.x*o,i=9*a.WHITE.y*o,r=t>8?Math.pow((t+16)/116,3):t/a.KAPPA,d=1/3*(52*t/(e+13*t*n)-1),u=-5*r,c=-1/3,l=r*(39*t/(s+13*t*i)-5),h=(l-u)/(d-c),f=h*d+u;return new a(h,r,f)},a.prototype.toRGB=function(){return o.fromXYZ(this.x,this.y,this.z)},a.prototype.toLUV=function(){return r.fromXYZ(this.x,this.y,this.z)},a.prototype.toHSL=function(){return o.fromXYZ(this.x,this.y,this.z).toHSL()},a.prototype.toHSV=function(){return o.fromXYZ(this.x,this.y,this.z).toHSV()},a.prototype._x=function(t){return new a(t,this.y,this.z)},a.prototype._y=function(t){return new a(this.x,t,this.z)},a.prototype._z=function(t){return new a(this.x,this.y,t)},a.EPSILON=Math.pow(6/29,3),a.KAPPA=Math.pow(29/3,3),a.WHITE=new o(255,255,255).toXYZ(),r.prototype.eq=function(t){return t.l===this.l&&t.u===this.u&&t.v===this.v},r.fromXYZ=function(t,e,s){var o=1/(a.WHITE.x+15*a.WHITE.y+3*a.WHITE.z),n=4*a.WHITE.x*o,i=9*a.WHITE.y*o,d=e/a.WHITE.y,u=t+15*e+3*s;0===u&&(u=1);var c=1/u,l=4*t*c,h=9*e*c,f=d>a.EPSILON?116*Math.pow(d,1/3)-16:a.KAPPA*d,_=13*f*(l-n),m=13*f*(h-i);return new r(f,_,m)},r.prototype.toXYZ=function(){return a.fromLUV(this.l,this.u,this.v)},r.prototype.toRGB=function(){return a.fromLUV(this.l,this.u,this.v).toRGB()},r.prototype.toHSL=function(){return a.fromLUV(this.l,this.u,this.v).toHSL()},r.prototype.toHSV=function(){return a.fromLUV(this.l,this.u,this.v).toHSV()},r.prototype._l=function(t){return new r(t,this.u,this.v)},r.prototype._u=function(t){return new r(this.l,t,this.v)},r.prototype._v=function(t){return new r(this.l,this.u,t)};var d=4.5,u=new a(0,d*(new o(35,35,35).toXYZ().y+.05)-.05,0).toLUV().l,c=new a(0,(new o(217,217,217).toXYZ().y+.05)/d-.05,0).toLUV().l;e.prototype._rebuild_colors=function(){if(this._color_style&&!this.has_bttv){this._color_style.innerHTML="";var t=Object.keys(this._colors);this._colors={};for(var e=0,s=t.length;s>e;e++)this._handle_color(t[e])}},e.prototype._handle_color=function(t){if(t&&!this._colors.hasOwnProperty(t)){this._colors[t]=!0;var e=o.fromHex(t),s=t,n=t,i=t,a=!1,r='span[style="color:'+t+'"]';if("0"!==this.settings.color_blind){var d=e.daltonize(this.settings.color_blind);e.eq(d)||(e=d,s=n=i=e.toCSS(),a=!0)}if("4"===this.settings.fix_color){var l=e.luminance();if(l>.3){for(var h=127,f=e;h--&&(f=f.brighten(-1),!(f.luminance()<=.3)););a=!0,n=f.toCSS()}if(.15>l){for(var h=127,f=e;h--&&(f=f.brighten(),!(f.luminance()>=.15)););a=!0,i=f.toCSS()}}if("2"===this.settings.fix_color){var _=e.toHSL();a=!0,n=_._l(Math.min(Math.max(0,.7*_.l),1)).toCSS(),i=_._l(Math.min(Math.max(0,.3+.7*_.l),1)).toCSS()}if("3"===this.settings.fix_color){var m=e.toHSV();a=!0,0===m.s?(n=m._v(Math.min(Math.max(.5,.5*m.v),1)).toRGB().toCSS(),i=m._v(Math.min(Math.max(.5,.5+.5*m.v),1)).toRGB().toCSS()):(n=o.fromHSV(m.h,Math.min(Math.max(.7,.7+.3*m.s),1),Math.min(.7,m.v)).toCSS(),i=o.fromHSV(m.h,Math.min(.7,m.s),Math.min(Math.max(.7,.7+.3*m.v),1)).toCSS())}if("1"===this.settings.fix_color){var p=e.toLUV();p.l>c&&(a=!0,n=p._l(c).toRGB().toCSS()),p.l<u&&(a=!0,i=p._l(u).toRGB().toCSS())}if(a){var g="";n!==s&&(g+="body.ffz-chat-colors .chat-line "+r+" { color: "+n+" !important; }"),i!==n&&(g+="body.ffz-chat-colors .theatre .chat-container .chat-line "+r+", body.ffz-chat-colors .ember-chat-container.dark .chat-line "+r+", body.ffz-chat-colors .ember-chat-container.force-dark .chat-line "+r+", body.ffz-chat-colors .chat-container.dark .chat-line "+r+", body.ffz-chat-colors .chat-container.force-dark .chat-line "+r+" { color: "+i+" !important; }"),this._color_style.innerHTML+=g}}}},{}],3:[function(){var e=t.FrankerFaceZ;e.ffz_commands.log=function(t){this._pastebin(this._log_data.join("\n"),function(e){return e?void this.room_message(t,"Your FrankerFaceZ log has been pasted to: "+e):this.room_message(t,"There was an error uploading the FrankerFaceZ log.")})},e.ffz_commands.massunmod=function(t,e){if(e=e.join(" ").trim(),!e.length)return"You must provide a list of users to unmod.";e=e.split(/\W*,\W*/);var s=this.get_user();if(!s||!s.login==t.id)return"You must be the broadcaster to use massunmod.";if(e.length>50)return"Each user you unmod counts as a single message. To avoid being globally banned, please limit yourself to 50 at a time and wait between uses.";for(var o=e.length;e.length;){var n=e.shift();t.room.tmiRoom.sendMessage("/unmod "+n)}return"Sent unmod command for "+o+" users."},e.ffz_commands.massunmod.help="Usage: /ffz massunmod <list, of, users>\nBroadcaster only. Unmod all the users in the provided list.",e.ffz_commands.massmod=function(t,e){if(e=e.join(" ").trim(),!e.length)return"You must provide a list of users to mod.";e=e.split(/\W*,\W*/);var s=this.get_user();if(!s||!s.login==t.id)return"You must be the broadcaster to use massmod.";if(e.length>50)return"Each user you mod counts as a single message. To avoid being globally banned, please limit yourself to 50 at a time and wait between uses.";for(var o=e.length;e.length;){var n=e.shift();t.room.tmiRoom.sendMessage("/mod "+n)}return"Sent mod command for "+o+" users."},e.ffz_commands.massmod.help="Usage: /ffz massmod <list, of, users>\nBroadcaster only. Mod all the users in the provided list."},{}],4:[function(t,e){var s='<path d="m120.95 1.74c4.08-0.09 8.33-0.84 12.21 0.82 3.61 1.8 7 4.16 11.01 5.05 2.08 3.61 6.12 5.46 8.19 9.07 3.6 5.67 7.09 11.66 8.28 18.36 1.61 9.51 7.07 17.72 12.69 25.35 3.43 7.74 1.97 16.49 3.6 24.62 2.23 5.11 4.09 10.39 6.76 15.31 1.16 2 4.38 0.63 4.77-1.32 1.2-7.1-2.39-13.94-1.97-21.03 0.38-3.64-0.91-7.48 0.25-10.99 2.74-3.74 4.57-8.05 7.47-11.67 3.55-5.47 10.31-8.34 16.73-7.64 2.26 2.89 5.13 5.21 7.58 7.92 2.88 4.3 6.52 8.01 9.83 11.97 1.89 2.61 3.06 5.64 4.48 8.52 2.81 4.9 4 10.5 6.63 15.49 2.16 6.04 5.56 11.92 5.37 18.5 0.65 1.95 0.78 4 0.98 6.03 1.01 3.95 2.84 8.55 0.63 12.42-2.4 5.23-7.03 8.97-11.55 12.33-6.06 4.66-11.62 10.05-18.37 13.75-4.06 2.65-8.24 5.17-12.71 7.08-3.59 1.57-6.06 4.94-9.85 6.09-2.29 1.71-3.98 4.51-6.97 5.02-4.56 1.35-8.98-3.72-13.5-1.25-2.99 1.83-6.19 3.21-9.39 4.6-8.5 5.61-18.13 9.48-28.06 11.62-8.36-0.2-16.69 0.62-25.05 0.47-3.5-1.87-7.67-1.08-11.22-2.83-6.19-1.52-10.93-6.01-16.62-8.61-2.87-1.39-5.53-3.16-8.11-4.99-2.58-1.88-4.17-4.85-6.98-6.44-3.83-0.11-6.54 3.42-10.24 3.92-2.31 0.28-4.64 0.32-6.96 0.31-3.5-3.65-5.69-8.74-10.59-10.77-5.01-3.68-10.57-6.67-14.84-11.25-2.52-2.55-5.22-4.87-8.24-6.8-4.73-4.07-7.93-9.51-11.41-14.62-3.08-4.41-5.22-9.73-4.6-15.19 0.65-8.01 0.62-16.18 2.55-24.02 4.06-10.46 11.15-19.34 18.05-28.06 3.71-5.31 9.91-10.21 16.8-8.39 3.25 1.61 5.74 4.56 7.14 7.89 1.19 2.7 3.49 4.93 3.87 7.96 0.97 5.85 1.6 11.86 0.74 17.77-1.7 6.12-2.98 12.53-2.32 18.9 0.01 2.92 2.9 5.36 5.78 4.57 3.06-0.68 3.99-4.07 5.32-6.48 1.67-4.06 4.18-7.66 6.69-11.23 3.61-5.28 5.09-11.57 7.63-17.37 2.07-4.56 1.7-9.64 2.56-14.46 0.78-7.65-0.62-15.44 0.7-23.04 1.32-3.78 1.79-7.89 3.8-11.4 3.01-3.66 6.78-6.63 9.85-10.26 1.72-2.12 4.21-3.32 6.55-4.6 7.89-2.71 15.56-6.75 24.06-7z"/>',o="true"==localStorage.ffzDebugMode&&document.body.classList.contains("ffz-dev"),n=o?"//localhost:8000/":"//cdn.frankerfacez.com/";e.exports={DEBUG:o,SERVER:n,API_SERVER:"//api.frankerfacez.com/",API_SERVER_2:"//direct-api.frankerfacez.com/",KNOWN_CODES:{"#-?[\\\\/]":"#-/",":-?(?:7|L)":":-7","\\<\\;\\]":"<]","\\:-?(S|s)":":-S","\\:-?\\\\":":-\\","\\:\\>\\;":":>","B-?\\)":"B-)","\\:-?[z|Z|\\|]":":-Z","\\:-?\\)":":-)","\\:-?\\(":":-(","\\:-?(p|P)":":-P","\\;-?(p|P)":";-P","\\<\\;3":"<3","\\:-?[\\\\/]":":-/","\\;-?\\)":";-)","R-?\\)":"R-)","[o|O](_|\\.)[o|O]":"O.o","\\:-?D":":-D","\\:-?(o|O)":":-O","\\>\\;\\(":">(","Gr(a|e)yFace":"GrayFace"},EMOTE_REPLACEMENT_BASE:n+"script/replacements/",EMOTE_REPLACEMENTS:{15:"15-JKanStyle.png",16:"16-OptimizePrime.png",17:"17-StoneLightning.png",18:"18-TheRinger.png",19:"19-PazPazowitz.png",20:"20-EagleEye.png",21:"21-CougarHunt.png",22:"22-RedCoat.png",26:"26-JonCarnage.png",27:"27-PicoMause.png",30:"30-BCWarrior.png",33:"33-DansGame.png",36:"36-PJSalt.png"},EMOJI_REGEX:/((?:\ud83c\udde8\ud83c\uddf3|\ud83c\uddfa\ud83c\uddf8|\ud83c\uddf7\ud83c\uddfa|\ud83c\uddf0\ud83c\uddf7|\ud83c\uddef\ud83c\uddf5|\ud83c\uddee\ud83c\uddf9|\ud83c\uddec\ud83c\udde7|\ud83c\uddeb\ud83c\uddf7|\ud83c\uddea\ud83c\uddf8|\ud83c\udde9\ud83c\uddea|\u0039\ufe0f?\u20e3|\u0038\ufe0f?\u20e3|\u0037\ufe0f?\u20e3|\u0036\ufe0f?\u20e3|\u0035\ufe0f?\u20e3|\u0034\ufe0f?\u20e3|\u0033\ufe0f?\u20e3|\u0032\ufe0f?\u20e3|\u0031\ufe0f?\u20e3|\u0030\ufe0f?\u20e3|\u0023\ufe0f?\u20e3|\ud83d\udeb3|\ud83d\udeb1|\ud83d\udeb0|\ud83d\udeaf|\ud83d\udeae|\ud83d\udea6|\ud83d\udea3|\ud83d\udea1|\ud83d\udea0|\ud83d\ude9f|\ud83d\ude9e|\ud83d\ude9d|\ud83d\ude9c|\ud83d\ude9b|\ud83d\ude98|\ud83d\ude96|\ud83d\ude94|\ud83d\ude90|\ud83d\ude8e|\ud83d\ude8d|\ud83d\ude8b|\ud83d\ude8a|\ud83d\ude88|\ud83d\ude86|\ud83d\ude82|\ud83d\ude81|\ud83d\ude36|\ud83d\ude34|\ud83d\ude2f|\ud83d\ude2e|\ud83d\ude2c|\ud83d\ude27|\ud83d\ude26|\ud83d\ude1f|\ud83d\ude1b|\ud83d\ude19|\ud83d\ude17|\ud83d\ude15|\ud83d\ude11|\ud83d\ude10|\ud83d\ude0e|\ud83d\ude08|\ud83d\ude07|\ud83d\ude00|\ud83d\udd67|\ud83d\udd66|\ud83d\udd65|\ud83d\udd64|\ud83d\udd63|\ud83d\udd62|\ud83d\udd61|\ud83d\udd60|\ud83d\udd5f|\ud83d\udd5e|\ud83d\udd5d|\ud83d\udd5c|\ud83d\udd2d|\ud83d\udd2c|\ud83d\udd15|\ud83d\udd09|\ud83d\udd08|\ud83d\udd07|\ud83d\udd06|\ud83d\udd05|\ud83d\udd04|\ud83d\udd02|\ud83d\udd01|\ud83d\udd00|\ud83d\udcf5|\ud83d\udcef|\ud83d\udced|\ud83d\udcec|\ud83d\udcb7|\ud83d\udcb6|\ud83d\udcad|\ud83d\udc6d|\ud83d\udc6c|\ud83d\udc65|\ud83d\udc2a|\ud83d\udc16|\ud83d\udc15|\ud83d\udc13|\ud83d\udc10|\ud83d\udc0f|\ud83d\udc0b|\ud83d\udc0a|\ud83d\udc09|\ud83d\udc08|\ud83d\udc07|\ud83d\udc06|\ud83d\udc05|\ud83d\udc04|\ud83d\udc03|\ud83d\udc02|\ud83d\udc01|\ud83d\udc00|\ud83c\udfe4|\ud83c\udfc9|\ud83c\udfc7|\ud83c\udf7c|\ud83c\udf50|\ud83c\udf4b|\ud83c\udf33|\ud83c\udf32|\ud83c\udf1e|\ud83c\udf1d|\ud83c\udf1c|\ud83c\udf1a|\ud83c\udf18|\ud83c\udccf|\ud83c\udd70|\ud83c\udd71|\ud83c\udd7e|\ud83c\udd8e|\ud83c\udd91|\ud83c\udd92|\ud83c\udd93|\ud83c\udd94|\ud83c\udd95|\ud83c\udd96|\ud83c\udd97|\ud83c\udd98|\ud83c\udd99|\ud83c\udd9a|\ud83d\udc77|\ud83d\udec5|\ud83d\udec4|\ud83d\udec3|\ud83d\udec2|\ud83d\udec1|\ud83d\udebf|\ud83d\udeb8|\ud83d\udeb7|\ud83d\udeb5|\ud83c\ude01|\ud83c\ude02|\ud83c\ude32|\ud83c\ude33|\ud83c\ude34|\ud83c\ude35|\ud83c\ude36|\ud83c\ude37|\ud83c\ude38|\ud83c\ude39|\ud83c\ude3a|\ud83c\ude50|\ud83c\ude51|\ud83c\udf00|\ud83c\udf01|\ud83c\udf02|\ud83c\udf03|\ud83c\udf04|\ud83c\udf05|\ud83c\udf06|\ud83c\udf07|\ud83c\udf08|\ud83c\udf09|\ud83c\udf0a|\ud83c\udf0b|\ud83c\udf0c|\ud83c\udf0f|\ud83c\udf11|\ud83c\udf13|\ud83c\udf14|\ud83c\udf15|\ud83c\udf19|\ud83c\udf1b|\ud83c\udf1f|\ud83c\udf20|\ud83c\udf30|\ud83c\udf31|\ud83c\udf34|\ud83c\udf35|\ud83c\udf37|\ud83c\udf38|\ud83c\udf39|\ud83c\udf3a|\ud83c\udf3b|\ud83c\udf3c|\ud83c\udf3d|\ud83c\udf3e|\ud83c\udf3f|\ud83c\udf40|\ud83c\udf41|\ud83c\udf42|\ud83c\udf43|\ud83c\udf44|\ud83c\udf45|\ud83c\udf46|\ud83c\udf47|\ud83c\udf48|\ud83c\udf49|\ud83c\udf4a|\ud83c\udf4c|\ud83c\udf4d|\ud83c\udf4e|\ud83c\udf4f|\ud83c\udf51|\ud83c\udf52|\ud83c\udf53|\ud83c\udf54|\ud83c\udf55|\ud83c\udf56|\ud83c\udf57|\ud83c\udf58|\ud83c\udf59|\ud83c\udf5a|\ud83c\udf5b|\ud83c\udf5c|\ud83c\udf5d|\ud83c\udf5e|\ud83c\udf5f|\ud83c\udf60|\ud83c\udf61|\ud83c\udf62|\ud83c\udf63|\ud83c\udf64|\ud83c\udf65|\ud83c\udf66|\ud83c\udf67|\ud83c\udf68|\ud83c\udf69|\ud83c\udf6a|\ud83c\udf6b|\ud83c\udf6c|\ud83c\udf6d|\ud83c\udf6e|\ud83c\udf6f|\ud83c\udf70|\ud83c\udf71|\ud83c\udf72|\ud83c\udf73|\ud83c\udf74|\ud83c\udf75|\ud83c\udf76|\ud83c\udf77|\ud83c\udf78|\ud83c\udf79|\ud83c\udf7a|\ud83c\udf7b|\ud83c\udf80|\ud83c\udf81|\ud83c\udf82|\ud83c\udf83|\ud83c\udf84|\ud83c\udf85|\ud83c\udf86|\ud83c\udf87|\ud83c\udf88|\ud83c\udf89|\ud83c\udf8a|\ud83c\udf8b|\ud83c\udf8c|\ud83c\udf8d|\ud83c\udf8e|\ud83c\udf8f|\ud83c\udf90|\ud83c\udf91|\ud83c\udf92|\ud83c\udf93|\ud83c\udfa0|\ud83c\udfa1|\ud83c\udfa2|\ud83c\udfa3|\ud83c\udfa4|\ud83c\udfa5|\ud83c\udfa6|\ud83c\udfa7|\ud83c\udfa8|\ud83c\udfa9|\ud83c\udfaa|\ud83c\udfab|\ud83c\udfac|\ud83c\udfad|\ud83c\udfae|\ud83c\udfaf|\ud83c\udfb0|\ud83c\udfb1|\ud83c\udfb2|\ud83c\udfb3|\ud83c\udfb4|\ud83c\udfb5|\ud83c\udfb6|\ud83c\udfb7|\ud83c\udfb8|\ud83c\udfb9|\ud83c\udfba|\ud83c\udfbb|\ud83c\udfbc|\ud83c\udfbd|\ud83c\udfbe|\ud83c\udfbf|\ud83c\udfc0|\ud83c\udfc1|\ud83c\udfc2|\ud83c\udfc3|\ud83c\udfc4|\ud83c\udfc6|\ud83c\udfc8|\ud83c\udfca|\ud83c\udfe0|\ud83c\udfe1|\ud83c\udfe2|\ud83c\udfe3|\ud83c\udfe5|\ud83c\udfe6|\ud83c\udfe7|\ud83c\udfe8|\ud83c\udfe9|\ud83c\udfea|\ud83c\udfeb|\ud83c\udfec|\ud83c\udfed|\ud83c\udfee|\ud83c\udfef|\ud83c\udff0|\ud83d\udc0c|\ud83d\udc0d|\ud83d\udc0e|\ud83d\udc11|\ud83d\udc12|\ud83d\udc14|\ud83d\udc17|\ud83d\udc18|\ud83d\udc19|\ud83d\udc1a|\ud83d\udc1b|\ud83d\udc1c|\ud83d\udc1d|\ud83d\udc1e|\ud83d\udc1f|\ud83d\udc20|\ud83d\udc21|\ud83d\udc22|\ud83d\udc23|\ud83d\udc24|\ud83d\udc25|\ud83d\udc26|\ud83d\udc27|\ud83d\udc28|\ud83d\udc29|\ud83d\udc2b|\ud83d\udc2c|\ud83d\udc2d|\ud83d\udc2e|\ud83d\udc2f|\ud83d\udc30|\ud83d\udc31|\ud83d\udc32|\ud83d\udc33|\ud83d\udc34|\ud83d\udc35|\ud83d\udc36|\ud83d\udc37|\ud83d\udc38|\ud83d\udc39|\ud83d\udc3a|\ud83d\udc3b|\ud83d\udc3c|\ud83d\udc3d|\ud83d\udc3e|\ud83d\udc40|\ud83d\udc42|\ud83d\udc43|\ud83d\udc44|\ud83d\udc45|\ud83d\udc46|\ud83d\udc47|\ud83d\udc48|\ud83d\udc49|\ud83d\udc4a|\ud83d\udc4b|\ud83d\udc4c|\ud83d\udc4d|\ud83d\udc4e|\ud83d\udc4f|\ud83d\udc50|\ud83d\udc51|\ud83d\udc52|\ud83d\udc53|\ud83d\udc54|\ud83d\udc55|\ud83d\udc56|\ud83d\udc57|\ud83d\udc58|\ud83d\udc59|\ud83d\udc5a|\ud83d\udc5b|\ud83d\udc5c|\ud83d\udc5d|\ud83d\udc5e|\ud83d\udc5f|\ud83d\udc60|\ud83d\udc61|\ud83d\udc62|\ud83d\udc63|\ud83d\udc64|\ud83d\udc66|\ud83d\udc67|\ud83d\udc68|\ud83d\udc69|\ud83d\udc6a|\ud83d\udc6b|\ud83d\udc6e|\ud83d\udc6f|\ud83d\udc70|\ud83d\udc71|\ud83d\udc72|\ud83d\udc73|\ud83d\udc74|\ud83d\udc75|\ud83d\udc76|\ud83d\udeb4|\ud83d\udc78|\ud83d\udc79|\ud83d\udc7a|\ud83d\udc7b|\ud83d\udc7c|\ud83d\udc7d|\ud83d\udc7e|\ud83d\udc7f|\ud83d\udc80|\ud83d\udc81|\ud83d\udc82|\ud83d\udc83|\ud83d\udc84|\ud83d\udc85|\ud83d\udc86|\ud83d\udc87|\ud83d\udc88|\ud83d\udc89|\ud83d\udc8a|\ud83d\udc8b|\ud83d\udc8c|\ud83d\udc8d|\ud83d\udc8e|\ud83d\udc8f|\ud83d\udc90|\ud83d\udc91|\ud83d\udc92|\ud83d\udc93|\ud83d\udc94|\ud83d\udc95|\ud83d\udc96|\ud83d\udc97|\ud83d\udc98|\ud83d\udc99|\ud83d\udc9a|\ud83d\udc9b|\ud83d\udc9c|\ud83d\udc9d|\ud83d\udc9e|\ud83d\udc9f|\ud83d\udca0|\ud83d\udca1|\ud83d\udca2|\ud83d\udca3|\ud83d\udca4|\ud83d\udca5|\ud83d\udca6|\ud83d\udca7|\ud83d\udca8|\ud83d\udca9|\ud83d\udcaa|\ud83d\udcab|\ud83d\udcac|\ud83d\udcae|\ud83d\udcaf|\ud83d\udcb0|\ud83d\udcb1|\ud83d\udcb2|\ud83d\udcb3|\ud83d\udcb4|\ud83d\udcb5|\ud83d\udcb8|\ud83d\udcb9|\ud83d\udcba|\ud83d\udcbb|\ud83d\udcbc|\ud83d\udcbd|\ud83d\udcbe|\ud83d\udcbf|\ud83d\udcc0|\ud83d\udcc1|\ud83d\udcc2|\ud83d\udcc3|\ud83d\udcc4|\ud83d\udcc5|\ud83d\udcc6|\ud83d\udcc7|\ud83d\udcc8|\ud83d\udcc9|\ud83d\udcca|\ud83d\udccb|\ud83d\udccc|\ud83d\udccd|\ud83d\udcce|\ud83d\udccf|\ud83d\udcd0|\ud83d\udcd1|\ud83d\udcd2|\ud83d\udcd3|\ud83d\udcd4|\ud83d\udcd5|\ud83d\udcd6|\ud83d\udcd7|\ud83d\udcd8|\ud83d\udcd9|\ud83d\udcda|\ud83d\udcdb|\ud83d\udcdc|\ud83d\udcdd|\ud83d\udcde|\ud83d\udcdf|\ud83d\udce0|\ud83d\udce1|\ud83d\udce2|\ud83d\udce3|\ud83d\udce4|\ud83d\udce5|\ud83d\udce6|\ud83d\udce7|\ud83d\udce8|\ud83d\udce9|\ud83d\udcea|\ud83d\udceb|\ud83d\udcee|\ud83d\udcf0|\ud83d\udcf1|\ud83d\udcf2|\ud83d\udcf3|\ud83d\udcf4|\ud83d\udcf6|\ud83d\udcf7|\ud83d\udcf9|\ud83d\udcfa|\ud83d\udcfb|\ud83d\udcfc|\ud83d\udd03|\ud83d\udd0a|\ud83d\udd0b|\ud83d\udd0c|\ud83d\udd0d|\ud83d\udd0e|\ud83d\udd0f|\ud83d\udd10|\ud83d\udd11|\ud83d\udd12|\ud83d\udd13|\ud83d\udd14|\ud83d\udd16|\ud83d\udd17|\ud83d\udd18|\ud83d\udd19|\ud83d\udd1a|\ud83d\udd1b|\ud83d\udd1c|\ud83d\udd1d|\ud83d\udd1e|\ud83d\udd1f|\ud83d\udd20|\ud83d\udd21|\ud83d\udd22|\ud83d\udd23|\ud83d\udd24|\ud83d\udd25|\ud83d\udd26|\ud83d\udd27|\ud83d\udd28|\ud83d\udd29|\ud83d\udd2a|\ud83d\udd2b|\ud83d\udd2e|\ud83d\udd2f|\ud83d\udd30|\ud83d\udd31|\ud83d\udd32|\ud83d\udd33|\ud83d\udd34|\ud83d\udd35|\ud83d\udd36|\ud83d\udd37|\ud83d\udd38|\ud83d\udd39|\ud83d\udd3a|\ud83d\udd3b|\ud83d\udd3c|\ud83d\udd3d|\ud83d\udd50|\ud83d\udd51|\ud83d\udd52|\ud83d\udd53|\ud83d\udd54|\ud83d\udd55|\ud83d\udd56|\ud83d\udd57|\ud83d\udd58|\ud83d\udd59|\ud83d\udd5a|\ud83d\udd5b|\ud83d\uddfb|\ud83d\uddfc|\ud83d\uddfd|\ud83d\uddfe|\ud83d\uddff|\ud83d\ude01|\ud83d\ude02|\ud83d\ude03|\ud83d\ude04|\ud83d\ude05|\ud83d\ude06|\ud83d\ude09|\ud83d\ude0a|\ud83d\ude0b|\ud83d\ude0c|\ud83d\ude0d|\ud83d\ude0f|\ud83d\ude12|\ud83d\ude13|\ud83d\ude14|\ud83d\ude16|\ud83d\ude18|\ud83d\ude1a|\ud83d\ude1c|\ud83d\ude1d|\ud83d\ude1e|\ud83d\ude20|\ud83d\ude21|\ud83d\ude22|\ud83d\ude23|\ud83d\ude24|\ud83d\ude25|\ud83d\ude28|\ud83d\ude29|\ud83d\ude2a|\ud83d\ude2b|\ud83d\ude2d|\ud83d\ude30|\ud83d\ude31|\ud83d\ude32|\ud83d\ude33|\ud83d\ude35|\ud83d\ude37|\ud83d\ude38|\ud83d\ude39|\ud83d\ude3a|\ud83d\ude3b|\ud83d\ude3c|\ud83d\ude3d|\ud83d\ude3e|\ud83d\ude3f|\ud83d\ude40|\ud83d\ude45|\ud83d\ude46|\ud83d\ude47|\ud83d\ude48|\ud83d\ude49|\ud83d\ude4a|\ud83d\ude4b|\ud83d\ude4c|\ud83d\ude4d|\ud83d\ude4e|\ud83d\ude4f|\ud83d\ude80|\ud83d\ude83|\ud83d\ude84|\ud83d\ude85|\ud83d\ude87|\ud83d\ude89|\ud83d\ude8c|\ud83d\ude8f|\ud83d\ude91|\ud83d\ude92|\ud83d\ude93|\ud83d\ude95|\ud83d\ude97|\ud83d\ude99|\ud83d\ude9a|\ud83d\udea2|\ud83d\udea4|\ud83d\udea5|\ud83d\udea7|\ud83d\udea8|\ud83d\udea9|\ud83d\udeaa|\ud83d\udeab|\ud83d\udeac|\ud83d\udead|\ud83d\udeb2|\ud83d\udeb6|\ud83d\udeb9|\ud83d\udeba|\ud83d\udebb|\ud83d\udebc|\ud83d\udebd|\ud83d\udebe|\ud83d\udec0|\ud83c\udde6|\ud83c\udde7|\ud83c\udde8|\ud83c\udde9|\ud83c\uddea|\ud83c\uddeb|\ud83c\uddec|\ud83c\udded|\ud83c\uddee|\ud83c\uddef|\ud83c\uddf0|\ud83c\uddf1|\ud83c\uddf2|\ud83c\uddf3|\ud83c\uddf4|\ud83c\uddf5|\ud83c\uddf6|\ud83c\uddf7|\ud83c\uddf8|\ud83c\uddf9|\ud83c\uddfa|\ud83c\uddfb|\ud83c\uddfc|\ud83c\uddfd|\ud83c\uddfe|\ud83c\uddff|\ud83c\udf0d|\ud83c\udf0e|\ud83c\udf10|\ud83c\udf12|\ud83c\udf16|\ud83c\udf17|\ue50a|\u3030|\u27b0|\u2797|\u2796|\u2795|\u2755|\u2754|\u2753|\u274e|\u274c|\u2728|\u270b|\u270a|\u2705|\u26ce|\u23f3|\u23f0|\u23ec|\u23eb|\u23ea|\u23e9|\u2122|\u27bf|\u00a9|\u00ae)|(?:(?:\ud83c\udc04|\ud83c\udd7f|\ud83c\ude1a|\ud83c\ude2f|\u3299|\u303d|\u2b55|\u2b50|\u2b1c|\u2b1b|\u2b07|\u2b06|\u2b05|\u2935|\u2934|\u27a1|\u2764|\u2757|\u2747|\u2744|\u2734|\u2733|\u2716|\u2714|\u2712|\u270f|\u270c|\u2709|\u2708|\u2702|\u26fd|\u26fa|\u26f5|\u26f3|\u26f2|\u26ea|\u26d4|\u26c5|\u26c4|\u26be|\u26bd|\u26ab|\u26aa|\u26a1|\u26a0|\u2693|\u267f|\u267b|\u3297|\u2666|\u2665|\u2663|\u2660|\u2653|\u2652|\u2651|\u2650|\u264f|\u264e|\u264d|\u264c|\u264b|\u264a|\u2649|\u2648|\u263a|\u261d|\u2615|\u2614|\u2611|\u260e|\u2601|\u2600|\u25fe|\u25fd|\u25fc|\u25fb|\u25c0|\u25b6|\u25ab|\u25aa|\u24c2|\u231b|\u231a|\u21aa|\u21a9|\u2199|\u2198|\u2197|\u2196|\u2195|\u2194|\u2139|\u2049|\u203c|\u2668)([\uFE0E\uFE0F]?)))/g,SVGPATH:s,ZREKNARF:'<svg style="padding:1.75px 0" class="svg-glyph_views ffz-svg svg-zreknarf" width="16px" viewBox="0 0 249 195" version="1.1" height="12.5px">'+s+"</svg>",CHAT_BUTTON:'<svg class="svg-emoticons ffz-svg" height="18px" width="24px" viewBox="0 0 249 195" version="1.1">'+s+"</svg>",ROOMS:'<svg class="svg-glyph_views svg-roomlist" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M1,13v-2h14v2H1z M1,5h13v2H1V5z M1,2h10v2H1V2z M12,10H1V8h11V10z" fill-rule="evenodd"></path></svg>',CAMERA:'<svg class="svg-camera" height="16px" version="1.1" viewBox="0 0 36 36" width="16px" x="0px" y="0px"><path fill-rule="evenodd" clip-rule="evenodd" d="M24,20v6H4V10h20v6l8-6v16L24,20z"/></svg>',INVITE:'<svg class="svg-plus" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M15,9h-3v3h-2V9H7V7h3V4h2v3h3V9z M9,6H6v4h2h1v3h4l0,0l0,0v1h-3H4H1v-1l3-3h2L4,8V2h6v1H9V6z" fill-rule="evenodd"></path></svg>',EYE:'<svg class="svg-glyph_views ffz-svg svg-eye" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M11,13H5L1,9V8V7l4-4h6l4,4v1v1L11,13z M8,5C6.344,5,5,6.343,5,8c0,1.656,1.344,3,3,3c1.657,0,3-1.344,3-3C11,6.343,9.657,5,8,5z M8,9C7.447,9,7,8.552,7,8s0.447-1,1-1s1,0.448,1,1S8.553,9,8,9z" fill-rule="evenodd"></path></svg>',CLOCK:'<svg class="svg-glyph_views ffz-svg svg-clock" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path fill-rule="evenodd" clip-rule="evenodd" fill="#888888" d="M8,15c-3.866,0-7-3.134-7-7s3.134-7,7-7s7,3.134,7,7 S11.866,15,8,15z M8,3C5.238,3,3,5.238,3,8s2.238,5,5,5s5-2.238,5-5S10.762,3,8,3z M7.293,8.707L7,8l1-4l0.902,3.607L11,11 L7.293,8.707z"/></svg>',GEAR:'<svg class="svg-gear" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M15,7v2h-2.115c-0.125,0.615-0.354,1.215-0.713,1.758l1.484,1.484l-1.414,1.414l-1.484-1.484C10.215,12.531,9.615,12.76,9,12.885V15H7v-2.12c-0.614-0.126-1.21-0.356-1.751-0.714l-1.491,1.49l-1.414-1.414l1.491-1.49C3.477,10.211,3.247,9.613,3.12,9H1V7h2.116C3.24,6.384,3.469,5.785,3.829,5.242L2.343,3.757l1.414-1.414l1.485,1.485C5.785,3.469,6.384,3.24,7,3.115V1h2v2.12c0.613,0.126,1.211,0.356,1.752,0.714l1.49-1.491l1.414,1.414l-1.49,1.492C12.523,5.79,12.754,6.387,12.88,7H15z M8,6C6.896,6,6,6.896,6,8s0.896,2,2,2s2-0.896,2-2S9.104,6,8,6z" fill-rule="evenodd"></path></svg>',HEART:'<svg class="svg-heart" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M8,13.5L1.5,7V4l2-2h3L8,3.5L9.5,2h3l2,2v3L8,13.5z" fill-rule="evenodd"></path></svg>',EMOTE:'<svg class="svg-emote" height="16px" version="1.1" viewBox="0 0 18 18" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M9,18c-4.971,0-9-4.029-9-9s4.029-9,9-9s9,4.029,9,9S13.971,18,9,18z M14,4.111V4h-0.111C12.627,2.766,10.904,2,9,2C7.095,2,5.373,2.766,4.111,4H4v0.111C2.766,5.373,2,7.096,2,9s0.766,3.627,2,4.889V14l0.05-0.051C5.317,15.217,7.067,16,9,16c1.934,0,3.684-0.783,4.949-2.051L14,14v-0.111c1.234-1.262,2-2.984,2-4.889S15.234,5.373,14,4.111zM11,6h2v4h-2V6z M12.535,12.535C11.631,13.44,10.381,14,9,14s-2.631-0.56-3.536-1.465l0.707-0.707C6.896,12.553,7.896,13,9,13s2.104-0.447,2.828-1.172L12.535,12.535z M5,6h2v4H5V6z" fill-rule="evenodd"></path></svg>',STAR:'<svg class="svg-star" height="16px" version="1.1" viewbox="0 0 16 16" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M15,6l-4.041,2.694L13,14l-5-3.333L3,14l2.041-5.306L1,6h5.077L8,1l1.924,5H15z" fill-rule="evenodd"></path></svg>',CLOSE:'<svg class="svg-close_small" height="16px" version="1.1" viewbox="0 0 16 16" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M12.657,4.757L9.414,8l3.243,3.242l-1.415,1.415L8,9.414l-3.243,3.243l-1.414-1.415L6.586,8L3.343,4.757l1.414-1.414L8,6.586l3.242-3.243L12.657,4.757z" fill-rule="evenodd"></path></svg>'}
|
||
},{}],5:[function(){var e=t.FrankerFaceZ;e.settings_info.developer_mode={type:"boolean",value:!1,storage_key:"ffzDebugMode",visible:function(){return this.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){var s,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),void 0===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."},{}],6:[function(e){var s=t.FrankerFaceZ,o=e("../utils"),n=e("../constants");s.prototype.setup_channel=function(){this.log("Creating channel style element.");var t=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.");var t=this._channel_style=document.createElement("style");t.id="ffz-channel-css",document.head.appendChild(t),this.log("Hooking the Ember Channel Index view.");var e=App.__container__.resolve("view:channel/index"),o=this;if(e){this._modify_cindex(e);try{e.create().destroy()}catch(n){}for(var i in Ember.View.views)if(Ember.View.views.hasOwnProperty(i)){var a=Ember.View.views[i];a instanceof e&&(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:void 0,setHostMode:function(t){return o.settings.hosted_channels?(this.set("ffz_host_target",t.target),this._super(t)):(this.set("ffz_host_target",void 0),this._super({target:void 0,delay:0}))}}),this.log("Hooking the Ember Channel controller."),e=App.__container__.lookup("controller:channel"),e&&e.reopen({ffzUpdateUptime:function(){o._cindex&&o._cindex.ffzUpdateUptime()}.observes("isLive","content.id"),ffzUpdateTitle:function(){var t=this.get("content.name"),e=this.get("content.display_name");e&&(s.capitalization[t]=[e,Date.now()]),o._cindex&&o._cindex.ffzFixTitle()}.observes("content.status","content.id"),ffzHostTarget:function(){var t=this.get("content.hostModeTarget"),e=t&&t.get("name"),n=t&&t.get("id"),i=t&&t.get("display_name");n!==o.__old_host_target&&(o.__old_host_target&&o.ws_send("unsub_channel",o.__old_host_target),n?(o.ws_send("sub_channel",n),o.__old_host_target=n):delete o.__old_host_target),i&&(s.capitalization[e]=[i,Date.now()]),o.settings.group_tabs&&o._chatv&&o._chatv.ffzRebuildTabs(),o.settings.follow_buttons&&o.rebuild_following_ui(),o.settings.srl_races&&o.rebuild_race_ui()}.observes("content.hostModeTarget")}))}},s.prototype._modify_cindex=function(t){var e=this;t.reopen({didInsertElement:function(){this._super();try{this.ffzInit()}catch(t){e.error("CIndex didInsertElement: "+t)}},willClearRender:function(){try{this.ffzTeardown()}catch(t){e.error("CIndex willClearRender: "+t)}return this._super()},ffzInit:function(){var t=this.get("controller.id"),s=this.get("element");e._cindex=this,e.ws_send("sub_channel",t),s.setAttribute("data-channel",t),s.classList.add("ffz-channel"),this.$(".theatre-button a").attr("title","Theater Mode (Alt+T)"),this.ffzFixTitle(),this.ffzUpdateUptime(),this.ffzUpdateChatters(),this.ffzUpdateHostButton();var o=this.get("element").querySelector(".svg-glyph_views:not(.ffz-svg)");o&&o.parentNode.classList.add("twitch-channel-views"),e.settings.follow_buttons&&e.rebuild_following_ui(),e.settings.srl_races&&e.rebuild_race_ui()},ffzFixTitle:function(){if(!e.has_bttv&&e.settings.stream_title){var t=this.get("controller.status"),s=this.get("controller.id");t=e.render_tokens(e.tokenize_line(s,s,t,!0)),this.$(".title span").each(function(e,s){var o=s.querySelectorAll("script");s.innerHTML=o.length?o[0].outerHTML+t+o[1].outerHTML:t})}},ffzUpdateHostButton:function(){var t=this.get("controller.id"),n=this.get("controller.hostModeTarget.id"),i=e.get_user(),a=i&&e.rooms&&e.rooms[i.login]&&e.rooms[i.login].room,r=a&&a.ffz_host_target,d=a&&a.ffz_hosts_left,u=this.get("element");if(this.set("ffz_host_updating",!1),t){var c=u&&u.querySelector(".stats-and-actions .channel-actions"),l=c&&c.querySelector("#ffz-ui-host-button");if(c&&e.settings.stream_host_button&&i&&i.login!==t){if(!l){l=document.createElement("span"),l.id="ffz-ui-host-button",l.className="button action tooltip",l.addEventListener("click",this.ffzClickHost.bind(l,this,!1));var h=c.querySelector(":scope > .theatre-button");h?c.insertBefore(l,h):c.appendChild(l)}l.classList.remove("disabled"),l.innerHTML=t===r?"Unhost":"Host",l.title=r?"You are now hosting "+o.sanitize(s.get_capitalization(r))+".":"You are not hosting any channel.","number"==typeof d&&(l.title+=" You have "+d+" host command"+o.pluralize(d)+" remaining this half hour.")}else l&&l.parentElement.removeChild(l)}if(n){var c=u&&u.querySelector("#hostmode .channel-actions"),l=c&&c.querySelector("#ffz-ui-host-button");if(c&&e.settings.stream_host_button&&i&&i.login!==n){if(!l){l=document.createElement("span"),l.id="ffz-ui-host-button",l.className="button action tooltip",l.addEventListener("click",this.ffzClickHost.bind(l,this,!0));var h=c.querySelector(":scope > .theatre-button");h?c.insertBefore(l,h):c.appendChild(l)}l.classList.remove("disabled"),l.innerHTML=n===r?"Unhost":"Host",l.title=r?"You are currently hosting "+o.sanitize(s.get_capitalization(r))+". Click to "+(n===r?"unhost":"host")+" this channel.":"You are not currently hosting any channel. Click to host this channel.","number"==typeof d&&(l.title+=" You have "+d+" host command"+o.pluralize(d)+" remaining this half hour.")}else l&&l.parentElement.removeChild(l)}},ffzClickHost:function(t,s){var o=t.get(s?"controller.hostModeTarget.id":"controller.id"),n=e.get_user(),i=n&&e.rooms&&e.rooms[n.login]&&e.rooms[n.login].room,a=i&&i.ffz_host_target;i&&!t.get("ffz_host_updating")&&(this.classList.add("disabled"),this.title="Updating...",t.set("ffz_host_updating",!0),i.send(a===o?"/unhost":"/host "+o))},ffzUpdateChatters:function(){var t=this.get("controller.id"),s=e.rooms&&e.rooms[t];if(!s||!e.settings.chatter_count){var i=this.get("element").querySelector("#ffz-chatter-display");return i&&i.parentElement.removeChild(i),i=this.get("element").querySelector("#ffz-ffzchatter-display"),void(i&&i.parentElement.removeChild(i))}var a=Object.keys(s.room.get("ffz_chatters")||{}).length,r=s.ffz_chatters||0,d=s.ffz_viewers||0,i=this.get("element").querySelector("#ffz-chatter-display span");if(!i){var u=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!u)return;var c=document.createElement("span");c.className="ffz stat",c.id="ffz-chatter-display",c.title="Currently in Chat",c.innerHTML=n.ROOMS+" ",i=document.createElement("span"),c.appendChild(i);var l=u.querySelector("#ffz-ffzchatter-display");l?u.insertBefore(c,l):u.appendChild(c),jQuery(c).tipsy()}if(i.innerHTML=o.number_commas(a),!r&&!d)return i=this.get("element").querySelector("#ffz-ffzchatter-display"),void(i&&i.parentNode.removeChild(i));if(i=this.get("element").querySelector("#ffz-ffzchatter-display span"),!i){var u=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!u)return;var c=document.createElement("span");c.className="ffz stat",c.id="ffz-ffzchatter-display",c.title="Viewers (In Chat) with FrankerFaceZ",c.innerHTML=n.ZREKNARF+" ",i=document.createElement("span"),c.appendChild(i);var l=u.querySelector("#ffz-chatter-display");l?u.insertBefore(c,l.nextSibling):u.appendChild(c),jQuery(c).tipsy()}i.innerHTML=o.number_commas(d)+" ("+o.number_commas(r)+")"},ffzUpdateUptime:function(){if(this._ffz_update_uptime&&(clearTimeout(this._ffz_update_uptime),delete this._ffz_update_uptime),!e.settings.stream_uptime||!this.get("controller.isLiveAccordingToKraken")){var t=this.get("element").querySelector("#ffz-uptime-display");return void(t&&t.parentElement.removeChild(t))}this._ffz_update_uptime=setTimeout(this.ffzUpdateUptime.bind(this),1e3);var s=this.get("controller.content.stream.created_at");if(s&&(s=o.parse_date(s))){var i=Math.floor((Date.now()-s.getTime())/1e3);if(!(0>i)){var t=this.get("element").querySelector("#ffz-uptime-display span");if(!t){var a=this.get("element").querySelector(".stats-and-actions .channel-stats");if(!a)return;var r=document.createElement("span");r.className="ffz stat",r.id="ffz-uptime-display",r.title="Stream Uptime <nobr>(since "+s.toLocaleString()+")</nobr>",r.innerHTML=n.CLOCK+" ",t=document.createElement("span"),r.appendChild(t);var d=a.querySelector(".live-count");if(d)a.insertBefore(r,d.nextSibling);else try{d=a.querySelector("script:nth-child(0n+2)"),a.insertBefore(r,d.nextSibling)}catch(u){a.insertBefore(r,a.childNodes[0])}jQuery(r).tipsy({html:!0})}t.innerHTML=o.time_to_string(i)}}},ffzTeardown:function(){var t=this.get("controller.id");t&&e.ws_send("unsub_channel",t),this.get("element").setAttribute("data-channel",""),e._cindex=void 0,this._ffz_update_uptime&&clearTimeout(this._ffz_update_uptime),o.update_css(e._channel_style,t,null)}})},s.settings_info.chatter_count={type:"boolean",value:!1,no_mobile:!0,category:"Channel Metadata",name:"Chatter Count",help:"Display the current number of users connected to chat beneath the channel.",on_update:function(t){if(this._cindex&&this._cindex.ffzUpdateChatters(),t&&this.rooms)for(var e in this.rooms)this.rooms.hasOwnProperty(e)&&this.rooms[e].room&&this.rooms[e].room.ffzInitChatterCount()}},s.settings_info.channel_views={type:"boolean",value:!0,no_mobile:!0,category:"Channel Metadata",name:"Channel Views",help:"Display the number of times the channel has been viewed beneath the stream.",on_update:function(t){document.body.classList.toggle("ffz-hide-view-count",!t)}},s.settings_info.hosted_channels={type:"boolean",value:!0,no_mobile:!0,category:"Channel Metadata",name:"Channel Hosting",help:"Display other channels that have been featured by the current channel.",on_update:function(t){var e=document.querySelector("input.ffz-setting-hosted-channels");if(e&&(e.checked=t),this._cindex){var s=this._cindex.get("controller.model"),o=s&&this.rooms&&this.rooms[s.get("id")],n=o&&o.room&&o.room.get("ffz_host_target");s&&o&&s.setHostMode({target:n,delay:0})}}},s.settings_info.stream_host_button={type:"boolean",value:!0,no_mobile:!0,category:"Channel Metadata",name:"Host This Channel Button",help:"Display a button underneath streams that make it easy to host them with your own channel.",on_update:function(){this._cindex&&this._cindex.ffzUpdateHostButton()}},s.settings_info.stream_uptime={type:"boolean",value:!1,no_mobile:!0,category:"Channel Metadata",name:"Stream Uptime",help:"Display the stream uptime under a channel by the viewer count.",on_update:function(){this._cindex&&this._cindex.ffzUpdateUptime()}},s.settings_info.stream_title={type:"boolean",value:!0,no_bttv:!0,no_mobile:!0,category:"Channel Metadata",name:"Title Links",help:"Make links in stream titles clickable.",on_update:function(){this._cindex&&this._cindex.ffzFixTitle()}}},{"../constants":4,"../utils":33}],7:[function(e){var s=t.FrankerFaceZ,o=(e("../utils"),e("../constants"),{BACKSPACE:8,TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,TWO:50,COLON:59,FAKE_COLON:186}),n=function(t){if("number"==typeof t.selectionStart)return t.selectionStart;if(!t.createTextRange)return-1;var e=document.selection.createRange(),s=t.createTextRange();return s.moveToBookmark(e.getBookmark()),s.moveStart("character",-t.value.length),s.text.length},i=function(t,e){if(t.setSelectionRange)t.setSelectionRange(e,e);else if(t.createTextRange){var s=t.createTextRange();s.move("character",-t.value.length),s.move("character",e),s.select()}};s.settings_info.input_quick_reply={type:"boolean",value:!0,category:"Chat Input",no_bttv:!0,name:"Reply to Whispers with /r",help:"Automatically replace /r at the start of the line with the command to whisper to the person you've whispered with most recently."},s.settings_info.input_mru={type:"boolean",value:!0,category:"Chat Input",no_bttv:!0,name:"Chat Input History",help:"Use the Up and Down arrows in chat to select previously sent chat messages."},s.settings_info.input_emoji={type:"boolean",value:!1,category:"Chat Input",no_bttv:!0,name:"Enter Emoji By Name",help:"Replace emoji that you type by name with the character. :+1: becomes 👍."},s.prototype.setup_chat_input=function(){this.log("Hooking the Ember Chat Input controller.");var t=App.__container__.resolve("component:twitch-chat-input");if(t&&(this._modify_chat_input(t),this._roomv))for(var e=0;e<this._roomv._childViews.length;e++){var s=this._roomv._childViews[e];s instanceof t&&(this._modify_chat_input(s),s.ffzInit())}},s.prototype._modify_chat_input=function(e){var a=this;e.reopen({ffz_mru_index:-1,didInsertElement:function(){this._super();try{this.ffzInit()}catch(t){a.error("ChatInput didInsertElement: "+t)}},willClearRender:function(){try{this.ffzTeardown()}catch(t){a.error("ChatInput willClearRender: "+t)}return this._super()},ffzInit:function(){a._inputv=this;var t=this.$("textarea");t.off("keydown"),t.on("keydown",this._ffzKeyDown.bind(this))},ffzTeardown:function(){a._inputv===this&&(a._inputv=void 0);var t=this.$("textarea");t.off("keydown"),t.on("keydown",this._onKeyDown.bind(this))},_ffzKeyDown:function(e){var s=e||t.event,r=s.charCode||s.keyCode;switch(r){case o.UP:case o.DOWN:if(s.shiftKey||s.shiftLeft||s.ctrlKey||s.metaKey)return;if(this.get("isShowingSuggestions"))s.preventDefault();else{if(!a.settings.input_mru)return this._onKeyDown(e);Ember.run.next(this.ffzCycleMRU.bind(this,r,n(this.get("chatTextArea"))))}break;case o.SPACE:if(!a.settings.input_quick_reply||2!==n(this.get("chatTextArea"))||"/r"!==this.get("textareaValue").substring(0,2))return this._onKeyDown(e);var d=this;Ember.run.next(function(){var t=d.get("uniqueWhisperSuggestions.0");if(t){var e="/w "+t+d.get("textareaValue").substr(2);d.set("_currentWhisperTarget",0),d.set("textareaValue",e),Ember.run.next(function(){i(d.get("chatTextArea"),4+t.length)})}});break;case o.COLON:case o.FAKE_COLON:if(a.settings.input_emoji&&(s.shiftKey||s.shiftLeft)){var d=this,u=n(this.get("chatTextArea"));return void(u>0&&Ember.run.next(function(){var t=d.get("textareaValue"),e=t.lastIndexOf(":",u-1);if(-1!==e&&-1!==u&&":"===t.charAt(u)){var s=t.substr(e+1,u-e-1),o=a.emoji_names[s],n=a.emoji_data[o];if(n){var r=t.substr(0,e)+n.raw;d.set("textareaValue",r+t.substr(u+1)),Ember.run.next(function(){i(d.get("chatTextArea"),r.length)})}}}))}return this._onKeyDown(e);case o.ENTER:s.shiftKey||s.shiftLeft||this.set("ffz_mru_index",-1);default:return this._onKeyDown(e)}},ffzCycleMRU:function(t,e){var s=n(this.get("chatTextArea"));if(e===s){var i=this.get("ffz_mru_index"),a=this._parentView.get("context.model.mru_list")||[];i=t===o.UP?(i+1)%(a.length+1):(i+a.length)%(a.length+1);var r=this.get("ffz_old_mru");(void 0===r||null===r)&&(r=this.get("textareaValue"),this.set("ffz_old_mru",r));var d=a[i];void 0===d&&(this.set("ffz_old_mru",void 0),d=r),this.set("ffz_mru_index",i),this.set("textareaValue",d)}},completeSuggestion:function(t){var e,o,n=this,a=this.get("textareaValue"),r=this.get("partialNameStartIndex");e=a.substring(0,r)+("/"===a.charAt(0)?t:s.get_capitalization(t)),o=a.substring(r+this.get("partialName").length),o||(e+=" "),this.set("textareaValue",e+o),this.set("isShowingSuggestions",!1),this.set("partialName",""),this.trackSuggestionsCompleted(),Ember.run.next(function(){i(n.get("chatTextArea"),e.length)})}})}},{"../constants":4,"../utils":33}],8:[function(e){var s=t.FrankerFaceZ,o=e("../utils"),n=e("../constants");s.settings_info.swap_sidebars={type:"boolean",value:!1,category:"Appearance",no_mobile:!0,no_bttv:!0,name:"Swap Sidebar Positions",help:"Swap the positions of the left and right sidebars, placing chat on the left.",on_update:function(t){this.has_bttv||document.body.classList.toggle("ffz-sidebar-swap",t)}},s.settings_info.minimal_chat={type:"boolean",value:!1,category:"Chat Appearance",name:"Minimalistic Chat",help:"Hide all of the chat user interface, only showing messages and an input box.",on_update:function(t){if(document.body.classList.toggle("ffz-minimal-chat",t),this.settings.group_tabs&&this._chatv&&this._chatv._ffz_tabs){var e=this;setTimeout(function(){e._chatv&&e._chatv.$(".chat-room").css("top",e._chatv._ffz_tabs.offsetHeight+"px"),e._roomv&&e._roomv.get("stuckToBottom")&&e._roomv._scrollToBottom()},0)}this._chatv&&this._chatv.get("controller.showList")&&this._chatv.set("controller.showList",!1)}},s.settings_info.prevent_clear={type:"boolean",value:!1,no_bttv:!0,category:"Chat Filtering",name:"Show Deleted Messages",help:"Fade deleted messages instead of replacing them, and prevent chat from being cleared.",on_update:function(t){if(!this.has_bttv&&this.rooms)for(var e in this.rooms){var s=this.rooms[e],o=s&&s.room;o&&o.get("messages").forEach(function(e,s){t&&!e.ffz_deleted&&e.deleted?o.set("messages."+s+".deleted",!1):!e.ffz_deleted||t||e.deleted||o.set("messages."+s+".deleted",!0)})}}},s.settings_info.chat_history={type:"boolean",value:!0,visible:!1,category:"Chat Appearance",name:"Chat History <span>Alpha</span>",help:"Load previous chat messages when loading a chat room so you can see what people have been talking about. <b>This currently only works in a handful of channels due to server capacity.</b>"},s.settings_info.group_tabs={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Chat Room Tabs <span>Beta</span>",help:"Enhanced UI for switching the current chat room and noticing new messages.",on_update:function(t){var e=!this.has_bttv&&t;this._chatv&&e!==this._group_tabs_state&&(e?this._chatv.ffzEnableTabs():this._chatv.ffzDisableTabs())}},s.settings_info.pinned_rooms={value:[],visible:!1},s.settings_info.visible_rooms={value:[],visible:!1},s.prototype.setup_chatview=function(){document.body.classList.toggle("ffz-minimal-chat",this.settings.minimal_chat),this.has_bttv||document.body.classList.toggle("ffz-sidebar-swap",this.settings.swap_sidebars),this.log("Hooking the Ember Chat controller.");var t=App.__container__.lookup("controller:chat"),e=this;t&&t.reopen({ffzUpdateChannels:function(){e._chatv&&(e._chatv.ffzRebuildMenu(),e.settings.group_tabs&&e._chatv.ffzRebuildTabs())}.observes("currentChannelRoom","connectedPrivateGroupRooms"),removeCurrentChannelRoom:function(){if(!e.settings.group_tabs||e.has_bttv)return this._super();var t=this.get("currentChannelRoom"),s=t&&t.get("id"),o=e.get_user();e.settings.pinned_rooms&&-1!==e.settings.pinned_rooms.indexOf(s)||(t===this.get("currentRoom")&&this.blurRoom(),t&&o&&o.login===s&&t.destroy()),this.set("currentChannelRoom",void 0)}}),this.log("Hooking the Ember Chat view.");var t=App.__container__.resolve("view:chat");this._modify_cview(t);try{t.create().destroy()}catch(s){}for(var o in Ember.View.views)if(Ember.View.views.hasOwnProperty(o)){var n=Ember.View.views[o];if(n instanceof t){this.log("Manually updating existing Chat view.",n);try{n.ffzInit()}catch(s){this.error("setup: build_ui_link: "+s)}}}this.log("Hooking the Ember Layout controller.");var i=App.__container__.lookup("controller:layout");if(i){i.reopen({ffzFixTabs:function(){e.settings.group_tabs&&e._chatv&&e._chatv._ffz_tabs&&setTimeout(function(){e._chatv&&e._chatv.$(".chat-room").css("top",e._chatv._ffz_tabs.offsetHeight+"px")},0)}.observes("isRightColumnClosed")}),this.log("Hooking the Ember 'Right Column' controller. Seriously...");var a=App.__container__.lookup("controller:right-column");a&&a.reopen({ffzFixTabs:function(){e.settings.group_tabs&&e._chatv&&e._chatv._ffz_tabs&&setTimeout(function(){e._chatv&&e._chatv.$(".chat-room").css("top",e._chatv._ffz_tabs.offsetHeight+"px")},0)}.observes("firstTabSelected")})}},s.prototype._modify_cview=function(t){var e=this;t.reopen({didInsertElement:function(){this._super();try{this.ffzInit()}catch(t){e.error("ChatView didInsertElement: "+t)}},willClearRender:function(){try{this.ffzTeardown()}catch(t){e.error("ChatView willClearRender: "+t)}this._super()},ffzInit:function(){e._chatv=this,this.$(".textarea-contain").append(e.build_ui_link(this)),!e.has_bttv&&e.settings.group_tabs&&this.ffzEnableTabs(),this.ffzRebuildMenu(),setTimeout(function(){e.settings.group_tabs&&e._chatv&&e._chatv._ffz_tabs&&e._chatv.$(".chat-room").css("top",e._chatv._ffz_tabs.offsetHeight+"px");var t=e._chatv.get("controller");t&&t.set("showList",!1)},1e3)},ffzTeardown:function(){e._chatv===this&&(e._chatv=null),this.$(".textarea-contain .ffz-ui-toggle").remove(),e.settings.group_tabs&&this.ffzDisableTabs()},ffzChangeRoom:Ember.observer("controller.currentRoom",function(){try{e.update_ui_link();var t,s=this.get("controller.currentRoom");if(s&&s.resetUnreadCount(),this._ffz_chan_table&&(t=jQuery(this._ffz_chan_table),t.children(".ffz-room-row").removeClass("active"),s&&t.children('.ffz-room-row[data-room="'+s.get("id")+'"]').addClass("active").children("span").text("")),this._ffz_group_table&&(t=jQuery(this._ffz_group_table),t.children(".ffz-room-row").removeClass("active"),s&&t.children('.ffz-room-row[data-room="'+s.get("id")+'"]').addClass("active").children("span").text("")),!e.has_bttv&&e.settings.group_tabs&&this._ffz_tabs){var o=jQuery(this._ffz_tabs);o.children(".ffz-chat-tab").removeClass("active"),s&&o.children('.ffz-chat-tab[data-room="'+s.get("id")+'"]').removeClass("tab-mentioned").removeClass("hidden").addClass("active").children("span").text("");var n=s&&s.get("canInvite");this._ffz_invite&&this._ffz_invite.classList.toggle("hidden",!n),this.set("controller.showInviteUser",n&&this.get("controller.showInviteUser")),this.$(".chat-room").css("top",this._ffz_tabs.offsetHeight+"px")}}catch(i){e.error("ChatView ffzUpdateLink: "+i)}}),ffzRebuildMenu:function(){return},ffzBuildRow:function(t,i,a,r){var d,u=document.createElement("tr"),c=document.createElement("td"),l=document.createElement("td"),h=document.createElement("td"),f=document.createElement("td"),_=i.get("isGroupRoom"),m=i===t.get("controller.currentRoom"),p=i.get("tmiRoom.displayName")||(_?i.get("tmiRoom.name"):s.get_capitalization(i.get("id"),function(t){e.log("Name for Row: "+t),l.innerHTML=o.sanitize(t)}));return l.className="ffz-room",l.innerHTML=o.sanitize(p),a?(c.innerHTML=n.CAMERA,c.title=l.title="Current Channel",c.className=l.className="tooltip"):r&&(c.innerHTML=n.EYE,c.title=l.title="Hosted Channel",c.className=l.className="tooltip"),h.className=f.className="ffz-row-switch",h.innerHTML='<a class="switch'+(-1!==e.settings.pinned_rooms.indexOf(i.get("id"))?" active":"")+'"><span></span></a>',f.innerHTML='<a class="switch'+(-1!==e.settings.visible_rooms.indexOf(i.get("id"))?" active":"")+'"><span></span></a>',u.setAttribute("data-room",i.get("id")),u.className="ffz-room-row",u.classList.toggle("current-channel",a),u.classList.toggle("host-channel",r),u.classList.toggle("group-chat",_),u.classList.toggle("active",m),u.appendChild(c),u.appendChild(l),_?(d=document.createElement("a"),d.className="leave-chat tooltip",d.innerHTML=n.CLOSE,d.title="Leave Group",l.appendChild(d),d.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation&&t.stopPropagation(),confirm('Are you sure you want to leave the group room "'+p+'"?')&&i.get("isGroupRoom")&&i.del()})):(u.appendChild(h),d=h.querySelector("a.switch"),d.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation&&t.stopPropagation();var s=i.get("id"),o=-1!==e.settings.pinned_rooms.indexOf(s);o?e._leave_room(s):e._join_room(s),this.classList.toggle("active",!o)})),u.appendChild(f),d=f.querySelector("a.switch"),d.addEventListener("click",function(s){s.preventDefault(),s.stopPropagation&&s.stopPropagation();var o=i.get("id"),n=e.settings.visible_rooms,a=-1!==n.indexOf(o);a?n.removeObject(o):n.push(o),e.settings.set("visible_rooms",n),this.classList.toggle("active",!a),t.ffzRebuildTabs()}),u.addEventListener("click",function(){var e=t.get("controller");e.focusRoom(i),e.set("showList",!1)}),u},ffzEnableTabs:function(){if(!e.has_bttv&&e.settings.group_tabs){this.$(".chat-header").addClass("hidden");var t=this._ffz_tabs=document.createElement("div");t.id="ffz-group-tabs",this.$(".chat-header").after(t),this.ffzRebuildTabs()}},ffzRebuildTabs:function(){if(!e.has_bttv&&e.settings.group_tabs){var t=this._ffz_tabs||this.get("element").querySelector("#ffz-group-tabs");if(t){t.innerHTML="";var s=document.createElement("a"),o=this;s.className="button glyph-only tooltip",s.title="Chat Room Management",s.innerHTML=n.ROOMS,s.addEventListener("click",function(){var t=o.get("controller");t&&t.set("showList",!t.get("showList"))}),t.appendChild(s),s=document.createElement("a"),s.className="button glyph-only tooltip invite",s.title="Invite a User",s.innerHTML=n.INVITE,s.addEventListener("click",function(){var t=o.get("controller");t&&t.set("showInviteUser",t.get("currentRoom.canInvite")&&!t.get("showInviteUser"))}),s.classList.toggle("hidden",!this.get("controller.currentRoom.canInvite")),o._ffz_invite=s,t.appendChild(s);var i,a=this.get("controller.currentChannelRoom");a&&(i=this.ffzBuildTab(o,a,!0),i&&t.appendChild(i));var r=App.__container__.lookup("controller:channel"),d=App.__container__.resolve("model:room");if(target=r&&r.get("hostModeTarget"),target&&d){var u=target.get("id");this._ffz_host!==u&&(-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()),this._ffz_host=u,this._ffz_host_room=d.findOne(u))}else 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()),delete this._ffz_host,delete this._ffz_host_room);this._ffz_host_room&&(i=o.ffzBuildTab(o,this._ffz_host_room,!1,!0),i&&t.appendChild(i));for(var c=0;c<e.settings.pinned_rooms.length;c++){var l=e.settings.pinned_rooms[c];if(a&&a.get("id")!==l&&this._ffz_host!==l&&e.rooms[l]&&e.rooms[l].room){var i=o.ffzBuildTab(o,e.rooms[l].room,!1,!1);i&&t.appendChild(i)}}_.each(this.get("controller.connectedPrivateGroupRooms"),function(e){var s=o.ffzBuildTab(o,e);s&&t.appendChild(s)}),this.$(".chat-room").css("top",t.offsetHeight+"px")}}},ffzTabUnread:function(t){if(!e.has_bttv&&e.settings.group_tabs){var s=this._ffz_tabs||this.get("element").querySelector("#ffz-group-tabs"),n=this.get("controller.currentRoom.id");if(s){if(t){var i=s.querySelector('.ffz-chat-tab[data-room="'+t+'"]'),a=e.rooms&&e.rooms[t];if(i&&a){var r=o.format_unread(t===n?0:a.room.get("unreadCount"));i.querySelector("span").innerHTML=r}return this.$(".chat-room").css("top",s.offsetHeight+"px")}for(var d=s.querySelectorAll(".ffz-chat-tab"),u=0;u<d.length;u++){var i=d[u],t=i.getAttribute("data-room"),a=e.rooms&&e.rooms[t];if(a){var r=o.format_unread(t===n?0:a.room.get("unreadCount"));i.querySelector("span").innerHTML=r}}this.$(".chat-room").css("top",s.offsetHeight+"px")}}},ffzBuildTab:function(t,i,a,r){{var d,u,c=document.createElement("span"),l="",h=i.get("id"),f=i.get("isGroupRoom"),_=i===t.get("controller.currentRoom");_||-1!==e.settings.visible_rooms.indexOf(h)}return c.setAttribute("data-room",i.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",_),u=o.format_unread(_?0:i.get("unreadCount")),d=i.get("tmiRoom.displayName")||(f?i.get("tmiRoom.name"):s.get_capitalization(i.get("id"),function(t){u=o.format_unread(_?0:i.get("unreadCount")),c.innerHTML=l+o.sanitize(t)+"<span>"+u+"</span>"})),a?(l=n.CAMERA,c.title="Current Channel"):r?(l=n.EYE,c.title="Hosted Channel"):c.title=f?"Group Chat":"Pinned Channel",c.innerHTML=l+o.sanitize(d)+"<span>"+u+"</span>",c.addEventListener("click",function(){var e=t.get("controller");e.focusRoom(i),e.set("showList",!1)}),c},ffzDisableTabs:function(){this._ffz_tabs&&(this._ffz_tabs.parentElement.removeChild(this._ffz_tabs),delete this._ffz_tabs,delete this._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()),delete this._ffz_host,delete this._ffz_host_room),this.$(".chat-room").css("top",""),this.$(".chat-header").removeClass("hidden")}})},s.prototype.connect_extra_chat=function(){var t=this.get_user();if(t&&t.login&&(!this.rooms[t.login]||this.rooms[t.login].room)){var e=App.__container__.resolve("model:room");e&&e.findOne(t.login)}if(!this.has_bttv){for(var s=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){var s=!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)return s&&!e&&!this.has_bttv&&this._chatv&&this.settings.group_tabs&&this._chatv.ffzRebuildTabs(),s;{var o=App.__container__.resolve("model:room");o&&o.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){var s=!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)return s;var o=App.__container__.lookup("controller:chat"),n=this.rooms[t].room,i=this.get_user();return!o||o.get("currentChannelRoom.id")===t||this._chatv&&this._chatv._ffz_host===t?s:(o.get("currentRoom.id")===t&&o.blurRoom(),i&&i.login===t||n.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>";var s=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>";var s=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":4,"../utils":33}],9:[function(e){var s=t.FrankerFaceZ,o=e("../utils"),n=e("../constants"),i="[\\s`~<>!-#%-\\x2A,-/:;\\x3F@\\x5B-\\x5D_\\x7B}\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E3B\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]",a=new RegExp(i+"*,"+i+"*"),r="http://static-cdn.jtvnw.net/emoticons/v1/",d={};
|
||
build_srcset=function(t){if(d[t])return d[t];var e=d[t]=r+t+"/1.0 1x, "+r+t+"/2.0 2x, "+r+t+"/3.0 4x";return e},LINK_SPLIT=/^(?:(https?):\/\/)?(?:(.*?)@)?([^\/:]+)(?::(\d+))?(.*?)(?:\?(.*?))?(?:\#(.*?))?$/,YOUTUBE_CHECK=/^(?:https?:\/\/)?(?:m\.|www\.)?youtu(?:be\.com|\.be)\/(?:v\/|watch\/|.*?(?:embed|watch).*?v=)?([a-zA-Z0-9\-_]+)$/,IMGUR_PATH=/^\/(?:gallery\/)?[A-Za-z0-9]+(?:\.(?:png|jpg|jpeg|gif|gifv|bmp))?$/,IMAGE_EXT=/\.(?:png|jpg|jpeg|gif|bmp)$/i,IMAGE_DOMAINS=[],is_image=function(t,e){var s=t.match(LINK_SPLIT);if(s){var o=s[3].toLowerCase(),n=s[4],i=s[5];return n&&"80"!==n&&"443"!==n?!1:"i.imgur.com"===o||"imgur.com"===o||"www.imgur.com"===o||"m.imgur.com"===o?IMGUR_PATH.test(i):e?IMAGE_EXT.test(i):-1!==IMAGE_DOMAINS.indexOf(o)}},image_iframe=function(t,e){return'<iframe class="ffz-image-hover'+(e?" "+e:"")+'" allowtransparency="true" src="'+n.SERVER+"script/image-proxy.html?"+o.quote_attr(t)+'"></iframe>'},data_to_tooltip=function(t){var e=t.set,s=t.set_type,o=t.owner;return void 0===s&&(s="Channel"),e?(("--twitch-turbo--"==e||"turbo"==e)&&(e="Twitch Turbo",s=null),"Emoticon: "+t.code+"\n"+(s?s+": ":"")+e+(o?"\nBy: "+o.display_name:"")):t.code},build_tooltip=function(t){{var e=this._twitch_emotes[t];e?e.set:null}return e?"string"==typeof e?e:e.tooltip?e.tooltip:e.tooltip=data_to_tooltip(e):"???"},load_emote_data=function(t,e,s,o){if(s){e&&(o.code=e),this._twitch_emotes[t]=o;for(var n=build_tooltip.bind(this)(t),i=document.querySelectorAll('img[emote-id="'+t+'"]'),a=0;a<i.length;a++)i[a].title=n}},build_link_tooltip=function(t){var e,s=this._link_data[t];if(!s)return"";if(s.tooltip)return s.tooltip;if("youtube"==s.type)e=this.settings.link_image_hover?image_iframe(s.full||t,"ffz-yt-thumb"):"",e+="<b>YouTube: "+o.sanitize(s.title)+"</b><hr>",e+="Channel: "+o.sanitize(s.channel)+" | "+o.time_to_string(s.duration)+"<br>",e+=o.number_commas(s.views||0)+" Views | 👍 "+o.number_commas(s.likes||0)+" 👎 "+o.number_commas(s.dislikes||0);else if("strawpoll"==s.type){e="<b>Strawpoll: "+o.sanitize(s.title)+"</b><hr><table><tbody>";for(var n in s.items){{var i=s.items[n];Math.floor(i/s.total*100)}e+='<tr><td style="text-align:left">'+o.sanitize(n)+'</td><td style="text-align:right">'+o.number_commas(i)+"</td></tr>"}e+="</tbody></table><hr>Total: "+o.number_commas(s.total);var a=o.parse_date(s.fetched);if(a){var r=Math.floor((a.getTime()-Date.now())/1e3);r>60&&(e+="<br><small>Data was cached "+o.time_to_string(r)+" ago.</small>")}}else if("twitch"==s.type){e="<b>Twitch: "+o.sanitize(s.display_name)+"</b><hr>";var d=o.parse_date(s.since);d&&(e+="Member Since: "+o.date_string(d)+"<br>"),e+="<nobr>Views: "+o.number_commas(s.views)+"</nobr> | <nobr>Followers: "+o.number_commas(s.followers)+"</nobr>"}else if("twitch_vod"==s.type)e="<b>Twitch "+("highlight"==s.broadcast_type?"Highlight":"Broadcast")+": "+o.sanitize(s.title)+"</b><hr>",e+="By: "+o.sanitize(s.display_name)+(s.game?" | Playing: "+o.sanitize(s.game):" | Not Playing")+"<br>",e+="Views: "+o.number_commas(s.views)+" | "+o.time_to_string(s.length);else if("twitter"==s.type)e="<b>Tweet By: "+o.sanitize(s.user)+"</b><hr>",e+=o.sanitize(s.tweet);else if("reputation"==s.type){if(e=this.settings.link_image_hover&&is_image(s.full||t,this.settings.image_hover_all_domains)?image_iframe(s.full||t):"",e+='<span style="word-wrap: break-word">'+o.sanitize(s.full.toLowerCase())+"</span>",s.trust<50||s.safety<50||s.tags&&s.tags.length>0){e+="<hr>";var u=!1;(s.trust<50||s.safety<50)&&(s.unsafe=!0,e+="<b>Potentially Unsafe Link</b><br>",e+="Trust: "+s.trust+"% | Child Safety: "+s.safety+"%",u=!0),s.tags&&s.tags.length>0&&(e+=(u?"<br>":"")+"Tags: "+s.tags.join(", ")),e+="<br>Data Source: WOT"}}else s.full&&(e=this.settings.link_image_hover&&is_image(s.full||t,this.settings.image_hover_all_domains)?image_iframe(s.full||t):"",e+='<span style="word-wrap: break-word">'+o.sanitize(s.full.toLowerCase())+"</span>");return e||(e='<span style="word-wrap: break-word">'+o.sanitize(t.toLowerCase())+"</span>"),s.tooltip=e,e},load_link_data=function(t,e,s){if(e){this._link_data[t]=s,s.unsafe=!1;var o,n=build_link_tooltip.bind(this)(t),i="/"==t.charAt(t.length-1)?t.substr(0,t.length-1):null;if(o=document.querySelectorAll(i?'span.message a[href="'+t+'"], span.message a[href="'+i+'"], span.message a[data-url="'+t+'"], span.message a[data-url="'+i+'"]':'span.message a[href="'+t+'"], span.message a[data-url="'+t+'"]'),this.settings.link_info)for(var a=0;a<o.length;a++)s.unsafe&&o[a].classList.add("unsafe-link"),o[a].classList.contains("deleted-link")||(o[a].title=n)}},s.settings_info.room_status={type:"boolean",value:!0,category:"Chat Appearance",no_bttv:!0,name:"Room Status Indicators",help:"Display the current room state (slow mode, sub mode, and r9k mode) next to the Chat button.",on_update:function(){this._roomv&&this._roomv.ffzUpdateStatus()}},s.settings_info.line_purge_icon={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Purge Icon in Mod Icons",help:"Display a Purge Icon in chat line Mod Icons for quickly purging users.",on_update:function(t){this.has_bttv||document.body.classList.toggle("ffz-chat-purge-icon",t)}},s.settings_info.replace_bad_emotes={type:"boolean",value:!0,category:"Chat Appearance",no_bttv:!0,name:"Fix Low Quality Twitch Global Emoticons",help:"Replace emoticons such as DansGame and RedCoat with cleaned up versions that don't have pixels around the edges or white backgrounds for nicer display on dark chat."},s.settings_info.parse_emoji={type:"boolean",value:!0,category:"Chat Appearance",name:"Replace Emoji with Images",help:"Replace emoji in chat messages with nicer looking images from the open-source Twitter Emoji project."},s.settings_info.room_status={type:"boolean",value:!0,category:"Chat Appearance",no_bttv:!0,name:"Room Status Indicators",help:"Display the current room state (slow mode, sub mode, and r9k mode) next to the Chat button.",on_update:function(){this._roomv&&this._roomv.ffzUpdateStatus()}},s.settings_info.scrollback_length={type:"button",value:150,category:"Chat Appearance",no_bttv:!0,name:"Scrollback Length",help:"Set the maximum number of lines to keep in chat.",method:function(){var t=prompt("Scrollback Length\n\nPlease enter a new maximum length for the chat scrollback. Default: 150\n\nNote: Making this too large will cause your browser to lag.",this.settings.scrollback_length);if(null!==t&&void 0!==t&&(t=parseInt(t),0/0!==t)){10>t&&(t=10),this.settings.set("scrollback_length",t);var e=App.__container__.lookup("controller:chat"),s=e&&e.get("currentRoom.id");for(var o in this.rooms){var n=this.rooms[o];n.room.set("messageBufferSize",t+(this._roomv&&!this._roomv.get("stuckToBottom")&&s===o?150:0))}}}},s.settings_info.banned_words={type:"button",value:[],category:"Chat Filtering",no_bttv:!0,name:"Banned Words",help:"Set a list of words that will be locally removed from chat messages.",method:function(){var t=this.settings.banned_words.join(", "),e=prompt("Banned Words\n\nPlease enter a comma-separated list of words that you would like to be removed from chat messages.",t);if(null!==e&&void 0!==e){e=e.trim().split(a);for(var s=[],o=0;o<e.length;o++)e[o]&&s.push(e[o]);1==s.length&&"disable"==s[0]&&(s=[]),this.settings.set("banned_words",s)}}},s.settings_info.keywords={type:"button",value:[],category:"Chat Filtering",no_bttv:!0,name:"Highlight Keywords",help:"Set additional keywords that will be highlighted in chat.",method:function(){var t=this.settings.keywords.join(", "),e=prompt("Highlight Keywords\n\nPlease enter a comma-separated list of words that you would like to be highlighted in chat.",t);if(null!==e&&void 0!==e){e=e.trim().split(a);for(var s=[],o=0;o<e.length;o++)e[o]&&s.push(e[o]);1==s.length&&"disable"==s[0]&&(s=[]),this.settings.set("keywords",s)}}},s.settings_info.link_info={type:"boolean",value:!0,category:"Chat Tooltips",no_bttv:!0,name:"Link Information <span>Beta</span>",help:"Check links against known bad websites, unshorten URLs, and show YouTube info."},s.settings_info.link_image_hover={type:"boolean",value:!1,category:"Chat Tooltips",no_bttv:!0,no_mobile:!0,name:"Image Preview",help:"Display image thumbnails for links to Imgur and YouTube."},s.settings_info.image_hover_all_domains={type:"boolean",value:!1,category:"Chat Tooltips",no_bttv:!0,no_mobile:!0,name:"Image Preview - All Domains",help:"<i>Requires Image Preview.</i> Attempt to show an image preview for any URL ending in the appropriate extension. <b>Warning: This may be used to leak your IP address to malicious users.</b>"},s.settings_info.legacy_badges={type:"boolean",value:!1,category:"Chat Appearance",name:"Legacy Badges",help:"Display the old, pre-vector chat badges from Twitch.",on_update:function(t){document.body.classList.toggle("ffz-legacy-badges",t)}},s.settings_info.chat_rows={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"Chat Line Backgrounds",help:"Display alternating background colors for lines in chat.",on_update:function(t){document.body.classList.toggle("ffz-chat-background",!this.has_bttv&&t)}},s.settings_info.chat_separators={type:"select",options:{0:"Disabled",1:"Basic Line (1px solid)",2:"3D Line (2px groove)"},value:"0",category:"Chat Appearance",no_bttv:!0,process_value:function(t){return t===!1?"0":t===!0?"1":t},name:"Chat Line Separators",help:"Display thin lines between chat messages for further visual separation.",on_update:function(t){document.body.classList.toggle("ffz-chat-separator",!this.has_bttv&&"0"!==t),document.body.classList.toggle("ffz-chat-separator-3d",!this.has_bttv&&"2"===t)}},s.settings_info.chat_padding={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"Reduced Chat Line Padding",help:"Reduce the amount of padding around chat messages to fit more on-screen at once.",on_update:function(t){document.body.classList.toggle("ffz-chat-padding",!this.has_bttv&&t)}},s.settings_info.high_contrast_chat={type:"boolean",value:!1,category:"Chat Appearance",no_bttv:!0,name:"High Contrast",help:"Display chat using white and black for maximum contrast. This is suitable for capturing and chroma keying chat to display on stream.",on_update:function(t){document.body.classList.toggle("ffz-high-contrast-chat",!this.has_bttv&&t)}},s.settings_info.chat_font_size={type:"button",value:12,category:"Chat Appearance",no_bttv:!0,name:"Font Size",help:"Make the chat font bigger or smaller.",method:function(){var t=this.settings.chat_font_size,e=prompt("Chat Font Size\n\nPlease enter a new size for the chat font. The default is 12.",t);if(null!==e&&void 0!==e){var s=parseInt(e);(0/0===s||1>s)&&(s=12),this.settings.set("chat_font_size",s)}},on_update:function(t){if(!this.has_bttv&&this._chat_style){var e;if(12===t)e="";else{var n=Math.max(20,Math.round(20/12*t)),i=Math.floor((n-20)/2);e=".ember-chat .chat-messages .chat-line { font-size: "+t+"px !important; line-height: "+n+"px !important; }",i&&(e+=".ember-chat .chat-messages .chat-line .mod-icons, .ember-chat .chat-messages .chat-line .badges { padding-top: "+i+"px; }")}o.update_css(this._chat_style,"chat_font_size",e),s.settings_info.chat_ts_size.on_update.bind(this)(this.settings.chat_ts_size)}}},s.settings_info.chat_ts_size={type:"button",value:null,category:"Chat Appearance",no_bttv:!0,name:"Timestamp Font Size",help:"Make the chat timestamp font bigger or smaller.",method:function(){var t=this.settings.chat_ts_size;null===t&&(t=this.settings.chat_font_size);var e=prompt("Chat Timestamp Font Size\n\nPlease enter a new size for the chat timestamp font. The default is to match the regular chat font size.",t);if(null!==e&&void 0!==e){var s=parseInt(e);(0/0===s||1>s)&&(s=null),this.settings.set("chat_ts_size",s)}},on_update:function(t){if(!this.has_bttv&&this._chat_style){var e;if(null===t)e="";else{var s=Math.max(20,Math.round(20/12*t),Math.round(20/12*this.settings.chat_font_size));e=".ember-chat .chat-messages .timestamp { font-size: "+t+"px !important; line-height: "+s+"px !important; }"}o.update_css(this._chat_style,"chat_ts_font_size",e)}}},s.prototype.setup_line=function(){jQuery(document.body).on("mouseleave",".tipsy",function(){this.parentElement.removeChild(this)});var t=this._chat_style=document.createElement("style");t.id="ffz-style-chat",t.type="text/css",document.head.appendChild(t),s.settings_info.chat_font_size.on_update.bind(this)(this.settings.chat_font_size),document.body.classList.toggle("ffz-chat-colors",!this.has_bttv&&"-1"!==this.settings.fix_color),document.body.classList.toggle("ffz-chat-colors-gray",!this.has_bttv&&"-1"===this.settings.fix_color),document.body.classList.toggle("ffz-legacy-badges",this.settings.legacy_badges),document.body.classList.toggle("ffz-chat-background",!this.has_bttv&&this.settings.chat_rows),document.body.classList.toggle("ffz-chat-separator",!this.has_bttv&&"0"!==this.settings.chat_separators),document.body.classList.toggle("ffz-chat-separator-3d",!this.has_bttv&&"2"===this.settings.chat_separators),document.body.classList.toggle("ffz-chat-padding",!this.has_bttv&&this.settings.chat_padding),document.body.classList.toggle("ffz-chat-purge-icon",!this.has_bttv&&this.settings.line_purge_icon),document.body.classList.toggle("ffz-high-contrast-chat",!this.has_bttv&&this.settings.high_contrast_chat),this._last_row={},this._twitch_emotes={},this._link_data={},this.log("Hooking the Ember Whisper Line component.");var e=App.__container__.resolve("component:whisper-line");e&&this._modify_line(e),this.log("Hooking the Ember Message Line component.");var o=App.__container__.resolve("component:message-line");o&&this._modify_line(o);var n=this.get_user();n&&n.name&&(s.capitalization[n.login]=[n.name,Date.now()])},s.prototype._modify_line=function(t){var e=this;t.reopen({tokenizedMessage:function(){var t=this.get("msgObject.cachedTokens");if(t)return t;t=this._super();try{var o=performance.now(),n=e.get_user(),i=n&&this.get("msgObject.from")===n.login;t=e._remove_banned(t),t=e._emoticonize(this,t),e.settings.parse_emoji&&(t=e.tokenize_emoji(t));var a=this.get("msgObject.tags.display-name");a&&a.length&&(s.capitalization[this.get("msgObject.from")]=[a.trim(),Date.now()]),i||(t=e.tokenize_mentions(t));for(var r=0;r<t.length;r++){var d=t[r];if(!_.isString(d)&&d.mentionedUser&&!d.own){this.set("msgObject.ffz_has_mention",!0);break}}var u=performance.now();u-o>5&&e.log("Tokenizing Message Took Too Long - "+(u-o)+"ms",t,!1,!0)}catch(c){try{e.error("LineController tokenizedMessage: "+c)}catch(c){}}return this.set("msgObject.cachedTokens",t),t}.property("msgObject.message","isChannelLinksDisabled","currentUserNick","msgObject.from","msgObject.tags.emotes"),ffzUpdated:Ember.observer("msgObject.ffz_deleted","msgObject.ffz_old_messages",function(){this.rerender()}),willClearRender:function(){try{}catch(t){e.error("LineView willClearRender: "+t)}this._super()},click:function(t){if(t.target&&t.target.classList.contains("mod-icon")&&(jQuery(t.target).trigger("mouseout"),t.target.classList.contains("purge"))){var s=this.get("msgObject.from"),o=this.get("msgObject.room"),n=o&&e.rooms[o]&&e.rooms[o].room;return void(n&&(n.send("/timeout "+s+" 1"),n.clearMessages(s)))}return this._super(t)},didInsertElement:function(){this._super();try{var t=performance.now(),i=this.get("element"),a=this.get("msgObject.from"),r=this.get("msgObject.room")||App.__container__.lookup("controller:chat").get("currentRoom.id"),d=this.get("msgObject.ffz_alternate");void 0===d&&(d=e._last_row[r]=e._last_row.hasOwnProperty(r)?!e._last_row[r]:!1,this.set("msgObject.ffz_alternate",d)),i.classList.toggle("ffz-alternate",d||!1),i.classList.toggle("ffz-deleted",e.settings.prevent_clear&&this.get("msgObject.ffz_deleted")||!1),i.setAttribute("data-room",r),i.setAttribute("data-sender",a),i.setAttribute("data-deleted",this.get("msgObject.deleted")||!1);var u=this.get("msgObject.ffz_old_messages");if(u&&u.length){var c=document.createElement("div");c.className="button primary float-right",c.innerHTML="Show "+o.number_commas(u.length)+" Old",c.addEventListener("click",e._show_deleted.bind(e,r)),i.classList.add("clearfix"),i.classList.add("ffz-has-deleted"),this.$(".message").append(c)}if(this.get("isBroadcaster")&&!this.get("controller.parentController.model.isStaff")&&!this.get("controller.parentController.model.isAdmin")||this.get("isModeratorOrHigher")&&!(this.get("controller.parentController.model.isBroadcaster")||this.get("controller.parentController.model.isStaff")||this.get("controller.parentController.model.isAdmin"))){var l=i.querySelector("span.mod-icons");l&&l.classList.add("hidden")}var h=i.querySelector("span.mod-icons a.mod-icon.timeout");if(h){var f=document.createElement("a");f.className="mod-icon float-left tooltip purge",f.innerHTML="Purge",f.title="Purge User (Timeout 1s)",f.href="#",h.title="Timeout User (10m)",h.parentElement.insertBefore(f,h.nextSibling)}e.render_badge(this),this.get("msgObject.ffz_has_mention")&&i.classList.add("ffz-mentioned");for(var _=i.querySelectorAll("span.message a.deleted-link"),m=0;m<_.length;m++)_[m].addEventListener("click",e._deleted_link_click);if(e.settings.link_info||e.settings.link_image_hover){for(var p=i.querySelectorAll("span.message a"),m=0;m<p.length;m++){var g=p[m],v=g.href,b=!1;if(g.classList.contains("deleted-link")&&(v=g.getAttribute("data-url"),b=!0),e.settings.link_info){var y=e._link_data[v];y?(b||"boolean"==typeof y||(g.title=y.tooltip),y.unsafe&&g.classList.add("unsafe-link")):/^mailto:/.test(v)||(e._link_data[v]=!0,e.ws_send("get_link",v,load_link_data.bind(e,v)),!b&&e.settings.link_image_hover&&is_image(v,e.settings.image_hover_all_domains)&&(g.title=image_iframe(v)))}else!b&&e.settings.link_image_hover&&is_image(v,e.settings.image_hover_all_domains)&&(g.title=image_iframe(v))}jQuery(p).tipsy({html:!0})}for(var w=i.querySelectorAll("span.message img.emoticon"),m=0;m<w.length;m++){var z=w[m],k=(z.alt,s.src_to_id(z.src));if(null!==k){n.EMOTE_REPLACEMENTS[k]||z.setAttribute("srcset",build_srcset(k)),z.setAttribute("emote-id",k);var C=e._twitch_emotes[k];C?"string"!=typeof C&&(z.title=C.tooltip):(e._twitch_emotes[k]=z.alt,e.ws_send("twitch_emote",k,load_emote_data.bind(e,k,z.alt)))}else if(z.getAttribute("data-ffz-emoji")){var E=z.getAttribute("data-ffz-emoji"),T=e.emoji_data&&e.emoji_data[E];T&&(z.setAttribute("srcset",T.srcSet),z.title="Emoji: "+z.alt+"\nName: :"+T.short_name+":")}else if(z.getAttribute("data-ffz-emote")){var T=JSON.parse(decodeURIComponent(z.getAttribute("data-ffz-emote"))),k=T&&T[0]||null,x=T&&T[1]||null,L=e.emote_sets[x],S=L?L.emoticons[k]:null;S&&S.srcSet&&z.setAttribute("srcset",S.srcSet),L&&e.feature_friday&&L.id==e.feature_friday.set&&(set_name=e.feature_friday.title+" - "+e.feature_friday.display_name),z.title=e._emote_tooltip(S)}}jQuery(w).tipsy();var M=performance.now()-t;M>5&&e.log("Line Took Too Long - "+M+"ms",i.innerHTML,!1,!0)}catch(A){try{e.error("LineView didInsertElement: "+A)}catch(A){}}}})},s.capitalization={},s._cap_fetching=0,s.get_capitalization=function(t,e){if(!t)return t;if(t=t.toLowerCase(),"jtv"==t||"twitchnotify"==t)return t;var o=s.capitalization[t];return o&&Date.now()-o[1]<36e5?o[0]:(s._cap_fetching<25&&(s._cap_fetching++,s.get().ws_send("get_display_name",t,function(o,n){var i=o?n:t;s.capitalization[t]=[i,Date.now()],s._cap_fetching--,"function"==typeof e&&e(i)})),o?o[0]:t)},s.prototype._remove_banned=function(t){var e=this.settings.banned_words;if(!e||!e.length)return t;"string"==typeof t&&(t=[t]);for(var n=s._words_to_regex(e),i=[],a=0;a<t.length;a++){var r=t[a];i.push(_.isString(r)?r.replace(n,"$1***"):r.emoticonSrc&&n.test(r.altText)?r.altText.replace(n,"$1***"):r.isLink&&n.test(r.href)?{mentionedUser:'</span><a class="deleted-link" title="'+o.quote_attr(r.href.replace(n,"$1***"))+'" data-url="'+o.quote_attr(r.href)+'" href="#"><banned link></a><span class="mentioning">',own:!0}:r)}return i},s.prototype._emoticonize=function(t,e){var s=t.get("msgObject.room"),o=t.get("msgObject.from");return this.tokenize_emotes(o,s,e)}},{"../constants":4,"../utils":33}],10:[function(e){var s,o=t.FrankerFaceZ,n=e("../utils"),i=e("../constants"),a={ESC:27,P:80,B:66,T:84,U:85},r='<svg class="svg-messages" height="16px" version="1.1" viewBox="0 0 18 18" width="16px" x="0px" y="0px"><path clip-rule="evenodd" d="M1,15V3h16v12H1z M15.354,5.354l-0.707-0.707L9,10.293L3.354,4.646L2.646,5.354L6.293,9l-3.646,3.646l0.707,0.707L7,9.707l1.646,1.646h0.707L11,9.707l3.646,3.646l0.707-0.707L11.707,9L15.354,5.354z" fill-rule="evenodd"></path></svg>',d='<svg class="svg-unban" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px"><path fill-rule="evenodd" clip-rule="evenodd" fill="#888888" d="M6.5,12.75L2,8.25l2-2l2.5,2.5l5.5-5.5l2,2L6.5,12.75z"/></svg>',u={},c=function(t){if(1===t)return"Purge";if(u[t])return u[t];var e,s,o,n,i;e=Math.floor(t/604800),i=t%604800,s=Math.floor(i/86400),i%=86400,o=Math.floor(i/3600),i%=3600,n=Math.floor(i/60),i%=60;var a=u[t]=(e?e+"w":"")+(s||e&&(o||n||i)?s+"d":"")+(o||(e||s)&&(n||i)?o+"h":"")+(n||(e||s||o)&&i?n+"m":"")+(i?i+"s":"");return a};try{s=t.require&&t.require("ember-twitch-chat/helpers/chat-line-helpers")}catch(l){}o.settings_info.chat_hover_pause={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Pause Chat Scrolling on Mouse Hover",help:"Automatically prevent the chat from scrolling when moving the mouse over it to prevent moderation mistakes and link mis-clicks.",on_update:function(t){this._roomv&&(t?this._roomv.ffzEnableFreeze():this._roomv.ffzDisableFreeze())}},o.settings_info.short_commands={type:"boolean",value:!0,no_bttv:!0,category:"Chat Moderation",name:"Short Moderation Commands",help:"Use /t, /b, and /u in chat in place of /timeout, /ban, /unban for quicker moderation, and use /p for 1 second timeouts."},o.settings_info.mod_card_hotkeys={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Moderation Card Hotkeys",help:"With a moderation card selected, press B to ban the user, T to time them out for 10 minutes, P to time them out for 1 second, or U to unban them. ESC closes the card."},o.settings_info.mod_card_info={type:"boolean",value:!0,no_bttv:!0,category:"Chat Moderation",name:"Moderation Card Additional Information",help:"Display a channel's follower count, view count, and account age on moderation cards."},o.settings_info.mod_card_history={type:"boolean",value:!1,no_bttv:!0,category:"Chat Moderation",name:"Moderation Card History",help:"Display a few of the user's previously sent messages on moderation cards.",on_update:function(t){if(!t&&this.rooms)for(var e in this.rooms){var s=this.rooms[e];s&&(s.user_history=void 0)}}},o.settings_info.mod_card_buttons={type:"button",value:[],category:"Chat Moderation",no_bttv:!0,name:"Moderation Card Additional Buttons",help:"Add additional buttons to moderation cards for running chat commands on those users.",method:function(){for(var t="",e=0;e<this.settings.mod_card_buttons.length;e++){var s=this.settings.mod_card_buttons[e];t+=-1!==s.indexOf(" ")?' "'+s+'"':" "+s}var o=prompt('Moderation Card Additional Buttons\n\nPlease enter a list of additional commands to display buttons for on moderation cards. Commands are separated by spaces. To include spaces in a command, surround the command with double quotes ("). Use "{user}" to insert the user\'s username into the command, otherwise it will be appended to the end.\n\nExample: !permit "!reg add {user}"',t);if(null!==o&&void 0!==o){var n=[];for(o=o.trim();o;)if('"'===o.charAt(0)){var i=o.indexOf('"',1);-1===i&&(i=o.length);var a=o.substr(1,i-1);a&&n.push(a),o=o.substr(i+1)}else{var r=o.indexOf(" ");if(-1===r)o&&n.push(o),o="";else{var a=o.substr(0,r);a&&n.push(a),o=o.substr(r+1)}}this.settings.set("mod_card_buttons",n)}}},o.settings_info.mod_card_durations={type:"button",value:[300,600,3600,43200,86400,604800],category:"Chat Moderation",no_bttv:!0,name:"Moderation Card Timeout Buttons",help:"Add additional timeout buttons to moderation cards with specific durations.",method:function(){var t=this.settings.mod_card_durations.join(", "),e=prompt('Moderation Card Timeout Buttons\n\nPlease enter a comma-separated list of durations that you would like to have timeout buttons for. Durations must be expressed in seconds.\n\nEnter "reset" without quotes to return to the default value.',t);if(null!==e&&void 0!==e){"reset"===e&&(e=o.settings_info.mod_card_durations.value.join(", ")),e=e.trim().split(/[ ,]+/);for(var s=[],n=0;n<e.length;n++){var i=parseInt(e[n]);0===i&&(i=1),0/0!==i&&i>0&&s.push(i)}this.settings.set("mod_card_durations",s)}}},o.prototype.setup_mod_card=function(){this.log("Modifying Mousetrap stopCallback so we can catch ESC.");var e=Mousetrap.stopCallback;Mousetrap.stopCallback=function(t,s,o){return s.classList.contains("no-mousetrap")?!0:e(t,s,o)},Mousetrap.bind("up up down down left right left right b a enter",function(){var t=document.querySelector(".app-main")||document.querySelector(".ember-chat-container");t&&t.classList.toggle("ffz-flip")}),this.log("Hooking the Ember Moderation Card view.");var o=App.__container__.resolve("component:moderation-card"),u=this;o.reopen({ffzForceRedraw:function(){this.rerender()}.observes("cardInfo.isModeratorOrHigher","cardInfo.user"),ffzRebuildInfo:function(){var t=this.get("element"),e=t&&t.querySelector(".info");if(e){var s='<span class="stat tooltip" title="Total Views">'+i.EYE+" "+n.number_commas(this.get("cardInfo.user.views")||0)+"</span>",o=n.parse_date(this.get("cardInfo.user.created_at")||""),a=this.get("cardInfo.user.ffz_followers");if("number"==typeof a)s+='<span class="stat tooltip" title="Followers">'+i.HEART+" "+n.number_commas(a||0)+"</span>";else if(void 0===a){var r=this;this.set("cardInfo.user.ffz_followers",!1),Twitch.api.get("channels/"+this.get("cardInfo.user.id")+"/follows",{limit:1}).done(function(t){r.set("cardInfo.user.ffz_followers",t._total),r.ffzRebuildInfo()}).fail(function(){r.set("cardInfo.user.ffz_followers",void 0)})}if(o){var d=Math.floor((Date.now()-o.getTime())/1e3);d>0&&(s+='<span class="stat tooltip" title="Member Since: '+(d>86400?o.toLocaleDateString():o.toLocaleString())+'">'+i.CLOCK+" "+n.human_time(d,10)+"</span>")}e.innerHTML=s}}.observes("cardInfo.user.views"),didInsertElement:function(){this._super(),t._card=this;try{if(u.has_bttv)return;var e,o=this.get("element"),i=this.get("controller");if(o.classList.add("ffz-moderation-card"),u.settings.mod_card_info){var l=document.createElement("div"),h=o.querySelector("h3.name");h&&(o.classList.add("ffz-has-info"),l.className="info channel-stats",h.parentElement.insertBefore(l,h.nextSibling),this.ffzRebuildInfo())}if(u.settings.mod_card_buttons&&u.settings.mod_card_buttons.length){e=document.createElement("div"),e.className="extra-interface interface clearfix";for(var f={},m=function(t){var e=i.get("cardInfo.user.id"),s=App.__container__.lookup("controller:chat"),o=s&&s.get("currentRoom");o&&o.send(t.replace(/{user}/g,e))},p=function(t){var e=document.createElement("button"),s=t.split(" ",1)[0],o=f[s]>1?t.split(" ",f[s]):[s];return/^[!~./]/.test(o[0])&&(o[0]=o[0].substr(1)),o=_.map(o,function(t){return t.capitalize()}).join(" "),e.className="button",e.innerHTML=n.sanitize(o),e.title=n.sanitize(t.replace(/{user}/g,i.get("cardInfo.user.id")||"{user}")),jQuery(e).tipsy(),e.addEventListener("click",m.bind(this,t)),e},f={},g=0;g<u.settings.mod_card_buttons.length;g++)f[u.settings.mod_card_buttons[g].split(" ",1)[0]]=(f[u.settings.mod_card_buttons[g].split(" ",1)[0]]||0)+1;for(var g=0;g<u.settings.mod_card_buttons.length;g++){var v=u.settings.mod_card_buttons[g],b=v.indexOf("{user}");-1===b&&(v+=" {user}"),e.appendChild(p(v))}o.appendChild(e)}if(o.setAttribute("tabindex",1),u.settings.mod_card_hotkeys&&(o.classList.add("no-mousetrap"),o.addEventListener("keyup",function(t){var e=t.keyCode||t.which,s=i.get("cardInfo.user.id"),o=i.get("cardInfo.isModeratorOrHigher"),n=App.__container__.lookup("controller:chat").get("currentRoom");if(o&&e==a.P)n.send("/timeout "+s+" 1");else if(o&&e==a.B)n.send("/ban "+s);else if(o&&e==a.T)n.send("/timeout "+s+" 600");else if(o&&e==a.U)n.send("/unban "+s);else if(e!=a.ESC)return;i.send("close")})),i.get("cardInfo.isModeratorOrHigher")){o.classList.add("ffz-is-mod"),u.settings.mod_card_hotkeys&&(o.classList.add("no-mousetrap"),o.addEventListener("keyup",function(t){var e=t.keyCode||t.which,s=i.get("cardInfo.user.id"),o=App.__container__.lookup("controller:chat").get("currentRoom");if(e==a.P)o.send("/timeout "+s+" 1");else if(e==a.B)o.send("/ban "+s);else if(e==a.T)o.send("/timeout "+s+" 600");else if(e==a.U)o.send("/unban "+s);else if(e!=a.ESC)return;i.send("close")}));var y=function(t){var e=i.get("cardInfo.user.id"),s=App.__container__.lookup("controller:chat").get("currentRoom");s.send(-1===t?"/unban "+e:"/timeout "+e+" "+t)},w=function(t){var e=document.createElement("button");return e.className="button",e.innerHTML=c(t),e.title="Timeout User for "+n.number_commas(t)+" Second"+(1!=t?"s":""),u.settings.mod_card_hotkeys&&600===t?e.title="(T)"+e.title.substr(1):u.settings.mod_card_hotkeys&&1===t&&(e.title="(P)urge - "+e.title),jQuery(e).tipsy(),e.addEventListener("click",y.bind(this,t)),e};if(u.settings.mod_card_durations&&u.settings.mod_card_durations.length){e=document.createElement("div"),e.className="extra-interface interface clearfix",e.appendChild(w(1));var z=document.createElement("span");z.className="right",e.appendChild(z);for(var g=0;g<u.settings.mod_card_durations.length;g++)z.appendChild(w(u.settings.mod_card_durations[g]));o.appendChild(e),this.$("button.timeout").remove()}var k=o.querySelector("button.ban");u.settings.mod_card_hotkeys&&k.setAttribute("title","(B)an User");var C=document.createElement("button");C.className="unban button glyph-only light",C.innerHTML=d,C.title=(u.settings.mod_card_hotkeys?"(U)":"U")+"nban User",jQuery(C).tipsy(),C.addEventListener("click",y.bind(this,-1)),jQuery(k).after(C)}var E=o.querySelector("button.mod");if(E){var T=i.get("cardInfo.isChannelOwner"),x=ffz.get_user();can_op=T||x&&x.is_admin||x&&x.is_staff,can_op||E.parentElement.removeChild(E)}var L=o.querySelector(".interface > button.message-button");if(L){L.innerHTML="W",L.classList.add("glyph-only"),L.classList.add("message"),L.title="Whisper User",jQuery(L).tipsy();var S=document.createElement("button");S.className="message-button button glyph-only message",S.innerHTML=r,S.title="Message User",jQuery(S).tipsy(),S.addEventListener("click",function(){t.open("http://www.twitch.tv/message/compose?to="+i.get("cardInfo.user.id"))}),L.parentElement.insertBefore(S,L.nextSibling)}if(u.settings.mod_card_history){var M=App.__container__.lookup("controller:chat"),A=M&&M.get("currentRoom"),F=A&&u.rooms&&u.rooms[A.get("id")],R=F&&F.user_history&&F.user_history[i.get("cardInfo.user.id")];if(R&&R.length){var I=document.createElement("ul"),H=!1;I.className="interface clearfix chat-history";for(var g=0;g<R.length;g++){var e=R[g],O=document.createElement("li");O.className="message-line chat-line",O.classList.toggle("ffz-alternate",H),H=!H,e.style&&O.classList.add(e.style),O.innerHTML=(s?'<span class="timestamp float-left">'+s.getTime(e.date)+"</span> ":"")+'<span class="message">'+("action"===e.style?"*"+e.from+" ":"")+u.render_tokens(e.cachedTokens)+"</span>";for(var B=O.querySelectorAll("a.deleted-link"),D=0;D<B.length;D++)B[D].addEventListener("click",u._deleted_link_click);jQuery("a",O).tipsy({html:!0}),I.appendChild(O)}o.appendChild(I),I.scrollTop=I.scrollHeight}}var j=o.getBoundingClientRect(),N=document.body.getBoundingClientRect();if(j.bottom>N.bottom){var P=j.bottom-N.bottom;j.top-P>N.top&&(o.style.top=j.top-P+"px")}this.$().draggable({start:function(){o.focus()}}),o.focus()}catch(U){try{u.error("ModerationCardView didInsertElement: "+U)}catch(U){}}}})},o.chat_commands.purge=function(t,e){if(!e||!e.length)return"Purge Usage: /p username [more usernames separated by spaces]";if(e.length>10)return"Please only purge up to 10 users at once.";for(var s=0;s<e.length;s++){var o=e[s];o&&t.room.send("/timeout "+o+" 1")
|
||
}},o.chat_commands.p=function(t,e){return o.chat_commands.purge.bind(this)(t,e)},o.chat_commands.p.enabled=function(){return this.settings.short_commands},o.chat_commands.t=function(t,e){return e&&e.length?void t.room.send("/timeout "+e.join(" ")):"Timeout Usage: /t username [duration]"},o.chat_commands.t.enabled=function(){return this.settings.short_commands},o.chat_commands.b=function(t,e){if(!e||!e.length)return"Ban Usage: /b username [more usernames separated by spaces]";if(e.length>10)return"Please only ban up to 10 users at once.";for(var s=0;s<e.length;s++){var o=e[s];o&&t.room.send("/ban "+o)}},o.chat_commands.b.enabled=function(){return this.settings.short_commands},o.chat_commands.u=function(t,e){if(!e||!e.length)return"Unban Usage: /u username [more usernames separated by spaces]";if(e.length>10)return"Please only unban up to 10 users at once.";for(var s=0;s<e.length;s++){var o=e[s];o&&t.room.send("/unban "+o)}},o.chat_commands.u.enabled=function(){return this.settings.short_commands}},{"../constants":4,"../utils":33}],11:[function(e){var s=t.FrankerFaceZ,o=e("../constants"),n=e("../utils"),i=-1!==navigator.userAgent.indexOf("Android"),a=function(t){return t.moderator_badge?'.chat-line[data-room="'+t.id+'"] .badges .moderator:not(.ffz-badge-replacement) { background-image:url("'+t.moderator_badge+'") !important; }':""};s.prototype.setup_room=function(){this.rooms={},this.log("Creating room style element.");var t=this._room_style=document.createElement("style");t.id="ffz-room-css",document.head.appendChild(t),this.log("Hooking the Ember Room controller.");var e=App.__container__.lookup("controller:room");if(e){var s=e._actions.banUser,o=e._actions.timeoutUser;e._actions.banUser=function(t){s.bind(this)(t),this.get("model").clearMessages(t.user)},e._actions.timeoutUser=function(t){o.bind(this)(t),this.get("model").clearMessages(t.user)},e._actions.purgeUser=function(t){this.get("model.tmiRoom").sendMessage("/timeout "+t.user+" 1"),this.get("model").clearMessages(t.user)}}this.log("Hooking the Ember Room model.");var n=App.__container__.resolve("model:room");this._modify_room(n);var i=n.instances;for(var a in i)if(i.hasOwnProperty(a)){var r=i[a];this.add_room(r.id,r),this._modify_room(r),r.ffzPatchTMI()}this.log("Hooking the Ember Room view.");var d=App.__container__.resolve("view:room");this._modify_rview(d);try{d.create().destroy()}catch(u){}for(var a in Ember.View.views)if(Ember.View.views.hasOwnProperty(a)){var c=Ember.View.views[a];if(c instanceof d){this.log("Manually updating existing Room view.",c);try{c.ffzInit()}catch(u){this.error("RoomView setup ffzInit: "+u)}}}},s.prototype._modify_rview=function(t){var e=this;t.reopen({didInsertElement:function(){this._super();try{this.ffzInit()}catch(t){e.error("RoomView didInsertElement: "+t)}},willClearRender:function(){try{this.ffzTeardown()}catch(t){e.error("RoomView willClearRender: "+t)}this._super()},ffzInit:function(){e._roomv=this,this.ffz_frozen=!1,this._ffz_mouse_down=this.ffzMouseDown.bind(this),i&&this._$chatMessagesScroller.bind("scroll",this._ffz_mouse_down),this._$chatMessagesScroller.unbind("mousedown"),this._$chatMessagesScroller.bind("mousedown",this._ffz_mouse_down),e.settings.chat_hover_pause&&this.ffzEnableFreeze(),e.settings.room_status&&this.ffzUpdateStatus();var t=this.get("controller");t&&(t.reopen({submitButtonText:function(){if(this.get("model.isWhisperMessage")&&this.get("model.isWhispersEnabled"))return i18n("Whisper");var t=this.get("model.slowWait"),s=this.get("model.messageToSend")||"";return"/"===s.charAt(0)&&"/me "!==s.substr(0,4)||!t||!e.settings.room_status?i18n("Chat"):n.time_to_string(t,!1,!1,!0)}.property("model.isWhisperMessage","model.isWhispersEnabled","model.slowWait")}),Ember.propertyDidChange(t,"submitButtonText"))},ffzTeardown:function(){e._roomv===this&&(e._roomv=void 0),this.ffzDisableFreeze()},ffzUpdateStatus:function(){var t=this.get("controller.model"),s=this.get("element"),o=s&&s.querySelector(".chat-buttons-container");if(o){var i=o.querySelector("#ffz-stat-r9k"),a=o.querySelector("#ffz-stat-sub"),r=o.querySelector("#ffz-stat-slow"),d=o.querySelector("#ffz-stat-banned"),u=o.querySelector("button");if(e.has_bttv||!e.settings.room_status)return i&&i.parentElement.removeChild(i),a&&a.parentElement.removeChild(a),r&&r.parentElement.removeChild(r),void(u&&u.classList.remove("ffz-waiting"));i||(i=document.createElement("span"),i.className="ffz room-state stat float-right",i.id="ffz-stat-r9k",i.innerHTML="R9K",i.title="This room is in R9K-mode.",o.appendChild(i),jQuery(i).tipsy({gravity:"s",offset:15})),a||(a=document.createElement("span"),a.className="ffz room-state stat float-right",a.id="ffz-stat-sub",a.innerHTML="SUB",a.title="This room is in subscribers-only mode.",o.appendChild(a),jQuery(a).tipsy({gravity:"s",offset:15})),r||(r=document.createElement("span"),r.className="ffz room-state stat float-right",r.id="ffz-stat-slow",r.innerHTML="SLOW",r.title="This room is in slow mode. You may send messages every 120 seconds.",o.appendChild(r),jQuery(r).tipsy({gravity:"s",offset:15})),d||(d=document.createElement("span"),d.className="ffz room-state stat float-right",d.id="ffz-stat-banned",d.innerHTML="BAN",d.title="You have been banned from talking in this room.",o.appendChild(d),jQuery(d).tipsy({gravity:"s",offset:15})),i.classList.toggle("hidden",!(t&&t.get("r9kMode"))),a.classList.toggle("hidden",!(t&&t.get("subsOnlyMode"))),r.classList.toggle("hidden",!(t&&t.get("slowMode"))),r.title="This room is in slow mode. You may send messages every "+n.number_commas(t&&t.get("slowValue")||120)+" seconds.",d.classList.toggle("hidden",!(t&&t.get("ffz_banned"))),u&&(u.classList.toggle("ffz-waiting",t&&t.get("slowWait")||0),u.classList.toggle("ffz-banned",t&&t.get("ffz_banned")))}}.observes("controller.model"),ffzEnableFreeze:function(){var t=this.get("element"),e=t.querySelector(".chat-messages");e&&(this._ffz_interval=setInterval(this.ffzPulse.bind(this),200),this._ffz_messages=e,this._ffz_mouse_move=this.ffzMouseMove.bind(this),this._ffz_mouse_out=this.ffzMouseOut.bind(this),e.addEventListener("mousemove",this._ffz_mouse_move),e.addEventListener("touchmove",this._ffz_mouse_move),e.addEventListener("mouseout",this._ffz_mouse_out),document.addEventListener("mouseout",this._ffz_mouse_out))},ffzDisableFreeze:function(){this._ffz_interval&&(clearInterval(this._ffz_interval),this._ffz_interval=void 0),this.ffzUnfreeze();var t=this._ffz_messages;t&&(this._ffz_messages=void 0,this._ffz_mouse_move&&(t.removeEventListener("mousemove",this._ffz_mouse_move),this._ffz_mouse_move=void 0),this._ffz_mouse_out&&(t.removeEventListener("mouseout",this._ffz_mouse_out),this._ffz_mouse_out=void 0))},ffzPulse:function(){if(this.ffz_frozen){var t=Date.now()-this._ffz_last_move;t>750&&this.ffzUnfreeze()}},ffzUnfreeze:function(){this.ffz_frozen=!1,this._ffz_last_move=0,this.ffzUnwarnPaused(),this.get("stuckToBottom")&&this._scrollToBottom()},ffzMouseDown:function(t){var e=this._$chatMessagesScroller;if(e&&e[0]&&(t.which>0||!this.ffz_frozne&&"mousedown"===t.type||"mousewheel"===t.type||i&&"scroll"===t.type)){var s=e[0].scrollHeight-e[0].scrollTop-e[0].offsetHeight;this._setStuckToBottom(10>=s)}},ffzMouseOut:function(){this._ffz_outside=!0;var t=this;setTimeout(function(){t._ffz_outside&&t.ffzUnfreeze()},25)},ffzMouseMove:function(t){this._ffz_last_move=Date.now(),this._ffz_outside=!1,(t.screenX!==this._ffz_last_screenx||t.screenY!==this._ffz_last_screeny)&&(this._ffz_last_screenx=t.screenX,this._ffz_last_screeny=t.screenY,this.ffz_frozen||(this.ffz_frozen=!0,this.get("stuckToBottom")&&(this.set("controller.model.messageBufferSize",e.settings.scrollback_length+150),this.ffzWarnPaused())))},_scrollToBottom:_.throttle(function(){var t=this,e=this._$chatMessagesScroller;Ember.run.next(function(){setTimeout(function(){!t.ffz_frozen&&e&&e.length&&(e.scrollTop(e[0].scrollHeight),t._setStuckToBottom(!0))})})},200),_setStuckToBottom:function(t){this.set("stuckToBottom",t),this.get("controller.model")&&this.set("controller.model.messageBufferSize",e.settings.scrollback_length+(t?0:150)),t||this.ffzUnfreeze()},ffzWarnPaused:function(){var t=this.get("element"),e=t&&t.querySelector(".chat-interface .more-messages-indicator.ffz-freeze-indicator");if(t){if(!e){e=document.createElement("div"),e.className="more-messages-indicator ffz-freeze-indicator",e.innerHTML="(Chat Paused Due to Mouse Movement)";var s=t.querySelector(".chat-interface");if(!s)return;s.insertBefore(e,s.childNodes[0])}e.classList.remove("hidden")}},ffzUnwarnPaused:function(){var t=this.get("element"),e=t&&t.querySelector(".chat-interface .more-messages-indicator.ffz-freeze-indicator");e&&e.classList.add("hidden")}})},s.chat_commands={},s.ffz_commands={},s.prototype.room_message=function(t,e){var s=e.split("\n");if(this.has_bttv)for(var o=0;o<s.length;o++)BetterTTV.chat.handlers.onPrivmsg(t.id,{style:"admin",date:new Date,from:"jtv",message:s[o]});else for(var o=0;o<s.length;o++)t.room.addMessage({style:"ffz admin",date:new Date,from:"FFZ",message:s[o]})},s.prototype.run_command=function(t,e){var o=this.rooms[e];if(!o||!o.room)return!1;if(t){var n,i=t.split(" "),a=i.shift().substr(1).toLowerCase(),r=s.chat_commands[a];if(!r)return!1;if(r.hasOwnProperty("enabled")){var d=r.enabled;if("function"==typeof d)try{d=r.enabled.bind(this)(o,i)}catch(u){this.error('command "'+a+'" enabled: '+u),d=!1}if(!d)return!1}this.log("Received Command: "+a,i,!0);try{n=r.bind(this)(o,i)}catch(u){this.error('command "'+a+'" runner: '+u),n="There was an error running the command."}return n&&this.room_message(o,n),!0}},s.prototype.run_ffz_command=function(t,e){var o=this.rooms[e];if(o&&o.room){if(!t){var n=document.querySelector("a.ffz-ui-toggle");if(n)return n.click();t="help"}var i=t.split(" "),a=i.shift().toLowerCase();this.log("Received Command: "+a,i,!0);var r,d=s.ffz_commands[a];if(d)try{r=d.bind(this)(o,i)}catch(u){this.log("Error Running Command - "+a+": "+u,o),r="There was an error running the command."}else r='There is no "'+a+'" command.';r&&this.room_message(o,r)}},s.ffz_commands.help=function(t,e){if(e&&e.length){var o=s.ffz_commands[e[0].toLowerCase()];return o?o.help?o.help:'No help is available for the command "'+e[0]+'".':'There is no "'+e[0]+'" command.'}var n=[];for(var i in s.ffz_commands)s.ffz_commands.hasOwnProperty(i)&&n.push(i);return"The available commands are: "+n.join(", ")},s.ffz_commands.help.help="Usage: /ffz help [command]\nList available commands, or show help for a specific command.",s.prototype.add_room=function(t,e){if(this.rooms[t])return this.log("Tried to add existing room: "+t);this.log("Adding Room: "+t);var s=this.rooms[t]={id:t,room:e,menu_sets:[],sets:[],css:null,needs_history:!1};if(this.follow_sets&&this.follow_sets[t]){s.extra_sets=this.follow_sets[t],delete this.follow_sets[t];for(var o=0;o<s.extra_sets.length;o++){var n=s.extra_sets[o],i=this.emote_sets&&this.emote_sets[n];i?-1===i.users.indexOf(t)&&i.users.push(t):this.load_set(n,function(e,s){e&&s.users.push(t)})}}this.ws_send("sub",t),!this.has_bttv&&this.settings.chat_history&&e&&(e.get("messages.length")||0)<10&&(this.ws_send("chat_history",[t,25],this._load_history.bind(this,t))||(s.needs_history=!0)),e.set("messageBufferSize",this.settings.scrollback_length+(this._roomv&&!this._roomv.get("stuckToBottom")&&this._roomv.get("controller.model.id")===t?150:0)),this.load_room(t)},s.prototype.remove_room=function(t){var e=this.rooms[t];if(e&&(this.log("Removing Room: "+t),(e.css||e.moderator_badge)&&n.update_css(this._room_style,t,null),this.ws_send("unsub",t),delete this.rooms[t],"_"!==t.charAt(0))){var s=this.emote_sets[e.set];s&&(s.users.removeObject(t),this.global_sets.contains(e.set)||s.users.length||this.unload_set(e.set))}},s.prototype._load_history=function(t,e,s){var o=this.rooms[t];if(o&&o.room){if(!e)return this.log("Error retrieving chat history for: "+t);if(this.log("Received "+s.length+" old messages for: "+t),s.length)return this._insert_history(t,s)}},s.prototype._show_deleted=function(t){var e=this.rooms[t];if(e&&e.room){var s=e.room.get("messages.0.ffz_old_messages");s&&s.length&&(e.room.set("messages.0.ffz_old_messages",void 0),this._insert_history(t,s))}},s.prototype._insert_history=function(t,e){var s=this.rooms[t];if(s&&s.room){var o=s.room,i=o.get("messages"),a=o.tmiSession||TMI._sessions&&TMI._sessions[0],r=(o.tmiRoom,0),d=e[e.length-1],u=new Date,c="string"==typeof d.date?n.parse_date(d.date):d.date,l=(u-c)/1e3,h=l>300,f=e.length,_=o.get("messages.0.ffz_alternate")||!1;h&&(_=!_);for(var f=e.length;f--;){var m=e[f];if("string"==typeof m.date&&(m.date=n.parse_date(m.date)),m.ffz_alternate=_=!_,m.room||(m.room=t),m.color||(m.color=m.tags&&m.tags.color?m.tags.color:a&&m.from?a.getColor(m.from.toLowerCase()):"#755000"),!m.labels||!m.labels.length){var p=m.labels=[];if(m.tags)if(m.tags.turbo&&p.push("turbo"),m.tags.subscriber&&p.push("subscriber"),m.from===t)p.push("owner");else{var g=m.tags["user-type"];("mod"===g||"staff"===g||"admin"===g||"global_mod"===g)&&p.push(g)}}if(m.style||("jtv"===m.from?m.style="admin":"twitchnotify"===m.from&&(m.style="notification")),m.cachedTokens&&m.cachedTokens.length||this.tokenize_chat_line(m,!0),o.shouldShowMessage(m)){if(!(i.length<o.get("messageBufferSize")))break;if(m.ffz_old_messages){var v=o.get("messageBufferSize")-(i.length+1);m.ffz_old_messages.length>v&&(m.ffz_old_messages=m.ffz_old_messages.slice(m.ffz_old_messages.length-v))}i.unshiftObject(m),r+=1}}if(h){var m={ffz_alternate:!_,color:"#755000",date:new Date,from:"frankerfacez_admin",style:"admin",message:"(Last message is "+n.human_time(l)+" old.)",room:t};if(this.tokenize_chat_line(m),o.shouldShowMessage(m))for(i.insertAt(r,m);i.length>o.get("messageBufferSize");)i.removeAt(0)}}},s.prototype.load_room=function(t,e,s){var n=this;jQuery.getJSON(((s||0)%2===0?o.API_SERVER:o.API_SERVER_2)+"v1/room/"+t).done(function(s){if(s.sets)for(var o in s.sets)s.sets.hasOwnProperty(o)&&n._load_set_json(o,void 0,s.sets[o]);n._load_room_json(t,e,s)}).fail(function(o){return 404==o.status?"function"==typeof e&&e(!1):(s=(s||0)+1,10>s?n.load_room(t,e,s):"function"==typeof e&&e(!1))})},s.prototype._load_room_json=function(t,e,s){if(!s||!s.room)return"function"==typeof e&&e(!1);s=s.room,this.rooms[t]&&(s.room=this.rooms[t].room);for(var o in this.rooms[t])"room"!==o&&this.rooms[t].hasOwnProperty(o)&&!s.hasOwnProperty(o)&&(s[o]=this.rooms[t][o]);s.needs_history=this.rooms[t]&&this.rooms[t].needs_history||!1,this.rooms[t]=s,(s.css||s.moderator_badge)&&n.update_css(this._room_style,t,a(s)+(s.css||"")),this.emote_sets.hasOwnProperty(s.set)?-1===this.emote_sets[s.set].users.indexOf(t)&&this.emote_sets[s.set].users.push(t):this.load_set(s.set,function(e,s){-1===s.users.indexOf(t)&&s.users.push(t)}),this.update_ui_link(),e&&e(!0,s)},s.prototype._modify_room=function(e){var s=this;e.reopen({subsOnlyMode:!1,r9kMode:!1,slowWaiting:!1,slowValue:0,mru_list:[],updateWait:function(t,e){var o=this.get("slowWait")||0;this.set("slowWait",t),1>o&&t>0?(this._ffz_wait_timer&&clearTimeout(this._ffz_wait_timer),this._ffz_wait_timer=setTimeout(this.ffzUpdateWait.bind(this),1e3),s._roomv&&s._roomv.ffzUpdateStatus()):(o>0&&1>t||e)&&(this.set("ffz_banned",!1),s._roomv&&s._roomv.ffzUpdateStatus())},ffzUpdateWait:function(){this._ffz_wait_timer=void 0;var t=this.get("slowWait")||0;1>t||(this.set("slowWait",--t),t>0?this._ffz_wait_timer=setTimeout(this.ffzUpdateWait.bind(this),1e3):(this.set("ffz_banned",!1),s._roomv&&s._roomv.ffzUpdateStatus()))},ffzUpdateStatus:function(){s._roomv&&s._roomv.ffzUpdateStatus()}.observes("r9kMode","subsOnlyMode","slowMode","slowValue","ffz_banned"),init:function(){this._super();try{s.add_room(this.id,this),this.set("ffz_chatters",{})}catch(t){s.error("add_room: "+t)}},willDestroy:function(){this._super();try{s.remove_room(this.id)}catch(t){s.error("remove_room: "+t)}},clearMessages:function(t){var e=this;if(t){if(this.get("messages").forEach(function(o,n){o.from===t&&(e.set("messages."+n+".ffz_deleted",!0),s.settings.prevent_clear||e.set("messages."+n+".deleted",!0))}),s.settings.mod_card_history){var o=s.rooms&&s.rooms[e.get("id")],n=o&&o.user_history&&o.user_history[t];if(null!==n&&void 0!==n){var i=!1,a=n.length>0?n[n.length-1]:null;if(i=null!==a&&a.is_delete,!i)for(n.push({from:"jtv",is_delete:!0,style:"admin",cachedTokens:["User has been timed out."],date:new Date});n.length>20;)n.shift()}}}else if(s.settings.prevent_clear)this.addTmiMessage("A moderator's attempt to clear chat was ignored.");else{var r=e.get("messages");e.set("messages",[]),e.addMessage({style:"admin",message:i18n("Chat was cleared by a moderator"),ffz_old_messages:r})}},pushMessage:function(t){if(this.shouldShowMessage(t)){var e,s,o,n=this.get("messageBufferSize");for(this.get("messages").pushObject(t),e=this.get("messages.length"),s=e-n,o=0;s>o;o++)this.get("messages").removeAt(0);"admin"===t.style||"whisper"===t.style&&!this.ffz_whisper_room||this.incrementProperty("unreadCount",1)}},addMessage:function(t){try{if(t){var e="whisper"===t.style;if(s.settings.group_tabs&&s.settings.whisper_room&&(e&&!this.ffz_whisper_room||!e&&this.ffz_whisper_room))return;if(e||(t.room=this.get("id")),s.tokenize_chat_line(t),!e&&t.from&&"jtv"!==t.from&&"twitchnotify"!==t.from&&s.settings.mod_card_history){var o=s.rooms&&s.rooms[t.room];if(o){var n=(o.user_history=o.user_history||{},o.user_history[t.from]=o.user_history[t.from]||[]);for(n.push({from:t.tags&&t.tags["display-name"]||t.from,cachedTokens:t.cachedTokens,style:t.style,date:t.date});n.length>20;)n.shift()}}if(!e){var i=s.get_user();if(i&&i.login===t.from){var a=this.get("ffz_banned");this.set("ffz_banned",!1),this.get("isModeratorOrHigher")||!this.get("slowMode")?this.updateWait(0,a):this.get("slowMode")&&this.updateWait(this.get("slowValue"))}}}}catch(r){s.error("Room addMessage: "+r)}var d=this._super(t);try{var u=t.color;u&&s._handle_color(u)}catch(r){s.error("Room addMessage2: "+r)}return d},setHostMode:function(t){this.set("ffz_host_target",t&&t.hostTarget||null);var e=s.get_user();e&&s._cindex&&this.get("id")===e.login&&s._cindex.ffzUpdateHostButton();var o=App.__container__.lookup("controller:chat");if(o&&o.get("currentChannelRoom")===this)return this._super(t)},send:function(t){if(!(s.settings.group_tabs&&s.settings.whisper_room&&this.ffz_whisper_room)){try{if(t){var e=this.get("mru_list"),o=e.indexOf(t);-1!==o?e.splice(o,1):e.length>20&&e.pop(),e.unshift(t)}var n=t.split(" ",1)[0].toLowerCase();if("/ffz"===n)return this.set("messageToSend",""),void s.run_ffz_command(t.substr(5),this.get("id"));if("/"===n.charAt(0)&&s.run_command(t,this.get("id")))return void this.set("messageToSend","")}catch(i){s.error("send: "+i)}return this._super(t)}},ffzUpdateUnread:function(){if(s.settings.group_tabs){var t=App.__container__.lookup("controller:chat");t&&t.get("currentRoom")===this?this.resetUnreadCount():s._chatv&&s._chatv.ffzTabUnread(this.get("id"))}}.observes("unreadCount"),ffzInitChatterCount:function(){if(this.tmiRoom){var t=this;this.tmiRoom.list().done(function(e){var s={};e=e.data.chatters;for(var o=0;o<e.admins.length;o++)s[e.admins[o]]=!0;for(var o=0;o<e.global_mods.length;o++)s[e.global_mods[o]]=!0;for(var o=0;o<e.moderators.length;o++)s[e.moderators[o]]=!0;for(var o=0;o<e.staff.length;o++)s[e.staff[o]]=!0;for(var o=0;o<e.viewers.length;o++)s[e.viewers[o]]=!0;t.set("ffz_chatters",s),t.ffzUpdateChatters()})}},ffzUpdateChatters:function(e,o){var n=this.get("ffz_chatters")||{};if(e&&(n[e]=!0),o&&n[o]&&delete n[o],s.settings.chatter_count){s._cindex&&s._cindex.ffzUpdateChatters();try{t.parent&&t.parent.postMessage&&t.parent.postMessage({from_ffz:!0,command:"chatter_count",message:Object.keys(this.get("ffz_chatters")||{}).length},"http://www.twitch.tv/")}catch(i){}}},ffzPatchTMI:function(){if(!this.get("ffz_is_patched")&&this.get("tmiRoom")){s.settings.chatter_count&&this.ffzInitChatterCount();var t=this.get("tmiRoom"),e=this,o=t._roomConn._connection;o.ffz_cap_patched||(o.ffz_cap_patched=!0,o._send("CAP REQ :twitch.tv/membership"),o.on("opened",function(){this._send("CAP REQ :twitch.tv/membership")},o)),t.on("notice",function(t){if("msg_slowmode"===t.msgId){var o=/in (\d+) seconds/.exec(t.message);o&&e.updateWait(parseInt(o[1]))}if("msg_timedout"===t.msgId){var o=/for (\d+) more seconds/.exec(t.message);o&&(e.set("ffz_banned",!0),e.updateWait(parseInt(o[1])))}if("msg_banned"===t.msgId&&(e.set("ffz_banned",!0),s._roomv&&s._roomv.ffzUpdateStatus()),"hosts_remaining"===t.msgId){var o=/(\d+) host command/.exec(t.message);o&&(e.set("ffz_hosts_left",parseInt(o[1]||0)),s._cindex&&s._cindex.ffzUpdateHostButton())}}),o.ffz_roomstate_patched||(o.ffz_roomstate_patched=!0,o._socket.off("data",o._onSocketDataReceived,o),o._socket.on("data",function(t){try{var e=n.splitIRCMessage(t.data);if("ROOMSTATE"===e.command)return e.tags=n.parseIRCTags(e.tags),e.target=e.params&&e.params[0],void this._trigger("roomstate",e)}catch(o){s.error("Connection onData: "+o)}return this._onSocketDataReceived(t)},o)),t.ffz_roomstate_patched||(t.ffz_roomstate_patched=!0,t._roomConn.on("roomstate",function(t){t.target===this.ircChannel&&this._trigger("roomstate",t.tags)},t)),t.on("roomstate",function(t){e&&(t.hasOwnProperty("slow")&&(e.set("slowMode",t.slow>0),e.set("slowValue",t.slow),e.get("slowMode")||e.updateWait(0)),t.hasOwnProperty("r9k")&&e.set("r9kMode",t.r9k),t.hasOwnProperty("subs-only")&&e.set("subsOnlyMode",t["subs-only"]))}),t._roomConn._connection.off("message",t._roomConn._onIrcMessage,t._roomConn),t._roomConn._onIrcMessage=function(t){if(t.target==this.ircChannel)switch(t.command){case"JOIN":this._session&&this._session.nickname===t.sender?this._onIrcJoin(t):s.settings.chatter_count&&e.ffzUpdateChatters(t.sender);break;case"PART":this._session&&this._session.nickname===t.sender?(this._resetActiveState(),this._connection._exitedRoomConn(),this._trigger("exited")):s.settings.chatter_count&&e.ffzUpdateChatters(null,t.sender)}},t._roomConn._connection.on("message",t._roomConn._onIrcMessage,t._roomConn),this.set("ffz_is_patched",!0)}}.observes("tmiRoom")})}},{"../constants":4,"../utils":33}],12:[function(){var e=t.FrankerFaceZ;e.prototype.setup_viewers=function(){this.log("Hooking the Ember Viewers controller.");var t=App.__container__.resolve("controller:viewers");this._modify_viewers(t)},e.prototype._modify_viewers=function(t){var s=this;t.reopen({lines:function(){var t=this._super();try{var o=[],n={},i=null,a=App.__container__.lookup("controller:channel"),r=this.get("parentController.model.id"),d=a&&a.get("id");if(d){var u=a.get("display_name");u&&(e.capitalization[d]=[u,Date.now()])}r!=d&&(d=null);for(var c=0;c<t.length;c++){var l=t[c];if(l.category)i=l.category,o.push(i),n[i]=[];else{var h=l.chatter.toLowerCase();if(!h)continue;h==d?(o.unshift("Broadcaster"),n.Broadcaster=[h]):n.hasOwnProperty(i)&&n[i].push(h)}}t=[];for(var c=0;c<o.length;c++){var f=o[c],_=n[f];if(_&&_.length)for(t.push({category:f}),t.push({chatter:""}),_.sort();_.length;){var h=_.shift();h=e.get_capitalization(h),t.push({chatter:h})}}}catch(m){s.error("ViewersController lines: "+m)}return t}.property("content.chatters")})}},{}],13:[function(e){var s=t.FrankerFaceZ,o=e("./constants"),n=e("./utils"),i=function(t){var e=t.margins,s="";return e||(e=(t.height-18)/-2+"px 0"),(t.urls[2]||t.urls[4])&&(s='url("'+t.urls[1]+'") 1x',t.urls[2]&&(s+=', url("'+t.urls[2]+'") 2x'),t.urls[4]&&(s+=', url("'+t.urls[4]+'") 4x'),s="-webkit-image-set("+s+"); image-set("+s+");"),".ffz-emote-"+t.id+' { background-image: url("'+t.urls[1]+'"); height: '+t.height+"px; width: "+t.width+"px; margin: "+e+(s?"; "+s:"")+(t.css?"; "+t.css:"")+"}\n"},a=function(t){return t.margins||t.css?i(t)+'img[src="'+t.urls[1]+'"] { '+(t.margins?"margin: "+t.margins+";":"")+(t.css||"")+" }\n":i(t)},r=a,d=function(t){var e="string"==typeof t?parseInt(t,16):t;return 65536>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.");var t=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){var o=this.emote_usage[e]=this.emote_usage[e]||{};o[t]=(o[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&&delete this._emote_report_scheduled;var t=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),delete this._twitch_emote_check);var t;if(this.rooms)for(var e in this.rooms)if(this.rooms.hasOwnProperty(e)){t=this.rooms[e];break}if(!t||!t.room||!t.room.tmiSession)return void(this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4));var s=t.room.tmiSession._emotesParser,o=Object.keys(s.emoticonRegexToIds).length;if(!(o>0)){var n=s.emoticonSetIds;s.emoticonSetIds="",s.updateEmoticons(n),this._twitch_emote_check=setTimeout(this.check_twitch_emotes.bind(this),1e4)}},s.prototype.getEmotes=function(t,e){var s=this.users&&this.users[t],o=this.rooms&&this.rooms[e];return _.union(s&&s.sets||[],o&&o.set&&[o.set]||[],o&&o.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)return null;if(t._tooltip)return t._tooltip;var e=this.emote_sets[t.set_id],s=t.owner,o=e&&e.title||"Global";return t._tooltip="Emoticon: "+(t.hidden?"???":t.name)+"\nFFZ "+o+(s?"\nBy: "+s.display_name:""),t._tooltip},s.prototype.load_emoji_data=function(t,e){var s=this;jQuery.getJSON(o.SERVER+"emoji/emoji.json").done(function(e){var n={},i={};for(var a in e){var r=e[a];a=a.toLowerCase(),r.code=a,n[a]=r,i[r.short_name]=a,r.raw=_.map(r.code.split("-"),d).join(""),r.src=o.SERVER+"emoji/"+a+"-1x.png",r.srcSet=r.src+" 1x, "+o.SERVER+"emoji/"+a+"-2x.png 2x, "+o.SERVER+"emoji/"+a+"-4x.png 4x",r.token={srcSet:r.srcSet,emoticonSrc:r.src+'" data-ffz-emoji="'+a+'" height="18px',ffzEmoji:a,altText:r.raw}}s.emoji_data=n,s.emoji_names=i,s.log("Loaded data on "+Object.keys(n).length+" emoji."),"function"==typeof t&&t(!0,e)}).fail(function(o){return 404===o.status?"function"==typeof t&&t(!1):(e=(e||0)+1,50>e?s.load_emoji(t,e):"function"==typeof t&&t(!1))})},s.prototype.load_global_sets=function(t,e){var s=this;jQuery.getJSON(((e||0)%2===0?o.API_SERVER:o.API_SERVER_2)+"v1/set/global").done(function(t){s.default_sets=t.default_sets;var e=s.global_sets=[],o=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(var n in o)if(o.hasOwnProperty(n)){var i=o[n];e.push(n),s._load_set_json(n,void 0,i)}}).fail(function(o){return 404==o.status?"function"==typeof t&&t(!1):(e=e||0,e++,50>e?s.load_global_sets(t,e):"function"==typeof t&&t(!1))})},s.prototype.load_set=function(t,e,s){var n=this;jQuery.getJSON(((s||0)%2===0?o.API_SERVER:o.API_SERVER_2)+"v1/set/"+t).done(function(s){n._load_set_json(t,e,s&&s.set)}).fail(function(o){return 404==o.status?"function"==typeof e&&e(!1):(s=s||0,s++,10>s?n.load_set(t,e,s):"function"==typeof e&&e(!1))})},s.prototype.unload_set=function(t){var e=this.emote_sets[t];e&&(this.log("Unloading emoticons for set: "+t),n.update_css(this._emote_style,t,null),delete this.emote_sets[t])},s.prototype._load_set_json=function(t,e,s){if(!s)return"function"==typeof e&&e(!1);var o=this.emote_sets[t]&&this.emote_sets[t].users||[];this.emote_sets[t]=s,s.users=o,s.count=0;var i="",a=s.emoticons;s.emoticons={};for(var d=0;d<a.length;d++){var u=a[d];u.klass="ffz-emote-"+u.id,u.set_id=t,u.srcSet=u.urls[1]+" 1x",u.urls[2]&&(u.srcSet+=", "+u.urls[2]+" 2x"),u.urls[4]&&(u.srcSet+=", "+u.urls[4]+" 4x"),u.regex="!"===u.name[u.name.length-1]?new RegExp("(^|\\W|\\b)("+u.name+")(?=\\W|$)","g"):new RegExp("(^|\\W|\\b)("+u.name+")\\b","g"),i+=r(u),s.count++,s.emoticons[u.id]=u}n.update_css(this._emote_style,t,i+(s.css||"")),this.log("Updated emoticons for set #"+t+": "+s.title,s),this._cindex&&this._cindex.ffzFixTitle(),this.update_ui_link(),e&&e(!0,s)}},{"./constants":4,"./utils":33}],14:[function(e){var s=t.FrankerFaceZ,o=e("../constants"),n=e("../utils");s.prototype.find_bttv=function(e,s){return this.has_bttv=!1,t.BTTVLOADED?this.setup_bttv(s||0):void(s>=6e4?this.log("BetterTTV was not detected after 60 seconds."):setTimeout(this.find_bttv.bind(this,e,(s||0)+e),e))},s.prototype.setup_bttv=function(t){this.log("BetterTTV was detected after "+t+"ms. Hooking."),this.has_bttv=!0,document.body.classList.remove("ffz-dark"),this._dark_style&&(this._dark_style.parentElement.removeChild(this._dark_style),this._dark_style=void 0),this._chat_style&&(this._chat_style.parentElement.removeChild(this._chat_style),this._chat_style=void 0),this.settings.group_tabs&&this._chatv&&this._chatv.ffzDisableTabs(),this._roomv&&(this.settings.chat_hover_pause&&this._roomv.ffzDisableFreeze(),this.settings.room_status&&this._roomv.ffzUpdateStatus()),document.body.classList.remove("ffz-chat-colors"),document.body.classList.remove("ffz-chat-colors-gray"),document.body.classList.remove("ffz-chat-background"),document.body.classList.remove("ffz-chat-padding"),document.body.classList.remove("ffz-chat-separator"),document.body.classList.remove("ffz-chat-separator-3d"),document.body.classList.remove("ffz-sidebar-swap"),document.body.classList.remove("ffz-transparent-badges"),document.body.classList.remove("ffz-high-contrast-chat"),this.settings.following_count&&(this._schedule_following_count(),this._draw_following_count()),this.is_dashboard&&this._update_subscribers(),document.body.classList.add("ffz-bttv");var e=BetterTTV.chat.helpers.sendMessage,s=this;BetterTTV.chat.helpers.sendMessage=function(t){var o=t.split(" ",1)[0].toLowerCase();return"/ffz"!==o?e(t):void s.run_ffz_command(t.substr(5),BetterTTV.chat.store.currentRoom)};var i,a=BetterTTV.chat.handlers.onPrivmsg;BetterTTV.chat.handlers.onPrivmsg=function(t,e){i=t;var s=a(t,e);return i=null,s};var r=BetterTTV.chat.templates.privmsg;BetterTTV.chat.templates.privmsg=function(t,e,o,n,a){try{return s.bttv_badges(a),'<div class="chat-line'+(t?" highlight":"")+(e?" action":"")+(o?" admin":"")+'" data-sender="'+(a.sender||"").toLowerCase()+'" data-room="'+i+'">'+BetterTTV.chat.templates.timestamp(a.time)+" "+(n?BetterTTV.chat.templates.modicons():"")+" "+BetterTTV.chat.templates.badges(a.badges)+BetterTTV.chat.templates.from(a.nickname,a.color)+BetterTTV.chat.templates.message(a.sender,a.message,a.emotes,e?a.color:!1)+"</div>"}catch(d){return s.log("Error: ",d),r(t,e,o,n,a)}};var d=BetterTTV.chat.templates.whisper;BetterTTV.chat.templates.whisper=function(t){try{return s.bttv_badges(t),'<div class="chat-line whisper" data-sender="'+t.sender+'">'+BetterTTV.chat.templates.timestamp(t.time)+" "+(t.badges&&t.badges.length?BetterTTV.chat.templates.badges(t.badges):"")+BetterTTV.chat.templates.whisperName(t.sender,t.receiver,t.from,t.to,t.fromColor,t.toColor)+BetterTTV.chat.templates.message(t.sender,t.message,t.emotes,!1)+"</div>"}catch(e){return s.log("Error: ",e),d(t)}};var u,c=BetterTTV.chat.templates.message;BetterTTV.chat.templates.message=function(t,e,o,n){try{n=n||!1;var i=encodeURIComponent(e);if("jtv"!==t){u=t;var a=BetterTTV.chat.templates.emoticonize(e,o);
|
||
u=null;for(var r=0;r<a.length;r++)a[r]="string"==typeof a[r]?BetterTTV.chat.templates.bttvMessageTokenize(t,a[r]):a[r][0];e=a.join(" ")}return'<span class="message" '+(n?'style="color: '+n+'" ':"")+'data-raw="'+i+'" data-emotes="'+(o?encodeURIComponent(JSON.stringify(o)):"false")+'">'+e+"</span>"}catch(d){return s.log("Error: ",d),c(t,e,o,n)}};var l=BetterTTV.chat.templates.emoticonize;BetterTTV.chat.templates.emoticonize=function(t,e){var a=l(t,e),r=i||BetterTTV.getChannel(),d=r&&r.toLowerCase(),c=u&&u.toLowerCase(),h=s.getEmotes(c,d),e=[],f=s.get_user(),m=f&&f.login===c;if(_.each(h,function(t){var o=s.emote_sets[t];o&&_.each(o.emoticons,function(t){_.any(a,function(e){return _.isString(e)&&e.match(t.regex)})&&e.push(t)})}),e.length&&_.each(e,function(t){var e=s._emote_tooltip(t),o=['<img class="emoticon" srcset="'+(t.srcSet||"")+'" src="'+t.urls[1]+'" alt="'+e+'" title="'+e+'" />'],n=a;a=[];for(var i=0;i<n.length;i++){var r=n[i];if("string"==typeof r)for(var u=r.split(t.regex);u.length;){var c=u.shift();u.length?(c+=u.shift(),c&&a.push(c),u.shift(),a.push(o),m&&d&&s.add_usage(d,t.id)):a.push(c)}else a.push(r)}}),s.settings.parse_emoji&&s.emoji_data){var p=a;a=[];for(var g=0;g<p.length;g++){var v=p[g];if("string"==typeof v)for(var b=v.split(o.EMOJI_REGEX);b.length;){var y=b.shift();if(y&&a.push(y),b.length){var w=b.shift(),z=b.shift();if("︎"===z)bits.push(w);else{var k=n.emoji_to_codepoint(w,z),C=s.emoji_data[k];a.push(C?['<img class="emoticon" height="18px" srcset="'+(C.srcSet||"")+'" src="'+C.src+'" alt="'+alt+'" title="Emoji: '+C.raw+"\nName: :"+C.short_name+':">']:w+(z||""))}}}else a.push(v)}}return a},this.update_ui_link()}},{"../constants":4,"../utils":33}],15:[function(){var e=t.FrankerFaceZ;e.prototype.find_emote_menu=function(e,s){return this.has_emote_menu=!1,t.emoteMenu&&emoteMenu.registerEmoteGetter?this.setup_emote_menu(s||0):void(s>=6e4?this.log("Emote Menu for Twitch was not detected after 60 seconds."):setTimeout(this.find_emote_menu.bind(this,e,(s||0)+e),e))},e.prototype.setup_emote_menu=function(t){this.log("Emote Menu for Twitch was detected after "+t+"ms. Registering emote enumerator."),emoteMenu.registerEmoteGetter("FrankerFaceZ",this._emote_menu_enumerator.bind(this))},e.prototype._emote_menu_enumerator=function(){for(var t=this.get_user(),s=t?t.login:null,o=App.__container__.lookup("controller:chat"),n=o?o.get("currentRoom.id"):null,i=this.getEmotes(s,n),a=[],r=0;r<i.length;r++){var d=this.emote_sets[i[r]];if(d&&d.emoticons)for(var u in d.emoticons)if(d.emoticons.hasOwnProperty(u)){var c=d.emoticons[u];if(!c.hidden){var l=d.title,h=d.icon||null;l=l?"FrankerFaceZ: "+l:"global"==d.id?"FrankerFaceZ Global Emotes":"globalevent"==d.id?"FrankerFaceZ Event Emotes":this.feature_friday&&d.id==this.feature_friday.set?"FrankerFaceZ "+this.feature_friday.title+": "+this.feature_friday.display_name:"FrankerFaceZ Set: "+e.get_capitalization(d.id),a.push({text:c.name,url:c.urls[1],hidden:!1,channel:l,badge:h})}}}return a}},{}],16:[function(e){var s=t.FrankerFaceZ=function(){s.instance=this,this._log_data=[],this.initialize()};s.get=function(){return s.instance};var o=s.version_info={major:3,minor:4,revision:25,toString:function(){return[o.major,o.minor,o.revision].join(".")+(o.extra||"")}};s.prototype.log=function(t,e,s,o){t="FFZ: "+t+(s?" -- "+JSON.stringify(e):""),this._log_data.push(t+(!s&&o?" -- "+JSON.stringify(e):"")),void 0!==e&&console.groupCollapsed&&console.dir?(console.groupCollapsed(t),-1!==navigator.userAgent.indexOf("Firefox/")?console.log(e):console.dir(e),console.groupEnd(t)):console.log(t)},s.prototype.error=function(t,e,s){t="FFZ Error: "+t+(s?" -- "+JSON.stringify(e):""),this._log_data.push(t),void 0!==e&&console.groupCollapsed&&console.dir?(console.groupCollapsed(t),-1!==navigator.userAgent.indexOf("Firefox/")?console.log(e):console.dir(e),console.groupEnd(t)):console.assert(!1,t)},s.prototype.paste_logs=function(){this._pastebin(this._log_data.join("\n"),function(t){return t?void console.log("FFZ: Your FrankerFaceZ log has been pasted to: "+t):console.log("FFZ Error: Unable to upload log to pastebin.")})},s.prototype._pastebin=function(t,e){jQuery.ajax({url:"http://putco.de/",type:"PUT",data:t,context:this}).success(function(t){e.bind(this)(t.trim()+".log")}).fail(function(){e.bind(this)(null)})},s.prototype.get_user=function(){if(t.PP&&PP.login)return PP;if(t.App){var e=App.__container__.lookup("controller:login");return e?e.get("userData"):void 0}},e("./ui/menu"),e("./settings"),e("./socket"),e("./colors"),e("./emoticons"),e("./badges"),e("./tokenize"),e("./ember/channel"),e("./ember/room"),e("./ember/line"),e("./ember/chatview"),e("./ember/viewers"),e("./ember/moderation-card"),e("./ember/chat-input"),e("./debug"),e("./ext/betterttv"),e("./ext/emote_menu"),e("./featurefriday"),e("./ui/styles"),e("./ui/dark"),e("./ui/notifications"),e("./ui/viewer_count"),e("./ui/sub_count"),e("./ui/menu_button"),e("./ui/following"),e("./ui/following-count"),e("./ui/races"),e("./ui/my_emotes"),e("./ui/about_page"),e("./commands"),s.prototype.initialize=function(e,s){if(/^\/(?:$|user\/|p\/|settings|m\/|messages?\/)/.test(location.pathname))return void this.setup_normal(s);if("passport"===location.hostname&&/^\/(?:authorize)/.test(location.pathname))return this.log("Running on passport!"),void this.setup_normal(s,!0);if(/\/[^\/]+\/dashboard/.test(location.pathname)&&!/bookmarks$/.test(location.pathname))return void this.setup_dashboard(s);var o=void 0!=t.App&&void 0!=App.__container__&&void 0!=App.__container__.resolve("model:room");return o?void this.setup_ember(s):(e=e||10,void(s>=6e4?this.log('Twitch application not detected in "'+location.toString()+'". Aborting.'):setTimeout(this.initialize.bind(this,e,(s||0)+e),e)))},s.prototype.setup_normal=function(e,o){var n=t.performance&&performance.now?performance.now():Date.now();this.log("Found non-Ember Twitch after "+(e||0)+' ms in "'+location+'". Initializing FrankerFaceZ version '+s.version_info),this.users={},this.is_dashboard=!1;try{this.embed_in_dash=t.top!==t&&/\/[^\/]+\/dashboard/.test(t.top.location.pathname)&&!/bookmarks$/.test(t.top.location.pathname)}catch(i){this.embed_in_dash=!1}this.load_settings(),this.setup_dark(),o||this.ws_create(),this.setup_colors(),this.setup_emoticons(),this.setup_badges(),this.setup_notifications(),this.setup_following_count(!1),this.setup_css(),this.setup_menu(),this.find_bttv(10);var a=t.performance&&performance.now?performance.now():Date.now(),r=a-n;this.log("Initialization complete in "+r+"ms")},s.prototype.is_dashboard=!1,s.prototype.setup_dashboard=function(e){var o=t.performance&&performance.now?performance.now():Date.now();this.log("Found Twitch Dashboard after "+(e||0)+' ms in "'+location+'". Initializing FrankerFaceZ version '+s.version_info),this.users={},this.is_dashboard=!0,this.embed_in_dash=!1,this.load_settings(),this.setup_dark(),this.ws_create(),this.setup_colors(),this.setup_emoticons(),this.setup_badges(),this.setup_tokenization(),this.setup_notifications(),this.setup_css(),this._update_subscribers(),this.setup_message_event(),this.find_bttv(10);var n=t.performance&&performance.now?performance.now():Date.now(),i=n-o;this.log("Initialization complete in "+i+"ms")},s.prototype.setup_ember=function(e){var o=t.performance&&performance.now?performance.now():Date.now();this.log("Found Twitch application after "+(e||0)+' ms in "'+location+'". Initializing FrankerFaceZ version '+s.version_info),this.users={},this.is_dashboard=!1;try{this.embed_in_dash=t.top!==t&&/\/[^\/]+\/dashboard/.test(t.top.location.pathname)&&!/bookmarks$/.test(t.top.location.pathname)}catch(n){this.embed_in_dash=!1}this.load_settings(),this.setup_dark(),this.ws_create(),this.setup_emoticons(),this.setup_badges(),this.setup_colors(),this.setup_tokenization(),this.setup_channel(),this.setup_room(),this.setup_line(),this.setup_chatview(),this.setup_viewers(),this.setup_mod_card(),this.setup_chat_input(),this.setup_notifications(),this.setup_css(),this.setup_menu(),this.setup_my_emotes(),this.setup_following(),this.setup_following_count(!0),this.setup_races(),this.connect_extra_chat(),this.find_bttv(10),this.find_emote_menu(10),this.check_ff();var i=t.performance&&performance.now?performance.now():Date.now(),a=i-o;this.log("Initialization complete in "+a+"ms")},s.prototype.setup_message_event=function(){this.log("Listening for Window Messages."),t.addEventListener("message",this._on_window_message.bind(this),!1)},s.prototype._on_window_message=function(t){if(t.data&&t.data.from_ffz){t.data}}},{"./badges":1,"./colors":2,"./commands":3,"./debug":5,"./ember/channel":6,"./ember/chat-input":7,"./ember/chatview":8,"./ember/line":9,"./ember/moderation-card":10,"./ember/room":11,"./ember/viewers":12,"./emoticons":13,"./ext/betterttv":14,"./ext/emote_menu":15,"./featurefriday":17,"./settings":18,"./socket":19,"./tokenize":20,"./ui/about_page":21,"./ui/dark":22,"./ui/following":24,"./ui/following-count":23,"./ui/menu":25,"./ui/menu_button":26,"./ui/my_emotes":27,"./ui/notifications":28,"./ui/races":29,"./ui/styles":30,"./ui/sub_count":31,"./ui/viewer_count":32}],17:[function(e){var s=t.FrankerFaceZ,o=e("./constants");s.prototype.feature_friday=null,s.prototype.check_ff=function(t){t||this.log("Checking for Feature Friday data..."),jQuery.ajax(o.SERVER+"script/event.json",{cache:!1,dataType:"json",context:this}).done(function(t){return this._load_ff(t)}).fail(function(e){return 404==e.status?this._load_ff(null):(t=t||0,t++,10>t?setTimeout(this.check_ff.bind(this,t),250):this._load_ff(null))})},s.ws_commands.reload_ff=function(){this.check_ff()},s.prototype._feature_friday_ui=function(t,e,s){if(this.feature_friday&&this.feature_friday.channel!=t){this._emotes_for_sets(e,s,[this.feature_friday.set],this.feature_friday.title,this.feature_friday.icon,"FrankerFaceZ");var o=App.__container__.lookup("controller:channel");if(!o||o.get("id")!=this.feature_friday.channel){var n=this.feature_friday,i=document.createElement("div"),a=document.createElement("a");i.className="chat-menu-content",i.style.textAlign="center";var r=n.display_name+(n.live?" is live now!":"");a.className="button primary",a.classList.toggle("live",n.live),a.classList.toggle("blue",this.has_bttv&&BetterTTV.settings.get("showBlueButtons")),a.href="http://www.twitch.tv/"+n.channel,a.title=r,a.target="_new",a.innerHTML="<span>"+r+"</span>",i.appendChild(a),e.appendChild(i)}}},s.prototype._load_ff=function(t){this.feature_friday&&(this.global_sets.removeObject(this.feature_friday.set),this.default_sets.removeObject(this.feature_friday.set),this.feature_friday=null,this.update_ui_link()),t&&t.set&&t.channel&&(this.feature_friday={set:t.set,channel:t.channel,live:!1,title:t.title||"Feature Friday",display_name:s.get_capitalization(t.channel,this._update_ff_name.bind(this))},this.global_sets.push(t.set),this.default_sets.push(t.set),this.load_set(t.set),this._update_ff_live())},s.prototype._update_ff_live=function(){if(this.feature_friday){var t=this;Twitch.api.get("streams/"+this.feature_friday.channel).done(function(e){t.feature_friday.live=null!=e.stream,t.update_ui_link()}).always(function(){t.feature_friday.timer=setTimeout(t._update_ff_live.bind(t),12e4)})}},s.prototype._update_ff_name=function(t){this.feature_friday&&(this.feature_friday.display_name=t)}},{"./constants":4}],18:[function(e){var s=t.FrankerFaceZ,o=e("./constants");make_ls=function(t){return"ffz_setting_"+t},toggle_setting=function(t,e){var s=!this.settings.get(e);this.settings.set(e,s),t.classList.toggle("active",s)},option_setting=function(t,e){this.settings.set(e,JSON.parse(t.options[t.selectedIndex].value))},s.settings_info={},s.prototype.load_settings=function(){this.log("Loading settings."),this.settings={};for(var e in s.settings_info)if(s.settings_info.hasOwnProperty(e)){var o=s.settings_info[e],n=o.storage_key||make_ls(e),i=o.hasOwnProperty("value")?o.value:void 0;if(localStorage.hasOwnProperty(n))try{i=JSON.parse(localStorage.getItem(n))}catch(a){this.log('Error loading value for "'+e+'": '+a)}o.process_value&&(i=o.process_value.bind(this)(i)),this.settings[e]=i}this.settings.get=this._setting_get.bind(this),this.settings.set=this._setting_set.bind(this),this.settings.del=this._setting_del.bind(this),t.addEventListener("storage",this._setting_update.bind(this),!1)},s.menu_pages.settings={render:function(t,e){var o={},n=[],i=-1!==navigator.userAgent.indexOf("Android");for(var a in s.settings_info)if(s.settings_info.hasOwnProperty(a)){var r=s.settings_info[a],d=r.category||"Miscellaneous",u=o[d];if(void 0!==r.visible&&null!==r.visible){var c=r.visible;if("function"==typeof r.visible&&(c=r.visible.bind(this)()),!c)continue}i&&r.no_mobile||(u||(n.push(d),u=o[d]=[]),u.push([a,r]))}n.sort(function(t,e){var t=t.toLowerCase(),e=e.toLowerCase();return"debugging"===t&&(t="zzz"+t),"debugging"===e&&(e="zzz"+e),e>t?-1:t>e?1:0});for(var l=this,h=this._ffz_settings_page||n[0],f=0;f<n.length;f++){var _=n[f],m=o[_],p=document.createElement("div"),g=document.createElement("div");g.className="heading",p.className="chat-menu-content collapsable",p.setAttribute("data-category",_),p.classList.toggle("collapsed",h!==_),g.innerHTML=_,p.appendChild(g),p.addEventListener("click",function(){if(this.classList.contains("collapsed")){for(var t=this,s=e.querySelectorAll(".chat-menu-content:not(.collapsed)"),o=0;o<s.length;o++)s[o].classList.add("collapsed");l._ffz_settings_page=t.getAttribute("data-category"),t.classList.remove("collapsed"),setTimeout(function(){t.scrollIntoViewIfNeeded()})}}),m.sort(function(t,e){var t=t[1],e=e[1],s="button"===t.type?2:1,o="button"===e.type?2:1,n=t.name.toLowerCase(),i=e.name.toLowerCase();return o>s?-1:s>o?1:i>n?-1:n>i?1:0});for(var v=0;v<m.length;v++){var a=m[v][0],r=m[v][1],b=document.createElement("p"),y=this.settings.get(a);if(b.className="clearfix",this.has_bttv&&r.no_bttv){var w=document.createElement("span"),z=document.createElement("span");w.className="switch-label",w.innerHTML=r.name,z=document.createElement("span"),z.className="help",z.innerHTML="Disabled due to incompatibility with BetterTTV.",b.classList.add("disabled"),b.appendChild(w),b.appendChild(z)}else{if("boolean"==r.type){var k=document.createElement("a"),w=document.createElement("span");k.className="switch",k.classList.toggle("active",y),k.innerHTML="<span></span>",w.className="switch-label",w.innerHTML=r.name,b.appendChild(k),b.appendChild(w),k.addEventListener("click",toggle_setting.bind(this,k,a))}else if("select"===r.type){var C=document.createElement("select"),w=document.createElement("span");w.className="option-label",w.innerHTML=r.name;for(var E in r.options){var T=document.createElement("option");T.value=JSON.stringify(E),y===E&&T.setAttribute("selected",!0),T.innerHTML=r.options[E],C.appendChild(T)}C.addEventListener("change",option_setting.bind(this,C,a)),b.appendChild(w),b.appendChild(C)}else{b.classList.add("option");var x=document.createElement("a");x.innerHTML=r.name,x.href="#",b.appendChild(x),x.addEventListener("click",r.method.bind(this))}if(r.help){var z=document.createElement("span");z.className="help",z.innerHTML=r.help,b.appendChild(z)}}p.appendChild(b)}e.appendChild(p)}},name:"Settings",icon:o.GEAR,sort_order:99999,wide:!0},s.prototype._setting_update=function(e){if(e||(e=t.event),e.key&&"ffz_setting_"===e.key.substr(0,12)){var o=e.key,n=o.substr(12),i=void 0,a=s.settings_info[n];if(!a){for(n in s.settings_info)if(s.settings_info.hasOwnProperty(n)&&(a=s.settings_info[n],a.storage_key==o))break;if(a.storage_key!=o)return}this.log("Updated Setting: "+n);try{i=JSON.parse(e.newValue)}catch(r){this.log('Error loading new value for "'+n+'": '+r),i=a.value||void 0}if(this.settings[n]=i,a.on_update)try{a.on_update.bind(this)(i,!1)}catch(r){this.log('Error running updater for setting "'+n+'": '+r)}}},s.prototype._setting_get=function(t){return this.settings[t]},s.prototype._setting_set=function(t,e){var o=s.settings_info[t],n=o.storage_key||make_ls(t),i=JSON.stringify(e);if(this.settings[t]=e,localStorage.setItem(n,i),this.log('Changed Setting "'+t+'" to: '+i),o.on_update)try{o.on_update.bind(this)(e,!0)}catch(a){this.log('Error running updater for setting "'+t+'": '+a)}},s.prototype._setting_del=function(t){var e=s.settings_info[t],o=e.storage_key||make_ls(t),n=void 0;if(localStorage.hasOwnProperty(o)&&localStorage.removeItem(o),delete this.settings[t],e&&(n=this.settings[t]=e.hasOwnProperty("value")?e.value:void 0),e.on_update)try{e.on_update.bind(this)(n,!0)}catch(i){this.log('Error running updater for setting "'+t+'": '+i)}}},{"./constants":4}],19:[function(){var e=t.FrankerFaceZ;e.prototype._ws_open=!1,e.prototype._ws_delay=0,e.ws_commands={},e.ws_on_close=[],e.prototype.ws_create=function(){var s,o=this;this._ws_last_req=0,this._ws_callbacks={},this._ws_pending=this._ws_pending||[];try{s=this._ws_sock=new WebSocket("ws://catbag.frankerfacez.com/")}catch(n){return this._ws_exists=!1,this.log("Error Creating WebSocket: "+n)}this._ws_exists=!0,s.onopen=function(){o._ws_open=!0,o._ws_delay=0,o.log("Socket connected.");var s=t.RequestFileSystem||t.webkitRequestFileSystem;s?s(t.TEMPORARY,100,o.ws_send.bind(o,"hello",["ffz_"+e.version_info,localStorage.ffzClientId],o._ws_on_hello.bind(o)),o.log.bind(o,"Operating in Incognito Mode.")):o.ws_send("hello",["ffz_"+e.version_info,localStorage.ffzClientId],o._ws_on_hello.bind(o));var n=o.get_user();if(n&&o.ws_send("setuser",n.login),o.is_dashboard){var i=location.pathname.match(/\/([^\/]+)/);i&&(o.ws_send("sub",i[1]),o.ws_send("sub_channel",i[1]))}for(var a in o.rooms)o.rooms.hasOwnProperty(a)&&o.rooms[a]&&(o.ws_send("sub",a),o.rooms[a].needs_history&&(o.rooms[a].needs_history=!1,!o.has_bttv&&o.settings.chat_history&&o.ws_send("chat_history",[a,25],o._load_history.bind(o,a))));if(o._cindex){var r=o._cindex.get("controller.id"),d=o._cindex.get("controller.hostModeTarget.id");r&&o.ws_send("sub_channel",r),d&&o.ws_send("sub_channel",d)}var u=o._ws_pending;o._ws_pending=[];for(var c=0;c<u.length;c++){var l=u[c];o.ws_send(l[0],l[1],l[2])}},s.onclose=function(t){o.log("Socket closed. (Code: "+t.code+", Reason: "+t.reason+")"),o._ws_open=!1;for(var s=0;s<e.ws_on_close.length;s++)try{e.ws_on_close[s].bind(o)()}catch(n){o.log("Error on Socket Close Callback: "+n)}o._ws_delay<6e4?o._ws_delay+=1e3*(Math.floor(10*Math.random())+5):o._ws_delay=1e3*(Math.floor(60*Math.random())+30),setTimeout(o.ws_create.bind(o),o._ws_delay)},s.onmessage=function(t){var s,n,i=t.data.indexOf(" "),a=t.data.substr(i+1),r=parseInt(t.data.slice(0,i));if(i=a.indexOf(" "),-1===i&&(i=a.length),s=a.slice(0,i),a=a.substr(i+1),a&&(n=JSON.parse(a)),-1===r){var d=e.ws_commands[s];d?d.bind(o)(n):o.log("Invalid command: "+s,n,!1,!0)}else{var u="True"===s,c=o._ws_callbacks.hasOwnProperty(r);if(c)try{o._ws_callbacks[r](u,n)}catch(l){o.error("Callback for "+r+": "+l)}else o.log("Socket Reply to "+r+" - "+(u?"SUCCESS":"FAIL"),n,!1,!0)}}},e.prototype.ws_send=function(t,e,s,o){if(!this._ws_open){if(o){var n=this._ws_pending=this._ws_pending||[];return n.push([t,e,s]),!0}return!1}var i=++this._ws_last_req;e=void 0!==e?" "+JSON.stringify(e):"",s&&(this._ws_callbacks[i]=s);try{this._ws_sock.send(i+" "+t+e)}catch(a){return this.log("Socket Send Error: "+a),!1}return i},e.prototype._ws_on_hello=function(t,s){if(!t)return this.log("Error Saying Hello: "+s);localStorage.ffzClientId=s,this.log("Client ID: "+s);var o={},n=o.settings={};for(var i in e.settings_info)n[i]=this.settings[i];n.keywords=this.settings.keywords.length,n.banned_words=this.settings.banned_words.length,o.bttv=this.has_bttv||!!document.head.querySelector('script[src*="betterttv"]'),o["user-agent"]=navigator.userAgent,o.screen=[screen.width,screen.height],o.language=navigator.language,o.platform=navigator.platform,this.ws_send("survey",[o])},e.ws_commands.do_authorize=function(t){var s;for(var o in this.rooms)if(this.rooms.hasOwnProperty(o)){var n=this.rooms[o];if(n&&n.room&&!n.room.get("roomProperties.eventchat")&&!n.room.get("isGroupRoom")&&n.room.tmiRoom){var i=n.room.tmiRoom._getConnection();if(i.isConnected){s=i;break}}}s?s._send("PRIVMSG #frankerfacezauthorizer :AUTH "+t):setTimeout(e.ws_commands.do_authorize.bind(this,t),5e3)}},{}],20:[function(e){{var s,o=t.FrankerFaceZ,n=e("./utils"),i=e("./constants"),a="http://static-cdn.jtvnw.net/emoticons/v1/",r=function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},d=/(?:https?:\/\/)?(?:[-a-zA-Z0-9@:%_\+~#=]+\.)+[a-z]{2,6}\b(?:[-a-zA-Z0-9@:%_\+.~#!?&//=]*)/g,u="[\\s`~<>!-#%-\\x2A,-/:;\\x3F@\\x5B-\\x5D_\\x7B}\\u00A1\\u00A7\\u00AB\\u00B6\\u00B7\\u00BB\\u00BF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E3B\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]";new RegExp(u+"*,"+u+"*")}o.SRC_IDS={},o.src_to_id=function(t){if(o.SRC_IDS.hasOwnProperty(t))return o.SRC_IDS[t];var e=/\/emoticons\/v1\/(\d+)\/1\.0/.exec(t),s=e?parseInt(e[1]):null;return 0/0===s&&(s=null),o.SRC_IDS[t]=s,s};var c=new Date(0).toLocaleTimeString().toUpperCase();o.settings_info.twenty_four_timestamps={type:"boolean",value:-1===c.lastIndexOf("PM")&&-1===c.lastIndexOf("AM"),category:"Chat Appearance",no_bttv:!0,name:"24hr Timestamps",help:"Display timestamps in chat in the 24 hour format rather than 12 hour."},o.settings_info.show_deleted_links={type:"boolean",value:!1,category:"Chat Moderation",no_bttv:!0,name:"Show Deleted Links",help:"Do not delete links based on room settings or link length."},o.prototype.setup_tokenization=function(){if(s=t.require&&t.require("ember-twitch-chat/helpers/chat-line-helpers"),!s)return this.log("Unable to get chat helper functions.");this.log("Hooking Ember chat line helpers.");var e=this;s.getTime=function(t){if(void 0===t||null===t)return"?:??";var s=t.getHours(),o=t.getMinutes();return s>12&&!e.settings.twenty_four_timestamps?s-=12:0!==s||e.settings.twenty_four_timestamps||(s=12),s+":"+(10>o?"0":"")+o},s.linkifyMessage=function(t,s){var o=e.settings.show_deleted_links;return _.chain(t).map(function(t){if(!_.isString(t))return t;var e=t.match(d);return e&&e.length?_.zip(t.split(d),_.map(e,function(t){return!o&&(s||t.length>255)?{mentionedUser:'</span><a class="deleted-link" title="'+n.quote_attr(t)+'" data-url="'+n.quote_attr(t)+'" href="#"><'+(t.length>255?"long link":"deleted link")+'></a><span class="mentioning">',own:!0}:{isLink:!0,href:t}})):[t]}).flatten().compact().value()}},o.prototype.tokenize_chat_line=function(e,n){if(e.cachedTokens)return e.cachedTokens;try{var i=e.message,a=this.get_user(),r=e.room,d=a&&e.from===a.login,u=e.tags&&e.tags.emotes,c=[i];s&&s.linkifyMessage&&(c=s.linkifyMessage(c)),a&&a.login&&s&&s.mentionizeMessage&&(c=s.mentionizeMessage(c,a.login,d)),s&&s.emoticonizeMessage&&(c=s.emoticonizeMessage(c,u)),this.settings.replace_bad_emotes&&(c=this.tokenize_replace_emotes(c)),c=this._remove_banned(c),c=this.tokenize_emotes(e.from,r,c,d),this.settings.parse_emoji&&(c=this.tokenize_emoji(c));var l=e.tags&&e.tags["display-name"];if(l&&l.length&&(o.capitalization[e.from]=[l.trim(),Date.now()]),!d){c=this.tokenize_mentions(c);for(var h=0;h<c.length;h++){var f=c[h];if("whisper"===e.style||!_.isString(f)&&f.mentionedUser&&!f.own){if(e.ffz_has_mention=!0,r&&!this.has_bttv&&this.settings.group_tabs&&this._chatv&&this._chatv._ffz_tabs){var m=this._chatv._ffz_tabs.querySelector('.ffz-chat-tab[data-room="'+r+'"]');m&&!m.classList.contains("active")&&m.classList.add("tab-mentioned")}if(this._chatv&&this.settings.highlight_notifications&&!this.embed_in_dash&&!document.hasFocus()&&!n){var p,g=this.rooms[r]&&this.rooms[r].room;if(this.settings.group_tabs&&(-1!==this.settings.pinned_rooms.indexOf(r)||this._chatv._ffz_host)||g.get("isGroupRoom")||g===this._chatv.get("controller.currentChannelRoom")){p=g&&g.get("isGroupRoom")?g.get("tmiRoom.displayName"):o.get_capitalization(r),l=l||Twitch.display.capitalize(e.from),i="action"===e.style?"* "+l+" "+i:l+": "+i;"whisper"===e.style?this.show_notification(i,"Twitch Chat Whisper","ffz_whisper_notice",1e3*this.settings.notification_timeout,function(){t.focus()}):this.show_notification(i,"Twitch Chat Mention in "+p,r,1e3*this.settings.notification_timeout,function(){t.focus();var e=App.__container__.lookup("controller:chat");g&&e&&e.focusRoom(g)})}}break}}}e.cachedTokens=c}catch(v){this.error("Tokenization Error: "+v)}return c},o.prototype.tokenize_line=function(t,e,o,n,i){if("string"==typeof o&&(o=[o]),s&&s.linkifyMessage&&(o=s.linkifyMessage(o)),s&&s.mentionizeMessage){var a=this.get_user();a&&a.login&&(o=s.mentionizeMessage(o,a.login,t===a.login))}return n||(o=this.tokenize_emotes(t,e,o),this.settings.replace_bad_emotes&&(o=this.tokenize_replace_emotes(o))),this.settings.parse_emoji&&!i&&(o=this.tokenize_emoji(o)),o},o.prototype.render_tokens=function(t,e){var s=this;return _.map(t,function(t){if(t.emoticonSrc){var i;if(t.ffzEmote){var a=s.emote_sets&&s.emote_sets[t.ffzEmoteSet],r=a&&a.emoticons&&a.emoticons[t.ffzEmote];i=r?n.sanitize(s._emote_tooltip(r)):t.altText}else if(t.ffzEmoji){var d=t.ffzEmoji,u=s.emoji_data&&s.emoji_data[d];i=u?"Emoji: "+t.altText+"\nName: :"+u.short_name+":":t.altText}else{var c=o.src_to_id(t.emoticonSrc),l=c&&s._twitch_emotes&&s._twitch_emotes[c];i=l&&l.tooltip?l.tooltip:t.altText}return'<img class="emoticon tooltip" src="'+t.emoticonSrc+'" '+(t.srcSet?'srcset="'+t.srcSet+'" ':"")+'alt="'+t.altText+'" title="'+i+'">'}if(t.isLink){if(!e&&void 0!==e)return t.href;var h=t.href;if(h.indexOf("@")>-1&&(-1===h.indexOf("/")||h.indexOf("@")<h.indexOf("/")))return'<a href="mailto:'+h+'">'+h+"</a>";var f=(h.match(/^https?:\/\//)?"":"http://")+h,l=s._link_data&&s._link_data[f]||{};return'<a href="'+f+'" class="'+(l.unsafe?"unsafe-link":"")+'" title="'+n.sanitize(l.tooltip||"")+'" target="_blank">'+h+"</a>"}return t.mentionedUser?'<span class="'+(t.own?"mentioning":"mentioned")+'">'+t.mentionedUser+"</span>":n.sanitize(t.deletedLink?t.text:t)}).join("")},o.prototype.tokenize_replace_emotes=function(t){_.isString(t)&&(t=[t]);for(var e=0;e<t.length;e++){var s=t[e];if(s&&s.emoticonSrc&&!s.ffzEmote){var n=o.src_to_id(s.emoticonSrc);i.EMOTE_REPLACEMENTS.hasOwnProperty(n)&&(s.emoticonSrc=i.EMOTE_REPLACEMENT_BASE+i.EMOTE_REPLACEMENTS[n]+'" data-twitch-emote="'+n)}}return t},o.prototype.tokenize_title_emotes=function(t){var e=this,s=App.__container__.lookup("controller:channel"),o=s&&s.get("product.emoticons"),n=[];return _.isString(t)&&(t=[t]),_.each(_.union(e.__twitch_global_emotes||[],o),function(e){if(e&&"inactive"!==e.state){var s=new RegExp("\\b"+e.regex+"\\b");_.any(t,function(t){return _.isString(t)&&t.match(s)})&&n.push(e)}}),(void 0===e.__twitch_global_emotes||null===e.__twitch_global_emotes)&&(e.__twitch_global_emotes=!1,Twitch.api.get("chat/emoticon_images",{emotesets:"0,42"}).done(function(t){if(!t||!t.emoticon_sets||!t.emoticon_sets[0])return void(e.__twitch_global_emotes=[]);var s=e.__twitch_global_emotes=[];t=t.emoticon_sets[0];for(var o=0;o<t.length;o++){var n=t[o];s.push({regex:n.code,url:a+n.id+"/1.0"})}e._cindex&&e._cindex.ffzFixTitle()}).fail(function(){setTimeout(function(){e.__twitch_global_emotes=null},5e3)})),n.length?("string"==typeof t&&(t=[t]),_.each(n,function(e){var s={isEmoticon:!0,srcSet:e.url+" 1x",emoticonSrc:e.url,altText:e.regex},o=new RegExp("\\b"+e.regex+"\\b");t=_.compact(_.flatten(_.map(t,function(t){if(_.isObject(t))return t;var e=t.split(o),n=[];return e.forEach(function(t,o){n.push(t),o!==e.length-1&&n.push(s)}),n})))}),t):t},o.prototype.tokenize_emotes=function(t,e,s,o){var n=this,i=this.getEmotes(t,e),a=[];return _.each(i,function(t){var e=n.emote_sets[t];e&&_.each(e.emoticons,function(t){_.any(s,function(e){return _.isString(e)&&e.match(t.regex)})&&a.push(t)})}),a.length?("string"==typeof s&&(s=[s]),_.each(a,function(t){var i={srcSet:t.srcSet,emoticonSrc:t.urls[1]+'" data-ffz-emote="'+encodeURIComponent(JSON.stringify([t.id,t.set_id])),ffzEmote:t.id,ffzEmoteSet:t.set_id,altText:t.hidden?"???":t.name};s=_.compact(_.flatten(_.map(s,function(s){if(_.isObject(s))return s;for(var a=s.split(t.regex),r=[];a.length;){var d=a.shift();a.length?(d+=a.shift(),d&&r.push(d),a.shift(),r.push(i),o&&e&&n.add_usage(e,t.id)):r.push(d)}return r})))}),s):s},o.prototype.tokenize_emoji=function(t){if("string"==typeof t&&(t=[t]),!this.emoji_data)return t;var e=this;return _.compact(_.flatten(_.map(t,function(t){if(_.isObject(t))return t;for(var s=t.split(i.EMOJI_REGEX),o=[];s.length;){var a=s.shift();if(a&&o.push(a),s.length){var r=s.shift(),d=s.shift();if("︎"===d)o.push(r);else{var u=n.emoji_to_codepoint(r,d),c=e.emoji_data[u];o.push(c?c.token:r+(d||""))}}}return o})))},o._regex_cache={},o._get_regex=function(t){return o._regex_cache[t]=o._regex_cache[t]||RegExp("\\b"+r(t)+"\\b","ig")},o._words_to_regex=function(t){var e=o._regex_cache[t];if(!e){for(var s="",n=0;n<t.length;n++)t[n]&&(s+=(s?"|":"")+r(t[n]));e=o._regex_cache[t]=new RegExp("(^|.*?"+u+")("+s+")(?=$|"+u+")","ig")}return e},o.prototype.tokenize_mentions=function(t){var e=this.settings.keywords;if(!e||!e.length)return t;"string"==typeof t&&(t=[t]);for(var s=o._words_to_regex(e),n=[],i=0;i<t.length;i++){var a=t[i];_.isString(a)&&a.match(s)?(a=a.replace(s,function(t,e,s){return n.push(e),n.push({mentionedUser:s,own:!1}),""}),a&&n.push(a)):n.push(a)}return n},o.prototype._deleted_link_click=function(t){if(!this.classList.contains("deleted-link"))return!0;var e=this.getAttribute("data-url"),s=e,o=FrankerFaceZ.get();this.classList.remove("deleted-link"),this.removeAttribute("data-url"),this.removeAttribute("title"),this.removeAttribute("original-title"),e.indexOf("@")>-1&&(-1===e.indexOf("/")||e.indexOf("@")<e.indexOf("/"))?e="mailto:"+e:e.match(/^https?:\/\//)||(e="http://"+e),this.href=e,this.target="_new",this.textContent=s;var n=o._link_data[s];n&&"boolean"!=typeof n&&(this.title=n.tooltip,n.unsafe&&this.classList.add("unsafe-link")),t.preventDefault()}},{"./constants":4,"./utils":33}],21:[function(e){var s=t.FrankerFaceZ,o=e("../constants");s.menu_pages.about={name:"About",icon:o.HEART,sort_order:1e5,render:function(t,e){var o=this.rooms[t.get("context.currentRoom.id")],n=!1,i=this;if(o&&o.set){var a=this.emote_sets[o.set];a&&a.count>0&&(n=!0)}var r=document.createElement("div"),d="";d+="<h1>FrankerFaceZ</h1>",d+='<div class="ffz-about-subheading">new ways to woof</div>',r.className="chat-menu-content center",r.innerHTML=d,e.appendChild(r);var u=0,c=r.querySelector("h1");c&&c.addEventListener("click",function(){if(c.style.cursor="pointer",u++,u>=3){u=0;var t=document.querySelector(".app-main")||document.querySelector(".ember-chat-container");t&&t.classList.toggle("ffz-flip")}setTimeout(function(){u=0,c.style.cursor=""},2e3)});var l=document.createElement("div"),h=document.createElement("a"),f="To use custom emoticons in "+(n?"this channel":"tons of channels")+", get FrankerFaceZ from http://www.frankerfacez.com";
|
||
h.className="button primary",h.innerHTML="Advertise in Chat",h.addEventListener("click",this._add_emote.bind(this,t,f)),l.appendChild(h);var _=document.createElement("a");_.className="button ffz-donate",_.href="https://www.frankerfacez.com/donate",_.target="_new",_.innerHTML="Donate",l.appendChild(_),l.className="chat-menu-content center",e.appendChild(l);var m=document.createElement("div");d='<table class="ffz-about-table">',d+='<tr><th colspan="4">Developers</th></tr>',d+='<tr><td>Dan Salvato</td><td><a class="twitch" href="http://www.twitch.tv/dansalvato" title="Twitch" target="_new"> </a></td><td><a class="twitter" href="https://twitter.com/dansalvato1" title="Twitter" target="_new"> </a></td><td><a class="youtube" href="https://www.youtube.com/user/dansalvato1" title="YouTube" target="_new"> </a></td></tr>',d+='<tr><td>Stendec</td><td><a class="twitch" href="http://www.twitch.tv/sirstendec" title="Twitch" target="_new"> </a></td><td><a class="twitter" href="https://twitter.com/SirStendec" title="Twitter" target="_new"> </a></td><td><a class="youtube" href="https://www.youtube.com/channel/UCnxuvmK1DCPCXSJ-mXIh4KQ" title="YouTube" target="_new"> </a></td></tr>',d+='<tr class="debug"><td>Version '+s.version_info+'</td><td colspan="3"><a href="#" id="ffz-debug-logs">Logs</a></td></tr>',m.className="chat-menu-content center",m.innerHTML=d;var p=!1;m.querySelector("#ffz-debug-logs").addEventListener("click",function(){p||(p=!0,i._pastebin(i._log_data.join("\n"),function(t){p=!1,t?prompt("Your FrankerFaceZ logs have been uploaded to the URL:",t):alert("There was an error uploading the FrankerFaceZ logs.")}))}),e.appendChild(m)}}},{"../constants":4}],22:[function(e){var s=t.FrankerFaceZ,o=e("../constants");s.settings_info.twitch_chat_dark={type:"boolean",value:!1,visible:!1},s.settings_info.dark_twitch={type:"boolean",value:!1,no_bttv:!0,category:"Appearance",name:"Dark Twitch",help:"Apply a dark background to channels and other related pages for easier viewing.",on_update:function(e){var s=document.querySelector("input.ffz-setting-dark-twitch");if(s&&(s.checked=e),!this.has_bttv){document.body.classList.toggle("ffz-dark",e);var o=t.App?App.__container__.lookup("controller:settings").get("model"):void 0;e?(this._load_dark_css(),o&&this.settings.set("twitch_chat_dark",o.get("darkMode")),o&&o.set("darkMode",!0)):o&&o.set("darkMode",this.settings.twitch_chat_dark)}}},s.settings_info.dark_no_blue={type:"boolean",value:!1,category:"Appearance",name:"Gray Chat (no blue)",help:"Make the dark theme for chat and a few other places on Twitch a bit darker and not at all blue.",on_update:function(t){document.body.classList.toggle("ffz-no-blue",t)}},s.settings_info.hide_recent_past_broadcast={type:"boolean",value:!1,no_mobile:!0,category:"Channel Metadata",name:'Hide "Watch Last Broadcast"',help:'Hide the "Watch Last Broadcast" banner at the top of offline Twitch channels.',on_update:function(t){document.body.classList.toggle("ffz-hide-recent-past-broadcast",t)}},s.prototype.setup_dark=function(){document.body.classList.toggle("ffz-hide-recent-past-broadcast",this.settings.hide_recent_past_broadcast),document.body.classList.toggle("ffz-no-blue",this.settings.dark_no_blue),this.has_bttv||(document.body.classList.toggle("ffz-dark",this.settings.dark_twitch),this.settings.dark_twitch&&(t.App&&App.__container__.lookup("controller:settings").set("model.darkMode",!0),this._load_dark_css()))},s.prototype._load_dark_css=function(){if(!this._dark_style){this.log("Injecting FrankerFaceZ Dark Twitch CSS.");var t=this._dark_style=document.createElement("link");t.id="ffz-dark-css",t.setAttribute("rel","stylesheet"),t.setAttribute("href",o.SERVER+"script/dark.css?_="+(o.DEBUG?Date.now():s.version_info)),document.head.appendChild(t)}}},{"../constants":4}],23:[function(e){var s=t.FrankerFaceZ,o=e("../utils");s.settings_info.following_count={type:"boolean",value:!0,no_bttv:!0,no_mobile:!0,category:"Appearance",name:"Sidebar Following Count",help:"Display the number of live channels you're following on the sidebar.",on_update:function(){this._schedule_following_count();var e=t.App&&App.__container__.resolve("model:stream"),s=e&&e.find("live");s?this._draw_following_count(s.get("total")||0):this._update_following_count()}},s.prototype.setup_following_count=function(e){if(this.settings.following_count&&this._schedule_following_count(),!e)return this._update_following_count();this.log("Connecting to Live Streams model.");var s=t.App&&App.__container__.resolve("model:stream");if(!s)return this.log("Unable to find Stream model.");var o=s.find("live"),n=this;if(!o)return this.log("Unable to find Live Streams collection.");o.addObserver("total",function(){n._draw_following_count(this.get("total"))}),o.load();var i=o.get("total");"number"==typeof i&&this._draw_following_count(i)},s.prototype._schedule_following_count=function(){return this.has_bttv||!this.settings.following_count?void(this._following_count_timer&&(clearTimeout(this._following_count_timer),this._following_count_timer=void 0)):void(this._following_count_timer||(this._following_count_timer=setTimeout(this._update_following_count.bind(this),6e4)))},s.prototype._update_following_count=function(){if(!this.settings.following_count)return void(this._following_count_timer&&(clearTimeout(this._following_count_timer),this._following_count_timer=void 0));this._following_count_timer=setTimeout(this._update_following_count.bind(this),6e4);var e=t.App&&App.__container__.resolve("model:stream"),s=e&&e.find("live"),o=this;s?s.load():Twitch.api.get("streams/followed",{limit:1,offset:0},{version:3}).done(function(t){o._draw_following_count(t._total)}).fail(function(){o._draw_following_count()})},s.prototype._draw_following_count=function(t){var e=document.querySelector('#small_nav ul.game_filters li[data-name="following"] a');if(e){var s=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?o.format_unread(t):"")}var n=document.querySelector('#large_nav #nav_personal li[data-name="following"] a');if(n){var s=n.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",n.appendChild(s)),s.innerHTML=t?o.format_unread(t):"")}var i=document.querySelector("#header_actions #header_following");if(i){var s=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?o.format_unread(t):"")}}},{"../utils":33}],24:[function(e){{var s=t.FrankerFaceZ;e("../utils")}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().split(/\s*,+\s*/),e.length&&""===e[0]&&e.shift(),e.length&&""===e[e.length-1]&&e.pop();var s=this.get_user(),o=this;return!s||s.login!==t.id&&"sirstendec"!==s.login&&"dansalvato"!==s.login?"You must be logged in as the broadcaster to use this command.":this.ws_send("update_follow_buttons",[t.id,e],function(e,s){return e?void(s?o.room_message(t,"The following buttons have been updated."):o.room_message(t,"The following buttons have been disabled.")):void o.room_message(t,"There was an error updating the following buttons.")})?void 0:"There was an error communicating with the server."},s.ws_on_close.push(function(){var e=t.App&&App.__container__.lookup("controller:channel"),s=e&&e.get("id"),o=e&&e.get("hostModeTarget.id"),n=!1;if(this.follow_sets={},e){for(var i in this.follow_data)if(delete this.follow_data[i],(i===s||i===o)&&(n=!0),this.rooms&&this.rooms[i]&&this.rooms[i].extra_sets){var a=this.rooms[i].extra_sets;delete this.rooms[i].extra_sets;for(var r=0;r<a.length;r++){var d=this.emote_sets[a[r]];d&&(d.users.removeObject(i),this.global_sets.contains(a[r])||d.users.length||this.unload_set(a[r]))}}n&&this.rebuild_following_ui()}}),s.ws_commands.follow_buttons=function(e){var s=t.App&&App.__container__.lookup("controller:channel"),o=s&&s.get("id"),n=s&&s.get("hostModeTarget.id"),i=!1;this.follow_data=this.follow_data||{};for(var a in e)this.follow_data[a]=e[a],(a===o||a===n)&&(i=!0);i&&this.rebuild_following_ui()},s.ws_commands.follow_sets=function(t){{var e=App.__container__.lookup("controller:channel");e&&e.get("id"),e&&e.get("hostModeTarget.id")}this.follow_sets=this.follow_sets||{};for(var s in t)if(this.rooms&&this.rooms.hasOwnProperty(s)){for(var o=this.rooms[s].extra_sets||[],n=this.rooms[s].extra_sets=t[s],i=0;i<o.length;i++){var a=o[i];if(-1===n.indexOf(a)){var r=this.emote_sets&&this.emote_sets[a];r&&(r.users.removeObject(s),this.global_sets.contains(a)||r.users.length||this.unload_set(a))}}for(var i=0;i<n.length;i++){var a=n[i],r=this.emote_sets&&this.emote_sets[a];r?-1===r.users.indexOf(s)&&r.users.push(s):this.load_set(a,function(t,e){t&&e.users.push(s)})}}else this.follow_sets[s]=t[s]},s.prototype.rebuild_following_ui=function(){var t=App.__container__.lookup("controller:channel"),e=t&&t.get("id"),s=t&&t.get("hostModeTarget.id");if(this._cindex){if(e){var o=this.follow_data&&this.follow_data[e],n=this._cindex.get("element"),i=n&&n.querySelector(".stats-and-actions .channel-actions"),a=i&&i.querySelector("#ffz-ui-following");if(i&&this.settings.follow_buttons&&o&&o.length){if(a)a.innerHTML="";else{a=document.createElement("span"),a.id="ffz-ui-following";var r=i.querySelector(":scope > span");r?i.insertBefore(a,r):i.appendChild(a)}for(var d=0;d<o.length;d++)this._build_following_button(a,o[d])}else a&&a.parentElement.removeChild(a)}if(s){var o=this.follow_data&&this.follow_data[s],n=this._cindex.get("element"),i=n&&n.querySelector("#hostmode .channel-actions"),a=i&&i.querySelector("#ffz-ui-following");if(i&&this.settings.follow_buttons&&o&&o.length){if(a)a.innerHTML="";else{a=document.createElement("span"),a.id="ffz-ui-following";var r=i.querySelector(":scope > span");r?i.insertBefore(a,r):i.appendChild(a)}for(var d=0;d<o.length;d++)this._build_following_button(a,o[d])}else a&&a.parentElement.removeChild(a)}}},s.prototype._build_following_button=function(t,e){var o,n=document.createElement("a"),i=this,a=document.createElement("div"),r=document.createElement("a"),d=document.createElement("div"),u=!1,c=!1,l=function(){a.classList.toggle("is-following",u),n.title=(u?"Unf":"F")+"ollow "+o,n.innerHTML=(u?"":"Follow ")+o,d.classList.toggle("hidden",!u)},h=function(){var t=i.get_user();return t&&t.login?void Twitch.api.get("users/"+t.login+"/follows/channels/"+e).done(function(t){u=!0,c=t.notifications,a.classList.add("is-initialized"),l()}).fail(function(){u=!1,c=!1,a.classList.add("is-initialized"),l()}):(u=!1,notification=!1,a.classList.add("is-initialized"),l())},f=function(t){t!==!1&&(t=!0);var s=i.get_user();return s&&s.login?(c=t,Twitch.api.put("users/:login/follows/channels/"+e,{notifications:c}).fail(h)):null},_=function(t){o=t||e,l()};a.className="ember-follow follow-button",a.appendChild(n),r.className="toggle-notification-menu js-toggle-notification-menu",r.href="#",d.className="notification-controls v2 hidden",d.appendChild(r),n.addEventListener("click",function(){var t=i.get_user();return t&&t.login?(u=!u,l(),i.ws_send("track_follow",[e,u]),u?f():Twitch.api.del("users/:login/follows/channels/"+e).done(h),!1):Ember.$.login({mpSourceAction:"follow-button",follow:e})}),r.addEventListener("click",function(){var t=i._build_following_popup(d,e,c);return t&&t.addEventListener("click",function(){var e=!c;return t.classList.toggle("active",e),f(e),!1}),!1}),o=s.get_capitalization(e,_),l(),h(),t.appendChild(a),t.appendChild(d)},s.prototype._build_following_popup=function(t,e,o){var n=this._popup,i="",a=t.offsetLeft+t.offsetWidth;return n&&(n.parentElement.removeChild(n),delete this._popup,this._popup_kill&&this._popup_kill(),delete this._popup_kill,"ffz-following-popup"==n.id&&n.getAttribute("data-channel")===e)?null:(n=this._popup=document.createElement("div"),n.id="ffz-following-popup",n.setAttribute("data-channel",e),n.className=(a>=300?"right":"left")+" dropmenu notify-menu js-notify",i='<div class="header">You are following '+s.get_capitalization(e)+"</div>",i+='<p class="clearfix">',i+='<a class="switch'+(o?" active":"")+'"><span></span></a>',i+='<span class="switch-label">Notify me when the broadcaster goes live</span>',i+="</p>",n.innerHTML=i,t.appendChild(n),n.querySelector("a.switch"))}},{"../utils":33}],25:[function(e){var s=t.FrankerFaceZ,o=e("../constants"),n=e("../utils"),i="http://static-cdn.jtvnw.net/emoticons/v1/";s.prototype.setup_menu=function(){this.log("Installing mouse-up event to auto-close menus.");var e=this;jQuery(document).mouseup(function(t){var s,o=e._popup;o&&(o=jQuery(o),s=o.parent(),s.is(t.target)||0!==s.has(t.target).length||(o.remove(),delete e._popup,e._popup_kill&&e._popup_kill(),delete e._popup_kill))}),document.body.classList.toggle("ffz-menu-replace",this.settings.replace_twitch_menu),this.log("Hooking the Ember Chat Settings view.");var s=t.App&&App.__container__.resolve("view:settings");if(s){s.reopen({didInsertElement:function(){this._super();try{this.ffzInit()}catch(t){e.error("ChatSettings didInsertElement: "+t)}},willClearRender:function(){try{this.ffzTeardown()}catch(t){e.error("ChatSettings willClearRender: "+t)}this._super()},ffzInit:function(){var t=this,s=this.get("element"),o=s&&s.querySelector(".dropmenu");if(o){var n,i,a,r=document.createElement("div"),d=document.createElement("div");r.className="list-header",r.innerHTML="FrankerFaceZ",d.className="chat-menu-content",n=document.createElement("p"),n.className="no-bttv",i=document.createElement("input"),i.type="checkbox",i.className="ember-checkbox ffz-setting-dark-twitch",i.checked=e.settings.dark_twitch,n.appendChild(i),n.appendChild(document.createTextNode("Dark Twitch")),d.appendChild(n),i.addEventListener("change",function(){e.settings.set("dark_twitch",this.checked)}),n=document.createElement("p"),i=document.createElement("input"),i.type="checkbox",i.className="ember-checkbox ffz-setting-hosted-channels",i.checked=e.settings.hosted_channels,n.appendChild(i),n.appendChild(document.createTextNode("Channel Hosting")),d.appendChild(n),i.addEventListener("change",function(){e.settings.set("hosted_channels",this.checked)}),n=document.createElement("p"),a=document.createElement("a"),a.href="#",a.innerHTML="More Settings",n.appendChild(a),d.appendChild(n),a.addEventListener("click",function(s){return t.set("controller.model.hidden",!0),e._last_page="settings",e.build_ui_popup(e._chatv),s.stopPropagation(),!1}),o.appendChild(r),o.appendChild(d)}},ffzTeardown:function(){}});try{s.create().destroy()}catch(o){}for(var n in Ember.View.views)if(Ember.View.views.hasOwnProperty(n)){var i=Ember.View.views[n];if(i instanceof s){this.log("Manually updating existing Chat Settings view.",i);try{i.ffzInit()}catch(o){this.error("setup: ChatSettings ffzInit: "+o)}}}}},s.menu_pages={},s.prototype.build_ui_popup=function(t){var e=this._popup;if(e)return e.parentElement.removeChild(e),delete this._popup,this._popup_kill&&this._popup_kill(),void delete this._popup_kill;var n=document.createElement("div"),i=document.createElement("div"),a=document.createElement("ul"),r=this.has_bttv?BetterTTV.settings.get("darkenedMode"):!1;n.className="emoticon-selector chat-menu ffz-ui-popup",i.className="emoticon-selector-box dropmenu",n.appendChild(i),n.classList.toggle("dark",r);var d=document.createElement("div");d.className="ffz-ui-menu-page",i.appendChild(d),a.className="menu clearfix",i.appendChild(a);var u=document.createElement("li");u.className="title",u.innerHTML="<span>"+(o.DEBUG?"[DEV] ":"")+"FrankerFaceZ</span>",a.appendChild(u);var c=[];for(var l in s.menu_pages)if(s.menu_pages.hasOwnProperty(l)){var h=s.menu_pages[l];try{if(!h||h.hasOwnProperty("visible")&&(!h.visible||"function"==typeof h.visible&&!h.visible.bind(this)(t)))continue}catch(f){this.error("menu_pages "+l+" visible: "+f);continue}c.push([h.sort_order||0,l,h])}c.sort(function(t,e){if(t[0]<e[0])return 1;if(t[0]>e[0])return-1;var s=t[1].toLowerCase(),o=e[1].toLowerCase();return o>s?1:s>o?-1:0});for(var _=0;_<c.length;_++){var l=c[_][1],h=c[_][2],m=document.createElement("li"),p=document.createElement("a");m.className="item",m.id="ffz-menu-page-"+l,p.title=h.name,p.innerHTML=h.icon,jQuery(p).tipsy(),p.addEventListener("click",this._ui_change_page.bind(this,t,i,a,d,l)),m.appendChild(p),a.appendChild(m)}this._ui_change_page(t,i,a,d,this._last_page||"channel"),this._popup=n,d.style.maxHeight=Math.max(200,t.$().height()-472)+"px",t.$(".chat-interface").append(n)},s.prototype._ui_change_page=function(t,e,o,n,i){this._last_page=i,n.innerHTML="",n.setAttribute("data-page",i);var a=document.querySelector(".app-main")||document.querySelector(".ember-chat-container");e.style.maxWidth=!s.menu_pages[i].wide||"function"==typeof s.menu_pages[i].wide&&!s.menu_pages[i].wide.bind(this)()?"":(a.offsetWidth<640?a.offsetWidth-40:600)+"px";for(var r=o.querySelectorAll("li.active"),d=0;d<r.length;d++)r[d].classList.remove("active");var u=o.querySelector("#ffz-menu-page-"+i);u?u.classList.add("active"):this.log("No matching page: "+i),s.menu_pages[i].render.bind(this)(t,n)},s.menu_pages.channel={render:function(t,e){var o=t.get("controller.currentRoom.id"),a=this.rooms[o],r=!1;if(this.settings.replace_twitch_menu){var d=a.room.get("product");if(d&&!d.get("error")){r=!0;var u=App.__container__.resolve("model:ticket").find("user",{channel:o}),c=u?u.get("content"):!1,l=u?u.get("isLoaded"):!1,h=a.room.get("badgeSet.subscriber.image"),f=document.createElement("div"),_=document.createElement("div"),m=0;if(c=c&&c.length>0,u&&!c&&!l){var p=this;u.addObserver("isLoaded",function(){setTimeout(function(){"channel"===e.getAttribute("data-page")&&(e.innerHTML="",s.menu_pages.channel.render.bind(p)(t,e))},0)}),u.load()}f.className="emoticon-grid",_.className="heading",h&&(_.style.backgroundImage='url("'+h+'")'),_.innerHTML='<span class="right">Twitch</span>Subscriber Emoticons',f.appendChild(_);for(var g=d.get("emoticons")||[],v=0;v<g.length;v++){var b=g[v];if("active"===b.state){var y=document.createElement("span"),w=c||!b.subscriber_only,z='image-set(url("'+i+b.id+'/1.0") 1x, url("'+i+b.id+'/2.0") 2x, url("'+i+b.id+'/3.0") 4x)';y.className="emoticon tooltip"+(w?"":" locked"),y.style.backgroundImage='url("'+i+b.id+'/1.0")',y.style.backgroundImage="-webkit-"+z,y.style.backgroundImage="-moz-"+z,y.style.backgroundImage="-ms-"+z,y.style.backgroundImage=z,y.style.width=b.width+"px",y.style.height=b.height+"px",y.title=b.regex,w&&y.addEventListener("click",this._add_emote.bind(this,t,b.regex)),f.appendChild(y),m++}}if(m>0&&e.appendChild(f),m>0&&!c){var k=document.createElement("div"),C=document.createElement("div"),E=document.createElement("span"),T=document.createElement("a");k.className="subscribe-message",C.className="non-subscriber-message",k.appendChild(C),E.className="unlock-text",E.innerHTML="Subscribe to unlock Emoticons",C.appendChild(E),T.className="action subscribe-button button primary",T.href=d.get("product_url"),T.innerHTML='<span class="subscribe-text">Subscribe</span><span class="subscribe-price">'+d.get("price")+"</span>",C.appendChild(T),e.appendChild(k)}else if(m>0){var x=u.get("content");if(x=x.length>0?x[x.length-1]:void 0,x&&x.purchase_profile&&!x.purchase_profile.will_renew){var L=n.parse_date(x.access_end||"");k=document.createElement("div"),C=document.createElement("div"),E=document.createElement("span"),end_time=L?Math.floor((L.getTime()-Date.now())/1e3):null,k.className="subscribe-message",C.className="non-subscriber-message",k.appendChild(C),E.className="unlock-text",E.innerHTML="Subscription expires in "+n.time_to_string(end_time,!0,!0),C.appendChild(E),e.appendChild(k)}}}}var S=a&&a.extra_sets||[];this._emotes_for_sets(e,t,a&&a.set&&[a.set]||[],this.feature_friday||r||S.length?"Channel Emoticons":null,"http://cdn.frankerfacez.com/script/devicon.png","FrankerFaceZ");for(var v=0;v<S.length;v++){var M=this.emote_sets[S[v]],A=M?"Featured "+M.title:"Featured Channel";this._emotes_for_sets(e,t,[S[v]],A,"http://cdn.frankerfacez.com/script/devicon.png","FrankerFaceZ")}this._feature_friday_ui(o,e,t)},name:"Channel",icon:o.ZREKNARF},s.prototype._emotes_for_sets=function(t,e,s,o,n,i){var a=document.createElement("div"),r=0;if(a.className="emoticon-grid",null!=o){var d=document.createElement("div");if(d.className="heading",i){var u=document.createElement("span");u.className="right",u.appendChild(document.createTextNode(i)),d.appendChild(u)}d.appendChild(document.createTextNode(o)),n&&(d.style.backgroundImage='url("'+n+'")'),a.appendChild(d)}for(var c=[],l=0;l<s.length;l++){var h=this.emote_sets[s[l]];if(h&&h.emoticons)for(var f in h.emoticons)h.emoticons.hasOwnProperty(f)&&!h.emoticons[f].hidden&&c.push(h.emoticons[f])}c.sort(function(t,e){var s=t.name.toLowerCase(),o=e.name.toLowerCase();return o>s?-1:s>o?1:0});for(var l=0;l<c.length;l++){var _=c[l],m=null;(_.urls[2]||_.urls[4])&&(m='url("'+_.urls[1]+'") 1x',_.urls[2]&&(m+=', url("'+_.urls[2]+'") 2x'),_.urls[4]&&(m+=', url("'+_.urls[4]+'") 4x')),r++;var u=document.createElement("span");if(u.className="emoticon tooltip",u.style.backgroundImage='url("'+_.urls[1]+'")',m){var p="image-set("+m+")";u.style.backgroundImage="-webkit-"+p,u.style.backgroundImage="-moz-"+p,u.style.backgroundImage="-ms-"+p,u.style.backgroundImage=p}u.style.width=_.width+"px",u.style.height=_.height+"px",u.title=this._emote_tooltip(_),u.addEventListener("click",this._add_emote.bind(this,e,_.name)),a.appendChild(u)}r||(a.innerHTML+="This channel has no emoticons.",a.className="emoticon-grid ffz-no-emotes center"),t.appendChild(a)},s.prototype._add_emote=function(t,e){var s,o,n;this.has_bttv?(s=t.get("element").querySelector("textarea"),o=s.value):(n=t.get("controller.currentRoom"),o=n.get("messageToSend")||""),o+=(o&&" "!==o.substr(-1)?" ":"")+(e.name||e),s?s.value=o:n.set("messageToSend",o)}},{"../constants":4,"../utils":33}],26:[function(e){var s=t.FrankerFaceZ,o=e("../constants");s.prototype.build_ui_link=function(t){var e=document.createElement("a");return e.className="ffz-ui-toggle",e.innerHTML=o.CHAT_BUTTON,e.addEventListener("click",this.build_ui_popup.bind(this,t)),this.update_ui_link(e),e},s.prototype.update_ui_link=function(e){var s=t.App&&App.__container__.lookup("controller:chat");if(e=e||document.querySelector("a.ffz-ui-toggle"),e&&s){var o=s.get("currentRoom.id"),n=this.rooms[o],i=!1,a=this.has_bttv?BetterTTV.settings.get("darkenedMode"):!1,r=this.has_bttv?BetterTTV.settings.get("showBlueButtons"):!1,d=this.feature_friday&&this.feature_friday.live;if(n&&n.set){var u=this.emote_sets[n.set];u&&u.count>0&&(i=!0)}e.classList.toggle("no-emotes",!i),e.classList.toggle("live",d),e.classList.toggle("dark",a),e.classList.toggle("blue",r)}}},{"../constants":4}],27:[function(e){var s=t.FrankerFaceZ,o=e("../constants"),n=e("../utils"),i="http://static-cdn.jtvnw.net/emoticons/v1/";s.settings_info.replace_twitch_menu={type:"boolean",value:!1,category:"Chat Input",name:"Replace Twitch Emoticon Menu",help:"Completely replace the default Twitch emoticon menu.",on_update:function(t){document.body.classList.toggle("ffz-menu-replace",t)}},s.settings_info.global_emotes_in_menu={type:"boolean",value:!1,category:"Chat Input",name:"Display Global Emotes in My Emotes",help:"Display the global Twitch emotes in the My Emoticons menu."},s.settings_info.emoji_in_menu={type:"boolean",value:!1,category:"Chat Input",name:"Display Emoji in My Emotes",help:"Display the supported emoji images in the My Emoticons menu."},s.settings_info.emote_menu_collapsed={value:[],visible:!1},s.prototype.setup_my_emotes=function(){if(this._twitch_set_to_channel={},this._twitch_badges={},localStorage.ffzTwitchSets)try{this._twitch_set_to_channel=JSON.parse(localStorage.ffzTwitchSets),this._twitch_badges=JSON.parse(localStorage.ffzTwitchBadges)}catch(t){}this._twitch_set_to_channel[0]="global",this._twitch_set_to_channel[33]="turbo_faces",this._twitch_set_to_channel[42]="turbo_faces",this._twitch_badges.global="//cdn.frankerfacez.com/script/twitch_logo.png",this._twitch_badges.turbo_faces=this._twitch_badges.turbo="//cdn.frankerfacez.com/script/turbo_badge.png"},s.menu_pages.my_emotes={name:"My Emoticons",icon:o.EMOTE,visible:function(t){var e=this.get_user(),s=t.get("controller.currentRoom.tmiSession"),o=e&&this.users[e.login]&&this.users[e.login].sets||[],n=(s&&s.getEmotes()||{emoticon_sets:{}}).emoticon_sets;return o.length||n&&Object.keys(n).length},render:function(t,e){var o=t.get("controller.currentRoom.tmiSession"),n=(o&&o.getEmotes()||{emoticon_sets:{}}).emoticon_sets,i=[];for(var a in n)n.hasOwnProperty(a)&&!this._twitch_set_to_channel.hasOwnProperty(a)&&i.push(a);if(!i.length)return s.menu_pages.my_emotes.draw_menu.bind(this)(t,e,n);var r=this,d=function(){if(i.length){i=[];var o={};for(var a in n)r._twitch_set_to_channel[a]&&(o[a]=n[a]);return s.menu_pages.my_emotes.draw_menu.bind(r)(t,e,o)}};this.ws_send("twitch_sets",i,function(o,a){if(i.length){if(i=[],o){for(var u in a)a.hasOwnProperty(u)&&(r._twitch_set_to_channel[u]=a[u]);return localStorage.ffzTwitchSets=JSON.stringify(r._twitch_set_to_channel),s.menu_pages.my_emotes.draw_menu.bind(r)(t,e,n)}d()}})?setTimeout(d,2e3):d()},toggle_section:function(t){var e=t.parentElement,s=e.getAttribute("data-set"),o=this.settings.emote_menu_collapsed,n=-1!==o.indexOf(s);n?o.removeObject(s):o.push(s),this.settings.set("emote_menu_collapsed",o),e.classList.toggle("collapsed",!n)},draw_emoji:function(t){var e=document.createElement("div"),n=document.createElement("div"),i=this;e.className="heading",e.innerHTML='<span class="right">FrankerFaceZ</span>Emoji',n.className="emoticon-grid collapsable",n.appendChild(e),n.setAttribute("data-set","emoji"),n.classList.toggle("collapsed",-1!==this.settings.emote_menu_collapsed.indexOf("emoji")),e.addEventListener("click",function(){s.menu_pages.my_emotes.toggle_section.bind(i)(this)});var a=[];for(var r in this.emoji_data)a.push(this.emoji_data[r]);a.sort(function(t,e){var s=t.short_name.toLowerCase(),o=e.short_name.toLowerCase();return o>s?-1:s>o?1:t.raw<e.raw?-1:t.raw>e.raw?1:0});for(var d=0;d<a.length;d++){var u=a[d],c=document.createElement("span"),l='image-set(url("'+u.src+'") 1x, url("'+o.SERVER+"emoji/"+u.code+'-2x.png") 2x, url("'+o.SERVER+"emoji/"+u.code+'-4x.png") 4x)';c.className="emoticon tooltip",c.title="Emoji: "+u.raw+"\nName: :"+u.short_name+":",c.addEventListener("click",this._add_emote.bind(this,t,u.raw)),c.style.backgroundImage='url("'+u.src+'")',c.style.backgroundImage="-webkit-"+l,c.style.backgroundImage="-moz-"+l,c.style.backgroundImage="-ms-"+l,c.style.backgroudnImage=l,n.appendChild(c)}return n},draw_twitch_set:function(t,e,a){var r,d=document.createElement("div"),u=document.createElement("div"),c=this,l=this._twitch_set_to_channel[e];if(r="global"===l?"Global Emoticons":"turbo"===l||"turbo_faces"===l?"Twitch Turbo":s.get_capitalization(l,function(t){d.innerHTML='<span class="right">Twitch</span>'+n.sanitize(t)}),d.className="heading",d.innerHTML='<span class="right">Twitch</span>'+n.sanitize(r),this._twitch_badges[l])d.style.backgroundImage='url("'+this._twitch_badges[l]+'")';else{var c=this;Twitch.api.get("chat/"+l+"/badges",null,{version:3}).done(function(t){t.subscriber&&t.subscriber.image&&(c._twitch_badges[l]=t.subscriber.image,localStorage.ffzTwitchBadges=JSON.stringify(c._twitch_badges),d.style.backgroundImage='url("'+t.subscriber.image+'")')})}u.className="emoticon-grid collapsable",u.appendChild(d),u.setAttribute("data-set","twitch-"+e),u.classList.toggle("collapsed",-1!==this.settings.emote_menu_collapsed.indexOf("twitch-"+e)),d.addEventListener("click",function(){s.menu_pages.my_emotes.toggle_section.bind(c)(this)}),a.sort(function(t,e){var s=t.code.toLowerCase(),o=e.code.toLowerCase();return o>s?-1:s>o?1:t.id<e.id?-1:t.id>e.id?1:0});for(var h=0;h<a.length;h++){var f=a[h],_=o.KNOWN_CODES[f.code]||f.code,m=document.createElement("span"),p='image-set(url("'+i+f.id+'/1.0") 1x, url("'+i+f.id+'/2.0") 2x, url("'+i+f.id+'/3.0") 4x)';m.className="emoticon tooltip",this.settings.replace_bad_emotes&&o.EMOTE_REPLACEMENTS[f.id]?m.style.backgroundImage='url("'+o.EMOTE_REPLACEMENT_BASE+o.EMOTE_REPLACEMENTS[f.id]+'")':(m.style.backgroundImage='url("'+i+f.id+'/1.0")',m.style.backgroundImage="-webkit-"+p,m.style.backgroundImage="-moz-"+p,m.style.backgroundImage="-ms-"+p,m.style.backgroudnImage=p),m.title=_,m.addEventListener("click",this._add_emote.bind(this,t,_)),u.appendChild(m)}return u},draw_ffz_set:function(t,e){var o=document.createElement("div"),n=document.createElement("div"),i=this,a=[];o.className="heading",o.innerHTML='<span class="right">FrankerFaceZ</span>'+e.title,o.style.backgroundImage='url("'+(e.icon||"//cdn.frankerfacez.com/script/devicon.png")+'")',n.className="emoticon-grid collapsable",n.appendChild(o),n.setAttribute("data-set","ffz-"+e.id),n.classList.toggle("collapsed",-1!==this.settings.emote_menu_collapsed.indexOf("ffz-"+e.id)),o.addEventListener("click",function(){s.menu_pages.my_emotes.toggle_section.bind(i)(this)});for(var r in e.emoticons)e.emoticons.hasOwnProperty(r)&&!e.emoticons[r].hidden&&a.push(e.emoticons[r]);a.sort(function(t,e){var s=t.name.toLowerCase(),o=e.name.toLowerCase();return o>s?-1:s>o?1:t.id<e.id?-1:t.id>e.id?1:0});for(var d=0;d<a.length;d++){var u=a[d],c=document.createElement("span"),l='image-set(url("'+u.urls[1]+'") 1x';u.urls[2]&&(l+=', url("'+u.urls[2]+'") 2x'),u.urls[4]&&(l+=', url("'+u.urls[4]+'") 4x'),l+=")",c.className="emoticon tooltip",c.style.backgroundImage='url("'+u.urls[1]+'")',c.style.backgroundImage="-webkit-"+l,c.style.backgroundImage="-moz-"+l,c.style.backgroundImage="-ms-"+l,c.style.backgroudnImage=l,u.height&&(c.style.height=u.height+"px"),u.width&&(c.style.width=u.width+"px"),c.title=this._emote_tooltip(u),c.addEventListener("click",this._add_emote.bind(this,t,u.name)),n.appendChild(c)}return n},draw_menu:function(t,e,o){if("my_emotes"===e.getAttribute("data-page")){e.innerHTML="";try{var n=this.get_user(),i=this.getEmotes(n&&n.login,null),a=[];for(var r in o)if(o.hasOwnProperty(r)&&(this.settings.global_emotes_in_menu||"0"!==r)){var d=o[r];d.length&&a.push([this._twitch_set_to_channel[r],s.menu_pages.my_emotes.draw_twitch_set.bind(this)(t,r,d)])}this.settings.emoji_in_menu&&a.push(["emoji",s.menu_pages.my_emotes.draw_emoji.bind(this)(t)]);for(var u=0;u<i.length;u++){var r=i[u],d=this.emote_sets[r];d&&d.count&&(this.settings.global_emotes_in_menu||-1===this.default_sets.indexOf(r))&&a.push([d.title.toLowerCase(),s.menu_pages.my_emotes.draw_ffz_set.bind(this)(t,d)])}a.sort(function(t,e){var s=t[0],o=e[0];return"turbo"===s||"turbo_faces"===s?s="zza|"+s:"global"===s||"global emoticons"===s?s="zzy|"+s:"emoji"===s&&(s="zzz|"+s),"turbo"===o||"turbo_faces"===o?o="zza|"+o:"global"===o||"global emoticons"===o?o="zzy|"+o:"emoji"===o&&(o="zzz|"+o),o>s?-1:s>o?1:0});for(var u=0;u<a.length;u++)e.appendChild(a[u][1])}catch(c){this.error("my_emotes draw_menu: "+c),e.innerHTML="";var l=document.createElement("div"),h=document.createElement("div"),f=document.createElement("p");h.className="heading",h.innerHTML="Error Loading Menu",l.appendChild(h),f.className="clearfix",f.textContent=c,l.appendChild(f),l.className="chat-menu-content",e.appendChild(l)}}}}},{"../constants":4,"../utils":33}],28:[function(){var e=t.FrankerFaceZ;e.prototype.setup_notifications=function(){this.log("Adding event handler for window focus."),t.addEventListener("focus",this.clear_notifications.bind(this))
|
||
},e.settings_info.highlight_notifications={type:"boolean",value:!1,category:"Chat Filtering",no_bttv:!0,no_mobile:!0,name:"Highlight Notifications",help:"Display notifications when a highlighted word appears in chat in an unfocused tab. This is automatically disabled on the dashboard.",on_update:function(t,e){if(t&&e){if("denied"===Notification.permission)return this.log("Notifications have been denied by the user."),void this.settings.set("highlight_notifications",!1);if("granted"!==Notification.permission){var s=this;Notification.requestPermission(function(t){"denied"===t&&(s.log("Notifications have been denied by the user."),s.settings.set("highlight_notifications",!1))})}}}},e.settings_info.notification_timeout={type:"button",value:60,category:"Chat Filtering",no_bttv:!0,no_mobile:!0,name:"Notification Timeout",help:"Specify how long notifications should be displayed before automatically closing.",method:function(){var t=this.settings.notification_timeout,e=prompt("Notification Timeout\n\nPlease enter the time you'd like notifications to be displayed before automatically closing, in seconds.\n\nDefault is: 60",t);if(null!==e&&void 0!==e){var s=parseInt(e);(0/0===s||1>s)&&(s=60),this.settings.set("notification_timeout",s)}}},e.ws_commands.message=function(t){this.show_message(t)},e._notifications={},e._last_notification=0,e.prototype.clear_notifications=function(){for(var t in e._notifications){var s=e._notifications[t];if(s)try{s.close()}catch(o){}}e._notifications={},e._last_notification=0},e.prototype.show_notification=function(t,s,o,n,i,a){var r=Notification.permission;if("denied "===r)return!1;if("granted"===r){s=s||"FrankerFaceZ",n=n||1e3*this.settings.notification_timeout;var d={lang:"en-US",dir:"ltr",body:t,tag:o||"FrankerFaceZ",icon:"http://cdn.frankerfacez.com/icon32.png"},u=this,c=new Notification(s,d),l=e._last_notification++;return e._notifications[l]=c,c.addEventListener("click",function(){delete e._notifications[l],i&&i.bind(u)()}),c.addEventListener("close",function(){delete e._notifications[l],a&&a.bind(u)()}),void("number"==typeof n&&c.addEventListener("show",function(){setTimeout(function(){delete e._notifications[l],c.close()},n)}))}var u=this;Notification.requestPermission(function(){u.show_notification(t,s,o)})},e.prototype.show_message=function(e){t.noty({text:e,theme:"ffzTheme",layout:"bottomCenter",closeWith:["button"]}).show()}},{}],29:[function(e){var s=t.FrankerFaceZ,o=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(){var e=t.App&&App.__container__.lookup("controller:channel"),s=e&&e.get("id"),o=e&&e.get("hostModeTarget.id"),n=!1;if(e){for(var i in this.srl_races)delete this.srl_races[i],(i===s||i===o)&&(n=!0);n&&this.rebuild_race_ui()}}),s.ws_commands.srl_race=function(t){var e=App.__container__.lookup("controller:channel"),s=e&&e.get("id"),o=e&&e.get("hostModeTarget.id"),n=!1;this.srl_races=this.srl_races||{};for(var i=0;i<t[0].length;i++){var a=t[0][i];this.srl_races[a]=t[1],(a===s||a===o)&&(n=!0)}if(t[1]){var r=t[1],d=r.twitch_entrants={};for(var u in r.entrants)r.entrants.hasOwnProperty(u)&&(r.entrants[u].channel&&(d[r.entrants[u].channel]=u),r.entrants[u].name=u)}n&&this.rebuild_race_ui()},s.prototype.rebuild_race_ui=function(){var t=App.__container__.lookup("controller:channel"),e=t&&t.get("id"),s=t&&t.get("hostModeTarget.id");if(this._cindex){if(e){var o=this.srl_races&&this.srl_races[e],n=this._cindex.get("element"),i=n&&n.querySelector(".stats-and-actions .channel-actions"),a=i&&i.querySelector("#ffz-ui-race");if(i&&this.settings.srl_races&&o){if(!a){a=document.createElement("span"),a.id="ffz-ui-race",a.setAttribute("data-channel",e);var r=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),i.appendChild(a)}this._update_race(a,!0)}else a&&a.parentElement.removeChild(a)}if(s){var o=this.srl_races&&this.srl_races[s],n=this._cindex.get("element"),i=n&&n.querySelector("#hostmode .channel-actions"),a=i&&i.querySelector("#ffz-ui-race");if(i&&this.settings.srl_races&&o){if(!a){a=document.createElement("span"),a.id="ffz-ui-race",a.setAttribute("data-channel",s);var r=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),i.appendChild(a)}this._update_race(a,!0)}else a&&a.parentElement.removeChild(a)}}},s.prototype._race_kill=function(){this._race_timer&&(clearTimeout(this._race_timer),delete this._race_timer),delete this._race_game,delete this._race_goal},s.prototype._build_race_popup=function(t,e){var o=this._popup;if((!o||(o.parentElement.removeChild(o),delete this._popup,this._popup_kill&&this._popup_kill(),delete this._popup_kill,"ffz-race-popup"!==o.id||o.getAttribute("data-channel")!==e))&&t){var n=t.querySelector(".button"),i=n.offsetLeft+n.offsetWidth,a=this.srl_races[e],o=document.createElement("div"),r="";o.id="ffz-race-popup",o.setAttribute("data-channel",e),o.className=(i>=300?"right":"left")+" share dropmenu",this._popup_kill=this._race_kill.bind(this),this._popup=o;var d="http://kadgar.net/live",u=!1;for(var c in a.entrants){var l=a.entrants[c].state;a.entrants.hasOwnProperty(c)&&a.entrants[c].channel&&("racing"==l||"entered"==l)&&(d+="/"+a.entrants[c].channel,u=!0)}var h=document.querySelector(".app-main.theatre")?document.body.clientHeight-300:t.parentElement.offsetTop-175,f=App.__container__.lookup("controller:channel"),_=f?f.get("display_name"):s.get_capitalization(e),m=encodeURIComponent("I'm watching "+_+" race "+a.goal+" in "+a.game+" on SpeedRunsLive!");r='<div class="heading"><div></div><span></span></div>',r+='<div class="table" style="max-height:'+h+'px"><table><thead><tr><th>#</th><th>Entrant</th><th> </th><th>Time</th></tr></thead>',r+="<tbody></tbody></table></div>",r+='<div class="divider"></div>',r+='<iframe class="twitter_share_button" style="width:130px; height:25px" src="https://platform.twitter.com/widgets/tweet_button.html?text='+m+"%20Watch%20at&via=Twitch&url=http://www.twitch.tv/"+e+'"></iframe>',r+='<p class="right"><a target="_new" href="http://www.speedrunslive.com/race/?id='+a.id+'">SRL</a>',u&&(r+=' <a target="_new" href="'+d+'">Multitwitch</a>'),r+="</p>",o.innerHTML=r,t.appendChild(o),this._update_race(t,!0)}},s.prototype._update_race=function(t,e){if(this._race_timer&&e&&(clearTimeout(this._race_timer),delete this._race_timer),t){var s=t.getAttribute("data-channel"),n=this.srl_races[s];if(!n)return t.parentElement.removeChild(t),void(this._popup&&"ffz-race-popup"===this._popup.id&&this._popup.getAttribute("data-channel")===s&&(this._popup_kill&&this._popup_kill(),this._popup&&(delete this._popup,delete this._popup_kill)));var i=n.twitch_entrants[s],a=n.entrants[i],r=t.querySelector("#ffz-race-popup"),d=Date.now()/1e3,u=Math.floor(d-n.time);if(t.querySelector(".logo").innerHTML=o.placement(a),r){var c=r.querySelector("tbody"),l=r.querySelector(".heading span"),h=r.querySelector(".heading div");c.innerHTML="";var f=[],_=!0;for(var m in n.entrants)n.entrants.hasOwnProperty(m)&&("racing"==n.entrants[m].state&&(_=!1),f.push(n.entrants[m]));f.sort(function(t,e){var s=t.place||9999,o=e.place||9999,n=t.time||u,i=e.time||u;return("forfeit"==t.state||"dq"==t.state)&&(s=1e4),("forfeit"==e.state||"dq"==e.state)&&(o=1e4),o>s?-1:s>o?1:t.name<e.name?-1:t.name>e.name?1:i>n?-1:n>i?1:void 0});for(var p=0;p<f.length;p++){var m=f[p],g='<a target="_new" href="http://www.speedrunslive.com/profiles/#!/'+o.sanitize(m.name)+'">'+m.display_name+"</a>",v=m.channel?'<a target="_new" class="twitch" href="http://www.twitch.tv/'+o.sanitize(m.channel)+'"></a>':"",b=m.hitbox?'<a target="_new" class="hitbox" href="http://www.hitbox.tv/'+o.sanitize(m.hitbox)+'"></a>':"",y=u?o.time_to_string(m.time||u):"",w=o.place_string(m.place),z=m.comment?o.sanitize(m.comment):"";c.innerHTML+="<tr"+(z?' title="'+z+'"':"")+' class="'+m.state+'"><td>'+w+"</td><td>"+g+"</td><td>"+v+b+'</td><td class="time">'+("forfeit"==m.state?"Forfeit":y)+"</td></tr>"}if(this._race_game!=n.game||this._race_goal!=n.goal){this._race_game=n.game,this._race_goal=n.goal;var k=o.sanitize(n.game),C=o.sanitize(n.goal);h.innerHTML='<h2 title="'+k+'">'+k+"</h2><b>Goal: </b>"+C}u?_?l.innerHTML="Done":(l.innerHTML=o.time_to_string(u),this._race_timer=setTimeout(this._update_race.bind(this,t),1e3)):l.innerHTML="Entry Open"}}}},{"../utils":33}],30:[function(e){var s=t.FrankerFaceZ,o=e("../constants");s.prototype.setup_css=function(){this.log("Injecting main FrankerFaceZ CSS.");var t=this._main_style=document.createElement("link");t.id="ffz-ui-css",t.setAttribute("rel","stylesheet"),t.setAttribute("href",o.SERVER+"script/style.css?_="+(o.DEBUG?Date.now():s.version_info)),document.head.appendChild(t),jQuery.noty.themes.ffzTheme={name:"ffzTheme",style:function(){this.$bar.removeClass().addClass("noty_bar").addClass("ffz-noty").addClass(this.options.type)},callback:{onShow:function(){},onClose:function(){}}}}},{"../constants":4}],31:[function(e){{var s=t.FrankerFaceZ,o=e("../constants");e("../utils")}s.prototype._update_subscribers=function(){this._update_subscribers_timer&&(clearTimeout(this._update_subscribers_timer),delete this._update_subscribers_timer),this._update_subscribers_timer=setTimeout(this._update_subscribers.bind(this),6e4);var t=this.get_user(),e=this,s=this.is_dashboard?location.pathname.match(/\/([^\/]+)/):void 0,n=this.is_dashboard&&s&&s[1];if(this.has_bttv||!n||n!==t.login){var i=document.querySelector("#ffz-sub-display");return void(i&&i.parentElement.removeChild(i))}jQuery.ajax({url:"/broadcast/dashboard/partnership"}).done(function(t){try{var s,i=document.createElement("span");i.innerHTML=t,s=i.querySelector("#dash_main");var a=s&&s.textContent.match(/([\d,\.]+) total active subscribers/),r=a&&a[1];if(!r){var d=document.querySelector("#ffz-sub-display");return d&&d.parentElement.removeChild(d),void(e._update_subscribers_timer&&(clearTimeout(e._update_subscribers_timer),delete e._update_subscribers_timer))}var d=document.querySelector("#ffz-sub-display span");if(!d){var u=document.querySelector(e.is_dashboard?"#stats":"#channel .stats-and-actions .channel-stats");if(!u)return;var c=document.createElement("span");c.className="ffz stat",c.id="ffz-sub-display",c.title="Active Channel Subscribers",c.innerHTML=o.STAR+" ",d=document.createElement("span"),c.appendChild(d),Twitch.api.get("chat/"+n+"/badges",null,{version:3}).done(function(t){t.subscriber&&t.subscriber.image&&(c.innerHTML="",c.appendChild(d),c.style.backgroundImage='url("'+t.subscriber.image+'")',c.style.backgroundRepeat="no-repeat",c.style.paddingLeft="23px",c.style.backgroundPosition="0 50%")}),u.appendChild(c),jQuery(c).tipsy(e.is_dashboard?{gravity:"s"}:void 0)}d.innerHTML=r}catch(l){e.error("_update_subscribers: "+l)}}).fail(function(){var t=document.querySelector("#ffz-sub-display");t&&t.parentElement.removeChild(t)})}},{"../constants":4,"../utils":33}],32:[function(e){var s=t.FrankerFaceZ,o=e("../constants"),n=e("../utils");s.ws_commands.chatters=function(e){{var s=e[0],o=e[1],n=t.App&&App.__container__.lookup("controller:channel"),i=this.is_dashboard?location.pathname.match(/\/([^\/]+)/):void 0;this.is_dashboard?i&&i[1]:n&&n.get&&n.get("id")}if(!this.is_dashboard){var a=this.rooms&&this.rooms[s];return void(a&&(a.ffz_chatters=o,this._cindex&&this._cindex.ffzUpdateChatters()))}this._dash_chatters=o},s.ws_commands.viewers=function(e){var s=e[0],i=e[1],a=t.App&&App.__container__.lookup("controller:channel"),r=this.is_dashboard?location.pathname.match(/\/([^\/]+)/):void 0,d=this.is_dashboard?r&&r[1]:a&&a.get&&a.get("id");if(!this.is_dashboard){var u=this.rooms&&this.rooms[s];return void(u&&(u.ffz_viewers=i,this._cindex&&this._cindex.ffzUpdateChatters()))}if(this._dash_viewers=i,this.settings.chatter_count&&d===s){var c=document.querySelector("#ffz-ffzchatter-display"),l=o.ZREKNARF+" "+n.number_commas(i)+("number"==typeof this._dash_chatters?" ("+n.number_commas(this._dash_chatters)+")":"");if(c)c.innerHTML=l;else{var h=document.querySelector("#stats");if(!h)return;c=document.createElement("span"),c.id="ffz-ffzchatter-display",c.className="ffz stat",c.title="Viewers (In Chat) with FrankerFaceZ",c.innerHTML=l,h.appendChild(c),jQuery(c).tipsy(this.is_dashboard?{gravity:"s"}:void 0)}}}},{"../constants":4,"../utils":33}],33:[function(e,s){var o=(t.FrankerFaceZ,e("./constants"),{}),n=document.createElement("span"),i=function(t,e,s){return s=s||"s",e=e||"",1===t?e:s},a=function(t){return 1==t?"1st":2==t?"2nd":3==t?"3rd":null==t?"---":t+"th"},r=/^(\d{4}|\+\d{6})(?:-?(\d{2})(?:-?(\d{2})(?:T(\d{2})(?::?(\d{2})(?::?(\d{2})(?:(?:\.|,)(\d{1,}))?)?)?(Z|([\-+])(\d{2})(?::?(\d{2}))?)?)?)?)?$/,d=function(t){var e=t.match(r);if(!e)return null;e[7]=e[7]&&e[7].length?e[7].substr(0,3):0;var s=Date.UTC(e[1],e[2]-1,e[3],e[4],e[5],e[6],e[7]);if(e[9]){var o=6e4*("-"==e[9]?1:-1)*(60*e[10]+1*e[11]);s+=o}return new Date(s)},u=function(t){t=$.trim(t);var e={raw:t},s=-1;"@"===t.charAt(0)&&(s=t.indexOf(" "),e.tags=t.substr(1,s-1));var o=s+1,n=-1;":"===t.charAt(o)&&(n=t.indexOf(" ",o),e.prefix=t.substr(o+1,n-(o+1)));var i=t.indexOf(" :",o);i>=0?e.trailing=t.substr(i+2):i=t.length;var a=t.substr(n+1,i-n-1).split(" ");return e.command=a[0],a.length>1&&(e.params=a.slice(1)),e},c={":":";",s:" ",r:"\r",n:"\n","\\":"\\"},l=function(t){for(var e="",s=0;s<t.length;s++){var o=t.charAt(s);if("\\"===o){if(s===t.length-1)throw"Improperly escaped tag";if(o=c[t.charAt(s+1)],void 0===o)throw"Improperly escaped tag";s++}e+=o}return e},h=function(t,e){switch(t){case"slow":try{return parseInt(e)}catch(s){return 0}case"subs-only":case"r9k":case"subscriber":case"turbo":return"1"===e;default:try{return l(e)}catch(s){return""}}},f=function(t){for(var e={},s=t.split(";"),o=0;o<s.length;++o){var n=s[o].split("=");2===n.length&&(e[n[0]]=h(n[0],n[1]))}return e},_={},m=function(t,e){if(_[t]&&_[t][e])return _[t][e];for(var s="️"===e?t.slice(0,-1):3===t.length&&"️"===t.charAt(1)?t.charAt(0)+t.charAt(2):t,o=[],n=0,i=0,a=0;a<s.length;)n=s.charCodeAt(a++),i?(o.push((65536+(i-55296<<10)+(n-56320)).toString(16)),i=0):n>=55296&&56319>=n?i=n:o.push(n.toString(16));var r=_[t]=_[t]||{},d=r[e]=o.join("-");return d};s.exports={update_css:function(t,e,s){var o=t.innerHTML,n="/*BEGIN "+e+"*/",i="/*END "+e+"*/",a=o.indexOf(n),r=o.indexOf(i),d=-1!==a&&-1!==r&&r>a;(d||s)&&(d&&(o=o.substr(0,a)+o.substr(r+i.length)),s&&(o+=n+s+i),t.innerHTML=o)},splitIRCMessage:u,parseIRCTags:f,emoji_to_codepoint:m,parse_date:d,number_commas:function(t){var e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),e.join(".")},place_string:a,placement:function(t){return"forfeit"==t.state?"Forfeit":"dq"==t.state?"DQed":t.place?a(t.place):""},sanitize:function(t){var e=o[t];return e||(n.textContent=t,e=o[t]=n.innerHTML,n.innerHTML=""),e},quote_attr:function(t){return(t+"").replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},date_string:function(t){return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()},pluralize:i,human_time:function(t,e){e=e||1,t=Math.floor(t);var s=Math.floor(t*e/31536e3)/e;if(s>=1)return s+" year"+i(s);var o=Math.floor((t%=31536e3)/86400);if(o>=1)return o+" day"+i(o);var n=Math.floor((t%=86400)/3600);if(n>=1)return n+" hour"+i(n);var a=Math.floor((t%=3600)/60);if(a>=1)return a+" minute"+i(a);var r=t%60;return r>=1?r+" second"+i(r):"less than a second"},time_to_string:function(t,e,s,o){var n=t%60,i=Math.floor(t/60),a=Math.floor(i/60),r="";if(i%=60,e){if(r=Math.floor(a/24),a%=24,s&&r>0)return r+" days";r=r>0?r+" days, ":""}return r+(!o||r||a?(10>a?"0":"")+a+":":"")+(10>i?"0":"")+i+":"+(10>n?"0":"")+n},format_unread:function(t){return 1>t?"":t>=99?"99+":""+t}}},{"./constants":4}]},{},[16]),t.ffz=new FrankerFaceZ}(window); |