');for(var f in this.collections){if(!this.collections.hasOwnProperty(f))return;if(d?-1!==f.toLowerCase().indexOf(d):"FFZ Global Emotes"!==f){var a=g?a+(''+f+" | "):a+(f+"\n"),e=this.collections[f],n;for(n in e)if(e.hasOwnProperty(n)){var k=e[n],
m=k.text;g?a+=''+m+" | "+k.image.html+" |
":(m=m[0]+"\u200b"+m.substr(1),a+=" "+m+" = "+k.text+"\n")}g&&(a+="")}}g&&(a+="");return-1===a.indexOf(g?"":"\u200b")?"There are no available FFZ channel emoticons. If this is in error, please try the /ffz reload command.":"The following emotes are available:\n"+a};d.commands.list.help="Usage: /ffz list [global]\nList available FFZ emoticons. Use the global parameter to list ALL FFZ emoticons, or filter for a specific set.";
d.commands.global=function(b,c){return d.commands.list.bind(this)(b,["global"])};d.commands.global.help="Usage: /ffz global\nShorthand for /ffz list global. List ALL FFZ emoticons, including FFZ global emoticons.";d.commands.reload=function(b,c){for(var a in this.channels)this.channels.hasOwnProperty(a)&&this.channels[a]&&this.load_emotes(a,!0);this.load_emotes("global");this.load_donors();return"Attempting to reload FFZ data from the server."};d.commands.reload.help="Usage: /ffz reload\nAttempt to reload FFZ emoticons and donors.";
d.commands.inject=function(b,c){if(!c||1!==c.length)return"/ffz inject requires exactly 1 argument.";var a=c[0].split("/").pop().split("?").shift().split("#").shift();this._msg(b,'Attempting to load test emoticons from imgur album "'+a+'"...');var d="https://api.imgur.com/3/album/"+a;l.localStorage&&localStorage.removeItem("ffz_"+d);this.get(d,this.do_imgur.bind(this,b,a),1,{Accept:"application/json",Authorization:"Client-ID e48d122e3437051"},5)};d.commands.inject.help="Usage: /ffz inject [album-id]\nLoads emoticons from an imgur album for testing. album-id can simply be the album URL. Ex: /ffz inject http://imgur.com/a/v4aZr";
d.prototype.do_imgur=function(b,c,a){if(void 0===a)return this._msg(b,"An error occurred communicating with Imgur.");if(!a)return this._msg(b,"The named album does not exist or is private.");a=JSON.parse(a).data;a=a.images;for(var h="",g=0;g',id:--k.last_emote};a="!"===e[e.length-1]?RegExp("\\b"+e+"(?=\\W|$)","g"):RegExp("\\b"+e+"\\b","g");e={image:h,images:[h],text:e,channel:c,hidden:!1,regex:a,ffzset:b};m.push(e);k.emoticons.push(e);f.push({isEmoticon:!0,cls:d,regex:a});l++});this.log("Loaded "+l+" emotes from collection: "+
b);return l}};d.prototype.unload_emotes=function(b){if(this.alive){var c=this.channels[b],a,d,g;if(!1!==c){c?(a=c.set_id,d=c.style,g="FFZ Channel Emotes: "+b,delete c.set,delete c.set_id,delete c.style):(a=this.globals[b],d=this.styles[b],g="FFZ Global Emotes"+("global"!=b?": "+b:""),delete this.globals[b],delete this.styles[b],c=this.global_sets.indexOf(a),-1!==c&&this.global_sets.splice(c,1));this.collections[g]&&delete this.collections[g];if(d)try{d.parentNode.removeChild(d)}catch(f){}delete this.emotesets[a];
this.manager&&delete this.manager.emoticonSets[a];this.emoticons=this.emoticons.filter(function(a){return a.ffzgroup!==b})}}};d.prototype.check_donor=function(b){return this.donors[b]||!1};d.prototype.load_donors=function(b){this.get("//commondatastorage.googleapis.com/frankerfacez/donors.txt",this.process_donors.bind(this),b?1:108E5)};d.prototype.process_donors=function(b){if(this.alive){this.donors={};var c=0;if(null!=b){b=b.trim().split(/\W+/);for(var a=0;aa?(this.log("Resource expired. Fetching: "+
b),this.do_get(b,c,0,d,g)):this.getting[b]=!1}};d.prototype.do_get=function(b,c,a,d,g){function f(){var e=(a||0)+1;if(!g||e<=g)return setTimeout(k.do_get.bind(k,b,c,e,d,g),1E3),!0}if(this.alive){var e=new XMLHttpRequest;e.open("GET",b);if(d)for(var n in d)d.hasOwnProperty(n)&&e.setRequestHeader(n,d[n]);var k=this;e.addEventListener("error",function(a){if(!f()){k.getting[b]=!1;try{c(void 0)}catch(d){k.log("Error in callback: "+d)}}},!1);e.addEventListener("load",function(a){if(200===e.status){if(a=
e.responseText,l.localStorage){var d=localStorage.getItem("ffz_last_"+b),g=e.getResponseHeader("Last-Modified");if(d&&d==g){k.log("Resource not modified: "+b);localStorage.setItem("ffz_age_"+b,(new Date).getTime());k.getting[b]=!1;return}localStorage.setItem("ffz_last_"+b,g)}}else{if(304===e.status){k.log("Resource not modified: "+b);l.localStorage&&localStorage.setItem("ffz_age_"+b,(new Date).getTime());k.getting[b]=!1;return}if(404===e.status)a=null;else{if(f())return;a=void 0}}l.localStorage&&
void 0!==a&&(localStorage.setItem("ffz_"+b,JSON.stringify(a)),localStorage.setItem("ffz_age_"+b,(new Date).getTime()));k.getting[b]=!1;try{c(a)}catch(h){k.log("Error in callback: "+h)}},!1);e.send()}else this.getting[b]=!1};l.ffz=new d}})(this.unsafeWindow||window,window.chrome?!0:!1); |