8000 Socket.IO/socket.io.js at master · tomyan/Socket.IO · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":"bin","path":"bin","contentType":"directory"},{"name":"lib","path":"lib","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".gitmodules","path":".gitmodules","contentType":"file"},{"name":"Makefile","path":"Makefile","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"socket.io.js","path":"socket.io.js","contentType":"file"}],"totalCount":7}},"fileTreeProcessingTime":7.340132,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":948478,"defaultBranch":"master","name":"Socket.IO","ownerLogin":"tomyan","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2010-09-29T14:12:41.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/50747?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1616502054.258558","canEdit":false,"refType":"branch","currentOid":"90465996f5f71c1d1b74581807e199a41899698c"},"path":"socket.io.js","currentUser":null,"blob":{"rawLines":["/** Socket.IO 0.6 - Built with build.js */","/**"," * Socket.IO client"," * "," * @author Guillermo Rauch \u003cguillermo@learnboost.com\u003e"," * @license The MIT license."," * @copyright Copyright (c) 2010 LearnBoost \u003cdev@learnboost.com\u003e"," */","","this.io = {","\tversion: '0.6',","\t","\tsetPath: function(path){","\t\tif (window.console \u0026\u0026 console.error) console.error('io.setPath will be removed. Please set the variable WEB_SOCKET_SWF_LOCATION pointing to WebSocketMain.swf');","\t\tthis.path = /\\/$/.test(path) ? path : path + '/';","\t\tWEB_SOCKET_SWF_LOCATION = path + 'lib/vendor/web-socket-js/WebSocketMain.swf';","\t}","};","","if ('jQuery' in this) jQuery.io = this.io;","","if (typeof window != 'undefined'){"," // WEB_SOCKET_SWF_LOCATION = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//cdn.socket.io/' + this.io.version + '/WebSocketMain.swf';"," WEB_SOCKET_SWF_LOCATION = '/socket.io/lib/vendor/web-socket-js/WebSocketMain.swf';","}","/**"," * Socket.IO client"," * "," * @author Guillermo Rauch \u003cguillermo@learnboost.com\u003e"," * @license The MIT license."," * @copyright Copyright (c) 2010 LearnBoost \u003cdev@learnboost.com\u003e"," */","","(function(){","","\tvar _pageLoaded = false;","","\tio.util = {","","\t\tios: false,","","\t\tload: function(fn){","\t\t\tif (document.readyState == 'complete' || _pageLoaded) return fn();","\t\t\tif ('attachEvent' in window){","\t\t\t\twindow.attachEvent('onload', fn);","\t\t\t} else {","\t\t\t\twindow.addEventListener('load', fn, false);","\t\t\t}","\t\t},","","\t\tinherit: function(ctor, superCtor){","\t\t\t// no support for `instanceof` for now","\t\t\tfor (var i in superCtor.prototype){","\t\t\t\tctor.prototype[i] = superCtor.prototype[i];","\t\t\t}","\t\t},","","\t\tindexOf: function(arr, item, from){","\t\t\tfor (var l = arr.length, i = (from \u003c 0) ? Math.max(0, l + from) : from || 0; i \u003c l; i++){","\t\t\t\tif (arr[i] === item) return i;","\t\t\t}","\t\t\treturn -1;","\t\t},","","\t\tisArray: function(obj){","\t\t\treturn Object.prototype.toString.call(obj) === '[object Array]';","\t\t}","","\t};","","\tio.util.ios = /iphone|ipad/i.test(navigator.userAgent);","\tio.util.android = /android/i.test(navigator.userAgent);","\tio.util.opera = /opera/i.test(navigator.userAgent);","","\tio.util.load(function(){","\t\t_pageLoaded = true;","\t});","","})();","/**"," * Socket.IO client"," * "," * @author Guillermo Rauch \u003cguillermo@learnboost.com\u003e"," * @license The MIT license."," * @copyright Copyright (c) 2010 LearnBoost \u003cdev@learnboost.com\u003e"," */","","// abstract","","(function(){","\t","\tvar frame = '~m~',","\t","\tstringify = function(message){","\t\tif (Object.prototype.toString.call(message) == '[object Object]'){","\t\t\tif (!('JSON' in window)){","\t\t\t\tif ('console' in window \u0026\u0026 console.error) console.error('Trying to encode as JSON, but JSON.stringify is missing.');","\t\t\t\treturn '{ \"$error\": \"Invalid message\" }';","\t\t\t}","\t\t\treturn '~j~' + JSON.stringify(message);","\t\t} else {","\t\t\treturn String(message);","\t\t}","\t};","\t","\tTransport = io.Transport = function(base, options){","\t\tthis.base = base;","\t\tthis.options = {","\t\t\ttimeout: 15000 // based on heartbeat interval default","\t\t};","\t\tfor (var i in options) ","\t\t\tif (this.options.hasOwnProperty(i))","\t\t\t\tthis.options[i] = options[i];","\t};","","\tTransport.prototype.send = function(){","\t\tthrow new Error('Missing send() implementation');","\t};","","\tTransport.prototype.connect = function(){","\t\tthrow new Error('Missing connect() implementation');","\t};","","\tTransport.prototype.disconnect = function(){","\t\tthrow new Error('Missing disconnect() implementation');","\t};","\t","\tTransport.prototype._encode = function(messages){","\t\tvar ret = '', message,","\t\t\t\tmessages = io.util.isArray(messages) ? messages : [messages];","\t\tfor (var i = 0, l = messages.length; i \u003c l; i++){","\t\t\tmessage = messages[i] === null || messages[i] === undefined ? '' : stringify(messages[i]);","\t\t\tret += frame + message.length + frame + message;","\t\t}","\t\treturn ret;","\t};","\t","\tTransport.prototype._decode = function(data){","\t\tvar messages = [], number, n;","\t\tdo {","\t\t\tif (data.substr(0, 3) !== frame) return messages;","\t\t\tdata = data.substr(3);","\t\t\tnumber = '', n = '';","\t\t\tfor (var i = 0, l = data.length; i \u003c l; i++){","\t\t\t\tn = Number(data.substr(i, 1));","\t\t\t\tif (data.substr(i, 1) == n){","\t\t\t\t\tnumber += n;","\t\t\t\t} else {\t","\t\t\t\t\tdata = data.substr(number.length + frame.length)","\t\t\t\t\tnumber = Number(number);","\t\t\t\t\tbreak;","\t\t\t\t} ","\t\t\t}","\t\t\tmessages.push(data.substr(0, number)); // here","\t\t\tdata = data.substr(number);","\t\t} while(data !== '');","\t\treturn messages;","\t};","\t","\tTransport.prototype._onData = function(data){","\t\tthis._setTimeout();","\t\tvar msgs = this._decode(data);","\t\tif (msgs \u0026\u0026 msgs.length){","\t\t\tfor (var i = 0, l = msgs.length; i \u003c l; i++){","\t\t\t\tthis._onMessage(msgs[i]);","\t\t\t}","\t\t}","\t};","\t","\tTransport.prototype._setTimeout = function(){","\t\tvar self = this;","\t\tif (this._timeout) clearTimeout(this._timeout);","\t\tthis._timeout = setTimeout(function(){","\t\t\tself._onTimeout();","\t\t}, this.options.timeout);","\t};","\t","\tTransport.prototype._onTimeout = function(){","\t\tthis._onDisconnect();","\t};","\t","\tTransport.prototype._onMessage = function(message){","\t\tif (!this.sessionid){","\t\t\tthis.sessionid = message;","\t\t\tthis._onConnect();","\t\t} else if (message.substr(0, 3) == '~h~'){","\t\t\tthis._onHeartbeat(message.substr(3));","\t\t} else if (message.substr(0, 3) == '~j~'){","\t\t\tthis.base._onMessage(JSON.parse(message.substr(3)));","\t\t} else {","\t\t\tthis.base._onMessage(message);","\t\t}","\t},","\t","\tTransport.prototype._onHeartbeat = function(heartbeat){","\t\tthis.send('~h~' + heartbeat); // echo","\t};","\t","\tTransport.prototype._onConnect = function(){","\t\tthis.connected = true;","\t\tthis.connecting = false;","\t\tthis.base._onConnect();","\t\tthis._setTimeout();","\t};","","\tTransport.prototype._onDisconnect = function(){","\t\tthis.connecting = false;","\t\tthis.connected = false;","\t\tthis.sessionid = null;","\t\tthis.base._onDisconnect();","\t};","","\tTransport.prototype._prepareUrl = function(){","\t\treturn (this.base.options.secure ? 'https' : 'http') ","\t\t\t+ '://' + this.base.host ","\t\t\t+ ':' + this.base.options.port","\t\t\t+ '/' + this.base.options.resource","\t\t\t+ '/' + this.type","\t\t\t+ (this.sessionid ? ('/' + this.sessionid) : '/');","\t};","","})();","/**"," * Socket.IO client"," * "," * @author Guillermo Rauch \u003cguillermo@learnboost.com\u003e"," * @license The MIT license."," * @copyright Copyright (c) 2010 LearnBoost \u003cdev@learnboost.com\u003e"," */","","(function(){","\t","\tvar empty = new Function,","\t ","\tXMLHttpRequestCORS = (function(){","\t\tif (!('XMLHttpRequest' in window)) return false;","\t\t// CORS feature detection","\t\tvar a = new XMLHttpRequest();","\t\treturn a.withCredentials != undefined;","\t})(),","\t","\trequest = function(xdomain){","\t\tif ('XDomainRequest' in window \u0026\u0026 xdomain) return new XDomainRequest();","\t\tif ('XMLHttpRequest' in window \u0026\u0026 (!xdomain || XMLHttpRequestCORS)) return new XMLHttpRequest();","\t\tif (!xdomain){","\t\t\ttry {","\t\t\t\tvar a = new ActiveXObject('MSXML2.XMLHTTP');","\t\t\t\treturn a;","\t\t\t} catch(e){}","\t\t","\t\t\ttry {","\t\t\t\tvar b = new ActiveXObject('Microsoft.XMLHTTP');","\t\t\t\treturn b;","\t\t\t} catch(e){}","\t\t}","\t\treturn false;","\t},","\t","\tXHR = io.Transport.XHR = function(){","\t\tio.Transport.apply(this, arguments);","\t\tthis._sendBuffer = [];","\t};","\t","\tio.util.inherit(XHR, io.Transport);","\t","\tXHR.prototype.connect = function(){","\t\tthis._get();","\t\treturn this;","\t};","\t","\tXHR.prototype._checkSend = function(){","\t\tif (!this._posting \u0026\u0026 this._sendBuffer.length){","\t\t\tvar encoded = this._encode(this._sendBuffer);","\t\t\tthis._sendBuffer = [];","\t\t\tthis._send(encoded);","\t\t}","\t};","\t","\tXHR.prototype.send = function(data){","\t\tif (io.util.isArray(data)){","\t\t\tthis._sendBuffer.push.apply(this._sendBuffer, data);","\t\t} else {","\t\t\tthis._sendBuffer.push(data);","\t\t}","\t\tthis._checkSend();","\t\treturn this;","\t};","\t","\tXHR.prototype._send = function(data){","\t\tvar self = this;","\t\tthis._posting = true;","\t\tthis._sendXhr = this._request('send', 'POST');","\t\tthis._sendXhr.","\t\t\tvar status;","\t\t\tif (self._sendXhr.readyState == 4){","\t\t\t\tself._sendXhr.","\t\t\t\ttry { status = self._sendXhr.status; } catch(e){}","\t\t\t\tself._posting = false;","\t\t\t\tif (status == 200){","\t\t\t\t\tself._checkSend();","\t\t\t\t} else {","\t\t\t\t\tself._onDisconnect();","\t\t\t\t}","\t\t\t}","\t\t};","\t\tthis._sendXhr.send('data=' + encodeURIComponent(data));","\t},","\t","\tXHR.prototype.disconnect = function(){","\t\t// send disconnection signal","\t\tthis._onDisconnect();","\t\treturn this;","\t}","\t","\tXHR.prototype._onDisconnect = function(){","\t\tif (this._xhr){","\t\t\tthis._xhr. = empty;","\t\t\tthis._xhr.abort();","\t\t\tthis._xhr = null;","\t\t}","\t\tif (this._sendXhr){","\t\t\tthis._sendXhr. = empty;","\t\t\tthis._sendXhr.abort();","\t\t\tthis._sendXhr = null;","\t\t}","\t\tthis._sendBuffer = [];","\t\tio.Transport.prototype._onDisconnect.call(this);","\t};","\t","\tXHR.prototype._request = function(url, method, multipart){","\t\tvar req = request(this.base._isXDomain());","\t\tif (multipart) req.multipart = true;","\t\treq.open(method || 'GET', this._prepareUrl() + (url ? '/' + url : ''));","\t\tif (method == 'POST' \u0026\u0026 'setRequestHeader' in req){","\t\t\treq.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=utf-8');","\t\t}","\t\treturn req;","\t};","\t","\tXHR.check = function(xdomain){","\t\ttry {","\t\t\tif (request(xdomain)) return true;","\t\t} catch(e){}","\t\treturn false;","\t};","\t","\tXHR.xdomainCheck = function(){","\t\treturn XHR.check(true);","\t};","\t","\tXHR.request = request;","\t","})();","/**"," * Socket.IO client"," * "," * @author Guillermo Rauch \u003cguillermo@learnboost.com\u003e"," * @license The MIT license."," * @copyright Copyright (c) 2010 LearnBoost \u003cdev@learnboost.com\u003e"," */","","(function(){","\t","\tvar WS = io.Transport.websocket = function(){","\t\tio.Transport.apply(this, arguments);","\t};","\t","\tio.util.inherit(WS, io.Transport);","\t","\tWS.prototype.type = 'websocket';","\t","\tWS.prototype.connect = function(){","\t\tvar self = this;","\t\tthis.socket = new WebSocket(this._prepareUrl());","\t\tthis.socket. self._onData(ev.data); };","\t\tthis.socket. self._onClose(); };","\t\treturn this;","\t};","\t","\tWS.prototype.send = function(data){","\t\tthis.socket.send(this._encode(data));","\t\treturn this;","\t}","\t","\tWS.prototype.disconnect = function(){","\t\tthis.socket.close();","\t\treturn this;","\t};","\t","\tWS.prototype._onClose = function(){","\t\tthis._onDisconnect();","\t\treturn this;","\t};","\t","\tWS.prototype._prepareUrl = function(){","\t\treturn (this.base.options.secure ? 'wss' : 'ws') ","\t\t+ '://' + this.base.host ","\t\t+ ':' + this.base.options.port","\t\t+ '/' + this.base.options.resource","\t\t+ '/' + this.type","\t\t+ (this.sessionid ? ('/' + this.sessionid) : '');","\t};","\t","\tWS.check = function(){","\t\t// we make sure WebSocket is not confounded with a previously loaded flash WebSocket","\t\treturn 'WebSocket' in window \u0026\u0026 WebSocket.prototype \u0026\u0026 ( WebSocket.prototype.send \u0026\u0026 !!WebSocket.prototype.send.toString().match(/native/i)) \u0026\u0026 typeof WebSocket !== \"undefined\";","\t};","","\tWS.xdomainCheck = function(){","\t\treturn true;","\t};","\t","})();","/**"," * Socket.IO client"," * "," * @author Guillermo Rauch \u003cguillermo@learnboost.com\u003e"," * @license The MIT license."," * @copyright Copyright (c) 2010 LearnBoost \u003cdev@learnboost.com\u003e"," */","","(function(){","\t","\tvar Flashsocket = io.Transport.flashsocket = function(){","\t\tio.Transport.websocket.apply(this, arguments);","\t};","\t","\tio.util.inherit(Flashsocket, io.Transport.websocket);","\t","\tFlashsocket.prototype.type = 'flashsocket';","\t","\tFlashsocket.prototype.connect = function(){","\t\tvar self = this, args = arguments;","\t\tWebSocket.__addTask(function(){","\t\t\tio.Transport.websocket.prototype.connect.apply(self, args);","\t\t});","\t\treturn this;","\t};","\t","\tFlashsocket.prototype.send = function(){","\t\tvar self = this, args = arguments;","\t\tWebSocket.__addTask(function(){","\t\t\tio.Transport.websocket.prototype.send.apply(self, args);","\t\t});","\t\treturn this;","\t};","\t","\tFlashsocket.prototype._onClose = function(){","\t\tif (!this.base.connected){","\t\t\t// something failed, we might be behind a proxy, so we'll try another transport","\t\t\tthis.base.options.transports.splice(io.util.indexOf(this.base.options.transports, 'flashsocket'), 1);","\t\t\tthis.base.transport = this.base.getTransport();","\t\t\tthis.base.connect();","\t\t\treturn;","\t\t}","\t\treturn io.Transport.websocket.prototype._onClose.call(this);","\t};","\t","\tFlashsocket.check = function(){","\t\tif (typeof WebSocket == 'undefined' || !('__addTask' in WebSocket)) return false;","\t\tif (io.util.opera) return false; // opera is buggy with this transport","\t\tif ('navigator' in window \u0026\u0026 'plugins' in navigator \u0026\u0026 navigator.plugins['Shockwave Flash']){","\t\t\treturn !!navigator.plugins['Shockwave Flash'].description;","\t }","\t\tif ('ActiveXObject' in window) {","\t\t\ttry {","\t\t\t\treturn !!new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');","\t\t\t} catch (e) {}","\t\t}","\t\treturn false;","\t};","\t","\tFlashsocket.xdomainCheck = function(){","\t\treturn true;","\t};","\t","})();","/**"," * Socket.IO client"," * "," * @author Guillermo Rauch \u003cguillermo@learnboost.com\u003e"," * @license The MIT license."," * @copyright Copyright (c) 2010 LearnBoost \u003cdev@learnboost.com\u003e"," */","","(function(){","\t","\tvar HTMLFile = io.Transport.htmlfile = function(){","\t\tio.Transport.XHR.apply(this, arguments);","\t};","\t","\tio.util.inherit(HTMLFile, io.Transport.XHR);","\t","\tHTMLFile.prototype.type = 'htmlfile';","\t","\tHTMLFile.prototype._get = function(){","\t\tvar self = this;","\t\tthis._open();","\t\twindow.attachEvent('onunload', function(){ self._destroy(); });","\t};","\t","\tHTMLFile.prototype._open = function(){","\t\tthis._doc = new ActiveXObject('htmlfile');","\t\tthis._doc.open();","\t\tthis._doc.write('\u003chtml\u003e\u003c/html\u003e');","\t\tthis._doc.parentWindow.s = this;","\t\tthis._doc.close();","","\t\tvar _iframeC = this._doc.createElement('div');","\t\tthis._doc.body.appendChild(_iframeC);","\t\tthis._iframe = this._doc.createElement('iframe');","\t\t_iframeC.appendChild(this._iframe);","\t\tthis._iframe.src = this._prepareUrl() + '/' + (+ new Date);","\t};","\t","\tHTMLFile.prototype._ = function(data, doc){","\t\tthis._onData(data);","\t\tvar script = doc.getElementsByTagName('script')[0];","\t\tscript.parentNode.removeChild(script);","\t};","\t","\tHTMLFile.prototype._destroy = function(){","\t\tthis._iframe.src = 'about:blank';","\t\tthis._doc = null;","\t\tCollectGarbage();","\t};","\t","\tHTMLFile.prototype.disconnect = function(){","\t\tthis._destroy();","\t\treturn io.Transport.XHR.prototype.disconnect.call(this);","\t};","\t","\tHTMLFile.check = function(){","\t\tif ('ActiveXObject' in window){","\t\t\ttry {","\t\t\t\tvar a = new ActiveXObject('htmlfile');","\t\t\t\treturn a \u0026\u0026 io.Transport.XHR.check();","\t\t\t} catch(e){}","\t\t}","\t\treturn false;","\t};","","\tHTMLFile.xdomainCheck = function(){","\t\t// we can probably do handling for sub-domains, we should test that it's cross domain but a subdomain here","\t\treturn false;","\t};","\t","})();","/**"," * Socket.IO client"," * "," * @author Guillermo Rauch \u003cguillermo@learnboost.com\u003e"," * @license The MIT license."," * @copyright Copyright (c) 2010 LearnBoost \u003cdev@learnboost.com\u003e"," */","","(function(){","\t","\tvar XHRMultipart = io.Transport['xhr-multipart'] = function(){","\t\tio.Transport.XHR.apply(this, arguments);","\t};","\t","\tio.util.inherit(XHRMultipart, io.Transport.XHR);","\t","\tXHRMultipart.prototype.type = 'xhr-multipart';","\t","\tXHRMultipart.prototype._get = function(){","\t\tvar self = this;","\t\tthis._xhr = this._request('', 'GET', true);","\t\tthis._xhr.","\t\t\tif (self._xhr.readyState == 3) self._onData(self._xhr.responseText);","\t\t};","\t\tthis._xhr.send();","\t};","\t","\tXHRMultipart.check = function(){","\t\treturn 'XMLHttpRequest' in window \u0026\u0026 'prototype' in XMLHttpRequest \u0026\u0026 'multipart' in XMLHttpRequest.prototype;","\t};","","\tXHRMultipart.xdomainCheck = function(){","\t\treturn true;","\t};","\t","})();","/**"," * Socket.IO client"," * "," * @author Guillermo Rauch \u003cguillermo@learnboost.com\u003e"," * @license The MIT license."," * @copyright Copyright (c) 2010 LearnBoost \u003cdev@learnboost.com\u003e"," */","","(function(){","","\tvar empty = new Function(),","","\tXHRPolling = io.Transport['xhr-polling'] = function(){","\t\tio.Transport.XHR.apply(this, arguments);","\t};","","\tio.util.inherit(XHRPolling, io.Transport.XHR);","","\tXHRPolling.prototype.type = 'xhr-polling';","","\tXHRPolling.prototype.connect = function(){","\t\tif (io.util.ios || io.util.android){","\t\t\tvar self = this;","\t\t\tio.util.load(function(){","\t\t\t\tsetTimeout(function(){","\t\t\t\t\tio.Transport.XHR.prototype.connect.call(self);","\t\t\t\t}, 10);","\t\t\t});","\t\t} else {","\t\t\tio.Transport.XHR.prototype.connect.call(this);","\t\t}","\t};","","\tXHRPolling.prototype._get = function(){","\t\tvar self = this;","\t\tthis._xhr = this._request(+ new Date, 'GET');","\t\tif ('onload' in this._xhr){","\t\t\tthis._xhr.","\t\t\t\tself._onData(this.responseText);","\t\t\t\tself._get();","\t\t\t};","\t\t} else {","\t\t\tthis._xhr.","\t\t\t\tvar status;","\t\t\t\tif (self._xhr.readyState == 4){","\t\t\t\t\tself._xhr.","\t\t\t\t\ttry { status = self._xhr.status; } catch(e){}","\t\t\t\t\tif (status == 200){","\t\t\t\t\t\tself._onData(self._xhr.responseText);","\t\t\t\t\t\tself._get();","\t\t\t\t\t} else {","\t\t\t\t\t\tself._onDisconnect();","\t\t\t\t\t}","\t\t\t\t}","\t\t\t};","\t\t}","\t\tthis._xhr.send();","\t};","","\tXHRPolling.check = function(){","\t\treturn io.Transport.XHR.check();","\t};","","\tXHRPolling.xdomainCheck = function(){","\t\treturn io.Transport.XHR.xdomainCheck();","\t};","","})();","/**"," * Socket.IO client"," * "," * @author Guillermo Rauch \u003cguillermo@learnboost.com\u003e"," * @license The MIT license."," * @copyright Copyright (c) 2010 LearnBoost \u003cdev@learnboost.com\u003e"," */","","io.JSONP = [];","","JSONPPolling = io.Transport['jsonp-polling'] = function(){","\tio.Transport.XHR.apply(this, arguments);","\tthis._insertAt = document.getElementsByTagName('script')[0];","\tthis._index = io.JSONP.length;","\tio.JSONP.push(this);","};","","io.util.inherit(JSONPPolling, io.Transport['xhr-polling']);","","JSONPPolling.prototype.type = 'jsonp-polling';","","JSONPPolling.prototype._send = function(data){","\tvar self = this;","\tif (!('_form' in this)){","\t\tvar form = document.createElement('FORM'),","\t\t area = document.createElement('TEXTAREA'),","\t\t id = this._iframeId = 'socket_io_iframe_' + this._index,","\t\t iframe;","","\t\tform.style.position = 'absolute';","\t\tform.style.top = '-1000px';","\t\tform.style.left = '-1000px';","\t\tform.target = id;","\t\tform.method = 'POST';","\t\tform.action = this._prepareUrl() + '/' + (+new Date) + '/' + this._index;","\t\tarea.name = 'data';","\t\tform.appendChild(area);","\t\tthis._insertAt.parentNode.insertBefore(form, this._insertAt);","\t\tdocument.body.appendChild(form);","","\t\tthis._form = form;","\t\tthis._area = area;","\t}","","\tfunction complete(){","\t\tinitIframe();","\t\tself._posting = false;","\t\tself._checkSend();","\t};","","\tfunction initIframe(){","\t\tif (self._iframe){","\t\t\tself._form.removeChild(self._iframe);","\t\t} ","","\t\ttry {","\t\t\t// ie6 dynamic iframes with target=\"\" support (thanks Chris Lambacher)","\t\t\tiframe = document.createElement('\u003ciframe name=\"'+ self._iframeId +'\"\u003e');","\t\t} catch(e){","\t\t\tiframe = document.createElement('iframe');","\t\t\tiframe.name = self._iframeId;","\t\t}","","\t\tiframe.id = self._iframeId;","","\t\tself._form.appendChild(iframe);","\t\tself._iframe = iframe;","\t};","","\tinitIframe();","","\tthis._posting = true;","\tthis._area.value = data;","","\ttry {","\t\tthis._form.submit();","\t} catch(e){}","","\tif (this._iframe.attachEvent){","\t\tiframe.","\t\t\tif (self._iframe.readyState == 'complete') complete();","\t\t};","\t} else {","\t\tthis._iframe.","\t}","};","","JSONPPolling.prototype._get = function(){","\tvar self = this,","\t\t\tscript = document.createElement('SCRIPT');","\tif (this._script){","\t\tthis._script.parentNode.removeChild(this._script);","\t\tthis._script = null;","\t}","\tscript.async = true;","\tscript.src = this._prepareUrl() + '/' + (+new Date) + '/' + this._index;","\tscript.","\t\tself._onDisconnect();","\t};","\tthis._insertAt.parentNode.insertBefore(script, this._insertAt);","\tthis._script = script;","};","","JSONPPolling.prototype._ = function(){","\tthis._onData.apply(this, arguments);","\tthis._get();","\treturn this;","};","","JSONPPolling.check = function(){","\treturn true;","};","","JSONPPolling.xdomainCheck = function(){","\treturn true;","};","/**"," * Socket.IO client"," * "," * @author Guillermo Rauch \u003cguillermo@learnboost.com\u003e"," * @license The MIT license."," * @copyright Copyright (c) 2010 LearnBoost \u003cdev@learnboost.com\u003e"," */","","(function(){","\t","\tvar Socket = io.Socket = function(host, options){","\t\tthis.host = host || document.domain;","\t\tthis.options = {","\t\t\tsecure: false,","\t\t\tdocument: document,","\t\t\tport: document.location.port || 80,","\t\t\tresource: 'socket.io',","\t\t\ttransports: ['websocket', 'flashsocket', 'htmlfile', 'xhr-multipart', 'xhr-polling', 'jsonp-polling'],","\t\t\ttransportOptions: {","\t\t\t\t'xhr-polling': {","\t\t\t\t\ttimeout: 25000 // based on polling duration default","\t\t\t\t},","\t\t\t\t'jsonp-polling': {","\t\t\t\t\ttimeout: 25000","\t\t\t\t}","\t\t\t},","\t\t\tconnectTimeout: 5000,","\t\t\ttryTransportsOnConnectTimeout: true,","\t\t\trememberTransport: true","\t\t};","\t\tfor (var i in options) ","\t\t\tif (this.options.hasOwnProperty(i))","\t\t\t\tthis.options[i] = options[i];","\t\tthis.connected = false;","\t\tthis.connecting = false;","\t\tthis._events = {};","\t\tthis.transport = this.getTransport();","\t\tif (!this.transport \u0026\u0026 'console' in window) console.error('No transport available');","\t};","\t","\tSocket.prototype.getTransport = function(override){","\t\tvar transports = override || this.options.transports, match;","\t\tif (this.options.rememberTransport \u0026\u0026 !override){","\t\t\tmatch = this.options.document.cookie.match('(?:^|;)\\\\s*socketio=([^;]*)');","\t\t\tif (match){","\t\t\t\tthis._rememberedTransport = true;","\t\t\t\ttransports = [decodeURIComponent(match[1])];","\t\t\t}","\t\t} ","\t\tfor (var i = 0, transport; transport = transports[i]; i++){","\t\t\tif (io.Transport[transport] ","\t\t\t\t\u0026\u0026 io.Transport[transport].check() ","\t\t\t\t\u0026\u0026 (!this._isXDomain() || io.Transport[transport].xdomainCheck())){","\t\t\t\treturn new io.Transport[transport](this, this.options.transportOptions[transport] || {});","\t\t\t}","\t\t}","\t\treturn null;","\t};","\t","\tSocket.prototype.connect = function(){","\t\tif (this.transport \u0026\u0026 !this.connected){","\t\t\tif (this.connecting) this.disconnect();","\t\t\tthis.connecting = true;","\t\t\tthis.transport.connect();","\t\t\tif (this.options.connectTimeout){","\t\t\t\tvar self = this;","\t\t\t\tsetTimeout(function(){","\t\t\t\t\tif (!self.connected){","\t\t\t\t\t\tself.disconnect();","\t\t\t\t\t\tif (self.options.tryTransportsOnConnectTimeout \u0026\u0026 !self._rememberedTransport){","\t\t\t\t\t\t\tvar remainingTransports = [], transports = self.options.transports;","\t\t\t\t\t\t\tfor (var i = 0, transport; transport = transports[i]; i++){","\t\t\t\t\t\t\t\tif (transport != self.transport.type) remainingTransports.push(transport);","\t\t\t\t\t\t\t}","\t\t\t\t\t\t\tif (remainingTransports.length){","\t\t\t\t\t\t\t\tself.transport = self.getTransport(remainingTransports);","\t\t\t\t\t\t\t\tself.connect();","\t\t\t\t\t\t\t}","\t\t\t\t\t\t}","\t\t\t\t\t}","\t\t\t\t}, this.options.connectTimeout)","\t\t\t}","\t\t}","\t\treturn this;","\t};","\t","\tSocket.prototype.send = function(data){","\t\tif (!this.transport || !this.transport.connected) return this._queue(data);","\t\tthis.transport.send(data);","\t\treturn this;","\t};","\t","\tSocket.prototype.disconnect = function(){","\t\tthis.transport.disconnect();","\t\treturn this;","\t};","\t","\tSocket.prototype.on = function(name, fn){","\t\tif (!(name in this._events)) this._events[name] = [];","\t\tthis._events[name].push(fn);","\t\treturn this;","\t};","\t","\tSocket.prototype.fire = function(name, args){","\t\tif (name in this._events){","\t\t\tfor (var i = 0, ii = this._events[name].length; i \u003c ii; i++) ","\t\t\t\tthis._events[name][i].apply(this, args === undefined ? [] : args);","\t\t}","\t\treturn this;","\t};","\t","\tSocket.prototype.removeEvent = function(name, fn){","\t\tif (name in this._events){","\t\t\tfor (var a = 0, l = this._events[name].length; a \u003c l; a++)","\t\t\t\tif (this._events[name][a] == fn) this._events[name].splice(a, 1);\t\t","\t\t}","\t\treturn this;","\t};","\t","\tSocket.prototype._queue = function(message){","\t\tif (!('_queueStack' in this)) this._queueStack = [];","\t\tthis._queueStack.push(message);","\t\treturn this;","\t};","\t","\tSocket.prototype._doQueue = function(){","\t\tif (!('_queueStack' in this) || !this._queueStack.length) return this;","\t\tthis.transport.send(this._queueStack);","\t\tthis._queueStack = [];","\t\treturn this;","\t};","\t","\tSocket.prototype._isXDomain = function(){","\t\treturn this.host !== document.domain;","\t};","\t","\tSocket.prototype._onConnect = function(){","\t\tthis.connected = true;","\t\tthis.connecting = false;","\t\tthis._doQueue();","\t\tif (this.options.rememberTransport) this.options.document.cookie = 'socketio=' + encodeURIComponent(this.transport.type);","\t\tthis.fire('connect');","\t};","\t","\tSocket.prototype._onMessage = function(data){","\t\tthis.fire('message', [data]);","\t};","\t","\tSocket.prototype._onDisconnect = function(){","\t\tvar wasConnected = this.connected;","\t\tthis.connected = false;","\t\tthis.connecting = false;","\t\tthis._queueStack = [];","\t\tif (wasConnected) this.fire('disconnect');","\t};","\t","\tSocket.prototype.addListener = Socket.prototype.addEvent = Socket.prototype.addEventListener = Socket.prototype.on;","\t","})();","/*\tSWFObject v2.2 \u003chttp://code.google.com/p/swfobject/\u003e ","\tis released under the MIT License \u003chttp://www.opensource.org/licenses/mit-license.php\u003e ","*/","var swfobject=function(){var D=\"undefined\",r=\"object\",S=\"Shockwave Flash\",W=\"ShockwaveFlash.ShockwaveFlash\",q=\"application/x-shockwave-flash\",R=\"SWFObjectExprInst\",x=\"onreadystatechange\",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D\u0026\u0026typeof j.getElementsByTagName!=D\u0026\u0026typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\\/(\\d+(\\.\\d+)?).*$/,\"$1\")):false,X=!+\"\\v1\",ag=[0,0,0],ab=null;if(typeof t.plugins!=D\u0026\u0026typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab\u0026\u0026!(typeof t.mimeTypes!=D\u0026\u0026t.mimeTypes[q]\u0026\u0026!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\\s+(\\S+\\s+\\S+$)/,\"$1\");ag[0]=parseInt(ab.replace(/^(.*)\\..*$/,\"$1\"),10);ag[1]=parseInt(ab.replace(/^.*\\.(.*)\\s.*$/,\"$1\"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,\"$1\"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable(\"$version\");if(ab){X=true;ab=ab.split(\" \")[1].split(\",\");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D\u0026\u0026j.readyState==\"complete\")||(typeof j.readyState==D\u0026\u0026(j.getElementsByTagName(\"body\")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener(\"DOMContentLoaded\",f,false)}if(M.ie\u0026\u0026M.win){j.attachEvent(x,function(){if(j.readyState==\"complete\"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll(\"left\")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName(\"body\")[0].appendChild(C(\"span\"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y\u003cX;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener(\"load\",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener(\"load\",Y,false)}else{if(typeof O.attachEvent!=D){i(O,\"onload\",Y)}else{if(typeof O."function\"){var X=O.onload;O. h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName(\"body\")[0];var aa=C(r);aa.setAttribute(\"type\",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable(\"$version\");if(ab){ab=ab.split(\" \")[1].split(\",\");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y\u003c10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag\u003e0){for(var af=0;af\u003cag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]\u003e0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)\u0026\u0026!(M.wk\u0026\u0026M.wk\u003c312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall\u0026\u0026A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute(\"width\")||\"0\";ai.height=ae.getAttribute(\"height\")||\"0\";if(ae.getAttribute(\"class\")){ai.styleclass=ae.getAttribute(\"class\")}if(ae.getAttribute(\"align\")){ai.align=ae.getAttri 8000 bute(\"align\")}var ah={};var X=ae.getElementsByTagName(\"param\");var ac=X.length;for(var ad=0;ad\u003cac;ad++){if(X[ad].getAttribute(\"name\").toLowerCase()!=\"movie\"){ah[X[ad].getAttribute(\"name\")]=X[ad].getAttribute(\"value\")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z\u0026\u0026typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y\u0026\u0026Y.nodeName==\"OBJECT\"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a\u0026\u0026F(\"6.0.65\")\u0026\u0026(M.win||M.mac)\u0026\u0026!(M.wk\u0026\u0026M.wk\u003c312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName==\"OBJECT\"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)\u0026\u0026parseInt(aa.width,10)\u003c310)){aa.width=\"310\"}if(typeof aa.height==D||(!/%$/.test(aa.height)\u0026\u0026parseInt(aa.height,10)\u003c137)){aa.height=\"137\"}j.title=j.title.slice(0,47)+\" - Flash Player Installation\";var ad=M.ie\u0026\u0026M.win?\"ActiveX\":\"PlugIn\",ac=\"MMredirectURL=\"+O.location.toString().replace(/\u0026/g,\"%26\")+\"\u0026MMplayerType=\"+ad+\"\u0026MMdoctitle=\"+j.title;if(typeof ab.flashvars!=D){ab.flashvars+=\"\u0026\"+ac}else{ab.flashvars=ac}if(M.ie\u0026\u0026M.win\u0026\u0026ae.readyState!=4){var Y=C(\"div\");X+=\"SWFObjectNew\";Y.setAttribute(\"id\",X);ae.parentNode.insertBefore(Y,ae);ae.style.display=\"none\";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie\u0026\u0026M.win\u0026\u0026Y.readyState!=4){var X=C(\"div\");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display=\"none\";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C(\"div\");if(M.win\u0026\u0026M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z\u003cX;Z++){if(!(ad[Z].nodeType==1\u0026\u0026ad[Z].nodeName==\"PARAM\")\u0026\u0026!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk\u0026\u0026M.wk\u003c312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie\u0026\u0026M.win){var ah=\"\";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()==\"data\"){ag.movie=ai[ae]}else{if(ae.toLowerCase()==\"styleclass\"){ah+=' class=\"'+ai[ae]+'\"'}else{if(ae.toLowerCase()!=\"classid\"){ah+=\" \"+ae+'=\"'+ai[ae]+'\"'}}}}}var af=\"\";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='\u003cparam name=\"'+ad+'\" value=\"'+ag[ad]+'\" /\u003e'}}aa.outerHTML='\u003cobject classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"'+ah+\"\u003e\"+af+\"\u003c/object\u003e\";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute(\"type\",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()==\"styleclass\"){Z.setAttribute(\"class\",ai[ac])}else{if(ac.toLowerCase()!=\"classid\"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]\u0026\u0026ab.toLowerCase()!=\"movie\"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C(\"param\");aa.setAttribute(\"name\",X);aa.setAttribute(\"value\",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X\u0026\u0026X.nodeName==\"OBJECT\"){if(M.ie\u0026\u0026M.win){X.style.display=\"none\";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]==\"function\"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(\".\");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]\u003eX[0]||(Y[0]==X[0]\u0026\u0026Y[1]\u003eX[1])||(Y[0]==X[0]\u0026\u0026Y[1]==X[1]\u0026\u0026Y[2]\u003e=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie\u0026\u0026M.mac){return}var aa=j.getElementsByTagName(\"head\")[0];if(!aa){return}var X=(ad\u0026\u0026typeof ad==\"string\")?ad:\"screen\";if(ab){n=null;G=null}if(!n||G!=X){var Z=C(\"style\");Z.setAttribute(\"type\",\"text/css\");Z.setAttribute(\"media\",X);n=aa.appendChild(Z);if(M.ie\u0026\u0026M.win\u0026\u0026typeof j.styleSheets!=D\u0026\u0026j.styleSheets.length\u003e0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie\u0026\u0026M.win){if(n\u0026\u0026typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n\u0026\u0026typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+\" {\"+Y+\"}\"))}}}function w(Z,X){if(!m){return}var Y=X?\"visible\":\"hidden\";if(J\u0026\u0026c(Z)){c(Z).style.visibility=Y}else{v(\"#\"+Z,\"visibility:\"+Y)}}function L(Y){var Z=/[\\\\\\\"\u003c\u003e\\.;]/;var X=Z.exec(Y)!=null;return X\u0026\u0026typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie\u0026\u0026M.win){window.attachEvent(\"onunload\",function(){var ac=I.length;for(var ab=0;ab\u003cac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa\u003cZ;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3\u0026\u0026ab\u0026\u0026X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3\u0026\u0026!(M.wk\u0026\u0026M.wk\u003c312)\u0026\u0026ab\u0026\u0026ah\u0026\u0026ae\u0026\u0026ag\u0026\u0026Y){w(ah,false);K(function(){ae+=\"\";ag+=\"\";var aj={};if(af\u0026\u0026typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad\u0026\u0026typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z\u0026\u0026typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+=\"\u0026\"+ai+\"=\"+Z[ai]}else{am.flashvars=ai+\"=\"+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa\u0026\u0026A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3\u0026\u0026A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\\?/.test(Z)){Z=Z.split(\"?\")[1]}if(aa==null){return L(Z)}var Y=Z.split(\"\u0026\");for(var X=0;X\u003cY.length;X++){if(Y[X].substring(0,Y[X].indexOf(\"=\"))==aa){return L(Y[X].substring((Y[X].indexOf(\"=\")+1)))}}}return\"\"},expressInstallCallback:function(){if(a){var X=c(R);if(X\u0026\u0026l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie\u0026\u0026M.win){l.style.display=\"block\"}}if(E){E(B)}}a=false}}}}();","/*\r","/*\r","Copyright 2006 Adobe Systems Incorporated\r","\r","Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"),\r","to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,\r","and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\r","\r"," The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\r","\r","\r","THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r","FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r","LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE\r","OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r","\r","*/\r","\r","\r","/*\r"," * The Bridge class, responsible for navigating AS instances\r"," */\r","function FABridge(target,bridgeName)\r","{\r"," this.target = target;\r"," this.remoteTypeCache = {};\r"," this.remoteInstanceCache = {};\r"," this.remoteFunctionCache = {};\r"," this.localFunctionCache = {};\r"," this.bridgeID = FABridge.nextBridgeID++;\r"," this.name = bridgeName;\r"," this.nextLocalFuncID = 0;\r"," FABridge.instances[this.name] = this;\r"," FABridge.idMap[this.bridgeID] = this;\r","\r"," return this;\r","}\r","\r","// type codes for packed values\r","FABridge.TYPE_ASINSTANCE = 1;\r","FABridge.TYPE_ASFUNCTION = 2;\r","\r","FABridge.TYPE_JSFUNCTION = 3;\r","FABridge.TYPE_ANONYMOUS = 4;\r","\r","FABridge.initCallbacks = {};\r","FABridge.userTypes = {};\r","\r","FABridge.addToUserTypes = function()\r","{\r","\tfor (var i = 0; i \u003c arguments.length; i++)\r","\t{\r","\t\tFABridge.userTypes[arguments[i]] = {\r","\t\t\t'typeName': arguments[i], \r","\t\t\t'enriched': false\r","\t\t};\r","\t}\r","}\r","\r","FABridge.argsToArray = function(args)\r","{\r"," var result = [];\r"," for (var i = 0; i \u003c args.length; i++)\r"," {\r"," result[i] = args[i];\r"," }\r"," return result;\r","}\r","\r","function instanceFactory(objID)\r","{\r"," this.fb_instance_id = objID;\r"," return this;\r","}\r","\r","function FABridge__invokeJSFunction(args)\r","{ \r"," var funcID = args[0];\r"," var throughArgs = args.concat();//FABridge.argsToArray(arguments);\r"," throughArgs.shift();\r"," \r"," var bridge = FABridge.extractBridgeFromID(funcID);\r"," return bridge.invokeLocalFunction(funcID, throughArgs);\r","}\r","\r","FABridge.addInitializationCallback = function(bridgeName, callback)\r","{\r"," var inst = FABridge.instances[bridgeName];\r"," if (inst != undefined)\r"," {\r"," callback.call(inst);\r"," return;\r"," }\r","\r"," var callbackList = FABridge.initCallbacks[bridgeName];\r"," if(callbackList == null)\r"," {\r"," FABridge.initCallbacks[bridgeName] = callbackList = [];\r"," }\r","\r"," callbackList.push(callback);\r","}\r","\r","// updated for changes to SWFObject2\r","function FABridge__bridgeInitialized(bridgeName) {\r"," var objects = document.getElementsByTagName(\"object\");\r"," var ol = objects.length;\r"," var activeObjects = [];\r"," if (ol \u003e 0) {\r","\t\tfor (var i = 0; i \u003c ol; i++) {\r","\t\t\tif (typeof objects[i].SetVariable != \"undefined\") {\r","\t\t\t\tactiveObjects[activeObjects.length] = objects[i];\r","\t\t\t}\r","\t\t}\r","\t}\r"," var embeds = document.getElementsByTagName(\"embed\");\r"," var el = embeds.length;\r"," var activeEmbeds = [];\r"," if (el \u003e 0) {\r","\t\tfor (var j = 0; j \u003c el; j++) {\r","\t\t\tif (typeof embeds[j].SetVariable != \"undefined\") {\r"," \tactiveEmbeds[activeEmbeds.length] = embeds[j];\r"," }\r"," }\r"," }\r"," var aol = activeObjects.length;\r"," var ael = activeEmbeds.length;\r"," var searchStr = \"bridgeName=\"+ bridgeName;\r"," if ((aol == 1 \u0026\u0026 !ael) || (aol == 1 \u0026\u0026 ael == 1)) {\r"," \tFABridge.attachBridge(activeObjects[0], bridgeName);\t \r"," }\r"," else if (ael == 1 \u0026\u0026 !aol) {\r"," \tFABridge.attachBridge(activeEmbeds[0], bridgeName);\r"," }\r"," else {\r"," var flash_found = false;\r","\t\tif (aol \u003e 1) {\r","\t\t\tfor (var k = 0; k \u003c aol; k++) {\r","\t\t\t\t var params = activeObjects[k].childNodes;\r","\t\t\t\t for (var l = 0; l \u003c params.length; l++) {\r","\t\t\t\t\tvar param = params[l];\r","\t\t\t\t\tif (param.nodeType == 1 \u0026\u0026 param.tagName.toLowerCase() == \"param\" \u0026\u0026 param[\"name\"].toLowerCase() == \"flashvars\" \u0026\u0026 param[\"value\"].indexOf(searchStr) \u003e= 0) {\r","\t\t\t\t\t\tFABridge.attachBridge(activeObjects[k], bridgeName);\r"," flash_found = true;\r"," break;\r"," }\r"," }\r"," if (flash_found) {\r"," break;\r"," }\r"," }\r"," }\r","\t\tif (!flash_found \u0026\u0026 ael \u003e 1) {\r","\t\t\tfor (var m = 0; m \u003c ael; m++) {\r","\t\t\t\tvar flashVars = activeEmbeds[m].attributes.getNamedItem(\"flashVars\").nodeValue;\r","\t\t\t\tif (flashVars.indexOf(searchStr) \u003e= 0) {\r","\t\t\t\t\tFABridge.attachBridge(activeEmbeds[m], bridgeName);\r","\t\t\t\t\tbreak;\r"," }\r"," }\r"," }\r"," }\r"," return true;\r","}\r","\r","// used to track multiple bridge instances, since callbacks from AS are global across the page.\r","\r","FABridge.nextBridgeID = 0;\r","FABridge.instances = {};\r","FABridge.idMap = {};\r","FABridge.refCount = 0;\r","\r","FABridge.extractBridgeFromID = function(id)\r","{\r"," var bridgeID = (id \u003e\u003e 16);\r"," return FABridge.idMap[bridgeID];\r","}\r","\r","FABridge.attachBridge = function(instance, bridgeName)\r","{\r"," var newBridgeInstance = new FABridge(instance, bridgeName);\r","\r"," FABridge[bridgeName] = newBridgeInstance;\r","\r","/* FABridge[bridgeName] = function() {\r"," return newBridgeInstance.root();\r"," }\r","*/\r"," var callbacks = FABridge.initCallbacks[bridgeName];\r"," if (callbacks == null)\r"," {\r"," return;\r"," }\r"," for (var i = 0; i \u003c callbacks.length; i++)\r"," {\r"," callbacks[i].call(newBridgeInstance);\r"," }\r"," delete FABridge.initCallbacks[bridgeName]\r","}\r","\r","// some methods can't be proxied. You can use the explicit get,set, and call methods if necessary.\r","\r","FABridge.blockedMethods =\r","{\r"," toString: true,\r"," get: true,\r"," set: true,\r"," call: true\r","};\r","\r","FABridge.prototype =\r","{\r","\r","\r","// bootstrapping\r","\r"," root: function()\r"," {\r"," return this.deserialize(this.target.getRoot());\r"," },\r","//clears all of the AS objects in the cache maps\r"," releaseASObjects: function()\r"," {\r"," return this.target.releaseASObjects();\r"," },\r","//clears a specific object in AS from the type maps\r"," releaseNamedASObject: function(value)\r"," {\r"," if(typeof(value) != \"object\")\r"," {\r"," return false;\r"," }\r"," else\r"," {\r"," var ret = this.target.releaseNamedASObject(value.fb_instance_id);\r"," return ret;\r"," }\r"," },\r","//create a new AS Object\r"," create: function(className)\r"," {\r"," return this.deserialize(this.target.create(className));\r"," },\r","\r","\r"," // utilities\r","\r"," makeID: function(token)\r"," {\r"," return (this.bridgeID \u003c\u003c 16) + token;\r"," },\r","\r","\r"," // low level access to the flash object\r","\r","//get a named property from an AS object\r"," getPropertyFromAS: function(objRef, propName)\r"," {\r"," if (FABridge.refCount \u003e 0)\r"," {\r"," throw new Error(\"You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.\");\r"," }\r"," else\r"," {\r"," FABridge.refCount++;\r"," retVal = this.target.getPropFromAS(objRef, propName);\r"," retVal = this.handleError(retVal);\r"," FABridge.refCount--;\r"," return retVal;\r"," }\r"," },\r","//set a named property on an AS object\r"," setPropertyInAS: function(objRef,propName, value)\r"," {\r"," if (FABridge.refCount \u003e 0)\r"," {\r"," throw new Error(\"You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.\");\r"," }\r"," else\r"," {\r"," FABridge.refCount++;\r"," retVal = this.target.setPropInAS(objRef,propName, this.serialize(value));\r"," retVal = this.handleError(retVal);\r"," FABridge.refCount--;\r"," return retVal;\r"," }\r"," },\r","\r","//call an AS function\r"," callASFunction: function(funcID, args)\r"," {\r"," if (FABridge.refCount \u003e 0)\r"," {\r"," throw new Error(\"You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.\");\r"," }\r"," else\r"," {\r"," FABridge.refCount++;\r"," retVal = this.target.invokeASFunction(funcID, this.serialize(args));\r"," retVal = this.handleError(retVal);\r"," FABridge.refCount--;\r"," return retVal;\r"," }\r"," },\r","//call a method on an AS object\r"," callASMethod: function(objID, funcName, args)\r"," {\r"," if (FABridge.refCount \u003e 0)\r"," {\r"," throw new Error(\"You are trying to call recursively into the Flash Player which is not allowed. In most cases the JavaScript setTimeout function, can be used as a workaround.\");\r"," }\r"," else\r"," {\r"," FABridge.refCount++;\r"," args = this.serialize(args);\r"," retVal = this.target.invokeASMethod(objID, funcName, args);\r"," retVal = this.handleError(retVal);\r"," FABridge.refCount--;\r"," return retVal;\r"," }\r"," },\r","\r"," // responders to remote calls from flash\r","\r"," //callback from flash that executes a local JS function\r"," //used mostly when setting js functions as callbacks on events\r"," invokeLocalFunction: function(funcID, args)\r"," {\r"," var result;\r"," var func = this.localFunctionCache[funcID];\r","\r"," if(func != undefined)\r"," {\r"," result = this.serialize(func.apply(null, this.deserialize(args)));\r"," }\r","\r"," return result;\r"," },\r","\r"," // Object Types and Proxies\r","\t\r"," // accepts an object reference, returns a type object matching the obj reference.\r"," getTypeFromName: function(objTypeName)\r"," {\r"," return this.remoteTypeCache[objTypeName];\r"," },\r"," //create an AS proxy for the given object ID and type\r"," createProxy: function(objID, typeName)\r"," {\r"," var objType = this.getTypeFromName(typeName);\r","\t instanceFactory.prototype = objType;\r","\t var instance = new instanceFactory(objID);\r"," this.remoteInstanceCache[objID] = instance;\r"," return instance;\r"," },\r"," //return the proxy associated with the given object ID\r"," getProxy: function(objID)\r"," {\r"," return this.remoteInstanceCache[objID];\r"," },\r","\r"," // accepts a type structure, returns a constructed type\r"," addTypeDataToCache: function(typeData)\r"," {\r"," var newType = new ASProxy(this, typeData.name);\r"," var accessors = typeData.accessors;\r"," for (var i = 0; i \u003c accessors.length; i++)\r"," {\r"," this.addPropertyToType(newType, accessors[i]);\r"," }\r","\r"," var methods = typeData.methods;\r"," for (var i = 0; i \u003c methods.length; i++)\r"," {\r"," if (FABridge.blockedMethods[methods[i]] == undefined)\r"," {\r"," this.addMethodToType(newType, methods[i]);\r"," }\r"," }\r","\r","\r"," this.remoteTypeCache[newType.typeName] = newType;\r"," return newType;\r"," },\r","\r"," //add a property to a typename; used to define the properties that can be called on an AS proxied object\r"," addPropertyToType: function(ty, propName)\r"," {\r"," var c = propName.charAt(0);\r"," var setterName;\r"," var getterName;\r"," if(c \u003e= \"a\" \u0026\u0026 c \u003c= \"z\")\r"," {\r"," getterName = \"get\" + c.toUpperCase() + propName.substr(1);\r"," setterName = \"set\" + c.toUpperCase() + propName.substr(1);\r"," }\r"," else\r"," {\r"," getterName = \"get\" + propName;\r"," setterName = \"set\" + propName;\r"," }\r"," ty[setterName] = function(val)\r"," {\r"," this.bridge.setPropertyInAS(this.fb_instance_id, propName, val);\r"," }\r"," ty[getterName] = function()\r"," {\r"," return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id, propName));\r"," }\r"," },\r","\r"," //add a method to a typename; used to define the methods that can be callefd on an AS proxied object\r"," addMethodToType: function(ty, methodName)\r"," {\r"," ty[methodName] = function()\r"," {\r"," return this.bridge.deserialize(this.bridge.callASMethod(this.fb_instance_id, methodName, FABridge.argsToArray(arguments)));\r"," }\r"," },\r","\r"," // Function Proxies\r","\r"," //returns the AS proxy for the specified function ID\r"," getFunctionProxy: function(funcID)\r"," {\r"," var bridge = this;\r"," if (this.remoteFunctionCache[funcID] == null)\r"," {\r"," this.remoteFunctionCache[funcID] = function()\r"," {\r"," bridge.callASFunction(funcID, FABridge.argsToArray(arguments));\r"," }\r"," }\r"," return this.remoteFunctionCache[funcID];\r"," },\r"," \r"," //reutrns the ID of the given function; if it doesnt exist it is created and added to the local cache\r"," getFunctionID: function(func)\r"," {\r"," if (func.__bridge_id__ == undefined)\r"," {\r"," func.__bridge_id__ = this.makeID(this.nextLocalFuncID++);\r"," this.localFunctionCache[func.__bridge_id__] = func;\r"," }\r"," return func.__bridge_id__;\r"," },\r","\r"," // serialization / deserialization\r","\r"," serialize: function(value)\r"," {\r"," var result = {};\r","\r"," var t = typeof(value);\r"," //primitives are kept as such\r"," if (t == \"number\" || t == \"string\" || t == \"boolean\" || t == null || t == undefined)\r"," {\r"," result = value;\r"," }\r"," else if (value instanceof Array)\r"," {\r"," //arrays are serializesd recursively\r"," result = [];\r"," for (var i = 0; i \u003c value.length; i++)\r"," {\r"," result[i] = this.serialize(value[i]);\r"," }\r"," }\r"," else if (t == \"function\")\r"," {\r"," //js functions are assigned an ID and stored in the local cache \r"," result.type = FABridge.TYPE_JSFUNCTION;\r"," result.value = this.getFunctionID(value);\r"," }\r"," else if (value instanceof ASProxy)\r"," {\r"," result.type = FABridge.TYPE_ASINSTANCE;\r"," result.value = value.fb_instance_id;\r"," }\r"," else\r"," {\r"," result.type = FABridge.TYPE_ANONYMOUS;\r"," result.value = value;\r"," }\r","\r"," return result;\r"," },\r","\r"," //on deserialization we always check the return for the specific error code that is used to marshall NPE's into JS errors\r"," // the unpacking is done by returning the value on each pachet for objects/arrays \r"," deserialize: function(packedValue)\r"," {\r","\r"," var result;\r","\r"," var t = typeof(packedValue);\r"," if (t == \"number\" || t == \"string\" || t == \"boolean\" || packedValue == null || packedValue == undefined)\r"," {\r"," result = this.handleError(packedValue);\r"," }\r"," else if (packedValue instanceof Array)\r"," {\r"," result = [];\r"," for (var i = 0; i \u003c packedValue.length; i++)\r"," {\r"," result[i] = this.deserialize(packedValue[i]);\r"," }\r"," }\r"," else if (t == \"object\")\r"," {\r"," for(var i = 0; i \u003c packedValue.newTypes.length; i++)\r"," {\r"," this.addTypeDataToCache(packedValue.newTypes[i]);\r"," }\r"," for (var aRefID in packedValue.newRefs)\r"," {\r"," this.createProxy(aRefID, packedValue.newRefs[aRefID]);\r"," }\r"," if (packedValue.type == FABridge.TYPE_PRIMITIVE)\r"," {\r"," result = packedValue.value;\r"," }\r"," else if (packedValue.type == FABridge.TYPE_ASFUNCTION)\r"," {\r"," result = this.getFunctionProxy(packedValue.value);\r"," }\r"," else if (packedValue.type == FABridge.TYPE_ASINSTANCE)\r"," {\r"," result = this.getProxy(packedValue.value);\r"," }\r"," else if (packedValue.type == FABridge.TYPE_ANONYMOUS)\r"," {\r"," result = packedValue.value;\r"," }\r"," }\r"," return result;\r"," },\r"," //increases the reference count for the given object\r"," addRef: function(obj)\r"," {\r"," this.target.incRef(obj.fb_instance_id);\r"," },\r"," //decrease the reference count for the given object and release it if needed\r"," release:function(obj)\r"," {\r"," this.target.releaseRef(obj.fb_instance_id);\r"," },\r","\r"," // check the given value for the components of the hard-coded error code : __FLASHERROR\r"," // used to marshall NPE's into flash\r"," \r"," handleError: function(value)\r"," {\r"," if (typeof(value)==\"string\" \u0026\u0026 value.indexOf(\"__FLASHERROR\")==0)\r"," {\r"," var myErrorMessage = value.split(\"||\");\r"," if(FABridge.refCount \u003e 0 )\r"," {\r"," FABridge.refCount--;\r"," }\r"," throw new Error(myErrorMessage[1]);\r"," return value;\r"," }\r"," else\r"," {\r"," return value;\r"," } \r"," }\r","};\r","\r","// The root ASProxy class that facades a flash object\r","\r","ASProxy = function(bridge, typeName)\r","{\r"," this.bridge = bridge;\r"," this.typeName = typeName;\r"," return this;\r","};\r","//methods available on each ASProxy object\r","ASProxy.prototype =\r","{\r"," get: function(propName)\r"," {\r"," return this.bridge.deserialize(this.bridge.getPropertyFromAS(this.fb_instance_id, propName));\r"," },\r","\r"," set: function(propName, value)\r"," {\r"," this.bridge.setPropertyInAS(this.fb_instance_id, propName, value);\r"," },\r","\r"," call: function(funcName, args)\r"," {\r"," this.bridge.callASMethod(this.fb_instance_id, funcName, args);\r"," }, \r"," \r"," addRef: function() {\r"," this.bridge.addRef(this);\r"," }, \r"," \r"," release: function() {\r"," this.bridge.release(this);\r"," }\r","};\r","","// Copyright: Hiroshi Ichikawa \u003chttp://gimite.net/en/\u003e","// License: New BSD License","// Reference: http://dev.w3.org/html5/websockets/","// Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol","","(function() {"," "," if (window.WebSocket) return;",""," var console = window.console;"," if (!console) console = {log: function(){ }, error: function(){ }};",""," if (!swfobject.hasFlashPlayerVersion(\"9.0.0\")) {"," console.error(\"Flash Player is not installed.\");"," return;"," }"," if (location.protocol == \"file:\") {"," console.error("," \"WARNING: web-socket-js doesn't work in file:///... URL \" +"," \"unless you set Flash Security Settings properly. \" +"," \"Open the page via Web server i.e. http://...\");"," }",""," WebSocket = function(url, protocol, proxyHost, proxyPort, headers) {"," var self = this;"," self.readyState = WebSocket.CONNECTING;"," self.bufferedAmount = 0;"," // Uses setTimeout() to make sure __createFlash() runs after the caller sets ws.onopen etc."," // Otherwise, when onopen fires immediately, onopen is called before it is set."," setTimeout(function() {"," WebSocket.__addTask(function() {"," self.__createFlash(url, protocol, proxyHost, proxyPort, headers);"," });"," }, 1);"," }"," "," WebSocket.prototype.__createFlash = function(url, protocol, proxyHost, proxyPort, headers) {"," var self = this;"," self.__flash ="," WebSocket.__flash.create(url, protocol, proxyHost || null, proxyPort || 0, headers || null);",""," self.__flash.addEventListener(\"open\", function(fe) {"," try {"," self.readyState = self.__flash.getReadyState();"," if (self.__timer) clearInterval(self.__timer);"," if (window.opera) {"," // Workaround for weird behavior of Opera which sometimes drops events."," self.__timer = setInterval(function () {"," self.__handleMessages();"," }, 500);"," }"," if (self.onopen) self.onopen();"," } catch (e) {"," console.error(e.toString());"," }"," });",""," self.__flash.addEventListener(\"close\", function(fe) {"," try {"," self.readyState = self.__flash.getReadyState();"," if (self.__timer) clearInterval(self.__timer);"," if (self.onclose) self.onclose();"," } catch (e) {"," console.error(e.toString());"," }"," });",""," self.__flash.addEventListener(\"message\", function() {"," try {"," self.__handleMessages();"," } catch (e) {"," console.error(e.toString());"," }"," });",""," self.__flash.addEventListener(\"error\", function(fe) {"," try {"," if (self.__timer) clearInterval(self.__timer);"," if (self.onerror) self.onerror();"," } catch (e) {"," console.error(e.toString());"," }"," });",""," self.__flash.addEventListener(\"stateChange\", function(fe) {"," try {"," self.readyState = self.__flash.getReadyState();"," self.bufferedAmount = fe.getBufferedAmount();"," } catch (e) {"," console.error(e.toString());"," }"," });",""," //console.log(\"[WebSocket] Flash object is ready\");"," };",""," WebSocket.prototype.send = function(data) {"," if (this.__flash) {"," this.readyState = this.__flash.getReadyState();"," }"," if (!this.__flash || this.readyState == WebSocket.CONNECTING) {"," throw \"INVALID_STATE_ERR: Web Socket connection has not been established\";"," }"," // We use encodeURIComponent() here, because FABridge doesn't work if"," // the argument includes some characters. We don't use escape() here"," // because of this:"," // https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Functions#escape_and_unescape_Functions"," // But it looks decodeURIComponent(encodeURIComponent(s)) doesn't"," // preserve all Unicode characters either e.g. \"\\uffff\" in Firefox."," var result = this.__flash.send(encodeURIComponent(data));"," if (result \u003c 0) { // success"," return true;"," } else {"," this.bufferedAmount = result;"," return false;"," }"," };",""," WebSocket.prototype.close = function() {"," var self = this;"," if (!self.__flash) return;"," self.readyState = self.__flash.getReadyState();"," if (self.readyState == WebSocket.CLOSED || self.readyState == WebSocket.CLOSING) return;"," self.__flash.close();"," // Sets/calls them manually here because Flash WebSocketConnection.close cannot fire events"," // which causes weird error:"," // \u003e You are trying to call recursively into the Flash Player which is not allowed."," self.readyState = WebSocket.CLOSED;"," if (self.__timer) clea 5750 rInterval(self.__timer);"," if (self.onclose) {"," // Make it asynchronous so that it looks more like an actual"," // close event"," setTimeout(self.onclose, 1);"," }"," };",""," /**"," * Implementation of {@link \u003ca href=\"http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration\"\u003eDOM 2 EventTarget Interface\u003c/a\u003e}"," *"," * @param {string} type"," * @param {function} listener"," * @param {boolean} useCapture !NB Not implemented yet"," * @return void"," */"," WebSocket.prototype.addEventListener = function(type, listener, useCapture) {"," if (!('__events' in this)) {"," this.__events = {};"," }"," if (!(type in this.__events)) {"," this.__events[type] = [];"," if ('function' == typeof this['on' + type]) {"," this.__events[type].defaultHandler = this['on' + type];"," this['on' + type] = this.__createEventHandler(this, type);"," }"," }"," this.__events[type].push(listener);"," };",""," /**"," * Implementation of {@link \u003ca href=\"http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration\"\u003eDOM 2 EventTarget Interface\u003c/a\u003e}"," *"," * @param {string} type"," * @param {function} listener"," * @param {boolean} useCapture NB! Not implemented yet"," * @return void"," */"," WebSocket.prototype.removeEventListener = function(type, listener, useCapture) {"," if (!('__events' in this)) {"," this.__events = {};"," }"," if (!(type in this.__events)) return;"," for (var i = this.__events.length; i \u003e -1; --i) {"," if (listener === this.__events[type][i]) {"," this.__events[type].splice(i, 1);"," break;"," }"," }"," };",""," /**"," * Implementation of {@link \u003ca href=\"http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration\"\u003eDOM 2 EventTarget Interface\u003c/a\u003e}"," *"," * @param {WebSocketEvent} event"," * @return void"," */"," WebSocket.prototype.dispatchEvent = function(event) {"," if (!('__events' in this)) throw 'UNSPECIFIED_EVENT_TYPE_ERR';"," if (!(event.type in this.__events)) throw 'UNSPECIFIED_EVENT_TYPE_ERR';",""," for (var i = 0, l = this.__events[event.type].length; i \u003c l; ++ i) {"," this.__events[event.type][i](event);"," if (event.cancelBubble) break;"," }",""," if (false !== event.returnValue \u0026\u0026"," 'function' == typeof this.__events[event.type].defaultHandler)"," {"," this.__events[event.type].defaultHandler(event);"," }"," };",""," WebSocket.prototype.__handleMessages = function() {"," // Gets data using readSocketData() instead of getting it from event object"," // of Flash event. This is to make sure to keep message order."," // It seems sometimes Flash events don't arrive in the same order as they are sent."," var arr = this.__flash.readSocketData();"," for (var i = 0; i \u003c arr.length; i++) {"," var data = decodeURIComponent(arr[i]);"," try {"," if (this.onmessage) {"," var e;"," if (window.MessageEvent) {"," e = document.createEvent(\"MessageEvent\");"," e.initMessageEvent(\"message\", false, false, data, null, null, window, null);"," } else { // IE"," e = {data: data};"," }"," this.onmessage(e);"," }"," } catch (e) {"," console.error(e.toString());"," }"," }"," };",""," /**"," * @param {object} object"," * @param {string} type"," */"," WebSocket.prototype.__createEventHandler = function(object, type) {"," return function(data) {"," var event = new WebSocketEvent();"," event.initEvent(type, true, true);"," event.target = event.currentTarget = object;"," for (var key in data) {"," event[key] = data[key];"," }"," object.dispatchEvent(event, arguments);"," };"," }",""," /**"," * Basic implementation of {@link \u003ca href=\"http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface\"\u003eDOM 2 EventInterface\u003c/a\u003e}"," *"," * @class"," * @constructor"," */"," function WebSocketEvent(){}",""," /**"," *"," * @type boolean"," */"," WebSocketEvent.prototype.cancelable = true;",""," /**"," *"," * @type boolean"," */"," WebSocketEvent.prototype.cancelBubble = false;",""," /**"," *"," * @return void"," */"," WebSocketEvent.prototype.preventDefault = function() {"," if (this.cancelable) {"," this.returnValue = false;"," }"," };",""," /**"," *"," * @return void"," */"," WebSocketEvent.prototype.stopPropagation = function() {"," this.cancelBubble = true;"," };",""," /**"," *"," * @param {string} eventTypeArg"," * @param {boolean} canBubbleArg"," * @param {boolean} cancelableArg"," * @return void"," */"," WebSocketEvent.prototype.initEvent = function(eventTypeArg, canBubbleArg, cancelableArg) {"," this.type = eventTypeArg;"," this.cancelable = cancelableArg;"," this.timeStamp = new Date();"," };","",""," WebSocket.CONNECTING = 0;"," WebSocket.OPEN = 1;"," WebSocket.CLOSING = 2;"," WebSocket.CLOSED = 3;",""," WebSocket.__tasks = [];",""," WebSocket.__initialize = function() {"," if (WebSocket.__swfLocation) {"," // For backword compatibility."," window.WEB_SOCKET_SWF_LOCATION = WebSocket.__swfLocation;"," }"," if (!window.WEB_SOCKET_SWF_LOCATION) {"," console.error(\"[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf\");"," return;"," }"," var container = document.createElement(\"div\");"," container.id = \"webSocketContainer\";"," // Hides Flash box. We cannot use display: none or visibility: hidden because it prevents"," // Flash from loading at least in IE. So we move it out of the screen at (-100, -100)."," // But this even doesn't work with Flash Lite (e.g. in Droid Incredible). So with Flash"," // Lite, we put it at (0, 0). This shows 1x1 box visible at left-top corner but this is"," // the best we can do as far as we know now."," container.style.position = \"absolute\";"," if (WebSocket.__isFlashLite()) {"," container.style.left = \"0px\";"," container.style.top = \"0px\";"," } else {"," container.style.left = \"-100px\";"," container.style.top = \"-100px\";"," }"," var holder = document.createElement(\"div\");"," holder.id = \"webSocketFlash\";"," container.appendChild(holder);"," document.body.appendChild(container);"," // See this article for hasPriority:"," // http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36cfb8137124318eebc6-7ffd.html"," swfobject.embedSWF("," WEB_SOCKET_SWF_LOCATION, \"webSocketFlash\","," \"1\" /* width */, \"1\" /* height */, \"9.0.0\" /* SWF version */,"," null, {bridgeName: \"webSocket\"}, {hasPriority: true, allowScriptAccess: \"always\"}, null,"," function(e) {"," if (!e.success) console.error(\"[WebSocket] swfobject.embedSWF failed\");"," }"," );"," FABridge.addInitializationCallback(\"webSocket\", function() {"," try {"," //console.log(\"[WebSocket] FABridge initializad\");"," WebSocket.__flash = FABridge.webSocket.root();"," WebSocket.__flash.setCallerUrl(location.href);"," WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG);"," for (var i = 0; i \u003c WebSocket.__tasks.length; ++i) {"," WebSocket.__tasks[i]();"," }"," WebSocket.__tasks = [];"," } catch (e) {"," console.error(\"[WebSocket] \" + e.toString());"," }"," });"," };",""," WebSocket.__addTask = function(task) {"," if (WebSocket.__flash) {"," task();"," } else {"," WebSocket.__tasks.push(task);"," }"," };"," "," WebSocket.__isFlashLite = function() {"," if (!window.navigator || !window.navigator.mimeTypes) return false;"," var mimeType = window.navigator.mimeTypes[\"application/x-shockwave-flash\"];"," if (!mimeType || !mimeType.enabledPlugin || !mimeType.enabledPlugin.filename) return false;"," return mimeType.enabledPlugin.filename.match(/flashlite/i) ? true : false;"," };",""," // called from Flash"," window.webSocketLog = function(message) {"," console.log(decodeURIComponent(message));"," };",""," // called from Flash"," window.webSocketError = function(message) {"," console.error(decodeURIComponent(message));"," };",""," if (!window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION) {"," if (window.addEventListener) {"," window.addEventListener(\"load\", WebSocket.__initialize, false);"," } else {"," window.attachEvent(\"onload\", WebSocket.__initialize);"," }"," }"," ","})();"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/tomyan/Socket.IO/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"socket.io.js","displayUrl":"https://github.com/tomyan/Socket.IO/blob/master/socket.io.js?raw=true","headerInfo":{"blobSize":"63.4 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"4d30591","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Ftomyan%2FSocket.IO%2Fblob%2Fmaster%2Fsocket.io.js","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"1925","truncatedSloc":"1674"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"JavaScript","languageID":183,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/tomyan/Socket.IO/blob/master/socket.io.js","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/tomyan/Socket.IO/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/tomyan/Socket.IO/raw/refs/heads/master/socket.io.js","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":null},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/tomyan/Socket.IO/branches":{"post":"x0krVQ0L4be5LSGfXso7ZWGpaTNol7rwlsGIx0oYPXmW2GRcobZ33_nflwfKqeJOOxoadUFbhCUxyg09lwQ28g"},"/repos/preferences":{"post":"gDZnGB2lQYVfcmOXL7mQeQ4jdnkJXL6WKSzSw_s6fktjcA5n8ChL7qmCJKRidyTKs4AJNObJN-_YWueWqwv7VQ"}}},"title":"Socket.IO/socket.io.js at master · tomyan/Socket.IO","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-b84e9496fc59.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}
0