1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-27 21:05:53 +00:00

Modified the script to grab files off the new cdn.frankerfacez.com

This commit is contained in:
SirStendec 2014-06-13 01:18:57 -04:00
parent f9fdcb3ba6
commit b74fdaa22b
2 changed files with 7 additions and 7 deletions

View file

@ -16,7 +16,7 @@ if ( injectNeeded ) {
var CSS = /\.([\w\-_]+)\s*?\{content:\s*?"([^"]+)";\s*?background-image:\s*?url\("([^"]+)"\);\s*?height:\s*?(\d+)px;\s*?width:\s*?(\d+)[^}]*\}/mg,
IMGUR_KEY = 'e48d122e3437051', CACHE_LENGTH = 10800000,
SERVER = '//commondatastorage.googleapis.com/frankerfacez/',
SERVER = '//cdn.frankerfacez.com/',
DEBUG = location.search.indexOf('frankerfacez') !== -1;
@ -696,7 +696,7 @@ ffz.prototype.load_emotes = function(group, refresh) {
if ( m != null )
name = m[1];
this.get(SERVER + name + ".css",
this.get(SERVER + "channel/" + name + ".css",
this.process_css.bind(this, group, undefined), refresh ? 1 : CACHE_LENGTH);
}
@ -856,7 +856,7 @@ ffz.prototype.unload_emotes = function(group) {
ffz.prototype.check_donor = function(username) { return this.donors[username] || false; }
ffz.prototype.load_donors = function(refresh) {
this.get(SERVER + "donors.txt",
this.get(SERVER + "scripts/donors.txt",
this.process_donors.bind(this), refresh ? 1 : CACHE_LENGTH);
}

8
script.min.js vendored
View file

@ -19,12 +19,12 @@ a||"turbo"==a}).first();c.length?c.before(a):d.append(a)}};c.prototype.modify_li
this.set("messageToSend","");d.run_command(this,a)}})};c.prototype.modify_room=function(){this._modify_room(App.Room);var b=App.Room.instances,d;for(d in b)if(b.hasOwnProperty(d)){var a=b[d];this.alive&&this.add_channel(a.id,a);a.tmiRoom&&this.alive?this.alter_tmi(a.id,a.tmiRoom):a.viewers&&this._modify_viewers(a.viewers);this._modify_room(a)}};c.prototype._modify_viewers=function(b){var d=this;b.reopen({tmiRoom:Ember.computed(function(a,b){1<arguments.length&&(this.tmiRoom=b,d.alive&&d.alter_tmi(this.id,
b))})})};c.prototype.modify_viewers=function(){this._modify_viewers(App.Room.Viewers)};c.prototype._modify_emotes=function(b){var d=this;b.reopen({_emoticons:b.emoticons||[],init:function(){this._super();d.alive&&d.get_manager(this)},emoticons:Ember.computed(function(a,b){1<arguments.length&&(this._emoticons=b,d.log("Twitch standard emoticons loaded."));return d.alive?_.union(this._emoticons,d.emoticons):this._emoticons})})};c.prototype.modify_emotes=function(){this._modify_emotes(App.EmoticonsController);
var b=App.__container__.lookup("controller:emoticons");b&&(this._modify_emotes(b),this.get_manager(b))};c.prototype.get_manager=function(b){this.manager=b;for(var d in this.emotesets)this.emotesets.hasOwnProperty(d)&&(b.emoticonSets[d]=this.emotesets[d])};c.prototype.add_channel=function(b,d){if(this.alive){this.log("Registered channel: "+b);this.channels[b]={id:b,room:d,tmi:null,style:null};if(0<this._log2.length)for(var a=this.has_bttv?BetterTTV.chat.helpers.serverMessage:d.addTmiMessage;this._log2.length;)a(this._log2.shift());
this.load_emotes(b)}};c.prototype.remove_channel=function(b){var d=this.channels[b];d&&(this.log("Removing channel: "+b),this.unload_emotes(b),d.tmi&&delete d.tmi.getEmotes,this.channels[b]=!1)};c.prototype.alter_tmi=function(b,d){var a=this.channels[b],c=this;if(a&&this.alive&&!a.tmi){a.tmi=d;var h=d.__proto__.getEmotes.bind(d);d.getEmotes=function(b){return _.union([a.set_id],c.global_sets,h(b)||[])}}};c.prototype.load_emotes=function(b,d){var a=/^_(.+)_\d+$/.exec(b),c=b;null!=a&&(c=a[1]);this.get("//commondatastorage.googleapis.com/frankerfacez/"+
this.load_emotes(b)}};c.prototype.remove_channel=function(b){var d=this.channels[b];d&&(this.log("Removing channel: "+b),this.unload_emotes(b),d.tmi&&delete d.tmi.getEmotes,this.channels[b]=!1)};c.prototype.alter_tmi=function(b,d){var a=this.channels[b],c=this;if(a&&this.alive&&!a.tmi){a.tmi=d;var h=d.__proto__.getEmotes.bind(d);d.getEmotes=function(b){return _.union([a.set_id],c.global_sets,h(b)||[])}}};c.prototype.load_emotes=function(b,d){var a=/^_(.+)_\d+$/.exec(b),c=b;null!=a&&(c=a[1]);this.get("//cdn.frankerfacez.com/channel/"+
c+".css",this.process_css.bind(this,b,void 0),d?1:108E5)};c.prototype.process_css=function(b,d,a){if(!this.alive||void 0===a)return 0;this.unload_emotes(b);if(null==a)return 0;var c=this.channels[b];if(!1!==c){var h=--this.last_set,f=[],e=document.createElement("style");c?(c.set_id=h,c.set=f,c.style=e,d="FFZ Channel Emotes: "+b):(this.globals[b]=h,this.global_sets.push(h),this.styles[b]=e,d||(d="FFZ Global Emotes"+("global"!=b?": "+b:"")));this.emotesets[h]=f;this.manager&&(this.manager.emoticonSets[h]=
f);e.type="text/css";e.innerHTML=a;document.body?document.body.appendChild(e):this.pending_styles.push(e);var l=0,k=this,n=this.collections[d]=[];a.replace(t,function(a,c,e,g,m,p){m=parseInt(m);p=parseInt(p);g={emoticon_set:h,height:m,width:p,url:g,html:'<span class="'+c+' emoticon" title="'+e+'"></span>',id:--k.last_emote};a="!"===e[e.length-1]?RegExp("\\b"+e+"(?=\\W|$)","g"):RegExp("\\b"+e+"\\b","g");e={image:g,images:[g],text:e,channel:d,hidden:!1,regex:a,ffzset:b};n.push(e);k.emoticons.push(e);
f);e.type="text/css";e.innerHTML=a;document.body?document.body.appendChild(e):this.pending_styles.push(e);var l=0,k=this,n=this.collections[d]=[];a.replace(t,function(a,c,e,g,m,p){m=parseInt(m);p=parseInt(p);g={emoticon_set:h,height:m,width:p,url:g,html:'<span class="'+c+' emoticon" title="'+e+'"></span>',id:--k.last_emote};a="!"===e[e.length-1]?new RegExp("\\b"+e+"(?=\\W|$)","g"):new RegExp("\\b"+e+"\\b","g");e={image:g,images:[g],text:e,channel:d,hidden:!1,regex:a,ffzset:b};n.push(e);k.emoticons.push(e);
f.push({isEmoticon:!0,cls:c,regex:a});l++});this.log("Loaded "+l+" emotes from collection: "+b);return l}};c.prototype.unload_emotes=function(b){if(this.alive){var d=this.channels[b],a,c,h;if(!1!==d){d?(a=d.set_id,c=d.style,h="FFZ Channel Emotes: "+b,delete d.set,delete d.set_id,delete d.style):(a=this.globals[b],c=this.styles[b],h="FFZ Global Emotes"+("global"!=b?": "+b:""),delete this.globals[b],delete this.styles[b],d=this.global_sets.indexOf(a),-1!==d&&this.global_sets.splice(d,1));this.collections[h]&&
delete this.collections[h];if(c)try{c.parentNode.removeChild(c)}catch(f){}delete this.emotesets[a];this.manager&&delete this.manager.emoticonSets[a];this.emoticons=this.emoticons.filter(function(a){return a.ffzgroup!==b})}}};c.prototype.check_donor=function(b){return this.donors[b]||!1};c.prototype.load_donors=function(b){this.get("//commondatastorage.googleapis.com/frankerfacez/donors.txt",this.process_donors.bind(this),b?1:108E5)};c.prototype.process_donors=function(b){if(this.alive){this.donors=
{};var d=0;if(null!=b){b=b.trim().split(/\W+/);for(var a=0;a<b.length;a++)this.donors[b[a]]=!0;d+=b.length}this.log("Loaded "+d+" donors.")}};c.prototype.get=function(b,d,a,c,h){if(this.alive)if(this.getting[b])this.log("Already getting resource: "+b);else{this.getting[b]=!0;h=h||10;var f=0,e=(new Date).getTime();if(m.localStorage){var l=localStorage.getItem("ffz_"+b);if(null!=l){this.log("Found resource in localStorage: "+b);try{d(JSON.parse(l))}catch(k){this.log("Error in callback: "+k)}f=parseInt(localStorage.getItem("ffz_age_"+
delete this.collections[h];if(c)try{c.parentNode.removeChild(c)}catch(f){}delete this.emotesets[a];this.manager&&delete this.manager.emoticonSets[a];this.emoticons=this.emoticons.filter(function(a){return a.ffzgroup!==b})}}};c.prototype.check_donor=function(b){return this.donors[b]||!1};c.prototype.load_donors=function(b){this.get("//cdn.frankerfacez.com/scripts/donors.txt",this.process_donors.bind(this),b?1:108E5)};c.prototype.process_donors=function(b){if(this.alive){this.donors={};var d=0;if(null!=
b){b=b.trim().split(/\W+/);for(var a=0;a<b.length;a++)this.donors[b[a]]=!0;d+=b.length}this.log("Loaded "+d+" donors.")}};c.prototype.get=function(b,d,a,c,h){if(this.alive)if(this.getting[b])this.log("Already getting resource: "+b);else{this.getting[b]=!0;h=h||10;var f=0,e=(new Date).getTime();if(m.localStorage){var l=localStorage.getItem("ffz_"+b);if(null!=l){this.log("Found resource in localStorage: "+b);try{d(JSON.parse(l))}catch(k){this.log("Error in callback: "+k)}f=parseInt(localStorage.getItem("ffz_age_"+
b)||0)}}r||!f||void 0!==a&&null!==a&&e-f>a?(this.log("Resource expired. Fetching: "+b),this.do_get(b,d,0,c,h)):this.getting[b]=!1}};c.prototype.do_get=function(b,d,a,c,h){function f(){var e=(a||0)+1;if(!h||e<=h)return setTimeout(k.do_get.bind(k,b,d,e,c,h),1E3),!0}if(this.alive){var e=new XMLHttpRequest;e.open("GET",b);if(c)for(var l in c)c.hasOwnProperty(l)&&e.setRequestHeader(l,c[l]);var k=this;e.addEventListener("error",function(a){if(!f()){k.getting[b]=!1;try{d(void 0)}catch(c){k.log("Error in callback: "+
c)}}},!1);e.addEventListener("load",function(a){if(200===e.status){if(a=e.responseText,m.localStorage){var c=localStorage.getItem("ffz_last_"+b),g=e.getResponseHeader("Last-Modified");if(c&&c==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);m.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}}m.localStorage&&void 0!==a&&(localStorage.setItem("ffz_"+b,JSON.stringify(a)),localStorage.setItem("ffz_age_"+b,(new Date).getTime()));k.getting[b]=!1;try{d(a)}catch(h){k.log("Error in callback: "+h)}},!1);e.send()}else this.getting[b]=!1};m.ffz=new c}})(this.unsafeWindow||window,window.chrome?!0:!1);