1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-28 05:15:54 +00:00
FrankerFaceZ/script.min.js

9 lines
246 KiB
JavaScript
Raw Normal View History

2015-08-09 23:32:29 -07:00
!function(t){!function e(t,s,n){function i(a,r){if(!s[a]){if(!t[a]){var d="function"==typeof require&&require;if(!r&&d)return d(a,!0);if(o)return o(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 i(s?s:e)},u,u.exports,e,t,s,n)}return s[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(e,s,n){var i=i||function(t){"use strict";if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var e=t.document,s=function(){return t.URL||t.webkitURL||t},n=e.createElementNS("http://www.w3.org/1999/xhtml","a"),i="download"in n,o=function(t){var e=new MouseEvent("click");t.dispatchEvent(e)},a=t.webkitRequestFileSystem,r=t.requestFileSystem||a||t.mozRequestFileSystem,d=function(e){(t.setImmediate||t.setTimeout)(function(){throw e},0)},u="application/octet-stream",c=0,l=500,h=function(e){var n=function(){"string"==typeof e?s().revokeObjectURL(e):e.remove()};t.chrome?n():setTimeout(n,l)},f=function(t,e,s){e=[].concat(e);for(var n=e.length;n--;){var i=t["on"+e[n]];if("function"==typeof i)try{i.call(t,s||t)}catch(o){d(o)}}},m=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t},_=function(e,d,l){l||(e=m(e));var _,p,g,v=this,b=e.type,y=!1,w=function(){f(v,"writestart progress write writeend".split(" "))},z=function(){if((y||!_)&&(_=s().createObjectURL(e)),p)p.location.href=_;else{var n=t.open(_,"_blank");void 0==n&&"undefined"!=typeof safari&&(t.location.href=_)}v.readyState=v.DONE,w(),h(_)},k=function(t){return function(){return v.readyState!==v.DONE?t.apply(this,arguments):void 0}},C={create:!0,exclusive:!1};return v.readyState=v.INIT,d||(d="download"),i?(_=s().createObjectURL(e),n.href=_,n.download=d,void setTimeout(function(){o(n),w(),h(_),v.readyState=v.DONE})):(t.chrome&&b&&b!==u&&(g=e.slice||e.webkitSlice,e=g.call(e,0,e.size,u),y=!0),a&&"download"!==d&&(d+=".download"),(b===u||a)&&(p=t),r?(c+=e.size,void r(t.TEMPORARY,c,k(function(t){t.root.getDirectory("saved",C,k(function(t){var s=function(){t.getFile(d,C,k(function(t){t.createWriter(k(function(s){s.onwriteend=function(e){p.location.href=t.toURL(),v.readyState=v.DONE,f(v,"writeend",e),h(t)},s.onerror=function(){var t=s.error;t.code!==t.ABORT_ERR&&z()},"writestart progress write abort".split(" ").forEach(function(t){s["on"+t]=v["on"+t]}),s.write(e),v.abort=function(){s.abort(),v.readyState=v.DONE},v.readyState=v.WRITING}),z)}),z)};t.getFile(d,{create:!1},k(function(t){t.remove(),s()}),k(function(t){t.code===t.NOT_FOUND_ERR?s():z()}))}),z)}),z)):void z())},p=_.prototype,g=function(t,e,s){return new _(t,e,s)};return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,s){return s||(t=m(t)),navigator.msSaveOrOpenBlob(t,e||"download")}:(p.abort=function(){var t=this;t.readyState=t.DONE,f(t,"abort")},p.readyState=p.INIT=0,p.WRITING=1,p.DONE=2,p.error=p.onwritestart=p.onprogress=p.onwrite=p.onabort=p.onerror=p.onwriteend=null,g)}}("undefined"!=typeof self&&self||"undefined"!=typeof t&&t||this.content);"undefined"!=typeof s&&s.exports?s.exports.saveAs=i:"undefined"!=typeof define&&null!==define&&null!=define.amd&&define([],function(){return i})},{}],2:[function(e,s,n){var i=t.FrankerFaceZ,o=e("./constants"),a=e("./utils");i.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."},i.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)}},i.prototype.setup_badges=function(){this.has_bttv||document.body.classList.toggle("ffz-transparent-badges",this.settings.transparent_badges),this.log("Preparing badge sy
SVGPATH:n,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">'+n+"</svg>",CHAT_BUTTON:'<svg class="svg-emoticons ffz-svg" height="18px" width="24px" viewBox="0 0 249 195" version="1.1">'+n+"</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>',LIVE:'<svg class="svg-glyph_live_small" height="16px" version="1.1" viewbox="0 0 16 16" width="13px" x="0px" y="0px"><path clip-rule="evenodd" d="M11,14H5H2v-1l3-3h2L5,8V2h6v6l-2,2h2l3,3v1H11z" 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
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 n=jQuery(this._ffz_tabs);if(n.children(".ffz-chat-tab").removeClass("active"),s&&s._ffz_tab){s._ffz_tab.classList.remove("tab-mentioned"),s._ffz_tab.classList.remove("hidden"),s._ffz_tab.classList.add("active");var i=s._ffz_tab.querySelector("span");i&&(i.innerHTML="")}var o=s&&s.get("canInvite");this._ffz_invite&&this._ffz_invite.classList.toggle("hidden",!o),this.set("controller.showInviteUser",o&&this.get("controller.showInviteUser")),this.$(".chat-room").css("top",this._ffz_tabs.offsetHeight+"px")}}),ffzRebuildMenu:function(){return},ffzBuildRow:function(t,s,n,r){var d,u=document.createElement("tr"),c=document.createElement("td"),l=document.createElement("td"),h=document.createElement("td"),f=document.createElement("td"),m=s.get("isGroupRoom"),_=s===t.get("controller.currentRoom"),p=s.get("tmiRoom.displayName")||(m?s.get("tmiRoom.name"):i.get_capitalization(s.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),n?(c.innerHTML=a.CAMERA,c.title=l.title="Current Channel",c.className=l.className="tooltip"):r&&(c.innerHTML=a.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(s.get("id"))?" active":"")+'"><span></span></a>',f.innerHTML='<a class="switch'+(-1!==e.settings.visible_rooms.indexOf(s.get("id"))?" active":"")+'"><span></span></a>',u.setAttribute("data-room",s.get("id")),u.className="ffz-room-row",u.classList.toggle("current-channel",n),u.classList.toggle("host-channel",r),u.classList.toggle("group-chat",m),u.classList.toggle("active",_),u.appendChild(c),u.appendChild(l),m?(d=document.createElement("a"),d.className="leave-chat tooltip",d.innerHTML=a.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+'"?')&&s.get("isGroupRoom")&&s.del()})):(u.appendChild(h),d=h.querySelector("a.switch"),d.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation&&t.stopPropagation();var n=s.get("id"),i=-1!==e.settings.pinned_rooms.indexOf(n);i?e._leave_room(n):e._join_room(n),this.classList.toggle("active",!i)})),u.appendChild(f),d=f.querySelector("a.switch"),d.addEventListener("click",function(n){n.preventDefault(),n.stopPropagation&&n.stopPropagation();var i=s.get("id"),o=e.settings.visible_rooms,a=-1!==o.indexOf(i);a?o.removeObject(i):o.push(i),e.settings.set("visible_rooms",o),this.classList.toggle("active",!a),t.ffzRebuildTabs()}),u.addEventListener("click",function(){var e=t.get("controller");e.focusRoom(s),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"),n=this;s.className="button glyph-only tooltip",s.title="Chat Room Management",s.innerHTML=a.ROOMS,s.addEventListener("click",function(){var t=n.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=a.INVITE,s.addEventListener("click",function(){var t=n.get("controller");t&&t.set("showInviteUser",t.get("currentRoom.canInvite")&&!t.get("showInviteUser"))}),
if(1===t)return"Purge";if(l[t])return l[t];var e,s,n,i,o;e=Math.floor(t/604800),o=t%604800,s=Math.floor(o/86400),o%=86400,n=Math.floor(o/3600),o%=3600,i=Math.floor(o/60),o%=60;var a=l[t]=(e?e+"w":"")+(s||e&&(n||i||o)?s+"d":"")+(n||(e||s)&&(i||o)?n+"h":"")+(i||(e||s||n)&&o?i+"m":"")+(o?o+"s":"");return a};try{i=t.require&&t.require("ember-twitch-chat/helpers/chat-line-helpers")}catch(f){}o.basic_settings.enhanced_moderation_cards={type:"boolean",no_bttv:!0,category:"Chat",name:"Enhanced Moderation Cards",help:"Improve moderation cards with hotkeys, additional buttons, chat history, and other information to make moderating easier.",get:function(){return this.settings.mod_card_hotkeys&&this.settings.mod_card_info&&this.settings.mod_card_history},set:function(t){this.settings.set("mod_card_hotkeys",t),this.settings.set("mod_card_info",t),this.settings.set("mod_card_history",t)}},o.basic_settings.chat_hover_pause={type:"boolean",no_bttv:!0,category:"Chat",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 misclicks.",get:"chat_hover_pause",set:"chat_hover_pause"},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 misclicks.",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 n=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!==n&&void 0!==n){var i=[];for(n=n.trim();n;)if('"'===n.charAt(0)){var o=n.indexOf('"',1);-1===o&&(o=n.length);var a=n.substr(1,o-1);a&&i.push(a),n=n.substr(o+1)}else{var r=n.indexOf(" ");if(-1===r)n&&i.push(n),n="";else{var a=n.substr(0,r);a&&i.push(a),n=n.substr(r+1)}}this.settings.set("mod_card_buttons",i)}}},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("
this.trimMessages(),"admin"===t.style||"whisper"===t.style&&!this.ffz_whisper_room||this.incrementProperty("unreadCount",1))},ffzPendingFlush:function(){for(var t=Date.now(),e=0,n=this.ffzPending.length;n>e;e++){var i=this.ffzPending[e];if(!i.removed){if(+s.settings.chat_delay+i.time>t)break;this.ffzActualPushMessage(i)}}this.ffzPending=this.ffzPending.slice(e),this.ffzPending.length&&setTimeout(this.ffzPendingFlush.bind(this),100)},ffzShouldShowMessage:function(t){if(s.settings.remove_bot_ban_notices&&this.ffzRecentlyBanned){var e="("+this.ffzRecentlyBanned.join("|")+")",n={nightbot:"^"+e,moobot:"\\("+e+"\\)",xanbot:"^"+e};if(t.from in n&&new RegExp(n[t.from]).test(t.message))return!1}return!0},addMessage:function(t){if(t){if(!s.settings.hosted_sub_notices&&"notification"===t.style&&o.test(t.message))return;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,!1,this.get("roomProperties.hide_chat_links")),!e&&t.from&&"jtv"!==t.from&&"twitchnotify"!==t.from&&s.settings.mod_card_history){var n=s.rooms&&s.rooms[t.room];if(n){var i=(n.user_history=n.user_history||{},n.user_history[t.from]=n.user_history[t.from]||[]);i.push({from:t.tags&&t.tags["display-name"]||t.from,cachedTokens:t.cachedTokens,style:t.style,date:t.date}),i.length>20&&i.shift()}}if(!e){var a=s.get_user();if(a&&a.login===t.from){var r=this.get("ffz_banned");this.set("ffz_banned",!1),this.get("isSubscriber")||this.get("isModeratorOrHigher")||!this.get("slowMode")?this.updateWait(0,r):this.get("slowMode")&&this.updateWait(this.get("slow"))}}e||!this.chatters||this.chatters[t.from]||"twitchnotify"===t.from||"jtv"===t.from||this.ffzUpdateChatters(t.from)}var d=this._super(t);return t.color&&s._handle_color(t.color),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 n=App.__container__.lookup("controller:chat");if(n&&n.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"),n=e.indexOf(t);-1!==n?e.splice(n,1):e.length>20&&e.pop(),e.unshift(t)}var i=t.split(" ",1)[0].toLowerCase();if("/ffz"===i)return this.set("messageToSend",""),void s.run_ffz_command(t.substr(5),this.get("id"));if("/"===i.charAt(0)&&s.run_command(t,this.get("id")))return void this.set("messageToSend","")}catch(o){s.error("send: "+o)}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){this._ffz_chatter_timer&&(clearTimeout(this._ffz_chatter_timer),this._ffz_chatter_timer=void 0);var t=this;this.tmiRoom.list().done(function(e){var s={};e=e.data.chatters;for(var n=0;n<e.admins.length;n++)s[e.admins[n]]=!0;for(var n=0;n<e.global_mods.length;n++)s[e.global_mods[n]]=!0;for(var n=0;n<e.moderators.length;n++)s[e.moderators[n]]=!0;for(var n=0;n<e.staff.length;n++)s[e.staff[n]]=!0;for(var n=0;n<e.viewers.length;n++)s[e.viewers[n]]=!0;t.set("ffz_chatters",s),t.ffzUpdateChatters()}).always(function(){t._ffz_chatter_timer=setTimeout(t.ffzInitChatterCount.bind(t),3e5)})}},ffzUpdateChatters:function(e,n){var i=this.get("ffz_chatters")||{};if(e&&(i[e]=!0),n&&i[n]&&delete i[n],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(o){}}},ffzPatchTMI:function(){if(!this.get("ffz_is_patched")&&this.get("tmiRoom")){s.settings.chatter_count&&this.ffzInitChatterCount();var t=this.get("tmiRoom"),e=this,n=t._roomConn._connection;n.ffz_cap_patched||(n.ffz_cap_patched=!0,n._send("CAP REQ :twitch.tv
n.className="heading",n.innerHTML="Restore Settings",o.appendChild(n),u.className="clearfix option",c.type="file",c.addEventListener("change",function(){f.load_settings_file(this.files[0])}),l.href="#",l.innerHTML="Restore from File",l.addEventListener("click",function(t){t.preventDefault(),c.click()}),h.className="help",h.innerHTML="This loads settings from a previously generated JSON file.",u.appendChild(l),u.appendChild(h),o.appendChild(u),e.appendChild(i),e.appendChild(o)},render_basic:function(t,e){var s={},n=[],o=-1!==navigator.userAgent.indexOf("Android");for(var a in i.basic_settings)if(i.basic_settings.hasOwnProperty(a)){var r=i.basic_settings[a],d=r.category||"Miscellaneous",u=s[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}o&&r.no_mobile||(u||(n.push(d),u=s[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._ffz_basic_settings_page||n[0],0);l<n.length;l++){var h=n[l],f=s[h],m=document.createElement("div"),_=document.createElement("div");_.className="heading",m.className="chat-menu-content",m.setAttribute("data-category",h),_.innerHTML=h,m.appendChild(_),f.sort(function(t,e){var t=t[1],e=e[1],s="boolean"===t.type?1:2,n="boolean"===e.type?1:2,i=t.name.toLowerCase(),o=e.name.toLowerCase();return n>s?-1:s>n?1:o>i?-1:i>o?1:0});for(var p=0;p<f.length;p++){var a=f[p][0],r=f[p][1],g=document.createElement("p"),v="button"!==r.type&&"function"==typeof r.get?r.get.bind(this)():this.settings.get(r.get);if(g.className="clearfix",this.has_bttv&&r.no_bttv){var b=document.createElement("span"),y=document.createElement("span");b.className="switch-label",b.innerHTML=r.name,y=document.createElement("span"),y.className="help",y.innerHTML="Disabled due to incompatibility with BetterTTV.",g.classList.add("disabled"),g.appendChild(b),g.appendChild(y)}else{if("boolean"==r.type){var w=document.createElement("a"),b=document.createElement("span");w.className="switch",w.classList.toggle("active",v),w.innerHTML="<span></span>",b.className="switch-label",b.innerHTML=r.name,g.appendChild(w),g.appendChild(b),w.addEventListener("click",toggle_basic_setting.bind(this,w,a))}else if("select"===r.type){var z=document.createElement("select"),b=document.createElement("span");b.className="option-label",b.innerHTML=r.name;for(var k in r.options){var C=document.createElement("option");C.value=JSON.stringify(k),v===k&&C.setAttribute("selected",!0),C.innerHTML=r.options[k],z.appendChild(C)}z.addEventListener("change",option_basic_setting.bind(this,z,a)),g.appendChild(b),g.appendChild(z)}else{g.classList.add("option");var E=document.createElement("a");E.innerHTML=r.name,E.href="#",g.appendChild(E),E.addEventListener("click",r.method.bind(this))}if(r.help){var y=document.createElement("span");y.className="help",y.innerHTML=r.help,g.appendChild(y)}}m.appendChild(g)}e.appendChild(m)}},render_advanced:function(t,e){var s={},n=[],o=-1!==navigator.userAgent.indexOf("Android");for(var a in i.settings_info)if(i.settings_info.hasOwnProperty(a)){var r=i.settings_info[a],d=r.category||"Miscellaneous",u=s[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}o&&r.no_mobile||(u||(n.push(d),u=s[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 m=n[f],_=s[m],p=document.createElement("div"),g=document.createElement("div");g.className="heading",p.className="chat-menu-content collapsable",p.setAttribute("data-category",m),p.classList.toggle("collapsed",h!==m),g.innerHTML=m,p.appendChild(g),p.addEventListener("click",function(){if(this.classList.contains("collapsed")){for(var t=this,s=e.querySelectorAll(".chat-menu-content:not(.collapsed)"),n=0;n<s.length;n++)s[n].classList.add("collapsed");l._ffz_setti
v||(v=!0,r._pastebin(r._log_data.join("\n"),function(t){v=!1,t?prompt("Your FrankerFaceZ logs have been uploaded to the URL:",t):alert("There was an error uploading the FrankerFaceZ logs.")}))}),e.appendChild(g)}}},{"../constants":5}],24:[function(e,s,n){var i=t.FrankerFaceZ,o=e("../constants");i.basic_settings.dark_twitch={type:"boolean",no_bttv:!0,category:"General",name:"Dark Twitch",help:"Apply a dark background to channels and other related pages for easier viewing.",get:function(){return this.settings.dark_twitch},set:function(t){this.settings.set("dark_twitch",t),this.settings.set("dark_no_blue",t)}},i.basic_settings.separated_chat={type:"boolean",no_bttv:!0,category:"Chat",name:"Separated Lines",help:"Use alternating rows and thin lines to visually separate chat messages for easier reading.",get:function(){return this.settings.chat_rows&&"0"!==this.settings.chat_separators},set:function(t){this.settings.set("chat_rows",t),this.settings.set("chat_separators",t?"2":"0")}},i.basic_settings.minimalistic_chat={type:"boolean",category:"Chat",name:"Minimalistic UI",help:"Hide all of chat except messages and the input box and reduce chat margins.",get:function(){return this.settings.minimal_chat&&this.settings.chat_padding},set:function(t){this.settings.set("minimal_chat",t),this.settings.set("chat_padding",t)}},i.basic_settings.high_contrast={type:"boolean",category:"Chat",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.",get:function(){return"222"!==this.settings.high_contrast_chat},set:function(t){this.settings.set("high_contrast_chat",t?"111":"222")}},i.basic_settings.keywords={type:"button",category:"Chat",no_bttv:!0,name:"Highlight Keywords",help:"Set additional keywords that will be highlighted in chat.",method:function(){i.settings_info.keywords.method.bind(this)()}},i.basic_settings.banned_words={type:"button",category:"Chat",no_bttv:!0,name:"Banned Keywords",help:"Set a list of words that will be removed from chat messages, locally.",method:function(){i.settings_info.banned_words.method.bind(this)()}},i.settings_info.twitch_chat_dark={type:"boolean",value:!1,visible:!1},i.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 n=t.App?App.__container__.lookup("controller:settings").get("model"):void 0;e?(this._load_dark_css(),n&&this.settings.set("twitch_chat_dark",n.get("darkMode")),n&&n.set("darkMode",!0)):n&&n.set("darkMode",this.settings.twitch_chat_dark)}}},i.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)}},i.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)}},i.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()))},i.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.set
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,s.appendChild(c)}return s},draw_twitch_set:function(e,s,n){var d,u=document.createElement("div"),c=document.createElement("div"),l=this,h=this._twitch_set_to_channel[s];if(d="twitch_unknown"===h?"Unknown Channel":"--global--"===h?"Global Emoticons":"turbo"===h||"--turbo-faces--"===h?"Twitch Turbo":i.get_capitalization(h,function(t){u.innerHTML='<span class="right">Twitch</span>'+a.sanitize(t)}),u.className="heading",u.innerHTML='<span class="right">Twitch</span>'+a.sanitize(d),this._twitch_badges[h])u.style.backgroundImage='url("'+this._twitch_badges[h]+'")';else{var l=this;Twitch.api.get("chat/"+h+"/badges",null,{version:3}).done(function(t){t.subscriber&&t.subscriber.image&&(l._twitch_badges[h]=t.subscriber.image,localStorage.ffzTwitchBadges=JSON.stringify(l._twitch_badges),u.style.backgroundImage='url("'+t.subscriber.image+'")')})}c.className="emoticon-grid collapsable",c.appendChild(u),c.setAttribute("data-set","twitch-"+s),c.classList.toggle("collapsed",-1!==this.settings.emote_menu_collapsed.indexOf("twitch-"+s)),u.addEventListener("click",function(){i.menu_pages.myemotes.toggle_section.bind(l)(this)}),n.sort(function(t,e){var s=t.code.toLowerCase(),n=e.code.toLowerCase();return n>s?-1:s>n?1:t.id<e.id?-1:t.id>e.id?1:0});for(var f=0;f<n.length;f++){var m=n[f],_=o.KNOWN_CODES[m.code]||m.code,p=document.createElement("span"),g='image-set(url("'+r+m.id+'/1.0") 1x, url("'+r+m.id+'/2.0") 2x, url("'+r+m.id+'/3.0") 4x)';p.className="emoticon tooltip",this.settings.replace_bad_emotes&&o.EMOTE_REPLACEMENTS[m.id]?p.style.backgroundImage='url("'+o.EMOTE_REPLACEMENT_BASE+o.EMOTE_REPLACEMENTS[m.id]+'")':(p.style.backgroundImage='url("'+r+m.id+'/1.0")',p.style.backgroundImage="-webkit-"+g,p.style.backgroundImage="-moz-"+g,p.style.backgroundImage="-ms-"+g,p.style.backgroudnImage=g),p.title=_,p.addEventListener("click",function(s,n,i){i.preventDefault(),(i.shiftKey||i.shiftLeft)&&l.settings.clickable_emoticons?t.open("https://twitchemotes.com/emote/"+s):this._add_emote(e,n)}.bind(this,m.id,m.code)),c.appendChild(p)}return c},draw_ffz_set:function(e,s){var n=document.createElement("div"),o=document.createElement("div"),a=this,r=[];n.className="heading",n.innerHTML='<span class="right">FrankerFaceZ</span>'+s.title,n.style.backgroundImage='url("'+(s.icon||"//cdn.frankerfacez.com/script/devicon.png")+'")',o.className="emoticon-grid collapsable",o.appendChild(n),o.setAttribute("data-set","ffz-"+s.id),o.classList.toggle("collapsed",-1!==this.settings.emote_menu_collapsed.indexOf("ffz-"+s.id)),n.addEventListener("click",function(){i.menu_pages.myemotes.toggle_section.bind(a)(this)});for(var d in s.emoticons)s.emoticons.hasOwnProperty(d)&&!s.emoticons[d].hidden&&r.push(s.emoticons[d]);r.sort(function(t,e){var s=t.name.toLowerCase(),n=e.name.toLowerCase();return n>s?-1:s>n?1:t.id<e.id?-1:t.id>e.id?1:0});for(var u=0;u<r.length;u++){var c=r[u],l=document.createElement("span"),h='image-set(url("'+c.urls[1]+'") 1x';c.urls[2]&&(h+=', url("'+c.urls[2]+'") 2x'),c.urls[4]&&(h+=', url("'+c.urls[4]+'") 4x'),h+=")",l.className="emoticon tooltip",l.style.backgroundImage='url("'+c.urls[1]+'")',l.style.backgroundImage="-webkit-"+h,l.style.backgroundImage="-moz-"+h,l.style.backgroundImage="-ms-"+h,l.style.backgroudnImage=h,c.height&&(l.style.height=c.height+"px"),c.width&&(l.style.width=c.width+"px"),l.title=this._emote_tooltip(c),l.addEventListener("click",function(s,n,i){i.preventDefault(),(i.shiftKey||i.shiftLeft)&&a.settings.clickable_emoticons?t.open("https://www.frankerfacez.com/emoticons/"+s):this._add_emote(e,n)}.bind(this,c.id,c.name)),o.appendChild(l)}return o},draw_menu:function(t,e,s){if("myemotes"===e.getAttribute("data-page")){e.innerHTML="";try{var n=this.get_user(),o=this.getEmotes(n&&n.login,null),a=[];for(var r in s)if(s.h