forked from MadPacMan/PCFW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPCFW.min.js
19 lines (19 loc) · 8.25 KB
/
PCFW.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//Generated at 03-06-2013 19:08:00
var c=void 0,e=!0,g=null,h=!1;function NotImplementedError(a){this.name="NotImplementedError";this.message=a||""}NotImplementedError.prototype=Error.prototype;function EventEmitError(a){this.name="EventEmitError";this.message="emit";this.error=a.error;this.event={type:a.type,data:a.data}}EventEmitError.prototype=Error.prototype;"undefined"!==typeof PCFW&&PCFW.kill();
var PCFW={a:{},version:{major:0,minor:6,patch:2},getVersion:function(){return PCFW.version.major+"."+PCFW.version.minor+"."+PCFW.version.patch},init:function(){"plug.dj"===document.location.host&&(console.group("Plug.dj Coding FrameWork"),PCFW.f.init(),console.log(" _/_/_/ _/_/_/ _/_/_/_/ _/ _/\n _/ _/ _/ _/ _/ _/ \n _/_/_/ _/ _/_/_/ _/ _/ _/ \n _/ _/ _/ _/ _/ _/ \n _/ _/_/_/ _/ _/ _/ "),
PCFW.console.log("Version "+PCFW.getVersion()+" initialized"),console.groupEnd())},kill:function(){PCFW.f.kill()},loadScript:function(a){if("string"===typeof a&&!(0===a.indexOf("http://")||0===a.indexOf("https://")||0===a.indexOf("chrome-extension://")&&$.browser.chrome))throw Error("Illegal URL");},console:{s:function(){return["[PCFW]"]},log:function(){for(var a=["[PCFW]"];arguments.length;)a.push([].shift.call(arguments));console.log.apply(console,a)},error:function(){for(var a=["[PCFW]"];arguments.length;)a.push([].shift.call(arguments));
console.error.apply(console,a)},trace:function(){for(var a=["[PCFW]"];arguments.length;)a.push([].shift.call(arguments));console.trace.apply(console,a)},info:function(){for(var a=["[PCFW]"];arguments.length;)a.push([].shift.call(arguments));console.info.apply(console,a)},warn:function(){for(var a=["[PCFW]"];arguments.length;)a.push([].shift.call(arguments));console.warn.apply(console,a)},assert:function(){for(var a=["[PCFW]"];arguments.length;)a.push([].shift.call(arguments));console.assert.apply(console,
a)}},commands:{b:{},add:function(a,b){a!==c&&(a=a.toString());return a===c||1>a.length||-1<a.indexOf(" ")||b===c||this.isset(a)===e?h:(this.b[a.toString()]=b,e)},remove:function(a){return a===c||this.isset(a)===h?h:(delete this.b[a.toString()],e)},isset:function(a){return a===c?h:this.b[a.toString()]!==c},execute:function(a,b){if(this.isset(a)===h)return h;this.b[a.toString()](b)}},events:{__events:{},e:function(a,b){return a.priority>b.priority?1:a.priority<b.priority?-1:0},priority:{HIGHEST:0,HIGH:1,
NORMAL:2,LOW:3,LOWEST:4,SYSTEM:5,MONITOR:6},on:function(a,b,f){if(a===c||a===g||b===c||b===g)return h;this.__events[a]===c&&(this.__events[a]=[]);if(f===c)f=this.priority.NORMAL;else{var d=h,k;for(k in this.priority)this.priority[k]===f&&(d=e);d||(f=this.priority.NORMAL)}this.__events[a].push({c:b,once:h,priority:f});this.__events[a].sort(this.e);return e},once:function(a,b,f){if(a===c||a===g||b===c||b===g)return h;this.__events[a]===c&&(this.__events[a]=[]);f===c&&(f=this.priority.NORMAL);this.__events[a].push({c:b,
once:e,priority:f});this.__events[a].sort(this.e);return e},off:function(a,b){if(a===c||(a===g||b===c||b===g)||this.__events[a]===c)return h;var f=h,d;for(d in this.__events[a])this.__events[a][d].c===b&&(this.__events[a].splice(d,1),f=e);return f},emit:function(a,b){if(a===c||a===g||this.__events[a]===c)return h;if(b===c||b===g)b={};for(var f=this.__events[a].length,d=0;d<f;d++)if(!("undefined"!==typeof b.cancelled&&b.cancelled===e&&this.__events[a][d].priority<this.priority.MONITOR))try{this.__events[a][d]===
c||this.__events[a][d].c===c?(this.__events[a].splice(d,1),d--,f--):this.__events[a][d].c(b),this.__events[a][d].once&&(this.__events[a].splice(d,1),d--,f--)}catch(k){this.__events[a].splice(d,1);try{this.emit(a,b)}catch(l){throw l;}throw new EventEmitError({error:k,type:a,data:b});}return e}},GUI:{"new":function(){return new m}}},m=Class.extend({init:function(){this.d={};return this},data:function(a,b){if(b===c)return this.d[a];this.d[a]=b;return this},width:function(a){return this.data("width",
a)},height:function(a){return this.data("height",a)},textfield:function(){throw new NotImplementedError;},toggle:function(){throw new NotImplementedError;},checkbox:function(){throw new NotImplementedError;},button:function(){throw new NotImplementedError;}});
PCFW.room={images:{woot:{normal:function(a){return a===c?Lang.ui.buttonVotePositive:Lang.ui.buttonVotePositive=a},disabled:function(a){return a===c?Lang.ui.buttonVotePositiveDisabled:Lang.ui.buttonVotePositiveDisabled=a},selected:function(a){return a===c?Lang.ui.buttonVotePositiveSelected:Lang.ui.buttonVotePositiveSelected=a},popout:{normal:function(a){return a===c?Lang.ui.buttonVotePositivePopout:Lang.ui.buttonVotePositivePopout=a},disabled:function(a){return a===c?Lang.ui.buttonVotePositiveDisabledPopout:
Lang.ui.buttonVotePositiveDisabledPopout=a},selected:function(a){return a===c?Lang.ui.buttonVotePositiveSelectedPopout:Lang.ui.buttonVotePositiveSelectedPopout=a}}},meh:{normal:function(a){return a===c?Lang.ui.buttonVoteNegative:Lang.ui.buttonVoteNegative=a},disabled:function(a){return a===c?Lang.ui.buttonVoteNegativeDisabled:Lang.ui.buttonVoteNegativeDisabled=a},selected:function(a){return a===c?Lang.ui.buttonVoteNegativeSelected:Lang.ui.buttonVoteNegativeSelected=a},popout:{normal:function(a){return a===
c?Lang.ui.buttonVoteNegativePopout:Lang.ui.buttonVoteNegativePopout=a},disabled:function(a){return a===c?Lang.ui.buttonVoteNegativeDisabledPopout:Lang.ui.buttonVoteNegativeDisabledPopout=a},selected:function(a){return a===c?Lang.ui.buttonVoteNegativeSelectedPopout:Lang.ui.buttonVoteNegativeSelectedPopout=a}}}},text:{}};
PCFW.f={init:function(){var a=Object.keys(this);a.splice(0,2);for(var b in a)"function"===typeof this[a[b]].init&&this[a[b]].init()},kill:function(){var a=Object.keys(this);a.splice(0,2);for(var b in a)"function"===typeof this[a[b]].kill&&this[a[b]].kill()},r:{init:function(){PCFW.a.chatCommand=Models.chat.chatCommand;PCFW.a.i=$.proxy(PCFW.a.chatCommand,Models.chat);PCFW.a.k=$.proxy(Models.chat.receive,Models.chat);PCFW.events.on(API.CHAT,PCFW.a.k,PCFW.events.priority.SYSTEM);PCFW.events.on("chatSoundUpdate",
$.proxy(Chat.onChatSoundUpdate,Chat));PCFW.events.on("chatDelete",$.proxy(Chat.onChatDelete,Chat));PCFW.events.on("chatReceived",$.proxy(Chat.onChatReceived,Chat));PCFW.events.on("chatClear",$.proxy(Chat.onChatClear,Chat));PCFW.events.on("timestampUpdate",$.proxy(Chat.onTimestampUpdate,Chat));Models.chat.chatCommand=function(a){if(PCFW.a.i(a)===e)return e;if(0===a.length||"/"!==a.substring(0,1))return h;a=a.split(" ");PCFW.commands.execute(a.splice(0,1)[0].substring(1),a)};PCFW.a.j=Models.chat.dispatchEvent;
Models.chat.dispatchEvent=function(a,b){PCFW.events.emit(a,b)}},kill:function(){Models.chat.chatCommand=PCFW.a.chatCommand;Models.chat.dispatchEvent=PCFW.a.j}},u:{init:function(){PCFW.a.g=SocketListener.chat;SocketListener.chat=function(a){a.mention=h;a.cancelled=h;-1<$("<span/>").html(a.message).text().indexOf("@"+Models.user.data.username)+" "&&(a.mention=e);API.delayDispatch(API.CHAT,a)};PCFW.a.h=SocketListener.userUpdate;SocketListener.userUpdate=function(a){if(Models.room.data.A){var b=Models.room.w[a.id];
b&&(API.delayDispatch("userUpdate",{z:a.id,before:jQuery.extend(e,{},b),now:a,cancelled:h}),Models.room.userUpdate(a))}}},kill:function(){SocketListener.chat=PCFW.a.g;SocketListener.userUpdate=PCFW.a.h}},o:{init:function(){PCFW.a.delayDispatch=API.delayDispatch;API.delayDispatch=function(a,b){API.isReady&&(PCFW.events.emit(a,b),API.__events[a]&&setTimeout(function(){API.dispatchEvent(a,b);b=a=g},1E3))}},kill:function(){API.delayDispatch=PCFW.a.delayDispatch}},q:{init:function(){PCFW.a.m=Socket.open;
Socket.open=function(){this.backoff=0;var a=Slug,b=this;Models.room.data.id&&(a=Models.room.data.id);console.log("open!",a);a=new RoomJoinService(a);a.v=function(){b.pong();PCFW.events.emit("onSocketJoin",{})};a.t=function(){console.log("boom time");PCFW.events.emit("onSocketError",{})}};PCFW.a.l=Socket.close;Socket.close=function(a){a&&(a.B?alert("This session has now ended. Goodbye."):(console.info("closing",a),a=this.backoff,5>=a&&socketInit(a+1)));PCFW.events.emit("onSocketClose",{})}},kill:function(){Socket.open=
PCFW.a.m;Socket.close=PCFW.a.l}},p:{init:function(){PCFW.a.n=$.proxy(Models.room.userUpdate,Models.room);PCFW.events.on("userUpdate",PCFW.a.n,PCFW.events.priority.SYSTEM)}}};PCFW.init();window.PCFW=PCFW;window.PCFW.GUI=PCFW.GUI;