-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathapeClientJS.js
More file actions
executable file
·24 lines (21 loc) · 3.88 KB
/
Copy pathapeClientJS.js
File metadata and controls
executable file
·24 lines (21 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var a,APE={Config:{identifier:"ape",init:true,frequency:0,scripts:[]},Client:function(b){if(b)this.core=b}};a=APE.Client.prototype;a.eventProxy=[];a.fireEvent=function(b,c,d){this.core.fireEvent(b,c,d)};a.addEvent=function(b,c,d){var e=c.bind(this),f=this;if(this.core==undefined)this.eventProxy.push([b,c,d]);else{f=this.core.addEvent(b,e,d);this.core.$originalEvents[b]=this.core.$originalEvents[b]||[];this.core.$originalEvents[b][c]=e}return f};
a.removeEvent=function(b,c){return this.core.removeEvent(b,c)};a.onRaw=function(b,c,d){this.addEvent("raw_"+b.toLowerCase(),c,d)};a.onCmd=function(b,c,d){this.addEvent("cmd_"+b.toLowerCase(),c,d)};a.onError=function(b,c,d){this.addEvent("error_"+b,c,d)};a.cookie={};a.cookie.write=function(b,c){document.cookie=b+"="+encodeURIComponent(c)+"; domain="+document.domain};
a.cookie.read=function(b){b=b+"=";for(var c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];e.charAt(0)==" ";)e=e.substring(1,e.length);if(e.indexOf(b)==0)return decodeURIComponent(e.substring(b.length,e.length))}return null};
a.load=function(b){b=b||{};b.transport=b.transport||APE.Config.transport||0;b.frequency=b.frequency||0;b.domain=b.domain||APE.Config.domain||document.domain;b.scripts=b.scripts||APE.Config.scripts;b.server=b.server||APE.Config.server;b.secure=b.sercure||APE.Config.secure;b.init=function(g){this.core=g;for(g=0;g<this.eventProxy.length;g++)this.addEvent.apply(this,this.eventProxy[g])}.bind(this);if(b.transport!=2){if(b.domain!="auto")document.domain=b.domain;if(b.domain=="auto")document.domain=document.domain}var c=
this.cookie.read("APE_Cookie"),d=eval("("+c+")");if(d)b.frequency=d.frequency+1;else c='{"frequency":0}';d=new RegExp('"frequency":([ 0-9]+)',"g");c=c.replace(d,'"frequency":'+b.frequency);this.cookie.write("APE_Cookie",c);var e=document.createElement("iframe");e.setAttribute("id","ape_"+b.identifier);e.style.display="none";e.style.position="absolute";e.style.left="-300px";e.style.top="-300px";document.body.insertBefore(e,document.body.childNodes[0]);function f(){e.contentWindow.APE.init(b)}if(e.addEventListener)e.addEventListener("load",
f,false);else e.attachEvent&&e.attachEvent("onload",f);if(b.transport==2){c=e.contentDocument;if(!c)c=e.contentWindow.document;c.open();d="<html><head>";for(var h=0;h<b.scripts.length;h++)d+='<script type="text/JavaScript" src="'+b.scripts[h]+'"><\/script>';d+="</head><body></body></html>";c.write(d);c.close()}else{e.setAttribute("src",(b.secure?"https":"http")+"://"+b.frequency+"."+b.server+'/?[{"cmd":"script","params":{"domain":"'+document.domain+'","scripts":["'+b.scripts.join('","')+'"]}}]');
if(navigator.product=="Gecko")e.contentWindow.location.href=e.getAttribute("src")}};if(Function.prototype.bind==null)Function.prototype.bind=function(b,c){return this.create({bind:b,arguments:c})};if(Function.prototype.create==null)Function.prototype.create=function(b){var c=this;b=b||{};return function(){var d=b.arguments||arguments;if(d&&!d.length)d=[d];function e(){return c.apply(b.bind||null,d)}return e()}};
/***
* APE JSF Setup
*/
APE.Config.baseUrl = 'http://local.ape-project.org/APE_JSF'; //APE JSF
APE.Config.domain = 'ape-project.org';
APE.Config.server = 'ape.local.ape-project.org:6969'; //APE server URL
APE.Config.baseUrl = 'http://ape.home.efyx.io/APE_JSF'; //APE JSF
APE.Config.domain = 'efyx.io';
APE.Config.server = 'ape.home.efyx.io:6969'; //APE server URL
APE.Config.transport = 6;
(function(){
for (var i = 0; i < arguments.length; i++)
APE.Config.scripts.push(APE.Config.baseUrl + '/Source/' + arguments[i] + '.js');
})('mootools-core', 'Core/APE', 'Core/Events', 'Core/Core', 'Pipe/Pipe', 'Pipe/PipeProxy', 'Pipe/PipeMulti', 'Pipe/PipeSingle', 'Request/Request','Request/Request.Stack', 'Request/Request.CycledStack', 'Transport/Transport.longPolling','Transport/Transport.SSE', 'Transport/Transport.XHRStreaming', 'Transport/Transport.JSONP', 'Transport/Transport.WebSocket', 'Core/Utility', 'Core/JSON');