downgraded to express@^3.23 and socket.io@^0.9.16
Showing
10 changed files
with
1474 additions
and
33 deletions
1 | const express = require('express'); | 1 | const express = require('express'); |
2 | const app = express(); | 2 | const app = express(); |
3 | 3 | const http = require('http'); | |
4 | const io = require('socket.io'); | ||
4 | const config = { | 5 | const config = { |
6 | uri: 'www.cert.coder.fi', | ||
7 | port: 4000, | ||
5 | path: '/', | 8 | path: '/', |
6 | title: 'Express Status', | 9 | title: 'Express Status', |
7 | spans: [{ | 10 | spans: [{ |
... | @@ -16,8 +19,9 @@ const config = { | ... | @@ -16,8 +19,9 @@ const config = { |
16 | }] | 19 | }] |
17 | } | 20 | } |
18 | 21 | ||
19 | app.use(require('../index')(config)); | 22 | var server = http.createServer(app); |
23 | app.use(require('../index')(config, server)); | ||
20 | 24 | ||
21 | app.listen(3000, () => { | 25 | server.listen(config.port, config.uri, () => { |
22 | console.log('🌏 http://0.0.0.0:3000'); | 26 | console.log('🌏 http://'+config.uri+':'+config.port); |
23 | }); | 27 | }); | ... | ... |
... | @@ -9,13 +9,18 @@ | ... | @@ -9,13 +9,18 @@ |
9 | "name": "Julien Breux", | 9 | "name": "Julien Breux", |
10 | "email": "julien.breux@gmail.com", | 10 | "email": "julien.breux@gmail.com", |
11 | "url": "https://github.com/JulienBreux/" | 11 | "url": "https://github.com/JulienBreux/" |
12 | }, | ||
13 | { | ||
14 | "name": "Jabis Sevon", | ||
15 | "email": "jabis.is@gmail.com", | ||
16 | "url": "https://jscodex.com" | ||
12 | } | 17 | } |
13 | ], | 18 | ], |
14 | "license": "MIT", | 19 | "license": "MIT", |
15 | "dependencies": { | 20 | "dependencies": { |
16 | "express": "^4.14.0", | 21 | "express": "^3.21.2", |
17 | "on-headers": "^1.0.1", | 22 | "on-headers": "^1.0.1", |
18 | "pidusage": "^1.0.4", | 23 | "pidusage": "^1.0.4", |
19 | "socket.io": "^1.4.8" | 24 | "socket.io": "^0.9.16" |
20 | } | 25 | } |
21 | } | 26 | } | ... | ... |
examples/socket.io.min.js
0 → 100644
1 | /*! Socket.IO.min.js build:0.9.16, production. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */ | ||
2 | var io="undefined"==typeof module?{}:module.exports;(function(){(function(a,b){var c=a;c.version="0.9.16",c.protocol=1,c.transports=[],c.j=[],c.sockets={},c.connect=function(a,d){var e=c.util.parseUri(a),f,g;b&&b.location&&(e.protocol=e.protocol||b.location.protocol.slice(0,-1),e.host=e.host||(b.document?b.document.domain:b.location.hostname),e.port=e.port||b.location.port),f=c.util.uniqueUri(e);var h={host:e.host,secure:"https"==e.protocol,port:e.port||("https"==e.protocol?443:80),query:e.query||""};c.util.merge(h,d);if(h["force new connection"]||!c.sockets[f])g=new c.Socket(h);return!h["force new connection"]&&g&&(c.sockets[f]=g),g=g||c.sockets[f],g.of(e.path.length>1?e.path:"")}})("object"==typeof module?module.exports:this.io={},this),function(a,b){var c=a.util={},d=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];c.parseUri=function(a){var b=d.exec(a||""),c={},f=14;while(f--)c[e[f]]=b[f]||"";return c},c.uniqueUri=function(a){var c=a.protocol,d=a.host,e=a.port;return"document"in b?(d=d||document.domain,e=e||(c=="https"&&document.location.protocol!=="https:"?443:document.location.port)):(d=d||"localhost",!e&&c=="https"&&(e=443)),(c||"http")+"://"+d+":"+(e||80)},c.query=function(a,b){var d=c.chunkQuery(a||""),e=[];c.merge(d,c.chunkQuery(b||""));for(var f in d)d.hasOwnProperty(f)&&e.push(f+"="+d[f]);return e.length?"?"+e.join("&"):""},c.chunkQuery=function(a){var b={},c=a.split("&"),d=0,e=c.length,f;for(;d<e;++d)f=c[d].split("="),f[0]&&(b[f[0]]=f[1]);return b};var f=!1;c.load=function(a){if("document"in b&&document.readyState==="complete"||f)return a();c.on(b,"load",a,!1)},c.on=function(a,b,c,d){a.attachEvent?a.attachEvent("on"+b,c):a.addEventListener&&a.addEventListener(b,c,d)},c.request=function(a){if(a&&"undefined"!=typeof XDomainRequest&&!c.ua.hasCORS)return new XDomainRequest;if("undefined"!=typeof XMLHttpRequest&&(!a||c.ua.hasCORS))return new XMLHttpRequest;if(!a)try{return new(window[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(b){}return null},"undefined"!=typeof window&&c.load(function(){f=!0}),c.defer=function(a){if(!c.ua.webkit||"undefined"!=typeof importScripts)return a();c.load(function(){setTimeout(a,100)})},c.merge=function(b,d,e,f){var g=f||[],h=typeof e=="undefined"?2:e,i;for(i in d)d.hasOwnProperty(i)&&c.indexOf(g,i)<0&&(typeof b[i]!="object"||!h?(b[i]=d[i],g.push(d[i])):c.merge(b[i],d[i],h-1,g));return b},c.mixin=function(a,b){c.merge(a.prototype,b.prototype)},c.inherit=function(a,b){function c(){}c.prototype=b.prototype,a.prototype=new c},c.isArray=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},c.intersect=function(a,b){var d=[],e=a.length>b.length?a:b,f=a.length>b.length?b:a;for(var g=0,h=f.length;g<h;g++)~c.indexOf(e,f[g])&&d.push(f[g]);return d},c.indexOf=function(a,b,c){for(var d=a.length,c=c<0?c+d<0?0:c+d:c||0;c<d&&a[c]!==b;c++);return d<=c?-1:c},c.toArray=function(a){var b=[];for(var c=0,d=a.length;c<d;c++)b.push(a[c]);return b},c.ua={},c.ua.hasCORS="undefined"!=typeof XMLHttpRequest&&function(){try{var a=new XMLHttpRequest}catch(b){return!1}return a.withCredentials!=undefined}(),c.ua.webkit="undefined"!=typeof navigator&&/webkit/i.test(navigator.userAgent),c.ua.iDevice="undefined"!=typeof navigator&&/iPad|iPhone|iPod/i.test(navigator.userAgent)}("undefined"!=typeof io?io:module.exports,this),function(a,b){function c(){}a.EventEmitter=c,c.prototype.on=function(a,c){return this.$events||(this.$events={}),this.$events[a]?b.util.isArray(this.$events[a])?this.$events[a].push(c):this.$events[a]=[this.$events[a],c]:this.$events[a]=c,this},c.prototype.addListener=c.prototype.on,c.prototype.once=function(a,b){function d(){c.removeListener(a,d),b.apply(this,arguments)}var c=this;return d.listener=b,this.on(a,d),this},c.prototype.removeListener=function(a,c){if(this.$events&&this.$events[a]){var d=this.$events[a];if(b.util.isArray(d)){var e=-1;for(var f=0,g=d.length;f<g;f++)if(d[f]===c||d[f].listener&&d[f].listener===c){e=f;break}if(e<0)return this;d.splice(e,1),d.length||delete this.$events[a]}else(d===c||d.listener&&d.listener===c)&&delete this.$events[a]}return this},c.prototype.removeAllListeners=function(a){return a===undefined?(this.$events={},this):(this.$events&&this.$events[a]&&(this.$events[a]=null),this)},c.prototype.listeners=function(a){return this.$events||(this.$events={}),this.$events[a]||(this.$events[a]=[]),b.util.isArray(this.$events[a])||(this.$events[a]=[this.$events[a]]),this.$events[a]},c.prototype.emit=function(a){if(!this.$events)return!1;var c=this.$events[a];if(!c)return!1;var d=Array.prototype.slice.call(arguments,1);if("function"==typeof c)c.apply(this,d);else{if(!b.util.isArray(c))return!1;var e=c.slice();for(var f=0,g=e.length;f<g;f++)e[f].apply(this,d)}return!0}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(exports,nativeJSON){function f(a){return a<10?"0"+a:a}function date(a,b){return isFinite(a.valueOf())?a.getUTCFullYear()+"-"+f(a.getUTCMonth()+1)+"-"+f(a.getUTCDate())+"T"+f(a.getUTCHours())+":"+f(a.getUTCMinutes())+":"+f(a.getUTCSeconds())+"Z":null}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return typeof b=="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g=gap,h,i=b[a];i instanceof Date&&(i=date(a)),typeof rep=="function"&&(i=rep.call(b,a,i));switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";gap+=indent,h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c<f;c+=1)h[c]=str(c,i)||"null";return e=h.length===0?"[]":gap?"[\n"+gap+h.join(",\n"+gap)+"\n"+g+"]":"["+h.join(",")+"]",gap=g,e}if(rep&&typeof rep=="object"){f=rep.length;for(c=0;c<f;c+=1)typeof rep[c]=="string"&&(d=rep[c],e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e))}else for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e));return e=h.length===0?"{}":gap?"{\n"+gap+h.join(",\n"+gap)+"\n"+g+"}":"{"+h.join(",")+"}",gap=g,e}}"use strict";if(nativeJSON&&nativeJSON.parse)return exports.JSON={parse:nativeJSON.parse,stringify:nativeJSON.stringify};var JSON=exports.JSON={},cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;JSON.stringify=function(a,b,c){var d;gap="",indent="";if(typeof c=="number")for(d=0;d<c;d+=1)indent+=" ";else typeof c=="string"&&(indent=c);rep=b;if(!b||typeof b=="function"||typeof b=="object"&&typeof b.length=="number")return str("",{"":a});throw new Error("JSON.stringify")},JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&typeof e=="object")for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),d!==undefined?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")}}("undefined"!=typeof io?io:module.exports,typeof JSON!="undefined"?JSON:undefined),function(a,b){var c=a.parser={},d=c.packets=["disconnect","connect","heartbeat","message","json","event","ack","error","noop"],e=c.reasons=["transport not supported","client not handshaken","unauthorized"],f=c.advice=["reconnect"],g=b.JSON,h=b.util.indexOf;c.encodePacket=function(a){var b=h(d,a.type),c=a.id||"",i=a.endpoint||"",j=a.ack,k=null;switch(a.type){case"error":var l=a.reason?h(e,a.reason):"",m=a.advice?h(f,a.advice):"";if(l!==""||m!=="")k=l+(m!==""?"+"+m:"");break;case"message":a.data!==""&&(k=a.data);break;case"event":var n={name:a.name};a.args&&a.args.length&&(n.args=a.args),k=g.stringify(n);break;case"json":k=g.stringify(a.data);break;case"connect":a.qs&&(k=a.qs);break;case"ack":k=a.ackId+(a.args&&a.args.length?"+"+g.stringify(a.args):"")}var o=[b,c+(j=="data"?"+":""),i];return k!==null&&k!==undefined&&o.push(k),o.join(":")},c.encodePayload=function(a){var b="";if(a.length==1)return a[0];for(var c=0,d=a.length;c<d;c++){var e=a[c];b+="\ufffd"+e.length+"\ufffd"+a[c]}return b};var i=/([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/;c.decodePacket=function(a){var b=a.match(i);if(!b)return{};var c=b[2]||"",a=b[5]||"",h={type:d[b[1]],endpoint:b[4]||""};c&&(h.id=c,b[3]?h.ack="data":h.ack=!0);switch(h.type){case"error":var b=a.split("+");h.reason=e[b[0]]||"",h.advice=f[b[1]]||"";break;case"message":h.data=a||"";break;case"event":try{var j=g.parse(a);h.name=j.name,h.args=j.args}catch(k){}h.args=h.args||[];break;case"json":try{h.data=g.parse(a)}catch(k){}break;case"connect":h.qs=a||"";break;case"ack":var b=a.match(/^([0-9]+)(\+)?(.*)/);if(b){h.ackId=b[1],h.args=[];if(b[3])try{h.args=b[3]?g.parse(b[3]):[]}catch(k){}}break;case"disconnect":case"heartbeat":}return h},c.decodePayload=function(a){if(a.charAt(0)=="\ufffd"){var b=[];for(var d=1,e="";d<a.length;d++)a.charAt(d)=="\ufffd"?(b.push(c.decodePacket(a.substr(d+1).substr(0,e))),d+=Number(e)+1,e=""):e+=a.charAt(d);return b}return[c.decodePacket(a)]}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(a,b){function c(a,b){this.socket=a,this.sessid=b}a.Transport=c,b.util.mixin(c,b.EventEmitter),c.prototype.heartbeats=function(){return!0},c.prototype.onData=function(a){this.clearCloseTimeout(),(this.socket.connected||this.socket.connecting||this.socket.reconnecting)&&this.setCloseTimeout();if(a!==""){var c=b.parser.decodePayload(a);if(c&&c.length)for(var d=0,e=c.length;d<e;d++)this.onPacket(c[d])}return this},c.prototype.onPacket=function(a){return this.socket.setHeartbeatTimeout(),a.type=="heartbeat"?this.onHeartbeat():(a.type=="connect"&&a.endpoint==""&&this.onConnect(),a.type=="error"&&a.advice=="reconnect"&&(this.isOpen=!1),this.socket.onPacket(a),this)},c.prototype.setCloseTimeout=function(){if(!this.closeTimeout){var a=this;this.closeTimeout=setTimeout(function(){a.onDisconnect()},this.socket.closeTimeout)}},c.prototype.onDisconnect=function(){return this.isOpen&&this.close(),this.clearTimeouts(),this.socket.onDisconnect(),this},c.prototype.onConnect=function(){return this.socket.onConnect(),this},c.prototype.clearCloseTimeout=function(){this.closeTimeout&&(clearTimeout(this.closeTimeout),this.closeTimeout=null)},c.prototype.clearTimeouts=function(){this.clearCloseTimeout(),this.reopenTimeout&&clearTimeout(this.reopenTimeout)},c.prototype.packet=function(a){this.send(b.parser.encodePacket(a))},c.prototype.onHeartbeat=function(a){this.packet({type:"heartbeat"})},c.prototype.onOpen=function(){this.isOpen=!0,this.clearCloseTimeout(),this.socket.onOpen()},c.prototype.onClose=function(){var a=this;this.isOpen=!1,this.socket.onClose(),this.onDisconnect()},c.prototype.prepareUrl=function(){var a=this.socket.options;return this.scheme()+"://"+a.host+":"+a.port+"/"+a.resource+"/"+b.protocol+"/"+this.name+"/"+this.sessid},c.prototype.ready=function(a,b){b.call(this)}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(a,b,c){function d(a){this.options={port:80,secure:!1,document:"document"in c?document:!1,resource:"socket.io",transports:b.transports,"connect timeout":1e4,"try multiple transports":!0,reconnect:!0,"reconnection delay":500,"reconnection limit":Infinity,"reopen delay":3e3,"max reconnection attempts":10,"sync disconnect on unload":!1,"auto connect":!0,"flash policy port":10843,manualFlush:!1},b.util.merge(this.options,a),this.connected=!1,this.open=!1,this.connecting=!1,this.reconnecting=!1,this.namespaces={},this.buffer=[],this.doBuffer=!1;if(this.options["sync disconnect on unload"]&&(!this.isXDomain()||b.util.ua.hasCORS)){var d=this;b.util.on(c,"beforeunload",function(){d.disconnectSync()},!1)}this.options["auto connect"]&&this.connect()}function e(){}a.Socket=d,b.util.mixin(d,b.EventEmitter),d.prototype.of=function(a){return this.namespaces[a]||(this.namespaces[a]=new b.SocketNamespace(this,a),a!==""&&this.namespaces[a].packet({type:"connect"})),this.namespaces[a]},d.prototype.publish=function(){this.emit.apply(this,arguments);var a;for(var b in this.namespaces)this.namespaces.hasOwnProperty(b)&&(a=this.of(b),a.$emit.apply(a,arguments))},d.prototype.handshake=function(a){function f(b){b instanceof Error?(c.connecting=!1,c.onError(b.message)):a.apply(null,b.split(":"))}var c=this,d=this.options,g=["http"+(d.secure?"s":"")+":/",d.host+":"+d.port,d.resource,b.protocol,b.util.query(this.options.query,"t="+ +(new Date))].join("/");if(this.isXDomain()&&!b.util.ua.hasCORS){var h=document.getElementsByTagName("script")[0],i=document.createElement("script");i.src=g+"&jsonp="+b.j.length,h.parentNode.insertBefore(i,h),b.j.push(function(a){f(a),i.parentNode.removeChild(i)})}else{var j=b.util.request();j.open("GET",g,!0),this.isXDomain()&&(j.withCredentials=!0),j.onreadystatechange=function(){j.readyState==4&&(j.onreadystatechange=e,j.status==200?f(j.responseText):j.status==403?c.onError(j.responseText):(c.connecting=!1,!c.reconnecting&&c.onError(j.responseText)))},j.send(null)}},d.prototype.getTransport=function(a){var c=a||this.transports,d;for(var e=0,f;f=c[e];e++)if(b.Transport[f]&&b.Transport[f].check(this)&&(!this.isXDomain()||b.Transport[f].xdomainCheck(this)))return new b.Transport[f](this,this.sessionid);return null},d.prototype.connect=function(a){if(this.connecting)return this;var c=this;return c.connecting=!0,this.handshake(function(d,e,f,g){function h(a){c.transport&&c.transport.clearTimeouts(),c.transport=c.getTransport(a);if(!c.transport)return c.publish("connect_failed");c.transport.ready(c,function(){c.connecting=!0,c.publish("connecting",c.transport.name),c.transport.open(),c.options["connect timeout"]&&(c.connectTimeoutTimer=setTimeout(function(){if(!c.connected){c.connecting=!1;if(c.options["try multiple transports"]){var a=c.transports;while(a.length>0&&a.splice(0,1)[0]!=c.transport.name);a.length?h(a):c.publish("connect_failed")}}},c.options["connect timeout"]))})}c.sessionid=d,c.closeTimeout=f*1e3,c.heartbeatTimeout=e*1e3,c.transports||(c.transports=c.origTransports=g?b.util.intersect(g.split(","),c.options.transports):c.options.transports),c.setHeartbeatTimeout(),h(c.transports),c.once("connect",function(){clearTimeout(c.connectTimeoutTimer),a&&typeof a=="function"&&a()})}),this},d.prototype.setHeartbeatTimeout=function(){clearTimeout(this.heartbeatTimeoutTimer);if(this.transport&&!this.transport.heartbeats())return;var a=this;this.heartbeatTimeoutTimer=setTimeout(function(){a.transport.onClose()},this.heartbeatTimeout)},d.prototype.packet=function(a){return this.connected&&!this.doBuffer?this.transport.packet(a):this.buffer.push(a),this},d.prototype.setBuffer=function(a){this.doBuffer=a,!a&&this.connected&&this.buffer.length&&(this.options.manualFlush||this.flushBuffer())},d.prototype.flushBuffer=function(){this.transport.payload(this.buffer),this.buffer=[]},d.prototype.disconnect=function(){if(this.connected||this.connecting)this.open&&this.of("").packet({type:"disconnect"}),this.onDisconnect("booted");return this},d.prototype.disconnectSync=function(){var a=b.util.request(),c=["http"+(this.options.secure?"s":"")+":/",this.options.host+":"+this.options.port,this.options.resource,b.protocol,"",this.sessionid].join("/")+"/?disconnect=1";a.open("GET",c,!1),a.send(null),this.onDisconnect("booted")},d.prototype.isXDomain=function(){var a=c.location.port||("https:"==c.location.protocol?443:80);return this.options.host!==c.location.hostname||this.options.port!=a},d.prototype.onConnect=function(){this.connected||(this.connected=!0,this.connecting=!1,this.doBuffer||this.setBuffer(!1),this.emit("connect"))},d.prototype.onOpen=function(){this.open=!0},d.prototype.onClose=function(){this.open=!1,clearTimeout(this.heartbeatTimeoutTimer)},d.prototype.onPacket=function(a){this.of(a.endpoint).onPacket(a)},d.prototype.onError=function(a){a&&a.advice&&a.advice==="reconnect"&&(this.connected||this.connecting)&&(this.disconnect(),this.options.reconnect&&this.reconnect()),this.publish("error",a&&a.reason?a.reason:a)},d.prototype.onDisconnect=function(a){var b=this.connected,c=this.connecting;this.connected=!1,this.connecting=!1,this.open=!1;if(b||c)this.transport.close(),this.transport.clearTimeouts(),b&&(this.publish("disconnect",a),"booted"!=a&&this.options.reconnect&&!this.reconnecting&&this.reconnect())},d.prototype.reconnect=function(){function e(){if(a.connected){for(var b in a.namespaces)a.namespaces.hasOwnProperty(b)&&""!==b&&a.namespaces[b].packet({type:"connect"});a.publish("reconnect",a.transport.name,a.reconnectionAttempts)}clearTimeout(a.reconnectionTimer),a.removeListener("connect_failed",f),a.removeListener("connect",f),a.reconnecting=!1,delete a.reconnectionAttempts,delete a.reconnectionDelay,delete a.reconnectionTimer,delete a.redoTransports,a.options["try multiple transports"]=c}function f(){if(!a.reconnecting)return;if(a.connected)return e();if(a.connecting&&a.reconnecting)return a.reconnectionTimer=setTimeout(f,1e3);a.reconnectionAttempts++>=b?a.redoTransports?(a.publish("reconnect_failed"),e()):(a.on("connect_failed",f),a.options["try multiple transports"]=!0,a.transports=a.origTransports,a.transport=a.getTransport(),a.redoTransports=!0,a.connect()):(a.reconnectionDelay<d&&(a.reconnectionDelay*=2),a.connect(),a.publish("reconnecting",a.reconnectionDelay,a.reconnectionAttempts),a.reconnectionTimer=setTimeout(f,a.reconnectionDelay))}this.reconnecting=!0,this.reconnectionAttempts=0,this.reconnectionDelay=this.options["reconnection delay"];var a=this,b=this.options["max reconnection attempts"],c=this.options["try multiple transports"],d=this.options["reconnection limit"];this.options["try multiple transports"]=!1,this.reconnectionTimer=setTimeout(f,this.reconnectionDelay),this.on("connect",f)}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(a,b){function c(a,b){this.socket=a,this.name=b||"",this.flags={},this.json=new d(this,"json"),this.ackPackets=0,this.acks={}}function d(a,b){this.namespace=a,this.name=b}a.SocketNamespace=c,b.util.mixin(c,b.EventEmitter),c.prototype.$emit=b.EventEmitter.prototype.emit,c.prototype.of=function(){return this.socket.of.apply(this.socket,arguments)},c.prototype.packet=function(a){return a.endpoint=this.name,this.socket.packet(a),this.flags={},this},c.prototype.send=function(a,b){var c={type:this.flags.json?"json":"message",data:a};return"function"==typeof b&&(c.id=++this.ackPackets,c.ack=!0,this.acks[c.id]=b),this.packet(c)},c.prototype.emit=function(a){var b=Array.prototype.slice.call(arguments,1),c=b[b.length-1],d={type:"event",name:a};return"function"==typeof c&&(d.id=++this.ackPackets,d.ack="data",this.acks[d.id]=c,b=b.slice(0,b.length-1)),d.args=b,this.packet(d)},c.prototype.disconnect=function(){return this.name===""?this.socket.disconnect():(this.packet({type:"disconnect"}),this.$emit("disconnect")),this},c.prototype.onPacket=function(a){function d(){c.packet({type:"ack",args:b.util.toArray(arguments),ackId:a.id})}var c=this;switch(a.type){case"connect":this.$emit("connect");break;case"disconnect":this.name===""?this.socket.onDisconnect(a.reason||"booted"):this.$emit("disconnect",a.reason);break;case"message":case"json":var e=["message",a.data];a.ack=="data"?e.push(d):a.ack&&this.packet({type:"ack",ackId:a.id}),this.$emit.apply(this,e);break;case"event":var e=[a.name].concat(a.args);a.ack=="data"&&e.push(d),this.$emit.apply(this,e);break;case"ack":this.acks[a.ackId]&&(this.acks[a.ackId].apply(this,a.args),delete this.acks[a.ackId]);break;case"error":a.advice?this.socket.onError(a):a.reason=="unauthorized"?this.$emit("connect_failed",a.reason):this.$emit("error",a.reason)}},d.prototype.send=function(){this.namespace.flags[this.name]=!0,this.namespace.send.apply(this.namespace,arguments)},d.prototype.emit=function(){this.namespace.flags[this.name]=!0,this.namespace.emit.apply(this.namespace,arguments)}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(a,b,c){function d(a){b.Transport.apply(this,arguments)}a.websocket=d,b.util.inherit(d,b.Transport),d.prototype.name="websocket",d.prototype.open=function(){var a=b.util.query(this.socket.options.query),d=this,e;return e||(e=c.MozWebSocket||c.WebSocket),this.websocket=new e(this.prepareUrl()+a),this.websocket.onopen=function(){d.onOpen(),d.socket.setBuffer(!1)},this.websocket.onmessage=function(a){d.onData(a.data)},this.websocket.onclose=function(){d.onClose(),d.socket.setBuffer(!0)},this.websocket.onerror=function(a){d.onError(a)},this},b.util.ua.iDevice?d.prototype.send=function(a){var b=this;return setTimeout(function(){b.websocket.send(a)},0),this}:d.prototype.send=function(a){return this.websocket.send(a),this},d.prototype.payload=function(a){for(var b=0,c=a.length;b<c;b++)this.packet(a[b]);return this},d.prototype.close=function(){return this.websocket.close(),this},d.prototype.onError=function(a){this.socket.onError(a)},d.prototype.scheme=function(){return this.socket.options.secure?"wss":"ws"},d.check=function(){return"WebSocket"in c&&!("__addTask"in WebSocket)||"MozWebSocket"in c},d.xdomainCheck=function(){return!0},b.transports.push("websocket")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(a,b){function c(){b.Transport.websocket.apply(this,arguments)}a.flashsocket=c,b.util.inherit(c,b.Transport.websocket),c.prototype.name="flashsocket",c.prototype.open=function(){var a=this,c=arguments;return WebSocket.__addTask(function(){b.Transport.websocket.prototype.open.apply(a,c)}),this},c.prototype.send=function(){var a=this,c=arguments;return WebSocket.__addTask(function(){b.Transport.websocket.prototype.send.apply(a,c)}),this},c.prototype.close=function(){return WebSocket.__tasks.length=0,b.Transport.websocket.prototype.close.call(this),this},c.prototype.ready=function(a,d){function e(){var b=a.options,e=b["flash policy port"],g=["http"+(b.secure?"s":"")+":/",b.host+":"+b.port,b.resource,"static/flashsocket","WebSocketMain"+(a.isXDomain()?"Insecure":"")+".swf"];c.loaded||(typeof WEB_SOCKET_SWF_LOCATION=="undefined"&&(WEB_SOCKET_SWF_LOCATION=g.join("/")),e!==843&&WebSocket.loadFlashPolicyFile("xmlsocket://"+b.host+":"+e),WebSocket.__initialize(),c.loaded=!0),d.call(f)}var f=this;if(document.body)return e();b.util.load(e)},c.check=function(){return typeof WebSocket!="undefined"&&"__initialize"in WebSocket&&!!swfobject?swfobject.getFlashPlayerVersion().major>=10:!1},c.xdomainCheck=function(){return!0},typeof window!="undefined"&&(WEB_SOCKET_DISABLE_AUTO_INITIALIZATION=!0),b.transports.push("flashsocket")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);if("undefined"!=typeof window)var swfobject=function(){function A(){if(t)return;try{var a=i.getElementsByTagName("body")[0].appendChild(Q("span"));a.parentNode.removeChild(a)}catch(b){return}t=!0;var c=l.length;for(var d=0;d<c;d++)l[d]()}function B(a){t?a():l[l.length]=a}function C(b){if(typeof h.addEventListener!=a)h.addEventListener("load",b,!1);else if(typeof i.addEventListener!=a)i.addEventListener("load",b,!1);else if(typeof h.attachEvent!=a)R(h,"onload",b);else if(typeof h.onload=="function"){var c=h.onload;h.onload=function(){c(),b()}}else h.onload=b}function D(){k?E():F()}function E(){var c=i.getElementsByTagName("body")[0],d=Q(b);d.setAttribute("type",e);var f=c.appendChild(d);if(f){var g=0;(function(){if(typeof f.GetVariable!=a){var b=f.GetVariable("$version");b&&(b=b.split(" ")[1].split(","),y.pv=[parseInt(b[0],10),parseInt(b[1],10),parseInt(b[2],10)])}else if(g<10){g++,setTimeout(arguments.callee,10);return}c.removeChild(d),f=null,F()})()}else F()}function F(){var b=m.length;if(b>0)for(var c=0;c<b;c++){var d=m[c].id,e=m[c].callbackFn,f={success:!1,id:d};if(y.pv[0]>0){var g=P(d);if(g)if(S(m[c].swfVersion)&&!(y.wk&&y.wk<312))U(d,!0),e&&(f.success=!0,f.ref=G(d),e(f));else if(m[c].expressInstall&&H()){var h={};h.data=m[c].expressInstall,h.width=g.getAttribute("width")||"0",h.height=g.getAttribute("height")||"0",g.getAttribute("class")&&(h.styleclass=g.getAttribute("class")),g.getAttribute("align")&&(h.align=g.getAttribute("align"));var i={},j=g.getElementsByTagName("param"),k=j.length;for(var l=0;l<k;l++)j[l].getAttribute("name").toLowerCase()!="movie"&&(i[j[l].getAttribute("name")]=j[l].getAttribute("value"));I(h,i,d,e)}else J(g),e&&e(f)}else{U(d,!0);if(e){var n=G(d);n&&typeof n.SetVariable!=a&&(f.success=!0,f.ref=n),e(f)}}}}function G(c){var d=null,e=P(c);if(e&&e.nodeName=="OBJECT")if(typeof e.SetVariable!=a)d=e;else{var f=e.getElementsByTagName(b)[0];f&&(d=f)}return d}function H(){return!u&&S("6.0.65")&&(y.win||y.mac)&&!(y.wk&&y.wk<312)}function I(b,c,d,e){u=!0,r=e||null,s={success:!1,id:d};var g=P(d);if(g){g.nodeName=="OBJECT"?(p=K(g),q=null):(p=g,q=d),b.id=f;if(typeof b.width==a||!/%$/.test(b.width)&&parseInt(b.width,10)<310)b.width="310";if(typeof b.height==a||!/%$/.test(b.height)&&parseInt(b.height,10)<137)b.height="137";i.title=i.title.slice(0,47)+" - Flash Player Installation";var j=y.ie&&y.win?["Active"].concat("").join("X"):"PlugIn",k="MMredirectURL="+h.location.toString().replace(/&/g,"%26")+"&MMplayerType="+j+"&MMdoctitle="+i.title;typeof c.flashvars!=a?c.flashvars+="&"+k:c.flashvars=k;if(y.ie&&y.win&&g.readyState!=4){var l=Q("div");d+="SWFObjectNew",l.setAttribute("id",d),g.parentNode.insertBefore(l,g),g.style.display="none",function(){g.readyState==4?g.parentNode.removeChild(g):setTimeout(arguments.callee,10)}()}L(b,c,d)}}function J(a){if(y.ie&&y.win&&a.readyState!=4){var b=Q("div");a.parentNode.insertBefore(b,a),b.parentNode.replaceChild(K(a),b),a.style.display="none",function(){a.readyState==4?a.parentNode.removeChild(a):setTimeout(arguments.callee,10)}()}else a.parentNode.replaceChild(K(a),a)}function K(a){var c=Q("div");if(y.win&&y.ie)c.innerHTML=a.innerHTML;else{var d=a.getElementsByTagName(b)[0];if(d){var e=d.childNodes;if(e){var f=e.length;for(var g=0;g<f;g++)(e[g].nodeType!=1||e[g].nodeName!="PARAM")&&e[g].nodeType!=8&&c.appendChild(e[g].cloneNode(!0))}}}return c}function L(c,d,f){var g,h=P(f);if(y.wk&&y.wk<312)return g;if(h){typeof c.id==a&&(c.id=f);if(y.ie&&y.win){var i="";for(var j in c)c[j]!=Object.prototype[j]&&(j.toLowerCase()=="data"?d.movie=c[j]:j.toLowerCase()=="styleclass"?i+=' class="'+c[j]+'"':j.toLowerCase()!="classid"&&(i+=" "+j+'="'+c[j]+'"'));var k="";for(var l in d)d[l]!=Object.prototype[l]&&(k+='<param name="'+l+'" value="'+d[l]+'" />');h.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+i+">"+k+"</object>",n[n.length]=c.id,g=P(c.id)}else{var m=Q(b);m.setAttribute("type",e);for(var o in c)c[o]!=Object.prototype[o]&&(o.toLowerCase()=="styleclass"?m.setAttribute("class",c[o]):o.toLowerCase()!="classid"&&m.setAttribute(o,c[o]));for(var p in d)d[p]!=Object.prototype[p]&&p.toLowerCase()!="movie"&&M(m,p,d[p]);h.parentNode.replaceChild(m,h),g=m}}return g}function M(a,b,c){var d=Q("param");d.setAttribute("name",b),d.setAttribute("value",c),a.appendChild(d)}function N(a){var b=P(a);b&&b.nodeName=="OBJECT"&&(y.ie&&y.win?(b.style.display="none",function(){b.readyState==4?O(a):setTimeout(arguments.callee,10)}()):b.parentNode.removeChild(b))}function O(a){var b=P(a);if(b){for(var c in b)typeof b[c]=="function"&&(b[c]=null);b.parentNode.removeChild(b)}}function P(a){var b=null;try{b=i.getElementById(a)}catch(c){}return b}function Q(a){return i.createElement(a)}function R(a,b,c){a.attachEvent(b,c),o[o.length]=[a,b,c]}function S(a){var b=y.pv,c=a.split(".");return c[0]=parseInt(c[0],10),c[1]=parseInt(c[1],10)||0,c[2]=parseInt(c[2],10)||0,b[0]>c[0]||b[0]==c[0]&&b[1]>c[1]||b[0]==c[0]&&b[1]==c[1]&&b[2]>=c[2]?!0:!1}function T(c,d,e,f){if(y.ie&&y.mac)return;var g=i.getElementsByTagName("head")[0];if(!g)return;var h=e&&typeof e=="string"?e:"screen";f&&(v=null,w=null);if(!v||w!=h){var j=Q("style");j.setAttribute("type","text/css"),j.setAttribute("media",h),v=g.appendChild(j),y.ie&&y.win&&typeof i.styleSheets!=a&&i.styleSheets.length>0&&(v=i.styleSheets[i.styleSheets.length-1]),w=h}y.ie&&y.win?v&&typeof v.addRule==b&&v.addRule(c,d):v&&typeof i.createTextNode!=a&&v.appendChild(i.createTextNode(c+" {"+d+"}"))}function U(a,b){if(!x)return;var c=b?"visible":"hidden";t&&P(a)?P(a).style.visibility=c:T("#"+a,"visibility:"+c)}function V(b){var c=/[\\\"<>\.;]/,d=c.exec(b)!=null;return d&&typeof encodeURIComponent!=a?encodeURIComponent(b):b}var a="undefined",b="object",c="Shockwave Flash",d="ShockwaveFlash.ShockwaveFlash",e="application/x-shockwave-flash",f="SWFObjectExprInst",g="onreadystatechange",h=window,i=document,j=navigator,k=!1,l=[D],m=[],n=[],o=[],p,q,r,s,t=!1,u=!1,v,w,x=!0,y=function(){var f=typeof i.getElementById!=a&&typeof i.getElementsByTagName!=a&&typeof i.createElement!=a,g=j.userAgent.toLowerCase(),l=j.platform.toLowerCase(),m=l?/win/.test(l):/win/.test(g),n=l?/mac/.test(l):/mac/.test(g),o=/webkit/.test(g)?parseFloat(g.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,p=!1,q=[0,0,0],r=null;if(typeof j.plugins!=a&&typeof j.plugins[c]==b)r=j.plugins[c].description,r&&(typeof j.mimeTypes==a||!j.mimeTypes[e]||!!j.mimeTypes[e].enabledPlugin)&&(k=!0,p=!1,r=r.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),q[0]=parseInt(r.replace(/^(.*)\..*$/,"$1"),10),q[1]=parseInt(r.replace(/^.*\.(.*)\s.*$/,"$1"),10),q[2]=/[a-zA-Z]/.test(r)?parseInt(r.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if(typeof h[["Active"].concat("Object").join("X")]!=a)try{var s=new(window[["Active"].concat("Object").join("X")])(d);s&&(r=s.GetVariable("$version"),r&&(p=!0,r=r.split(" ")[1].split(","),q=[parseInt(r[0],10),parseInt(r[1],10),parseInt(r[2],10)]))}catch(t){}return{w3:f,pv:q,wk:o,ie:p,win:m,mac:n}}(),z=function(){if(!y.w3)return;(typeof i.readyState!=a&&i.readyState=="complete"||typeof i.readyState==a&&(i.getElementsByTagName("body")[0]||i.body))&&A(),t||(typeof i.addEventListener!=a&&i.addEventListener("DOMContentLoaded",A,!1),y.ie&&y.win&&(i.attachEvent(g,function(){i.readyState=="complete"&&(i.detachEvent(g,arguments.callee),A())}),h==top&&function(){if(t)return;try{i.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}A()}()),y.wk&&function(){if(t)return;if(!/loaded|complete/.test(i.readyState)){setTimeout(arguments.callee,0);return}A()}(),C(A))}(),W=function(){y.ie&&y.win&&window.attachEvent("onunload",function(){var a=o.length;for(var b=0;b<a;b++)o[b][0].detachEvent(o[b][1],o[b][2]);var c=n.length;for(var d=0;d<c;d++)N(n[d]);for(var e in y)y[e]=null;y=null;for(var f in swfobject)swfobject[f]=null;swfobject=null})}();return{registerObject:function(a,b,c,d){if(y.w3&&a&&b){var e={};e.id=a,e.swfVersion=b,e.expressInstall=c,e.callbackFn=d,m[m.length]=e,U(a,!1)}else d&&d({success:!1,id:a})},getObjectById:function(a){if(y.w3)return G(a)},embedSWF:function(c,d,e,f,g,h,i,j,k,l){var m={success:!1,id:d};y.w3&&!(y.wk&&y.wk<312)&&c&&d&&e&&f&&g?(U(d,!1),B(function(){e+="",f+="";var n={};if(k&&typeof k===b)for(var o in k)n[o]=k[o];n.data=c,n.width=e,n.height=f;var p={};if(j&&typeof j===b)for(var q in j)p[q]=j[q];if(i&&typeof i===b)for(var r in i)typeof p.flashvars!=a?p.flashvars+="&"+r+"="+i[r]:p.flashvars=r+"="+i[r];if(S(g)){var s=L(n,p,d);n.id==d&&U(d,!0),m.success=!0,m.ref=s}else{if(h&&H()){n.data=h,I(n,p,d,l);return}U(d,!0)}l&&l(m)})):l&&l(m)},switchOffAutoHideShow:function(){x=!1},ua:y,getFlashPlayerVersion:function(){return{major:y.pv[0],minor:y.pv[1],release:y.pv[2]}},hasFlashPlayerVersion:S,createSWF:function(a,b,c){return y.w3?L(a,b,c):undefined},showExpressInstall:function(a,b,c,d){y.w3&&H()&&I(a,b,c,d)},removeSWF:function(a){y.w3&&N(a)},createCSS:function(a,b,c,d){y.w3&&T(a,b,c,d)},addDomLoadEvent:B,addLoadEvent:C,getQueryParamValue:function(a){var b=i.location.search||i.location.hash;if(b){/\?/.test(b)&&(b=b.split("?")[1]);if(a==null)return V(b);var c=b.split("&");for(var d=0;d<c.length;d++)if(c[d].substring(0,c[d].indexOf("="))==a)return V(c[d].substring(c[d].indexOf("=")+1))}return""},expressInstallCallback:function(){if(u){var a=P(f);a&&p&&(a.parentNode.replaceChild(p,a),q&&(U(q,!0),y.ie&&y.win&&(p.style.display="block")),r&&r(s)),u=!1}}}}();(function(){if("undefined"==typeof window||window.WebSocket)return;var a=window.console;if(!a||!a.log||!a.error)a={log:function(){},error:function(){}};if(!swfobject.hasFlashPlayerVersion("10.0.0")){a.error("Flash Player >= 10.0.0 is required.");return}location.protocol=="file:"&&a.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(a,b,c,d,e){var f=this;f.__id=WebSocket.__nextId++,WebSocket.__instances[f.__id]=f,f.readyState=WebSocket.CONNECTING,f.bufferedAmount=0,f.__events={},b?typeof b=="string"&&(b=[b]):b=[],setTimeout(function(){WebSocket.__addTask(function(){WebSocket.__flash.create(f.__id,a,b,c||null,d||0,e||null)})},0)},WebSocket.prototype.send=function(a){if(this.readyState==WebSocket.CONNECTING)throw"INVALID_STATE_ERR: Web Socket connection has not been established";var b=WebSocket.__flash.send(this.__id,encodeURIComponent(a));return b<0?!0:(this.bufferedAmount+=b,!1)},WebSocket.prototype.close=function(){if(this.readyState==WebSocket.CLOSED||this.readyState==WebSocket.CLOSING)return;this.readyState=WebSocket.CLOSING,WebSocket.__flash.close(this.__id)},WebSocket.prototype.addEventListener=function(a,b,c){a in this.__events||(this.__events[a]=[]),this.__events[a].push(b)},WebSocket.prototype.removeEventListener=function(a,b,c){if(!(a in this.__events))return;var d=this.__events[a];for(var e=d.length-1;e>=0;--e)if(d[e]===b){d.splice(e,1);break}},WebSocket.prototype.dispatchEvent=function(a){var b=this.__events[a.type]||[];for(var c=0;c<b.length;++c)b[c](a);var d=this["on"+a.type];d&&d(a)},WebSocket.prototype.__handleEvent=function(a){"readyState"in a&&(this.readyState=a.readyState),"protocol"in a&&(this.protocol=a.protocol);var b;if(a.type=="open"||a.type=="error")b=this.__createSimpleEvent(a.type);else if(a.type=="close")b=this.__createSimpleEvent("close");else{if(a.type!="message")throw"unknown event type: "+a.type;var c=decodeURIComponent(a.message);b=this.__createMessageEvent("message",c)}this.dispatchEvent(b)},WebSocket.prototype.__createSimpleEvent=function(a){if(document.createEvent&&window.Event){var b=document.createEvent("Event");return b.initEvent(a,!1,!1),b}return{type:a,bubbles:!1,cancelable:!1}},WebSocket.prototype.__createMessageEvent=function(a,b){if(document.createEvent&&window.MessageEvent&&!window.opera){var c=document.createEvent("MessageEvent");return c.initMessageEvent("message",!1,!1,b,null,null,window,null),c}return{type:a,data:b,bubbles:!1,cancelable:!1}},WebSocket.CONNECTING=0,WebSocket.OPEN=1,WebSocket.CLOSING=2,WebSocket.CLOSED=3,WebSocket.__flash=null,WebSocket.__instances={},WebSocket.__tasks=[],WebSocket.__nextId=0,WebSocket.loadFlashPolicyFile=function(a){WebSocket.__addTask(function(){WebSocket.__flash.loadManualPolicyFile(a)})},WebSocket.__initialize=function(){if(WebSocket.__flash)return;WebSocket.__swfLocation&&(window.WEB_SOCKET_SWF_LOCATION=WebSocket.__swfLocation);if(!window.WEB_SOCKET_SWF_LOCATION){a.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf");return}var b=document.createElement("div");b.id="webSocketContainer",b.style.position="absolute",WebSocket.__isFlashLite()?(b.style.left="0px",b.style.top="0px"):(b.style.left="-100px",b.style.top="-100px");var c=document.createElement("div");c.id="webSocketFlash",b.appendChild(c),document.body.appendChild(b),swfobject.embedSWF(WEB_SOCKET_SWF_LOCATION,"webSocketFlash","1","1","10.0.0",null,null,{hasPriority:!0,swliveconnect:!0,allowScriptAccess:"always"},null,function(b){b.success||a.error("[WebSocket] swfobject.embedSWF failed")})},WebSocket.__onFlashInitialized=function(){setTimeout(function(){WebSocket.__flash=document.getElementById("webSocketFlash"),WebSocket.__flash.setCallerUrl(location.href),WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG);for(var a=0;a<WebSocket.__tasks.length;++a)WebSocket.__tasks[a]();WebSocket.__tasks=[]},0)},WebSocket.__onFlashEvent=function(){return setTimeout(function(){try{var b=WebSocket.__flash.receiveEvents();for(var c=0;c<b.length;++c)WebSocket.__instances[b[c].webSocketId].__handleEvent(b[c])}catch(d){a.error(d)}},0),!0},WebSocket.__log=function(b){a.log(decodeURIComponent(b))},WebSocket.__error=function(b){a.error(decodeURIComponent(b))},WebSocket.__addTask=function(a){WebSocket.__flash?a():WebSocket.__tasks.push(a)},WebSocket.__isFlashLite=function(){if(!window.navigator||!window.navigator.mimeTypes)return!1;var a=window.navigator.mimeTypes["application/x-shockwave-flash"];return!a||!a.enabledPlugin||!a.enabledPlugin.filename?!1:a.enabledPlugin.filename.match(/flashlite/i)?!0:!1},window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION||(window.addEventListener?window.addEventListener("load",function(){WebSocket.__initialize()},!1):window.attachEvent("onload",function(){WebSocket.__initialize()}))})(),function(a,b,c){function d(a){if(!a)return;b.Transport.apply(this,arguments),this.sendBuffer=[]}function e(){}a.XHR=d,b.util.inherit(d,b.Transport),d.prototype.open=function(){return this.socket.setBuffer(!1),this.onOpen(),this.get(),this.setCloseTimeout(),this},d.prototype.payload=function(a){var c=[];for(var d=0,e=a.length;d<e;d++)c.push(b.parser.encodePacket(a[d]));this.send(b.parser.encodePayload(c))},d.prototype.send=function(a){return this.post(a),this},d.prototype.post=function(a){function d(){this.readyState==4&&(this.onreadystatechange=e,b.posting=!1,this.status==200?b.socket.setBuffer(!1):b.onClose())}function f(){this.onload=e,b.socket.setBuffer(!1)}var b=this;this.socket.setBuffer(!0),this.sendXHR=this.request("POST"),c.XDomainRequest&&this.sendXHR instanceof XDomainRequest?this.sendXHR.onload=this.sendXHR.onerror=f:this.sendXHR.onreadystatechange=d,this.sendXHR.send(a)},d.prototype.close=function(){return this.onClose(),this},d.prototype.request=function(a){var c=b.util.request(this.socket.isXDomain()),d=b.util.query(this.socket.options.query,"t="+ +(new Date));c.open(a||"GET",this.prepareUrl()+d,!0);if(a=="POST")try{c.setRequestHeader?c.setRequestHeader("Content-type","text/plain;charset=UTF-8"):c.contentType="text/plain"}catch(e){}return c},d.prototype.scheme=function(){return this.socket.options.secure?"https":"http"},d.check=function(a,d){try{var e=b.util.request(d),f=c.XDomainRequest&&e instanceof XDomainRequest,g=a&&a.options&&a.options.secure?"https:":"http:",h=c.location&&g!=c.location.protocol;if(e&&(!f||!h))return!0}catch(i){}return!1},d.xdomainCheck=function(a){return d.check(a,!0)}}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(a,b){function c(a){b.Transport.XHR.apply(this,arguments)}a.htmlfile=c,b.util.inherit(c,b.Transport.XHR),c.prototype.name="htmlfile",c.prototype.get=function(){this.doc=new(window[["Active"].concat("Object").join("X")])("htmlfile"),this.doc.open(),this.doc.write("<html></html>"),this.doc.close(),this.doc.parentWindow.s=this;var a=this.doc.createElement("div");a.className="socketio",this.doc.body.appendChild(a),this.iframe=this.doc.createElement("iframe"),a.appendChild(this.iframe);var c=this,d=b.util.query(this.socket.options.query,"t="+ +(new Date));this.iframe.src=this.prepareUrl()+d,b.util.on(window,"unload",function(){c.destroy()})},c.prototype._=function(a,b){a=a.replace(/\\\//g,"/"),this.onData(a);try{var c=b.getElementsByTagName("script")[0];c.parentNode.removeChild(c)}catch(d){}},c.prototype.destroy=function(){if(this.iframe){try{this.iframe.src="about:blank"}catch(a){}this.doc=null,this.iframe.parentNode.removeChild(this.iframe),this.iframe=null,CollectGarbage()}},c.prototype.close=function(){return this.destroy(),b.Transport.XHR.prototype.close.call(this)},c.check=function(a){if(typeof window!="undefined"&&["Active"].concat("Object").join("X")in window)try{var c=new(window[["Active"].concat("Object").join("X")])("htmlfile");return c&&b.Transport.XHR.check(a)}catch(d){}return!1},c.xdomainCheck=function(){return!1},b.transports.push("htmlfile")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(a,b,c){function d(){b.Transport.XHR.apply(this,arguments)}function e(){}a["xhr-polling"]=d,b.util.inherit(d,b.Transport.XHR),b.util.merge(d,b.Transport.XHR),d.prototype.name="xhr-polling",d.prototype.heartbeats=function(){return!1},d.prototype.open=function(){var a=this;return b.Transport.XHR.prototype.open.call(a),!1},d.prototype.get=function(){function b(){this.readyState==4&&(this.onreadystatechange=e,this.status==200?(a.onData(this.responseText),a.get()):a.onClose())}function d(){this.onload=e,this.onerror=e,a.retryCounter=1,a.onData(this.responseText),a.get()}function f(){a.retryCounter++,!a.retryCounter||a.retryCounter>3?a.onClose():a.get()}if(!this.isOpen)return;var a=this;this.xhr=this.request(),c.XDomainRequest&&this.xhr instanceof XDomainRequest?(this.xhr.onload=d,this.xhr.onerror=f):this.xhr.onreadystatechange=b,this.xhr.send(null)},d.prototype.onClose=function(){b.Transport.XHR.prototype.onClose.call(this);if(this.xhr){this.xhr.onreadystatechange=this.xhr.onload=this.xhr.onerror=e;try{this.xhr.abort()}catch(a){}this.xhr=null}},d.prototype.ready=function(a,c){var d=this;b.util.defer(function(){c.call(d)})},b.transports.push("xhr-polling")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(a,b,c){function e(a){b.Transport["xhr-polling"].apply(this,arguments),this.index=b.j.length;var c=this;b.j.push(function(a){c._(a)})}var d=c.document&&"MozAppearance"in c.document.documentElement.style;a["jsonp-polling"]=e,b.util.inherit(e,b.Transport["xhr-polling"]),e.prototype.name="jsonp-polling",e.prototype.post=function(a){function i(){j(),c.socket.setBuffer(!1)}function j(){c.iframe&&c.form.removeChild(c.iframe);try{h=document.createElement('<iframe name="'+c.iframeId+'">')}catch(a){h=document.createElement("iframe"),h.name=c.iframeId}h.id=c.iframeId,c.form.appendChild(h),c.iframe=h}var c=this,d=b.util.query(this.socket.options.query,"t="+ +(new Date)+"&i="+this.index);if(!this.form){var e=document.createElement("form"),f=document.createElement("textarea"),g=this.iframeId="socketio_iframe_"+this.index,h;e.className="socketio",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.display="none",e.target=g,e.method="POST",e.setAttribute("accept-charset","utf-8"),f.name="d",e.appendChild(f),document.body.appendChild(e),this.form=e,this.area=f}this.form.action=this.prepareUrl()+d,j(),this.area.value=b.JSON.stringify(a);try{this.form.submit()}catch(k){}this.iframe.attachEvent?h.onreadystatechange=function(){c.iframe.readyState=="complete"&&i()}:this.iframe.onload=i,this.socket.setBuffer(!0)},e.prototype.get=function(){var a=this,c=document.createElement("script"),e=b.util.query(this.socket.options.query,"t="+ +(new Date)+"&i="+this.index);this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),c.async=!0,c.src=this.prepareUrl()+e,c.onerror=function(){a.onClose()};var f=document.getElementsByTagName("script")[0];f.parentNode.insertBefore(c,f),this.script=c,d&&setTimeout(function(){var a=document.createElement("iframe");document.body.appendChild(a),document.body.removeChild(a)},100)},e.prototype._=function(a){return this.onData(a),this.isOpen&&this.get(),this},e.prototype.ready=function(a,c){var e=this;if(!d)return c.call(this);b.util.load(function(){c.call(e)})},e.check=function(){return"document"in c},e.xdomainCheck=function(){return!0},b.transports.push("jsonp-polling")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),typeof define=="function"&&define.amd&&define([],function(){return io})})() | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html> | 2 | <html> |
3 | |||
3 | <head> | 4 | <head> |
4 | <title>{{title}}</title> | 5 | <title>{{title}}</title> |
5 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.bundle.min.js"></script> | 6 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.bundle.min.js"></script> |
6 | <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.5/socket.io.min.js"></script> | 7 | <script type="text/javascript"> |
8 | /*! Socket.IO.min.js build:0.9.16, production. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */ | ||
9 | var io = "undefined" == typeof module ? {} : module.exports; | ||
10 | (function() { | ||
11 | (function(a, b) { | ||
12 | var c = a; | ||
13 | c.version = "0.9.16", c.protocol = 1, c.transports = [], c.j = [], c.sockets = {}, c.connect = function(a, d) { | ||
14 | var e = c.util.parseUri(a), | ||
15 | f, g; | ||
16 | b && b.location && (e.protocol = e.protocol || b.location.protocol.slice(0, -1), e.host = e.host || (b.document ? b.document.domain : b.location.hostname), e.port = e.port || b.location.port), f = c.util.uniqueUri(e); | ||
17 | var h = { | ||
18 | host: e.host, | ||
19 | secure: "https" == e.protocol, | ||
20 | port: e.port || ("https" == e.protocol ? 443 : 80), | ||
21 | query: e.query || "" | ||
22 | }; | ||
23 | c.util.merge(h, d); | ||
24 | if (h["force new connection"] || !c.sockets[f]) g = new c.Socket(h); | ||
25 | return !h["force new connection"] && g && (c.sockets[f] = g), g = g || c.sockets[f], g.of(e.path.length > 1 ? e.path : "") | ||
26 | } | ||
27 | })("object" == typeof module ? module.exports : this.io = {}, this), | ||
28 | function(a, b) { | ||
29 | var c = a.util = {}, | ||
30 | d = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, | ||
31 | e = ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"]; | ||
32 | c.parseUri = function(a) { | ||
33 | var b = d.exec(a || ""), | ||
34 | c = {}, | ||
35 | f = 14; | ||
36 | while (f--) c[e[f]] = b[f] || ""; | ||
37 | return c | ||
38 | }, c.uniqueUri = function(a) { | ||
39 | var c = a.protocol, | ||
40 | d = a.host, | ||
41 | e = a.port; | ||
42 | return "document" in b ? (d = d || document.domain, e = e || (c == "https" && document.location.protocol !== "https:" ? 443 : document.location.port)) : (d = d || "localhost", !e && c == "https" && (e = 443)), (c || "http") + "://" + d + ":" + (e || 80) | ||
43 | }, c.query = function(a, b) { | ||
44 | var d = c.chunkQuery(a || ""), | ||
45 | e = []; | ||
46 | c.merge(d, c.chunkQuery(b || "")); | ||
47 | for (var f in d) d.hasOwnProperty(f) && e.push(f + "=" + d[f]); | ||
48 | return e.length ? "?" + e.join("&") : "" | ||
49 | }, c.chunkQuery = function(a) { | ||
50 | var b = {}, | ||
51 | c = a.split("&"), | ||
52 | d = 0, | ||
53 | e = c.length, | ||
54 | f; | ||
55 | for (; d < e; ++d) f = c[d].split("="), f[0] && (b[f[0]] = f[1]); | ||
56 | return b | ||
57 | }; | ||
58 | var f = !1; | ||
59 | c.load = function(a) { | ||
60 | if ("document" in b && document.readyState === "complete" || f) return a(); | ||
61 | c.on(b, "load", a, !1) | ||
62 | }, c.on = function(a, b, c, d) { | ||
63 | a.attachEvent ? a.attachEvent("on" + b, c) : a.addEventListener && a.addEventListener(b, c, d) | ||
64 | }, c.request = function(a) { | ||
65 | if (a && "undefined" != typeof XDomainRequest && !c.ua.hasCORS) return new XDomainRequest; | ||
66 | if ("undefined" != typeof XMLHttpRequest && (!a || c.ua.hasCORS)) return new XMLHttpRequest; | ||
67 | if (!a) try { | ||
68 | return new(window[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP") | ||
69 | } catch (b) {} | ||
70 | return null | ||
71 | }, "undefined" != typeof window && c.load(function() { | ||
72 | f = !0 | ||
73 | }), c.defer = function(a) { | ||
74 | if (!c.ua.webkit || "undefined" != typeof importScripts) return a(); | ||
75 | c.load(function() { | ||
76 | setTimeout(a, 100) | ||
77 | }) | ||
78 | }, c.merge = function(b, d, e, f) { | ||
79 | var g = f || [], | ||
80 | h = typeof e == "undefined" ? 2 : e, | ||
81 | i; | ||
82 | for (i in d) d.hasOwnProperty(i) && c.indexOf(g, i) < 0 && (typeof b[i] != "object" || !h ? (b[i] = d[i], g.push(d[i])) : c.merge(b[i], d[i], h - 1, g)); | ||
83 | return b | ||
84 | }, c.mixin = function(a, b) { | ||
85 | c.merge(a.prototype, b.prototype) | ||
86 | }, c.inherit = function(a, b) { | ||
87 | function c() {} | ||
88 | c.prototype = b.prototype, a.prototype = new c | ||
89 | }, c.isArray = Array.isArray || function(a) { | ||
90 | return Object.prototype.toString.call(a) === "[object Array]" | ||
91 | }, c.intersect = function(a, b) { | ||
92 | var d = [], | ||
93 | e = a.length > b.length ? a : b, | ||
94 | f = a.length > b.length ? b : a; | ||
95 | for (var g = 0, h = f.length; g < h; g++) ~c.indexOf(e, f[g]) && d.push(f[g]); | ||
96 | return d | ||
97 | }, c.indexOf = function(a, b, c) { | ||
98 | for (var d = a.length, c = c < 0 ? c + d < 0 ? 0 : c + d : c || 0; c < d && a[c] !== b; c++); | ||
99 | return d <= c ? -1 : c | ||
100 | }, c.toArray = function(a) { | ||
101 | var b = []; | ||
102 | for (var c = 0, d = a.length; c < d; c++) b.push(a[c]); | ||
103 | return b | ||
104 | }, c.ua = {}, c.ua.hasCORS = "undefined" != typeof XMLHttpRequest && function() { | ||
105 | try { | ||
106 | var a = new XMLHttpRequest | ||
107 | } catch (b) { | ||
108 | return !1 | ||
109 | } | ||
110 | return a.withCredentials != undefined | ||
111 | }(), c.ua.webkit = "undefined" != typeof navigator && /webkit/i.test(navigator.userAgent), c.ua.iDevice = "undefined" != typeof navigator && /iPad|iPhone|iPod/i.test(navigator.userAgent) | ||
112 | }("undefined" != typeof io ? io : module.exports, this), | ||
113 | function(a, b) { | ||
114 | function c() {} | ||
115 | a.EventEmitter = c, c.prototype.on = function(a, c) { | ||
116 | return this.$events || (this.$events = {}), this.$events[a] ? b.util.isArray(this.$events[a]) ? this.$events[a].push(c) : this.$events[a] = [this.$events[a], c] : this.$events[a] = c, this | ||
117 | }, c.prototype.addListener = c.prototype.on, c.prototype.once = function(a, b) { | ||
118 | function d() { | ||
119 | c.removeListener(a, d), b.apply(this, arguments) | ||
120 | } | ||
121 | var c = this; | ||
122 | return d.listener = b, this.on(a, d), this | ||
123 | }, c.prototype.removeListener = function(a, c) { | ||
124 | if (this.$events && this.$events[a]) { | ||
125 | var d = this.$events[a]; | ||
126 | if (b.util.isArray(d)) { | ||
127 | var e = -1; | ||
128 | for (var f = 0, g = d.length; f < g; f++) | ||
129 | if (d[f] === c || d[f].listener && d[f].listener === c) { | ||
130 | e = f; | ||
131 | break | ||
132 | } | ||
133 | if (e < 0) return this; | ||
134 | d.splice(e, 1), d.length || delete this.$events[a] | ||
135 | } else(d === c || d.listener && d.listener === c) && delete this.$events[a] | ||
136 | } | ||
137 | return this | ||
138 | }, c.prototype.removeAllListeners = function(a) { | ||
139 | return a === undefined ? (this.$events = {}, this) : (this.$events && this.$events[a] && (this.$events[a] = null), this) | ||
140 | }, c.prototype.listeners = function(a) { | ||
141 | return this.$events || (this.$events = {}), this.$events[a] || (this.$events[a] = []), b.util.isArray(this.$events[a]) || (this.$events[a] = [this.$events[a]]), this.$events[a] | ||
142 | }, c.prototype.emit = function(a) { | ||
143 | if (!this.$events) return !1; | ||
144 | var c = this.$events[a]; | ||
145 | if (!c) return !1; | ||
146 | var d = Array.prototype.slice.call(arguments, 1); | ||
147 | if ("function" == typeof c) c.apply(this, d); | ||
148 | else { | ||
149 | if (!b.util.isArray(c)) return !1; | ||
150 | var e = c.slice(); | ||
151 | for (var f = 0, g = e.length; f < g; f++) e[f].apply(this, d) | ||
152 | } | ||
153 | return !0 | ||
154 | } | ||
155 | }("undefined" != typeof io ? io : module.exports, "undefined" != typeof io ? io : module.parent.exports), | ||
156 | function(exports, nativeJSON) { | ||
157 | function f(a) { | ||
158 | return a < 10 ? "0" + a : a | ||
159 | } | ||
160 | |||
161 | function date(a, b) { | ||
162 | return isFinite(a.valueOf()) ? a.getUTCFullYear() + "-" + f(a.getUTCMonth() + 1) + "-" + f(a.getUTCDate()) + "T" + f(a.getUTCHours()) + ":" + f(a.getUTCMinutes()) + ":" + f(a.getUTCSeconds()) + "Z" : null | ||
163 | } | ||
164 | |||
165 | function quote(a) { | ||
166 | return escapable.lastIndex = 0, escapable.test(a) ? '"' + a.replace(escapable, function(a) { | ||
167 | var b = meta[a]; | ||
168 | return typeof b == "string" ? b : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) | ||
169 | }) + '"' : '"' + a + '"' | ||
170 | } | ||
171 | |||
172 | function str(a, b) { | ||
173 | var c, d, e, f, g = gap, | ||
174 | h, i = b[a]; | ||
175 | i instanceof Date && (i = date(a)), typeof rep == "function" && (i = rep.call(b, a, i)); | ||
176 | switch (typeof i) { | ||
177 | case "string": | ||
178 | return quote(i); | ||
179 | case "number": | ||
180 | return isFinite(i) ? String(i) : "null"; | ||
181 | case "boolean": | ||
182 | case "null": | ||
183 | return String(i); | ||
184 | case "object": | ||
185 | if (!i) return "null"; | ||
186 | gap += indent, h = []; | ||
187 | if (Object.prototype.toString.apply(i) === "[object Array]") { | ||
188 | f = i.length; | ||
189 | for (c = 0; c < f; c += 1) h[c] = str(c, i) || "null"; | ||
190 | return e = h.length === 0 ? "[]" : gap ? "[\n" + gap + h.join(",\n" + gap) + "\n" + g + "]" : "[" + h.join(",") + "]", gap = g, e | ||
191 | } | ||
192 | if (rep && typeof rep == "object") { | ||
193 | f = rep.length; | ||
194 | for (c = 0; c < f; c += 1) typeof rep[c] == "string" && (d = rep[c], e = str(d, i), e && h.push(quote(d) + (gap ? ": " : ":") + e)) | ||
195 | } else | ||
196 | for (d in i) Object.prototype.hasOwnProperty.call(i, d) && (e = str(d, i), e && h.push(quote(d) + (gap ? ": " : ":") + e)); | ||
197 | return e = h.length === 0 ? "{}" : gap ? "{\n" + gap + h.join(",\n" + gap) + "\n" + g + "}" : "{" + h.join(",") + "}", gap = g, e | ||
198 | } | ||
199 | } | ||
200 | "use strict"; | ||
201 | if (nativeJSON && nativeJSON.parse) return exports.JSON = { | ||
202 | parse: nativeJSON.parse, | ||
203 | stringify: nativeJSON.stringify | ||
204 | }; | ||
205 | var JSON = exports.JSON = {}, | ||
206 | cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, | ||
207 | escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, | ||
208 | gap, indent, meta = { | ||
209 | "\b": "\\b", | ||
210 | "\t": "\\t", | ||
211 | "\n": "\\n", | ||
212 | "\f": "\\f", | ||
213 | "\r": "\\r", | ||
214 | '"': '\\"', | ||
215 | "\\": "\\\\" | ||
216 | }, | ||
217 | rep; | ||
218 | JSON.stringify = function(a, b, c) { | ||
219 | var d; | ||
220 | gap = "", indent = ""; | ||
221 | if (typeof c == "number") | ||
222 | for (d = 0; d < c; d += 1) indent += " "; | ||
223 | else typeof c == "string" && (indent = c); | ||
224 | rep = b; | ||
225 | if (!b || typeof b == "function" || typeof b == "object" && typeof b.length == "number") return str("", { | ||
226 | "": a | ||
227 | }); | ||
228 | throw new Error("JSON.stringify") | ||
229 | }, JSON.parse = function(text, reviver) { | ||
230 | function walk(a, b) { | ||
231 | var c, d, e = a[b]; | ||
232 | if (e && typeof e == "object") | ||
233 | for (c in e) Object.prototype.hasOwnProperty.call(e, c) && (d = walk(e, c), d !== undefined ? e[c] = d : delete e[c]); | ||
234 | return reviver.call(a, b, e) | ||
235 | } | ||
236 | var j; | ||
237 | text = String(text), cx.lastIndex = 0, cx.test(text) && (text = text.replace(cx, function(a) { | ||
238 | return "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) | ||
239 | })); | ||
240 | if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) return j = eval("(" + text + ")"), typeof reviver == "function" ? walk({ | ||
241 | "": j | ||
242 | }, "") : j; | ||
243 | throw new SyntaxError("JSON.parse") | ||
244 | } | ||
245 | }("undefined" != typeof io ? io : module.exports, typeof JSON != "undefined" ? JSON : undefined), | ||
246 | function(a, b) { | ||
247 | var c = a.parser = {}, | ||
248 | d = c.packets = ["disconnect", "connect", "heartbeat", "message", "json", "event", "ack", "error", "noop"], | ||
249 | e = c.reasons = ["transport not supported", "client not handshaken", "unauthorized"], | ||
250 | f = c.advice = ["reconnect"], | ||
251 | g = b.JSON, | ||
252 | h = b.util.indexOf; | ||
253 | c.encodePacket = function(a) { | ||
254 | var b = h(d, a.type), | ||
255 | c = a.id || "", | ||
256 | i = a.endpoint || "", | ||
257 | j = a.ack, | ||
258 | k = null; | ||
259 | switch (a.type) { | ||
260 | case "error": | ||
261 | var l = a.reason ? h(e, a.reason) : "", | ||
262 | m = a.advice ? h(f, a.advice) : ""; | ||
263 | if (l !== "" || m !== "") k = l + (m !== "" ? "+" + m : ""); | ||
264 | break; | ||
265 | case "message": | ||
266 | a.data !== "" && (k = a.data); | ||
267 | break; | ||
268 | case "event": | ||
269 | var n = { | ||
270 | name: a.name | ||
271 | }; | ||
272 | a.args && a.args.length && (n.args = a.args), k = g.stringify(n); | ||
273 | break; | ||
274 | case "json": | ||
275 | k = g.stringify(a.data); | ||
276 | break; | ||
277 | case "connect": | ||
278 | a.qs && (k = a.qs); | ||
279 | break; | ||
280 | case "ack": | ||
281 | k = a.ackId + (a.args && a.args.length ? "+" + g.stringify(a.args) : "") | ||
282 | } | ||
283 | var o = [b, c + (j == "data" ? "+" : ""), i]; | ||
284 | return k !== null && k !== undefined && o.push(k), o.join(":") | ||
285 | }, c.encodePayload = function(a) { | ||
286 | var b = ""; | ||
287 | if (a.length == 1) return a[0]; | ||
288 | for (var c = 0, d = a.length; c < d; c++) { | ||
289 | var e = a[c]; | ||
290 | b += "\ufffd" + e.length + "\ufffd" + a[c] | ||
291 | } | ||
292 | return b | ||
293 | }; | ||
294 | var i = /([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/; | ||
295 | c.decodePacket = function(a) { | ||
296 | var b = a.match(i); | ||
297 | if (!b) return {}; | ||
298 | var c = b[2] || "", | ||
299 | a = b[5] || "", | ||
300 | h = { | ||
301 | type: d[b[1]], | ||
302 | endpoint: b[4] || "" | ||
303 | }; | ||
304 | c && (h.id = c, b[3] ? h.ack = "data" : h.ack = !0); | ||
305 | switch (h.type) { | ||
306 | case "error": | ||
307 | var b = a.split("+"); | ||
308 | h.reason = e[b[0]] || "", h.advice = f[b[1]] || ""; | ||
309 | break; | ||
310 | case "message": | ||
311 | h.data = a || ""; | ||
312 | break; | ||
313 | case "event": | ||
314 | try { | ||
315 | var j = g.parse(a); | ||
316 | h.name = j.name, h.args = j.args | ||
317 | } catch (k) {} | ||
318 | h.args = h.args || []; | ||
319 | break; | ||
320 | case "json": | ||
321 | try { | ||
322 | h.data = g.parse(a) | ||
323 | } catch (k) {} | ||
324 | break; | ||
325 | case "connect": | ||
326 | h.qs = a || ""; | ||
327 | break; | ||
328 | case "ack": | ||
329 | var b = a.match(/^([0-9]+)(\+)?(.*)/); | ||
330 | if (b) { | ||
331 | h.ackId = b[1], h.args = []; | ||
332 | if (b[3]) try { | ||
333 | h.args = b[3] ? g.parse(b[3]) : [] | ||
334 | } catch (k) {} | ||
335 | } | ||
336 | break; | ||
337 | case "disconnect": | ||
338 | case "heartbeat": | ||
339 | } | ||
340 | return h | ||
341 | }, c.decodePayload = function(a) { | ||
342 | if (a.charAt(0) == "\ufffd") { | ||
343 | var b = []; | ||
344 | for (var d = 1, e = ""; d < a.length; d++) a.charAt(d) == "\ufffd" ? (b.push(c.decodePacket(a.substr(d + 1).substr(0, e))), d += Number(e) + 1, e = "") : e += a.charAt(d); | ||
345 | return b | ||
346 | } | ||
347 | return [c.decodePacket(a)] | ||
348 | } | ||
349 | }("undefined" != typeof io ? io : module.exports, "undefined" != typeof io ? io : module.parent.exports), | ||
350 | function(a, b) { | ||
351 | function c(a, b) { | ||
352 | this.socket = a, this.sessid = b | ||
353 | } | ||
354 | a.Transport = c, b.util.mixin(c, b.EventEmitter), c.prototype.heartbeats = function() { | ||
355 | return !0 | ||
356 | }, c.prototype.onData = function(a) { | ||
357 | this.clearCloseTimeout(), (this.socket.connected || this.socket.connecting || this.socket.reconnecting) && this.setCloseTimeout(); | ||
358 | if (a !== "") { | ||
359 | var c = b.parser.decodePayload(a); | ||
360 | if (c && c.length) | ||
361 | for (var d = 0, e = c.length; d < e; d++) this.onPacket(c[d]) | ||
362 | } | ||
363 | return this | ||
364 | }, c.prototype.onPacket = function(a) { | ||
365 | return this.socket.setHeartbeatTimeout(), a.type == "heartbeat" ? this.onHeartbeat() : (a.type == "connect" && a.endpoint == "" && this.onConnect(), a.type == "error" && a.advice == "reconnect" && (this.isOpen = !1), this.socket.onPacket(a), this) | ||
366 | }, c.prototype.setCloseTimeout = function() { | ||
367 | if (!this.closeTimeout) { | ||
368 | var a = this; | ||
369 | this.closeTimeout = setTimeout(function() { | ||
370 | a.onDisconnect() | ||
371 | }, this.socket.closeTimeout) | ||
372 | } | ||
373 | }, c.prototype.onDisconnect = function() { | ||
374 | return this.isOpen && this.close(), this.clearTimeouts(), this.socket.onDisconnect(), this | ||
375 | }, c.prototype.onConnect = function() { | ||
376 | return this.socket.onConnect(), this | ||
377 | }, c.prototype.clearCloseTimeout = function() { | ||
378 | this.closeTimeout && (clearTimeout(this.closeTimeout), this.closeTimeout = null) | ||
379 | }, c.prototype.clearTimeouts = function() { | ||
380 | this.clearCloseTimeout(), this.reopenTimeout && clearTimeout(this.reopenTimeout) | ||
381 | }, c.prototype.packet = function(a) { | ||
382 | this.send(b.parser.encodePacket(a)) | ||
383 | }, c.prototype.onHeartbeat = function(a) { | ||
384 | this.packet({ | ||
385 | type: "heartbeat" | ||
386 | }) | ||
387 | }, c.prototype.onOpen = function() { | ||
388 | this.isOpen = !0, this.clearCloseTimeout(), this.socket.onOpen() | ||
389 | }, c.prototype.onClose = function() { | ||
390 | var a = this; | ||
391 | this.isOpen = !1, this.socket.onClose(), this.onDisconnect() | ||
392 | }, c.prototype.prepareUrl = function() { | ||
393 | var a = this.socket.options; | ||
394 | return this.scheme() + "://" + a.host + ":" + a.port + "/" + a.resource + "/" + b.protocol + "/" + this.name + "/" + this.sessid | ||
395 | }, c.prototype.ready = function(a, b) { | ||
396 | b.call(this) | ||
397 | } | ||
398 | }("undefined" != typeof io ? io : module.exports, "undefined" != typeof io ? io : module.parent.exports), | ||
399 | function(a, b, c) { | ||
400 | function d(a) { | ||
401 | this.options = { | ||
402 | port: 80, | ||
403 | secure: !1, | ||
404 | document: "document" in c ? document : !1, | ||
405 | resource: "socket.io", | ||
406 | transports: b.transports, | ||
407 | "connect timeout": 1e4, | ||
408 | "try multiple transports": !0, | ||
409 | reconnect: !0, | ||
410 | "reconnection delay": 500, | ||
411 | "reconnection limit": Infinity, | ||
412 | "reopen delay": 3e3, | ||
413 | "max reconnection attempts": 10, | ||
414 | "sync disconnect on unload": !1, | ||
415 | "auto connect": !0, | ||
416 | "flash policy port": 10843, | ||
417 | manualFlush: !1 | ||
418 | }, b.util.merge(this.options, a), this.connected = !1, this.open = !1, this.connecting = !1, this.reconnecting = !1, this.namespaces = {}, this.buffer = [], this.doBuffer = !1; | ||
419 | if (this.options["sync disconnect on unload"] && (!this.isXDomain() || b.util.ua.hasCORS)) { | ||
420 | var d = this; | ||
421 | b.util.on(c, "beforeunload", function() { | ||
422 | d.disconnectSync() | ||
423 | }, !1) | ||
424 | } | ||
425 | this.options["auto connect"] && this.connect() | ||
426 | } | ||
427 | |||
428 | function e() {} | ||
429 | a.Socket = d, b.util.mixin(d, b.EventEmitter), d.prototype.of = function(a) { | ||
430 | return this.namespaces[a] || (this.namespaces[a] = new b.SocketNamespace(this, a), a !== "" && this.namespaces[a].packet({ | ||
431 | type: "connect" | ||
432 | })), this.namespaces[a] | ||
433 | }, d.prototype.publish = function() { | ||
434 | this.emit.apply(this, arguments); | ||
435 | var a; | ||
436 | for (var b in this.namespaces) this.namespaces.hasOwnProperty(b) && (a = this.of(b), a.$emit.apply(a, arguments)) | ||
437 | }, d.prototype.handshake = function(a) { | ||
438 | function f(b) { | ||
439 | b instanceof Error ? (c.connecting = !1, c.onError(b.message)) : a.apply(null, b.split(":")) | ||
440 | } | ||
441 | var c = this, | ||
442 | d = this.options, | ||
443 | g = ["http" + (d.secure ? "s" : "") + ":/", d.host + ":" + d.port, d.resource, b.protocol, b.util.query(this.options.query, "t=" + +(new Date))].join("/"); | ||
444 | if (this.isXDomain() && !b.util.ua.hasCORS) { | ||
445 | var h = document.getElementsByTagName("script")[0], | ||
446 | i = document.createElement("script"); | ||
447 | i.src = g + "&jsonp=" + b.j.length, h.parentNode.insertBefore(i, h), b.j.push(function(a) { | ||
448 | f(a), i.parentNode.removeChild(i) | ||
449 | }) | ||
450 | } else { | ||
451 | var j = b.util.request(); | ||
452 | j.open("GET", g, !0), this.isXDomain() && (j.withCredentials = !0), j.onreadystatechange = function() { | ||
453 | j.readyState == 4 && (j.onreadystatechange = e, j.status == 200 ? f(j.responseText) : j.status == 403 ? c.onError(j.responseText) : (c.connecting = !1, !c.reconnecting && c.onError(j.responseText))) | ||
454 | }, j.send(null) | ||
455 | } | ||
456 | }, d.prototype.getTransport = function(a) { | ||
457 | var c = a || this.transports, | ||
458 | d; | ||
459 | for (var e = 0, f; f = c[e]; e++) | ||
460 | if (b.Transport[f] && b.Transport[f].check(this) && (!this.isXDomain() || b.Transport[f].xdomainCheck(this))) return new b.Transport[f](this, this.sessionid); | ||
461 | return null | ||
462 | }, d.prototype.connect = function(a) { | ||
463 | if (this.connecting) return this; | ||
464 | var c = this; | ||
465 | return c.connecting = !0, this.handshake(function(d, e, f, g) { | ||
466 | function h(a) { | ||
467 | c.transport && c.transport.clearTimeouts(), c.transport = c.getTransport(a); | ||
468 | if (!c.transport) return c.publish("connect_failed"); | ||
469 | c.transport.ready(c, function() { | ||
470 | c.connecting = !0, c.publish("connecting", c.transport.name), c.transport.open(), c.options["connect timeout"] && (c.connectTimeoutTimer = setTimeout(function() { | ||
471 | if (!c.connected) { | ||
472 | c.connecting = !1; | ||
473 | if (c.options["try multiple transports"]) { | ||
474 | var a = c.transports; | ||
475 | while (a.length > 0 && a.splice(0, 1)[0] != c.transport.name); | ||
476 | a.length ? h(a) : c.publish("connect_failed") | ||
477 | } | ||
478 | } | ||
479 | }, c.options["connect timeout"])) | ||
480 | }) | ||
481 | } | ||
482 | c.sessionid = d, c.closeTimeout = f * 1e3, c.heartbeatTimeout = e * 1e3, c.transports || (c.transports = c.origTransports = g ? b.util.intersect(g.split(","), c.options.transports) : c.options.transports), c.setHeartbeatTimeout(), h(c.transports), c.once("connect", function() { | ||
483 | clearTimeout(c.connectTimeoutTimer), a && typeof a == "function" && a() | ||
484 | }) | ||
485 | }), this | ||
486 | }, d.prototype.setHeartbeatTimeout = function() { | ||
487 | clearTimeout(this.heartbeatTimeoutTimer); | ||
488 | if (this.transport && !this.transport.heartbeats()) return; | ||
489 | var a = this; | ||
490 | this.heartbeatTimeoutTimer = setTimeout(function() { | ||
491 | a.transport.onClose() | ||
492 | }, this.heartbeatTimeout) | ||
493 | }, d.prototype.packet = function(a) { | ||
494 | return this.connected && !this.doBuffer ? this.transport.packet(a) : this.buffer.push(a), this | ||
495 | }, d.prototype.setBuffer = function(a) { | ||
496 | this.doBuffer = a, !a && this.connected && this.buffer.length && (this.options.manualFlush || this.flushBuffer()) | ||
497 | }, d.prototype.flushBuffer = function() { | ||
498 | this.transport.payload(this.buffer), this.buffer = [] | ||
499 | }, d.prototype.disconnect = function() { | ||
500 | if (this.connected || this.connecting) this.open && this.of("").packet({ | ||
501 | type: "disconnect" | ||
502 | }), this.onDisconnect("booted"); | ||
503 | return this | ||
504 | }, d.prototype.disconnectSync = function() { | ||
505 | var a = b.util.request(), | ||
506 | c = ["http" + (this.options.secure ? "s" : "") + ":/", this.options.host + ":" + this.options.port, this.options.resource, b.protocol, "", this.sessionid].join("/") + "/?disconnect=1"; | ||
507 | a.open("GET", c, !1), a.send(null), this.onDisconnect("booted") | ||
508 | }, d.prototype.isXDomain = function() { | ||
509 | var a = c.location.port || ("https:" == c.location.protocol ? 443 : 80); | ||
510 | return this.options.host !== c.location.hostname || this.options.port != a | ||
511 | }, d.prototype.onConnect = function() { | ||
512 | this.connected || (this.connected = !0, this.connecting = !1, this.doBuffer || this.setBuffer(!1), this.emit("connect")) | ||
513 | }, d.prototype.onOpen = function() { | ||
514 | this.open = !0 | ||
515 | }, d.prototype.onClose = function() { | ||
516 | this.open = !1, clearTimeout(this.heartbeatTimeoutTimer) | ||
517 | }, d.prototype.onPacket = function(a) { | ||
518 | this.of(a.endpoint).onPacket(a) | ||
519 | }, d.prototype.onError = function(a) { | ||
520 | a && a.advice && a.advice === "reconnect" && (this.connected || this.connecting) && (this.disconnect(), this.options.reconnect && this.reconnect()), this.publish("error", a && a.reason ? a.reason : a) | ||
521 | }, d.prototype.onDisconnect = function(a) { | ||
522 | var b = this.connected, | ||
523 | c = this.connecting; | ||
524 | this.connected = !1, this.connecting = !1, this.open = !1; | ||
525 | if (b || c) this.transport.close(), this.transport.clearTimeouts(), b && (this.publish("disconnect", a), "booted" != a && this.options.reconnect && !this.reconnecting && this.reconnect()) | ||
526 | }, d.prototype.reconnect = function() { | ||
527 | function e() { | ||
528 | if (a.connected) { | ||
529 | for (var b in a.namespaces) a.namespaces.hasOwnProperty(b) && "" !== b && a.namespaces[b].packet({ | ||
530 | type: "connect" | ||
531 | }); | ||
532 | a.publish("reconnect", a.transport.name, a.reconnectionAttempts) | ||
533 | } | ||
534 | clearTimeout(a.reconnectionTimer), a.removeListener("connect_failed", f), a.removeListener("connect", f), a.reconnecting = !1, delete a.reconnectionAttempts, delete a.reconnectionDelay, delete a.reconnectionTimer, delete a.redoTransports, a.options["try multiple transports"] = c | ||
535 | } | ||
536 | |||
537 | function f() { | ||
538 | if (!a.reconnecting) return; | ||
539 | if (a.connected) return e(); | ||
540 | if (a.connecting && a.reconnecting) return a.reconnectionTimer = setTimeout(f, 1e3); | ||
541 | a.reconnectionAttempts++ >= b ? a.redoTransports ? (a.publish("reconnect_failed"), e()) : (a.on("connect_failed", f), a.options["try multiple transports"] = !0, a.transports = a.origTransports, a.transport = a.getTransport(), a.redoTransports = !0, a.connect()) : (a.reconnectionDelay < d && (a.reconnectionDelay *= 2), a.connect(), a.publish("reconnecting", a.reconnectionDelay, a.reconnectionAttempts), a.reconnectionTimer = setTimeout(f, a.reconnectionDelay)) | ||
542 | } | ||
543 | this.reconnecting = !0, this.reconnectionAttempts = 0, this.reconnectionDelay = this.options["reconnection delay"]; | ||
544 | var a = this, | ||
545 | b = this.options["max reconnection attempts"], | ||
546 | c = this.options["try multiple transports"], | ||
547 | d = this.options["reconnection limit"]; | ||
548 | this.options["try multiple transports"] = !1, this.reconnectionTimer = setTimeout(f, this.reconnectionDelay), this.on("connect", f) | ||
549 | } | ||
550 | }("undefined" != typeof io ? io : module.exports, "undefined" != typeof io ? io : module.parent.exports, this), | ||
551 | function(a, b) { | ||
552 | function c(a, b) { | ||
553 | this.socket = a, this.name = b || "", this.flags = {}, this.json = new d(this, "json"), this.ackPackets = 0, this.acks = {} | ||
554 | } | ||
555 | |||
556 | function d(a, b) { | ||
557 | this.namespace = a, this.name = b | ||
558 | } | ||
559 | a.SocketNamespace = c, b.util.mixin(c, b.EventEmitter), c.prototype.$emit = b.EventEmitter.prototype.emit, c.prototype.of = function() { | ||
560 | return this.socket.of.apply(this.socket, arguments) | ||
561 | }, c.prototype.packet = function(a) { | ||
562 | return a.endpoint = this.name, this.socket.packet(a), this.flags = {}, this | ||
563 | }, c.prototype.send = function(a, b) { | ||
564 | var c = { | ||
565 | type: this.flags.json ? "json" : "message", | ||
566 | data: a | ||
567 | }; | ||
568 | return "function" == typeof b && (c.id = ++this.ackPackets, c.ack = !0, this.acks[c.id] = b), this.packet(c) | ||
569 | }, c.prototype.emit = function(a) { | ||
570 | var b = Array.prototype.slice.call(arguments, 1), | ||
571 | c = b[b.length - 1], | ||
572 | d = { | ||
573 | type: "event", | ||
574 | name: a | ||
575 | }; | ||
576 | return "function" == typeof c && (d.id = ++this.ackPackets, d.ack = "data", this.acks[d.id] = c, b = b.slice(0, b.length - 1)), d.args = b, this.packet(d) | ||
577 | }, c.prototype.disconnect = function() { | ||
578 | return this.name === "" ? this.socket.disconnect() : (this.packet({ | ||
579 | type: "disconnect" | ||
580 | }), this.$emit("disconnect")), this | ||
581 | }, c.prototype.onPacket = function(a) { | ||
582 | function d() { | ||
583 | c.packet({ | ||
584 | type: "ack", | ||
585 | args: b.util.toArray(arguments), | ||
586 | ackId: a.id | ||
587 | }) | ||
588 | } | ||
589 | var c = this; | ||
590 | switch (a.type) { | ||
591 | case "connect": | ||
592 | this.$emit("connect"); | ||
593 | break; | ||
594 | case "disconnect": | ||
595 | this.name === "" ? this.socket.onDisconnect(a.reason || "booted") : this.$emit("disconnect", a.reason); | ||
596 | break; | ||
597 | case "message": | ||
598 | case "json": | ||
599 | var e = ["message", a.data]; | ||
600 | a.ack == "data" ? e.push(d) : a.ack && this.packet({ | ||
601 | type: "ack", | ||
602 | ackId: a.id | ||
603 | }), this.$emit.apply(this, e); | ||
604 | break; | ||
605 | case "event": | ||
606 | var e = [a.name].concat(a.args); | ||
607 | a.ack == "data" && e.push(d), this.$emit.apply(this, e); | ||
608 | break; | ||
609 | case "ack": | ||
610 | this.acks[a.ackId] && (this.acks[a.ackId].apply(this, a.args), delete this.acks[a.ackId]); | ||
611 | break; | ||
612 | case "error": | ||
613 | a.advice ? this.socket.onError(a) : a.reason == "unauthorized" ? this.$emit("connect_failed", a.reason) : this.$emit("error", a.reason) | ||
614 | } | ||
615 | }, d.prototype.send = function() { | ||
616 | this.namespace.flags[this.name] = !0, this.namespace.send.apply(this.namespace, arguments) | ||
617 | }, d.prototype.emit = function() { | ||
618 | this.namespace.flags[this.name] = !0, this.namespace.emit.apply(this.namespace, arguments) | ||
619 | } | ||
620 | }("undefined" != typeof io ? io : module.exports, "undefined" != typeof io ? io : module.parent.exports), | ||
621 | function(a, b, c) { | ||
622 | function d(a) { | ||
623 | b.Transport.apply(this, arguments) | ||
624 | } | ||
625 | a.websocket = d, b.util.inherit(d, b.Transport), d.prototype.name = "websocket", d.prototype.open = function() { | ||
626 | var a = b.util.query(this.socket.options.query), | ||
627 | d = this, | ||
628 | e; | ||
629 | return e || (e = c.MozWebSocket || c.WebSocket), this.websocket = new e(this.prepareUrl() + a), this.websocket.onopen = function() { | ||
630 | d.onOpen(), d.socket.setBuffer(!1) | ||
631 | }, this.websocket.onmessage = function(a) { | ||
632 | d.onData(a.data) | ||
633 | }, this.websocket.onclose = function() { | ||
634 | d.onClose(), d.socket.setBuffer(!0) | ||
635 | }, this.websocket.onerror = function(a) { | ||
636 | d.onError(a) | ||
637 | }, this | ||
638 | }, b.util.ua.iDevice ? d.prototype.send = function(a) { | ||
639 | var b = this; | ||
640 | return setTimeout(function() { | ||
641 | b.websocket.send(a) | ||
642 | }, 0), this | ||
643 | } : d.prototype.send = function(a) { | ||
644 | return this.websocket.send(a), this | ||
645 | }, d.prototype.payload = function(a) { | ||
646 | for (var b = 0, c = a.length; b < c; b++) this.packet(a[b]); | ||
647 | return this | ||
648 | }, d.prototype.close = function() { | ||
649 | return this.websocket.close(), this | ||
650 | }, d.prototype.onError = function(a) { | ||
651 | this.socket.onError(a) | ||
652 | }, d.prototype.scheme = function() { | ||
653 | return this.socket.options.secure ? "wss" : "ws" | ||
654 | }, d.check = function() { | ||
655 | return "WebSocket" in c && !("__addTask" in WebSocket) || "MozWebSocket" in c | ||
656 | }, d.xdomainCheck = function() { | ||
657 | return !0 | ||
658 | }, b.transports.push("websocket") | ||
659 | }("undefined" != typeof io ? io.Transport : module.exports, "undefined" != typeof io ? io : module.parent.exports, this), | ||
660 | function(a, b) { | ||
661 | function c() { | ||
662 | b.Transport.websocket.apply(this, arguments) | ||
663 | } | ||
664 | a.flashsocket = c, b.util.inherit(c, b.Transport.websocket), c.prototype.name = "flashsocket", c.prototype.open = function() { | ||
665 | var a = this, | ||
666 | c = arguments; | ||
667 | return WebSocket.__addTask(function() { | ||
668 | b.Transport.websocket.prototype.open.apply(a, c) | ||
669 | }), this | ||
670 | }, c.prototype.send = function() { | ||
671 | var a = this, | ||
672 | c = arguments; | ||
673 | return WebSocket.__addTask(function() { | ||
674 | b.Transport.websocket.prototype.send.apply(a, c) | ||
675 | }), this | ||
676 | }, c.prototype.close = function() { | ||
677 | return WebSocket.__tasks.length = 0, b.Transport.websocket.prototype.close.call(this), this | ||
678 | }, c.prototype.ready = function(a, d) { | ||
679 | function e() { | ||
680 | var b = a.options, | ||
681 | e = b["flash policy port"], | ||
682 | g = ["http" + (b.secure ? "s" : "") + ":/", b.host + ":" + b.port, b.resource, "static/flashsocket", "WebSocketMain" + (a.isXDomain() ? "Insecure" : "") + ".swf"]; | ||
683 | c.loaded || (typeof WEB_SOCKET_SWF_LOCATION == "undefined" && (WEB_SOCKET_SWF_LOCATION = g.join("/")), e !== 843 && WebSocket.loadFlashPolicyFile("xmlsocket://" + b.host + ":" + e), WebSocket.__initialize(), c.loaded = !0), d.call(f) | ||
684 | } | ||
685 | var f = this; | ||
686 | if (document.body) return e(); | ||
687 | b.util.load(e) | ||
688 | }, c.check = function() { | ||
689 | return typeof WebSocket != "undefined" && "__initialize" in WebSocket && !!swfobject ? swfobject.getFlashPlayerVersion().major >= 10 : !1 | ||
690 | }, c.xdomainCheck = function() { | ||
691 | return !0 | ||
692 | }, typeof window != "undefined" && (WEB_SOCKET_DISABLE_AUTO_INITIALIZATION = !0), b.transports.push("flashsocket") | ||
693 | }("undefined" != typeof io ? io.Transport : module.exports, "undefined" != typeof io ? io : module.parent.exports); | ||
694 | if ("undefined" != typeof window) var swfobject = function() { | ||
695 | function A() { | ||
696 | if (t) return; | ||
697 | try { | ||
698 | var a = i.getElementsByTagName("body")[0].appendChild(Q("span")); | ||
699 | a.parentNode.removeChild(a) | ||
700 | } catch (b) { | ||
701 | return | ||
702 | } | ||
703 | t = !0; | ||
704 | var c = l.length; | ||
705 | for (var d = 0; d < c; d++) l[d]() | ||
706 | } | ||
707 | |||
708 | function B(a) { | ||
709 | t ? a() : l[l.length] = a | ||
710 | } | ||
711 | |||
712 | function C(b) { | ||
713 | if (typeof h.addEventListener != a) h.addEventListener("load", b, !1); | ||
714 | else if (typeof i.addEventListener != a) i.addEventListener("load", b, !1); | ||
715 | else if (typeof h.attachEvent != a) R(h, "onload", b); | ||
716 | else if (typeof h.onload == "function") { | ||
717 | var c = h.onload; | ||
718 | h.onload = function() { | ||
719 | c(), b() | ||
720 | } | ||
721 | } else h.onload = b | ||
722 | } | ||
723 | |||
724 | function D() { | ||
725 | k ? E() : F() | ||
726 | } | ||
727 | |||
728 | function E() { | ||
729 | var c = i.getElementsByTagName("body")[0], | ||
730 | d = Q(b); | ||
731 | d.setAttribute("type", e); | ||
732 | var f = c.appendChild(d); | ||
733 | if (f) { | ||
734 | var g = 0; | ||
735 | (function() { | ||
736 | if (typeof f.GetVariable != a) { | ||
737 | var b = f.GetVariable("$version"); | ||
738 | b && (b = b.split(" ")[1].split(","), y.pv = [parseInt(b[0], 10), parseInt(b[1], 10), parseInt(b[2], 10)]) | ||
739 | } else if (g < 10) { | ||
740 | g++, setTimeout(arguments.callee, 10); | ||
741 | return | ||
742 | } | ||
743 | c.removeChild(d), f = null, F() | ||
744 | })() | ||
745 | } else F() | ||
746 | } | ||
747 | |||
748 | function F() { | ||
749 | var b = m.length; | ||
750 | if (b > 0) | ||
751 | for (var c = 0; c < b; c++) { | ||
752 | var d = m[c].id, | ||
753 | e = m[c].callbackFn, | ||
754 | f = { | ||
755 | success: !1, | ||
756 | id: d | ||
757 | }; | ||
758 | if (y.pv[0] > 0) { | ||
759 | var g = P(d); | ||
760 | if (g) | ||
761 | if (S(m[c].swfVersion) && !(y.wk && y.wk < 312)) U(d, !0), e && (f.success = !0, f.ref = G(d), e(f)); | ||
762 | else if (m[c].expressInstall && H()) { | ||
763 | var h = {}; | ||
764 | h.data = m[c].expressInstall, h.width = g.getAttribute("width") || "0", h.height = g.getAttribute("height") || "0", g.getAttribute("class") && (h.styleclass = g.getAttribute("class")), g.getAttribute("align") && (h.align = g.getAttribute("align")); | ||
765 | var i = {}, | ||
766 | j = g.getElementsByTagName("param"), | ||
767 | k = j.length; | ||
768 | for (var l = 0; l < k; l++) j[l].getAttribute("name").toLowerCase() != "movie" && (i[j[l].getAttribute("name")] = j[l].getAttribute("value")); | ||
769 | I(h, i, d, e) | ||
770 | } else J(g), e && e(f) | ||
771 | } else { | ||
772 | U(d, !0); | ||
773 | if (e) { | ||
774 | var n = G(d); | ||
775 | n && typeof n.SetVariable != a && (f.success = !0, f.ref = n), e(f) | ||
776 | } | ||
777 | } | ||
778 | } | ||
779 | } | ||
780 | |||
781 | function G(c) { | ||
782 | var d = null, | ||
783 | e = P(c); | ||
784 | if (e && e.nodeName == "OBJECT") | ||
785 | if (typeof e.SetVariable != a) d = e; | ||
786 | else { | ||
787 | var f = e.getElementsByTagName(b)[0]; | ||
788 | f && (d = f) | ||
789 | } | ||
790 | return d | ||
791 | } | ||
792 | |||
793 | function H() { | ||
794 | return !u && S("6.0.65") && (y.win || y.mac) && !(y.wk && y.wk < 312) | ||
795 | } | ||
796 | |||
797 | function I(b, c, d, e) { | ||
798 | u = !0, r = e || null, s = { | ||
799 | success: !1, | ||
800 | id: d | ||
801 | }; | ||
802 | var g = P(d); | ||
803 | if (g) { | ||
804 | g.nodeName == "OBJECT" ? (p = K(g), q = null) : (p = g, q = d), b.id = f; | ||
805 | if (typeof b.width == a || !/%$/.test(b.width) && parseInt(b.width, 10) < 310) b.width = "310"; | ||
806 | if (typeof b.height == a || !/%$/.test(b.height) && parseInt(b.height, 10) < 137) b.height = "137"; | ||
807 | i.title = i.title.slice(0, 47) + " - Flash Player Installation"; | ||
808 | var j = y.ie && y.win ? ["Active"].concat("").join("X") : "PlugIn", | ||
809 | k = "MMredirectURL=" + h.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + j + "&MMdoctitle=" + i.title; | ||
810 | typeof c.flashvars != a ? c.flashvars += "&" + k : c.flashvars = k; | ||
811 | if (y.ie && y.win && g.readyState != 4) { | ||
812 | var l = Q("div"); | ||
813 | d += "SWFObjectNew", l.setAttribute("id", d), g.parentNode.insertBefore(l, g), g.style.display = "none", | ||
814 | function() { | ||
815 | g.readyState == 4 ? g.parentNode.removeChild(g) : setTimeout(arguments.callee, 10) | ||
816 | }() | ||
817 | } | ||
818 | L(b, c, d) | ||
819 | } | ||
820 | } | ||
821 | |||
822 | function J(a) { | ||
823 | if (y.ie && y.win && a.readyState != 4) { | ||
824 | var b = Q("div"); | ||
825 | a.parentNode.insertBefore(b, a), b.parentNode.replaceChild(K(a), b), a.style.display = "none", | ||
826 | function() { | ||
827 | a.readyState == 4 ? a.parentNode.removeChild(a) : setTimeout(arguments.callee, 10) | ||
828 | }() | ||
829 | } else a.parentNode.replaceChild(K(a), a) | ||
830 | } | ||
831 | |||
832 | function K(a) { | ||
833 | var c = Q("div"); | ||
834 | if (y.win && y.ie) c.innerHTML = a.innerHTML; | ||
835 | else { | ||
836 | var d = a.getElementsByTagName(b)[0]; | ||
837 | if (d) { | ||
838 | var e = d.childNodes; | ||
839 | if (e) { | ||
840 | var f = e.length; | ||
841 | for (var g = 0; g < f; g++)(e[g].nodeType != 1 || e[g].nodeName != "PARAM") && e[g].nodeType != 8 && c.appendChild(e[g].cloneNode(!0)) | ||
842 | } | ||
843 | } | ||
844 | } | ||
845 | return c | ||
846 | } | ||
847 | |||
848 | function L(c, d, f) { | ||
849 | var g, h = P(f); | ||
850 | if (y.wk && y.wk < 312) return g; | ||
851 | if (h) { | ||
852 | typeof c.id == a && (c.id = f); | ||
853 | if (y.ie && y.win) { | ||
854 | var i = ""; | ||
855 | for (var j in c) c[j] != Object.prototype[j] && (j.toLowerCase() == "data" ? d.movie = c[j] : j.toLowerCase() == "styleclass" ? i += ' class="' + c[j] + '"' : j.toLowerCase() != "classid" && (i += " " + j + '="' + c[j] + '"')); | ||
856 | var k = ""; | ||
857 | for (var l in d) d[l] != Object.prototype[l] && (k += '<param name="' + l + '" value="' + d[l] + '" />'); | ||
858 | h.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + i + ">" + k + "</object>", n[n.length] = c.id, g = P(c.id) | ||
859 | } else { | ||
860 | var m = Q(b); | ||
861 | m.setAttribute("type", e); | ||
862 | for (var o in c) c[o] != Object.prototype[o] && (o.toLowerCase() == "styleclass" ? m.setAttribute("class", c[o]) : o.toLowerCase() != "classid" && m.setAttribute(o, c[o])); | ||
863 | for (var p in d) d[p] != Object.prototype[p] && p.toLowerCase() != "movie" && M(m, p, d[p]); | ||
864 | h.parentNode.replaceChild(m, h), g = m | ||
865 | } | ||
866 | } | ||
867 | return g | ||
868 | } | ||
869 | |||
870 | function M(a, b, c) { | ||
871 | var d = Q("param"); | ||
872 | d.setAttribute("name", b), d.setAttribute("value", c), a.appendChild(d) | ||
873 | } | ||
874 | |||
875 | function N(a) { | ||
876 | var b = P(a); | ||
877 | b && b.nodeName == "OBJECT" && (y.ie && y.win ? (b.style.display = "none", function() { | ||
878 | b.readyState == 4 ? O(a) : setTimeout(arguments.callee, 10) | ||
879 | }()) : b.parentNode.removeChild(b)) | ||
880 | } | ||
881 | |||
882 | function O(a) { | ||
883 | var b = P(a); | ||
884 | if (b) { | ||
885 | for (var c in b) typeof b[c] == "function" && (b[c] = null); | ||
886 | b.parentNode.removeChild(b) | ||
887 | } | ||
888 | } | ||
889 | |||
890 | function P(a) { | ||
891 | var b = null; | ||
892 | try { | ||
893 | b = i.getElementById(a) | ||
894 | } catch (c) {} | ||
895 | return b | ||
896 | } | ||
897 | |||
898 | function Q(a) { | ||
899 | return i.createElement(a) | ||
900 | } | ||
901 | |||
902 | function R(a, b, c) { | ||
903 | a.attachEvent(b, c), o[o.length] = [a, b, c] | ||
904 | } | ||
905 | |||
906 | function S(a) { | ||
907 | var b = y.pv, | ||
908 | c = a.split("."); | ||
909 | return c[0] = parseInt(c[0], 10), c[1] = parseInt(c[1], 10) || 0, c[2] = parseInt(c[2], 10) || 0, b[0] > c[0] || b[0] == c[0] && b[1] > c[1] || b[0] == c[0] && b[1] == c[1] && b[2] >= c[2] ? !0 : !1 | ||
910 | } | ||
911 | |||
912 | function T(c, d, e, f) { | ||
913 | if (y.ie && y.mac) return; | ||
914 | var g = i.getElementsByTagName("head")[0]; | ||
915 | if (!g) return; | ||
916 | var h = e && typeof e == "string" ? e : "screen"; | ||
917 | f && (v = null, w = null); | ||
918 | if (!v || w != h) { | ||
919 | var j = Q("style"); | ||
920 | j.setAttribute("type", "text/css"), j.setAttribute("media", h), v = g.appendChild(j), y.ie && y.win && typeof i.styleSheets != a && i.styleSheets.length > 0 && (v = i.styleSheets[i.styleSheets.length - 1]), w = h | ||
921 | } | ||
922 | y.ie && y.win ? v && typeof v.addRule == b && v.addRule(c, d) : v && typeof i.createTextNode != a && v.appendChild(i.createTextNode(c + " {" + d + "}")) | ||
923 | } | ||
924 | |||
925 | function U(a, b) { | ||
926 | if (!x) return; | ||
927 | var c = b ? "visible" : "hidden"; | ||
928 | t && P(a) ? P(a).style.visibility = c : T("#" + a, "visibility:" + c) | ||
929 | } | ||
930 | |||
931 | function V(b) { | ||
932 | var c = /[\\\"<>\.;]/, | ||
933 | d = c.exec(b) != null; | ||
934 | return d && typeof encodeURIComponent != a ? encodeURIComponent(b) : b | ||
935 | } | ||
936 | var a = "undefined", | ||
937 | b = "object", | ||
938 | c = "Shockwave Flash", | ||
939 | d = "ShockwaveFlash.ShockwaveFlash", | ||
940 | e = "application/x-shockwave-flash", | ||
941 | f = "SWFObjectExprInst", | ||
942 | g = "onreadystatechange", | ||
943 | h = window, | ||
944 | i = document, | ||
945 | j = navigator, | ||
946 | k = !1, | ||
947 | l = [D], | ||
948 | m = [], | ||
949 | n = [], | ||
950 | o = [], | ||
951 | p, q, r, s, t = !1, | ||
952 | u = !1, | ||
953 | v, w, x = !0, | ||
954 | y = function() { | ||
955 | var f = typeof i.getElementById != a && typeof i.getElementsByTagName != a && typeof i.createElement != a, | ||
956 | g = j.userAgent.toLowerCase(), | ||
957 | l = j.platform.toLowerCase(), | ||
958 | m = l ? /win/.test(l) : /win/.test(g), | ||
959 | n = l ? /mac/.test(l) : /mac/.test(g), | ||
960 | o = /webkit/.test(g) ? parseFloat(g.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : !1, | ||
961 | p = !1, | ||
962 | q = [0, 0, 0], | ||
963 | r = null; | ||
964 | if (typeof j.plugins != a && typeof j.plugins[c] == b) r = j.plugins[c].description, r && (typeof j.mimeTypes == a || !j.mimeTypes[e] || !!j.mimeTypes[e].enabledPlugin) && (k = !0, p = !1, r = r.replace(/^.*\s+(\S+\s+\S+$)/, "$1"), q[0] = parseInt(r.replace(/^(.*)\..*$/, "$1"), 10), q[1] = parseInt(r.replace(/^.*\.(.*)\s.*$/, "$1"), 10), q[2] = /[a-zA-Z]/.test(r) ? parseInt(r.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0); | ||
965 | else if (typeof h[["Active"].concat("Object").join("X")] != a) try { | ||
966 | var s = new(window[["Active"].concat("Object").join("X")])(d); | ||
967 | s && (r = s.GetVariable("$version"), r && (p = !0, r = r.split(" ")[1].split(","), q = [parseInt(r[0], 10), parseInt(r[1], 10), parseInt(r[2], 10)])) | ||
968 | } catch (t) {} | ||
969 | return { | ||
970 | w3: f, | ||
971 | pv: q, | ||
972 | wk: o, | ||
973 | ie: p, | ||
974 | win: m, | ||
975 | mac: n | ||
976 | } | ||
977 | }(), | ||
978 | z = function() { | ||
979 | if (!y.w3) return; | ||
980 | (typeof i.readyState != a && i.readyState == "complete" || typeof i.readyState == a && (i.getElementsByTagName("body")[0] || i.body)) && A(), t || (typeof i.addEventListener != a && i.addEventListener("DOMContentLoaded", A, !1), y.ie && y.win && (i.attachEvent(g, function() { | ||
981 | i.readyState == "complete" && (i.detachEvent(g, arguments.callee), A()) | ||
982 | }), h == top && function() { | ||
983 | if (t) return; | ||
984 | try { | ||
985 | i.documentElement.doScroll("left") | ||
986 | } catch (a) { | ||
987 | setTimeout(arguments.callee, 0); | ||
988 | return | ||
989 | } | ||
990 | A() | ||
991 | }()), y.wk && function() { | ||
992 | if (t) return; | ||
993 | if (!/loaded|complete/.test(i.readyState)) { | ||
994 | setTimeout(arguments.callee, 0); | ||
995 | return | ||
996 | } | ||
997 | A() | ||
998 | }(), C(A)) | ||
999 | }(), | ||
1000 | W = function() { | ||
1001 | y.ie && y.win && window.attachEvent("onunload", function() { | ||
1002 | var a = o.length; | ||
1003 | for (var b = 0; b < a; b++) o[b][0].detachEvent(o[b][1], o[b][2]); | ||
1004 | var c = n.length; | ||
1005 | for (var d = 0; d < c; d++) N(n[d]); | ||
1006 | for (var e in y) y[e] = null; | ||
1007 | y = null; | ||
1008 | for (var f in swfobject) swfobject[f] = null; | ||
1009 | swfobject = null | ||
1010 | }) | ||
1011 | }(); | ||
1012 | return { | ||
1013 | registerObject: function(a, b, c, d) { | ||
1014 | if (y.w3 && a && b) { | ||
1015 | var e = {}; | ||
1016 | e.id = a, e.swfVersion = b, e.expressInstall = c, e.callbackFn = d, m[m.length] = e, U(a, !1) | ||
1017 | } else d && d({ | ||
1018 | success: !1, | ||
1019 | id: a | ||
1020 | }) | ||
1021 | }, | ||
1022 | getObjectById: function(a) { | ||
1023 | if (y.w3) return G(a) | ||
1024 | }, | ||
1025 | embedSWF: function(c, d, e, f, g, h, i, j, k, l) { | ||
1026 | var m = { | ||
1027 | success: !1, | ||
1028 | id: d | ||
1029 | }; | ||
1030 | y.w3 && !(y.wk && y.wk < 312) && c && d && e && f && g ? (U(d, !1), B(function() { | ||
1031 | e += "", f += ""; | ||
1032 | var n = {}; | ||
1033 | if (k && typeof k === b) | ||
1034 | for (var o in k) n[o] = k[o]; | ||
1035 | n.data = c, n.width = e, n.height = f; | ||
1036 | var p = {}; | ||
1037 | if (j && typeof j === b) | ||
1038 | for (var q in j) p[q] = j[q]; | ||
1039 | if (i && typeof i === b) | ||
1040 | for (var r in i) typeof p.flashvars != a ? p.flashvars += "&" + r + "=" + i[r] : p.flashvars = r + "=" + i[r]; | ||
1041 | if (S(g)) { | ||
1042 | var s = L(n, p, d); | ||
1043 | n.id == d && U(d, !0), m.success = !0, m.ref = s | ||
1044 | } else { | ||
1045 | if (h && H()) { | ||
1046 | n.data = h, I(n, p, d, l); | ||
1047 | return | ||
1048 | } | ||
1049 | U(d, !0) | ||
1050 | } | ||
1051 | l && l(m) | ||
1052 | })) : l && l(m) | ||
1053 | }, | ||
1054 | switchOffAutoHideShow: function() { | ||
1055 | x = !1 | ||
1056 | }, | ||
1057 | ua: y, | ||
1058 | getFlashPlayerVersion: function() { | ||
1059 | return { | ||
1060 | major: y.pv[0], | ||
1061 | minor: y.pv[1], | ||
1062 | release: y.pv[2] | ||
1063 | } | ||
1064 | }, | ||
1065 | hasFlashPlayerVersion: S, | ||
1066 | createSWF: function(a, b, c) { | ||
1067 | return y.w3 ? L(a, b, c) : undefined | ||
1068 | }, | ||
1069 | showExpressInstall: function(a, b, c, d) { | ||
1070 | y.w3 && H() && I(a, b, c, d) | ||
1071 | }, | ||
1072 | removeSWF: function(a) { | ||
1073 | y.w3 && N(a) | ||
1074 | }, | ||
1075 | createCSS: function(a, b, c, d) { | ||
1076 | y.w3 && T(a, b, c, d) | ||
1077 | }, | ||
1078 | addDomLoadEvent: B, | ||
1079 | addLoadEvent: C, | ||
1080 | getQueryParamValue: function(a) { | ||
1081 | var b = i.location.search || i.location.hash; | ||
1082 | if (b) { | ||
1083 | /\?/.test(b) && (b = b.split("?")[1]); | ||
1084 | if (a == null) return V(b); | ||
1085 | var c = b.split("&"); | ||
1086 | for (var d = 0; d < c.length; d++) | ||
1087 | if (c[d].substring(0, c[d].indexOf("=")) == a) return V(c[d].substring(c[d].indexOf("=") + 1)) | ||
1088 | } | ||
1089 | return "" | ||
1090 | }, | ||
1091 | expressInstallCallback: function() { | ||
1092 | if (u) { | ||
1093 | var a = P(f); | ||
1094 | a && p && (a.parentNode.replaceChild(p, a), q && (U(q, !0), y.ie && y.win && (p.style.display = "block")), r && r(s)), u = !1 | ||
1095 | } | ||
1096 | } | ||
1097 | } | ||
1098 | }(); | ||
1099 | (function() { | ||
1100 | if ("undefined" == typeof window || window.WebSocket) return; | ||
1101 | var a = window.console; | ||
1102 | if (!a || !a.log || !a.error) a = { | ||
1103 | log: function() {}, | ||
1104 | error: function() {} | ||
1105 | }; | ||
1106 | if (!swfobject.hasFlashPlayerVersion("10.0.0")) { | ||
1107 | a.error("Flash Player >= 10.0.0 is required."); | ||
1108 | return | ||
1109 | } | ||
1110 | location.protocol == "file:" && a.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(a, b, c, d, e) { | ||
1111 | var f = this; | ||
1112 | f.__id = WebSocket.__nextId++, WebSocket.__instances[f.__id] = f, f.readyState = WebSocket.CONNECTING, f.bufferedAmount = 0, f.__events = {}, b ? typeof b == "string" && (b = [b]) : b = [], setTimeout(function() { | ||
1113 | WebSocket.__addTask(function() { | ||
1114 | WebSocket.__flash.create(f.__id, a, b, c || null, d || 0, e || null) | ||
1115 | }) | ||
1116 | }, 0) | ||
1117 | }, WebSocket.prototype.send = function(a) { | ||
1118 | if (this.readyState == WebSocket.CONNECTING) throw "INVALID_STATE_ERR: Web Socket connection has not been established"; | ||
1119 | var b = WebSocket.__flash.send(this.__id, encodeURIComponent(a)); | ||
1120 | return b < 0 ? !0 : (this.bufferedAmount += b, !1) | ||
1121 | }, WebSocket.prototype.close = function() { | ||
1122 | if (this.readyState == WebSocket.CLOSED || this.readyState == WebSocket.CLOSING) return; | ||
1123 | this.readyState = WebSocket.CLOSING, WebSocket.__flash.close(this.__id) | ||
1124 | }, WebSocket.prototype.addEventListener = function(a, b, c) { | ||
1125 | a in this.__events || (this.__events[a] = []), this.__events[a].push(b) | ||
1126 | }, WebSocket.prototype.removeEventListener = function(a, b, c) { | ||
1127 | if (!(a in this.__events)) return; | ||
1128 | var d = this.__events[a]; | ||
1129 | for (var e = d.length - 1; e >= 0; --e) | ||
1130 | if (d[e] === b) { | ||
1131 | d.splice(e, 1); | ||
1132 | break | ||
1133 | } | ||
1134 | }, WebSocket.prototype.dispatchEvent = function(a) { | ||
1135 | var b = this.__events[a.type] || []; | ||
1136 | for (var c = 0; c < b.length; ++c) b[c](a); | ||
1137 | var d = this["on" + a.type]; | ||
1138 | d && d(a) | ||
1139 | }, WebSocket.prototype.__handleEvent = function(a) { | ||
1140 | "readyState" in a && (this.readyState = a.readyState), "protocol" in a && (this.protocol = a.protocol); | ||
1141 | var b; | ||
1142 | if (a.type == "open" || a.type == "error") b = this.__createSimpleEvent(a.type); | ||
1143 | else if (a.type == "close") b = this.__createSimpleEvent("close"); | ||
1144 | else { | ||
1145 | if (a.type != "message") throw "unknown event type: " + a.type; | ||
1146 | var c = decodeURIComponent(a.message); | ||
1147 | b = this.__createMessageEvent("message", c) | ||
1148 | } | ||
1149 | this.dispatchEvent(b) | ||
1150 | }, WebSocket.prototype.__createSimpleEvent = function(a) { | ||
1151 | if (document.createEvent && window.Event) { | ||
1152 | var b = document.createEvent("Event"); | ||
1153 | return b.initEvent(a, !1, !1), b | ||
1154 | } | ||
1155 | return { | ||
1156 | type: a, | ||
1157 | bubbles: !1, | ||
1158 | cancelable: !1 | ||
1159 | } | ||
1160 | }, WebSocket.prototype.__createMessageEvent = function(a, b) { | ||
1161 | if (document.createEvent && window.MessageEvent && !window.opera) { | ||
1162 | var c = document.createEvent("MessageEvent"); | ||
1163 | return c.initMessageEvent("message", !1, !1, b, null, null, window, null), c | ||
1164 | } | ||
1165 | return { | ||
1166 | type: a, | ||
1167 | data: b, | ||
1168 | bubbles: !1, | ||
1169 | cancelable: !1 | ||
1170 | } | ||
1171 | }, WebSocket.CONNECTING = 0, WebSocket.OPEN = 1, WebSocket.CLOSING = 2, WebSocket.CLOSED = 3, WebSocket.__flash = null, WebSocket.__instances = {}, WebSocket.__tasks = [], WebSocket.__nextId = 0, WebSocket.loadFlashPolicyFile = function(a) { | ||
1172 | WebSocket.__addTask(function() { | ||
1173 | WebSocket.__flash.loadManualPolicyFile(a) | ||
1174 | }) | ||
1175 | }, WebSocket.__initialize = function() { | ||
1176 | if (WebSocket.__flash) return; | ||
1177 | WebSocket.__swfLocation && (window.WEB_SOCKET_SWF_LOCATION = WebSocket.__swfLocation); | ||
1178 | if (!window.WEB_SOCKET_SWF_LOCATION) { | ||
1179 | a.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf"); | ||
1180 | return | ||
1181 | } | ||
1182 | var b = document.createElement("div"); | ||
1183 | b.id = "webSocketContainer", b.style.position = "absolute", WebSocket.__isFlashLite() ? (b.style.left = "0px", b.style.top = "0px") : (b.style.left = "-100px", b.style.top = "-100px"); | ||
1184 | var c = document.createElement("div"); | ||
1185 | c.id = "webSocketFlash", b.appendChild(c), document.body.appendChild(b), swfobject.embedSWF(WEB_SOCKET_SWF_LOCATION, "webSocketFlash", "1", "1", "10.0.0", null, null, { | ||
1186 | hasPriority: !0, | ||
1187 | swliveconnect: !0, | ||
1188 | allowScriptAccess: "always" | ||
1189 | }, null, function(b) { | ||
1190 | b.success || a.error("[WebSocket] swfobject.embedSWF failed") | ||
1191 | }) | ||
1192 | }, WebSocket.__onFlashInitialized = function() { | ||
1193 | setTimeout(function() { | ||
1194 | WebSocket.__flash = document.getElementById("webSocketFlash"), WebSocket.__flash.setCallerUrl(location.href), WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG); | ||
1195 | for (var a = 0; a < WebSocket.__tasks.length; ++a) WebSocket.__tasks[a](); | ||
1196 | WebSocket.__tasks = [] | ||
1197 | }, 0) | ||
1198 | }, WebSocket.__onFlashEvent = function() { | ||
1199 | return setTimeout(function() { | ||
1200 | try { | ||
1201 | var b = WebSocket.__flash.receiveEvents(); | ||
1202 | for (var c = 0; c < b.length; ++c) WebSocket.__instances[b[c].webSocketId].__handleEvent(b[c]) | ||
1203 | } catch (d) { | ||
1204 | a.error(d) | ||
1205 | } | ||
1206 | }, 0), !0 | ||
1207 | }, WebSocket.__log = function(b) { | ||
1208 | a.log(decodeURIComponent(b)) | ||
1209 | }, WebSocket.__error = function(b) { | ||
1210 | a.error(decodeURIComponent(b)) | ||
1211 | }, WebSocket.__addTask = function(a) { | ||
1212 | WebSocket.__flash ? a() : WebSocket.__tasks.push(a) | ||
1213 | }, WebSocket.__isFlashLite = function() { | ||
1214 | if (!window.navigator || !window.navigator.mimeTypes) return !1; | ||
1215 | var a = window.navigator.mimeTypes["application/x-shockwave-flash"]; | ||
1216 | return !a || !a.enabledPlugin || !a.enabledPlugin.filename ? !1 : a.enabledPlugin.filename.match(/flashlite/i) ? !0 : !1 | ||
1217 | }, window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION || (window.addEventListener ? window.addEventListener("load", function() { | ||
1218 | WebSocket.__initialize() | ||
1219 | }, !1) : window.attachEvent("onload", function() { | ||
1220 | WebSocket.__initialize() | ||
1221 | })) | ||
1222 | })(), | ||
1223 | function(a, b, c) { | ||
1224 | function d(a) { | ||
1225 | if (!a) return; | ||
1226 | b.Transport.apply(this, arguments), this.sendBuffer = [] | ||
1227 | } | ||
1228 | |||
1229 | function e() {} | ||
1230 | a.XHR = d, b.util.inherit(d, b.Transport), d.prototype.open = function() { | ||
1231 | return this.socket.setBuffer(!1), this.onOpen(), this.get(), this.setCloseTimeout(), this | ||
1232 | }, d.prototype.payload = function(a) { | ||
1233 | var c = []; | ||
1234 | for (var d = 0, e = a.length; d < e; d++) c.push(b.parser.encodePacket(a[d])); | ||
1235 | this.send(b.parser.encodePayload(c)) | ||
1236 | }, d.prototype.send = function(a) { | ||
1237 | return this.post(a), this | ||
1238 | }, d.prototype.post = function(a) { | ||
1239 | function d() { | ||
1240 | this.readyState == 4 && (this.onreadystatechange = e, b.posting = !1, this.status == 200 ? b.socket.setBuffer(!1) : b.onClose()) | ||
1241 | } | ||
1242 | |||
1243 | function f() { | ||
1244 | this.onload = e, b.socket.setBuffer(!1) | ||
1245 | } | ||
1246 | var b = this; | ||
1247 | this.socket.setBuffer(!0), this.sendXHR = this.request("POST"), c.XDomainRequest && this.sendXHR instanceof XDomainRequest ? this.sendXHR.onload = this.sendXHR.onerror = f : this.sendXHR.onreadystatechange = d, this.sendXHR.send(a) | ||
1248 | }, d.prototype.close = function() { | ||
1249 | return this.onClose(), this | ||
1250 | }, d.prototype.request = function(a) { | ||
1251 | var c = b.util.request(this.socket.isXDomain()), | ||
1252 | d = b.util.query(this.socket.options.query, "t=" + +(new Date)); | ||
1253 | c.open(a || "GET", this.prepareUrl() + d, !0); | ||
1254 | if (a == "POST") try { | ||
1255 | c.setRequestHeader ? c.setRequestHeader("Content-type", "text/plain;charset=UTF-8") : c.contentType = "text/plain" | ||
1256 | } catch (e) {} | ||
1257 | return c | ||
1258 | }, d.prototype.scheme = function() { | ||
1259 | return this.socket.options.secure ? "https" : "http" | ||
1260 | }, d.check = function(a, d) { | ||
1261 | try { | ||
1262 | var e = b.util.request(d), | ||
1263 | f = c.XDomainRequest && e instanceof XDomainRequest, | ||
1264 | g = a && a.options && a.options.secure ? "https:" : "http:", | ||
1265 | h = c.location && g != c.location.protocol; | ||
1266 | if (e && (!f || !h)) return !0 | ||
1267 | } catch (i) {} | ||
1268 | return !1 | ||
1269 | }, d.xdomainCheck = function(a) { | ||
1270 | return d.check(a, !0) | ||
1271 | } | ||
1272 | }("undefined" != typeof io ? io.Transport : module.exports, "undefined" != typeof io ? io : module.parent.exports, this), | ||
1273 | function(a, b) { | ||
1274 | function c(a) { | ||
1275 | b.Transport.XHR.apply(this, arguments) | ||
1276 | } | ||
1277 | a.htmlfile = c, b.util.inherit(c, b.Transport.XHR), c.prototype.name = "htmlfile", c.prototype.get = function() { | ||
1278 | this.doc = new(window[["Active"].concat("Object").join("X")])("htmlfile"), this.doc.open(), this.doc.write("<html></html>"), this.doc.close(), this.doc.parentWindow.s = this; | ||
1279 | var a = this.doc.createElement("div"); | ||
1280 | a.className = "socketio", this.doc.body.appendChild(a), this.iframe = this.doc.createElement("iframe"), a.appendChild(this.iframe); | ||
1281 | var c = this, | ||
1282 | d = b.util.query(this.socket.options.query, "t=" + +(new Date)); | ||
1283 | this.iframe.src = this.prepareUrl() + d, b.util.on(window, "unload", function() { | ||
1284 | c.destroy() | ||
1285 | }) | ||
1286 | }, c.prototype._ = function(a, b) { | ||
1287 | a = a.replace(/\\\//g, "/"), this.onData(a); | ||
1288 | try { | ||
1289 | var c = b.getElementsByTagName("script")[0]; | ||
1290 | c.parentNode.removeChild(c) | ||
1291 | } catch (d) {} | ||
1292 | }, c.prototype.destroy = function() { | ||
1293 | if (this.iframe) { | ||
1294 | try { | ||
1295 | this.iframe.src = "about:blank" | ||
1296 | } catch (a) {} | ||
1297 | this.doc = null, this.iframe.parentNode.removeChild(this.iframe), this.iframe = null, CollectGarbage() | ||
1298 | } | ||
1299 | }, c.prototype.close = function() { | ||
1300 | return this.destroy(), b.Transport.XHR.prototype.close.call(this) | ||
1301 | }, c.check = function(a) { | ||
1302 | if (typeof window != "undefined" && ["Active"].concat("Object").join("X") in window) try { | ||
1303 | var c = new(window[["Active"].concat("Object").join("X")])("htmlfile"); | ||
1304 | return c && b.Transport.XHR.check(a) | ||
1305 | } catch (d) {} | ||
1306 | return !1 | ||
1307 | }, c.xdomainCheck = function() { | ||
1308 | return !1 | ||
1309 | }, b.transports.push("htmlfile") | ||
1310 | }("undefined" != typeof io ? io.Transport : module.exports, "undefined" != typeof io ? io : module.parent.exports), | ||
1311 | function(a, b, c) { | ||
1312 | function d() { | ||
1313 | b.Transport.XHR.apply(this, arguments) | ||
1314 | } | ||
1315 | |||
1316 | function e() {} | ||
1317 | a["xhr-polling"] = d, b.util.inherit(d, b.Transport.XHR), b.util.merge(d, b.Transport.XHR), d.prototype.name = "xhr-polling", d.prototype.heartbeats = function() { | ||
1318 | return !1 | ||
1319 | }, d.prototype.open = function() { | ||
1320 | var a = this; | ||
1321 | return b.Transport.XHR.prototype.open.call(a), !1 | ||
1322 | }, d.prototype.get = function() { | ||
1323 | function b() { | ||
1324 | this.readyState == 4 && (this.onreadystatechange = e, this.status == 200 ? (a.onData(this.responseText), a.get()) : a.onClose()) | ||
1325 | } | ||
1326 | |||
1327 | function d() { | ||
1328 | this.onload = e, this.onerror = e, a.retryCounter = 1, a.onData(this.responseText), a.get() | ||
1329 | } | ||
1330 | |||
1331 | function f() { | ||
1332 | a.retryCounter++, !a.retryCounter || a.retryCounter > 3 ? a.onClose() : a.get() | ||
1333 | } | ||
1334 | if (!this.isOpen) return; | ||
1335 | var a = this; | ||
1336 | this.xhr = this.request(), c.XDomainRequest && this.xhr instanceof XDomainRequest ? (this.xhr.onload = d, this.xhr.onerror = f) : this.xhr.onreadystatechange = b, this.xhr.send(null) | ||
1337 | }, d.prototype.onClose = function() { | ||
1338 | b.Transport.XHR.prototype.onClose.call(this); | ||
1339 | if (this.xhr) { | ||
1340 | this.xhr.onreadystatechange = this.xhr.onload = this.xhr.onerror = e; | ||
1341 | try { | ||
1342 | this.xhr.abort() | ||
1343 | } catch (a) {} | ||
1344 | this.xhr = null | ||
1345 | } | ||
1346 | }, d.prototype.ready = function(a, c) { | ||
1347 | var d = this; | ||
1348 | b.util.defer(function() { | ||
1349 | c.call(d) | ||
1350 | }) | ||
1351 | }, b.transports.push("xhr-polling") | ||
1352 | }("undefined" != typeof io ? io.Transport : module.exports, "undefined" != typeof io ? io : module.parent.exports, this), | ||
1353 | function(a, b, c) { | ||
1354 | function e(a) { | ||
1355 | b.Transport["xhr-polling"].apply(this, arguments), this.index = b.j.length; | ||
1356 | var c = this; | ||
1357 | b.j.push(function(a) { | ||
1358 | c._(a) | ||
1359 | }) | ||
1360 | } | ||
1361 | var d = c.document && "MozAppearance" in c.document.documentElement.style; | ||
1362 | a["jsonp-polling"] = e, b.util.inherit(e, b.Transport["xhr-polling"]), e.prototype.name = "jsonp-polling", e.prototype.post = function(a) { | ||
1363 | function i() { | ||
1364 | j(), c.socket.setBuffer(!1) | ||
1365 | } | ||
1366 | |||
1367 | function j() { | ||
1368 | c.iframe && c.form.removeChild(c.iframe); | ||
1369 | try { | ||
1370 | h = document.createElement('<iframe name="' + c.iframeId + '">') | ||
1371 | } catch (a) { | ||
1372 | h = document.createElement("iframe"), h.name = c.iframeId | ||
1373 | } | ||
1374 | h.id = c.iframeId, c.form.appendChild(h), c.iframe = h | ||
1375 | } | ||
1376 | var c = this, | ||
1377 | d = b.util.query(this.socket.options.query, "t=" + +(new Date) + "&i=" + this.index); | ||
1378 | if (!this.form) { | ||
1379 | var e = document.createElement("form"), | ||
1380 | f = document.createElement("textarea"), | ||
1381 | g = this.iframeId = "socketio_iframe_" + this.index, | ||
1382 | h; | ||
1383 | e.className = "socketio", e.style.position = "absolute", e.style.top = "0px", e.style.left = "0px", e.style.display = "none", e.target = g, e.method = "POST", e.setAttribute("accept-charset", "utf-8"), f.name = "d", e.appendChild(f), document.body.appendChild(e), this.form = e, this.area = f | ||
1384 | } | ||
1385 | this.form.action = this.prepareUrl() + d, j(), this.area.value = b.JSON.stringify(a); | ||
1386 | try { | ||
1387 | this.form.submit() | ||
1388 | } catch (k) {} | ||
1389 | this.iframe.attachEvent ? h.onreadystatechange = function() { | ||
1390 | c.iframe.readyState == "complete" && i() | ||
1391 | } : this.iframe.onload = i, this.socket.setBuffer(!0) | ||
1392 | }, e.prototype.get = function() { | ||
1393 | var a = this, | ||
1394 | c = document.createElement("script"), | ||
1395 | e = b.util.query(this.socket.options.query, "t=" + +(new Date) + "&i=" + this.index); | ||
1396 | this.script && (this.script.parentNode.removeChild(this.script), this.script = null), c.async = !0, c.src = this.prepareUrl() + e, c.onerror = function() { | ||
1397 | a.onClose() | ||
1398 | }; | ||
1399 | var f = document.getElementsByTagName("script")[0]; | ||
1400 | f.parentNode.insertBefore(c, f), this.script = c, d && setTimeout(function() { | ||
1401 | var a = document.createElement("iframe"); | ||
1402 | document.body.appendChild(a), document.body.removeChild(a) | ||
1403 | }, 100) | ||
1404 | }, e.prototype._ = function(a) { | ||
1405 | return this.onData(a), this.isOpen && this.get(), this | ||
1406 | }, e.prototype.ready = function(a, c) { | ||
1407 | var e = this; | ||
1408 | if (!d) return c.call(this); | ||
1409 | b.util.load(function() { | ||
1410 | c.call(e) | ||
1411 | }) | ||
1412 | }, e.check = function() { | ||
1413 | return "document" in c | ||
1414 | }, e.xdomainCheck = function() { | ||
1415 | return !0 | ||
1416 | }, b.transports.push("jsonp-polling") | ||
1417 | }("undefined" != typeof io ? io.Transport : module.exports, "undefined" != typeof io ? io : module.parent.exports, this), typeof define == "function" && define.amd && define([], function() { | ||
1418 | return io | ||
1419 | }) | ||
1420 | })() | ||
1421 | </script> | ||
7 | <style> | 1422 | <style> |
8 | * { | 1423 | * { |
9 | font-family: Helvetica Neue, Helvetica, Arial, sans-serif; | 1424 | font-family: Helvetica Neue, Helvetica, Arial, sans-serif; |
... | @@ -72,8 +1487,9 @@ | ... | @@ -72,8 +1487,9 @@ |
72 | } | 1487 | } |
73 | </style> | 1488 | </style> |
74 | </head> | 1489 | </head> |
1490 | |||
75 | <body> | 1491 | <body> |
76 | <div style="width: 600px; margin: auto"> | 1492 | <div style="width: 600px; margin: auto"> |
77 | <div class="header"> | 1493 | <div class="header"> |
78 | <b>{{title}}</b> | 1494 | <b>{{title}}</b> |
79 | <div id="span-controls" class="span-controls"> | 1495 | <div id="span-controls" class="span-controls"> |
... | @@ -127,8 +1543,8 @@ | ... | @@ -127,8 +1543,8 @@ |
127 | <div class="footer"> | 1543 | <div class="footer"> |
128 | <p>Made with ♥ with Socket.io & Chart.js</p> | 1544 | <p>Made with ♥ with Socket.io & Chart.js</p> |
129 | </div> | 1545 | </div> |
130 | </div> | 1546 | </div> |
131 | <script> | 1547 | <script> |
132 | Chart.defaults.global.defaultFontSize = 8; | 1548 | Chart.defaults.global.defaultFontSize = 8; |
133 | Chart.defaults.global.animation.duration = 500; | 1549 | Chart.defaults.global.animation.duration = 500; |
134 | Chart.defaults.global.legend.display = false; | 1550 | Chart.defaults.global.legend.display = false; |
... | @@ -136,7 +1552,7 @@ | ... | @@ -136,7 +1552,7 @@ |
136 | Chart.defaults.global.elements.line.borderColor = "rgba(0,0,0,0.9)"; | 1552 | Chart.defaults.global.elements.line.borderColor = "rgba(0,0,0,0.9)"; |
137 | Chart.defaults.global.elements.line.borderWidth = 2; | 1553 | Chart.defaults.global.elements.line.borderWidth = 2; |
138 | 1554 | ||
139 | var socket = io(location.protocol + '//' + location.hostname + ':' + location.port); | 1555 | var socket = io.connect(location.protocol + '//' + location.hostname + ':' + location.port); |
140 | var defaultSpan = 0; | 1556 | var defaultSpan = 0; |
141 | var spans = []; | 1557 | var spans = []; |
142 | 1558 | ||
... | @@ -172,7 +1588,7 @@ | ... | @@ -172,7 +1588,7 @@ |
172 | animation: false | 1588 | animation: false |
173 | }; | 1589 | }; |
174 | 1590 | ||
175 | var createChart = function (ctx, dataset) { | 1591 | var createChart = function(ctx, dataset) { |
176 | return new Chart(ctx, { | 1592 | return new Chart(ctx, { |
177 | type: 'line', | 1593 | type: 'line', |
178 | data: { | 1594 | data: { |
... | @@ -213,7 +1629,7 @@ | ... | @@ -213,7 +1629,7 @@ |
213 | 1629 | ||
214 | var charts = [cpuChart, memChart, loadChart, responseTimeChart, rpsChart]; | 1630 | var charts = [cpuChart, memChart, loadChart, responseTimeChart, rpsChart]; |
215 | 1631 | ||
216 | var onSpanChange = function (e) { | 1632 | var onSpanChange = function(e) { |
217 | e.target.classList.add('active'); | 1633 | e.target.classList.add('active'); |
218 | defaultSpan = parseInt(e.target.id); | 1634 | defaultSpan = parseInt(e.target.id); |
219 | 1635 | ||
... | @@ -225,32 +1641,32 @@ | ... | @@ -225,32 +1641,32 @@ |
225 | socket.emit('change'); | 1641 | socket.emit('change'); |
226 | }; | 1642 | }; |
227 | 1643 | ||
228 | socket.on('start', function (data) { | 1644 | socket.on('start', function(data) { |
229 | // Remove last element of Array because it contains malformed responses data. | 1645 | // Remove last element of Array because it contains malformed responses data. |
230 | // To keep consistency we also remove os data. | 1646 | // To keep consistency we also remove os data. |
231 | data[defaultSpan].responses.pop(); | 1647 | data[defaultSpan].responses.pop(); |
232 | data[defaultSpan].os.pop(); | 1648 | data[defaultSpan].os.pop(); |
233 | 1649 | ||
234 | cpuStat.textContent = data[defaultSpan].os[data[defaultSpan].os.length - 1].cpu.toFixed(1) + '%'; | 1650 | cpuStat.textContent = data[defaultSpan].os[data[defaultSpan].os.length - 1].cpu.toFixed(1) + '%'; |
235 | cpuChart.data.datasets[0].data = data[defaultSpan].os.map(function (point) { | 1651 | cpuChart.data.datasets[0].data = data[defaultSpan].os.map(function(point) { |
236 | return point.cpu; | 1652 | return point.cpu || 0; |
237 | }); | 1653 | }); |
238 | cpuChart.data.labels = data[defaultSpan].os.map(addTimestamp); | 1654 | cpuChart.data.labels = data[defaultSpan].os.map(addTimestamp); |
239 | 1655 | ||
240 | memStat.textContent = data[defaultSpan].os[data[defaultSpan].os.length - 1].memory.toFixed(1) + 'MB'; | 1656 | memStat.textContent = data[defaultSpan].os[data[defaultSpan].os.length - 1].memory.toFixed(1) + 'MB'; |
241 | memChart.data.datasets[0].data = data[defaultSpan].os.map(function (point) { | 1657 | memChart.data.datasets[0].data = data[defaultSpan].os.map(function(point) { |
242 | return point.memory; | 1658 | return point.memory; |
243 | }); | 1659 | }); |
244 | memChart.data.labels = data[defaultSpan].os.map(addTimestamp); | 1660 | memChart.data.labels = data[defaultSpan].os.map(addTimestamp); |
245 | 1661 | ||
246 | loadStat.textContent = data[defaultSpan].os[data[defaultSpan].os.length - 1].load[defaultSpan].toFixed(2); | 1662 | loadStat.textContent = data[defaultSpan].os[data[defaultSpan].os.length - 1].load[defaultSpan].toFixed(2); |
247 | loadChart.data.datasets[0].data = data[defaultSpan].os.map(function (point) { | 1663 | loadChart.data.datasets[0].data = data[defaultSpan].os.map(function(point) { |
248 | return point.load[0]; | 1664 | return point.load[0]; |
249 | }); | 1665 | }); |
250 | loadChart.data.labels = data[defaultSpan].os.map(addTimestamp); | 1666 | loadChart.data.labels = data[defaultSpan].os.map(addTimestamp); |
251 | 1667 | ||
252 | responseTimeStat.textContent = data[defaultSpan].responses[data[defaultSpan].responses.length - 1].mean.toFixed(2) + 'ms'; | 1668 | responseTimeStat.textContent = data[defaultSpan].responses[data[defaultSpan].responses.length - 1].mean.toFixed(2) + 'ms'; |
253 | responseTimeChart.data.datasets[0].data = data[defaultSpan].responses.map(function (point) { | 1669 | responseTimeChart.data.datasets[0].data = data[defaultSpan].responses.map(function(point) { |
254 | return point.mean; | 1670 | return point.mean; |
255 | }); | 1671 | }); |
256 | responseTimeChart.data.labels = data[defaultSpan].responses.map(addTimestamp); | 1672 | responseTimeChart.data.labels = data[defaultSpan].responses.map(addTimestamp); |
... | @@ -258,7 +1674,7 @@ | ... | @@ -258,7 +1674,7 @@ |
258 | if (data[defaultSpan].responses.length >= 2) { | 1674 | if (data[defaultSpan].responses.length >= 2) { |
259 | var deltaTime = data[defaultSpan].responses[data[defaultSpan].responses.length - 1].timestamp - data[defaultSpan].responses[data[defaultSpan].responses.length - 2].timestamp; | 1675 | var deltaTime = data[defaultSpan].responses[data[defaultSpan].responses.length - 1].timestamp - data[defaultSpan].responses[data[defaultSpan].responses.length - 2].timestamp; |
260 | rpsStat.textContent = (data[defaultSpan].responses[data[defaultSpan].responses.length - 1].count / deltaTime * 1000).toFixed(2); | 1676 | rpsStat.textContent = (data[defaultSpan].responses[data[defaultSpan].responses.length - 1].count / deltaTime * 1000).toFixed(2); |
261 | rpsChart.data.datasets[0].data = data[defaultSpan].responses.map(function (point) { | 1677 | rpsChart.data.datasets[0].data = data[defaultSpan].responses.map(function(point) { |
262 | return point.count / deltaTime * 1000; | 1678 | return point.count / deltaTime * 1000; |
263 | }); | 1679 | }); |
264 | rpsChart.data.labels = data[defaultSpan].responses.map(addTimestamp); | 1680 | rpsChart.data.labels = data[defaultSpan].responses.map(addTimestamp); |
... | @@ -270,7 +1686,7 @@ | ... | @@ -270,7 +1686,7 @@ |
270 | 1686 | ||
271 | var spanControls = document.getElementById('span-controls'); | 1687 | var spanControls = document.getElementById('span-controls'); |
272 | if (data.length !== spans.length) { | 1688 | if (data.length !== spans.length) { |
273 | data.forEach(function (span, index) { | 1689 | data.forEach(function(span, index) { |
274 | spans.push({ | 1690 | spans.push({ |
275 | retention: span.retention, | 1691 | retention: span.retention, |
276 | interval: span.interval | 1692 | interval: span.interval |
... | @@ -287,9 +1703,9 @@ | ... | @@ -287,9 +1703,9 @@ |
287 | } | 1703 | } |
288 | }); | 1704 | }); |
289 | 1705 | ||
290 | socket.on('stats', function (data) { | 1706 | socket.on('stats', function(data) { |
291 | if (data.retention === spans[defaultSpan].retention && data.interval === spans[defaultSpan].interval) { | 1707 | if (data.retention === spans[defaultSpan].retention && data.interval === spans[defaultSpan].interval) { |
292 | cpuStat.textContent = data.os.cpu.toFixed(1) + '%'; | 1708 | cpuStat.textContent = (data.os.cpu || 0).toFixed(1) + '%'; |
293 | cpuChart.data.datasets[0].data.push(data.os.cpu); | 1709 | cpuChart.data.datasets[0].data.push(data.os.cpu); |
294 | cpuChart.data.labels.push(data.os.timestamp); | 1710 | cpuChart.data.labels.push(data.os.timestamp); |
295 | 1711 | ||
... | @@ -310,7 +1726,7 @@ | ... | @@ -310,7 +1726,7 @@ |
310 | rpsChart.data.datasets[0].data.push(data.responses.count / deltaTime * 1000); | 1726 | rpsChart.data.datasets[0].data.push(data.responses.count / deltaTime * 1000); |
311 | rpsChart.data.labels.push(data.responses.timestamp); | 1727 | rpsChart.data.labels.push(data.responses.timestamp); |
312 | 1728 | ||
313 | charts.forEach(function (chart) { | 1729 | charts.forEach(function(chart) { |
314 | if (spans[defaultSpan].retention < chart.data.labels.length) { | 1730 | if (spans[defaultSpan].retention < chart.data.labels.length) { |
315 | chart.data.datasets[0].data.shift(); | 1731 | chart.data.datasets[0].data.shift(); |
316 | chart.data.labels.shift(); | 1732 | chart.data.labels.shift(); |
... | @@ -320,6 +1736,7 @@ | ... | @@ -320,6 +1736,7 @@ |
320 | }); | 1736 | }); |
321 | } | 1737 | } |
322 | }); | 1738 | }); |
323 | </script> | 1739 | </script> |
324 | </body> | 1740 | </body> |
1741 | |||
325 | </html> | 1742 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | (function () { | 1 | (function() { |
2 | 'use strict'; | 2 | 'use strict'; |
3 | 3 | ||
4 | const fs = require('fs'); | 4 | const fs = require('fs'); |
... | @@ -9,6 +9,8 @@ | ... | @@ -9,6 +9,8 @@ |
9 | let io; | 9 | let io; |
10 | 10 | ||
11 | const defaultConfig = { | 11 | const defaultConfig = { |
12 | uri: 'www.cert.coder.fi', | ||
13 | port: 4000, | ||
12 | title: 'Express Status', | 14 | title: 'Express Status', |
13 | path: '/status', | 15 | path: '/status', |
14 | spans: [{ | 16 | spans: [{ |
... | @@ -60,7 +62,7 @@ | ... | @@ -60,7 +62,7 @@ |
60 | }); | 62 | }); |
61 | }; | 63 | }; |
62 | 64 | ||
63 | const middlewareWrapper = (config) => { | 65 | const middlewareWrapper = (config, server) => { |
64 | if (config === null || config === undefined) { | 66 | if (config === null || config === undefined) { |
65 | config = defaultConfig; | 67 | config = defaultConfig; |
66 | } | 68 | } |
... | @@ -78,18 +80,20 @@ | ... | @@ -78,18 +80,20 @@ |
78 | } | 80 | } |
79 | 81 | ||
80 | let renderedHtml; | 82 | let renderedHtml; |
81 | fs.readFile(path.join(__dirname, '/index.html'), function(err, html){ | 83 | fs.readFile(path.join(__dirname, '/index.html'), function(err, html) { |
82 | renderedHtml = html.toString().replace(/{{title}}/g, config.title); | 84 | renderedHtml = html.toString().replace(/{{title}}/g, config.title); |
83 | }); | 85 | }); |
84 | 86 | ||
85 | return (req, res, next) => { | 87 | return (req, res, next) => { |
86 | if (io === null || io === undefined) { | 88 | if (io === null || io === undefined) { |
87 | 89 | //console.log(req) | |
88 | io = require('socket.io')(req.socket.server); | 90 | io = require('socket.io').listen(server); |
89 | 91 | ||
90 | io.on('connection', (socket) => { | 92 | io.on('connection', (socket) => { |
91 | socket.emit('start', config.spans); | 93 | socket.emit('start', config.spans); |
92 | socket.on('change', function() { socket.emit('start', config.spans); }); | 94 | socket.on('change', function() { |
95 | socket.emit('start', config.spans); | ||
96 | }); | ||
93 | }); | 97 | }); |
94 | 98 | ||
95 | config.spans.forEach((span) => { | 99 | config.spans.forEach((span) => { | ... | ... |
1 | { | 1 | { |
2 | "name": "express-status-monitor", | 2 | "name": "express-status-monitor", |
3 | "version": "0.0.10", | 3 | "version": "0.0.10-dev", |
4 | "description": "Realtime Monitoring for Express-based Node applications", | 4 | "description": "Realtime Monitoring for Express-based Node applications", |
5 | "main": "app.js", | 5 | "main": "app.js", |
6 | "keywords": [ | 6 | "keywords": [ |
... | @@ -16,7 +16,13 @@ | ... | @@ -16,7 +16,13 @@ |
16 | "name": "Julien Breux", | 16 | "name": "Julien Breux", |
17 | "email": "julien.breux@gmail.com", | 17 | "email": "julien.breux@gmail.com", |
18 | "url": "https://github.com/JulienBreux/" | 18 | "url": "https://github.com/JulienBreux/" |
19 | }, | ||
20 | { | ||
21 | "name": "Jabis Sevon", | ||
22 | "email": "jabis.is@gmail.com", | ||
23 | "url": "https://jscodex.com" | ||
19 | } | 24 | } |
25 | |||
20 | ], | 26 | ], |
21 | "repository": { | 27 | "repository": { |
22 | "type": "git", | 28 | "type": "git", |
... | @@ -26,6 +32,6 @@ | ... | @@ -26,6 +32,6 @@ |
26 | "dependencies": { | 32 | "dependencies": { |
27 | "on-headers": "^1.0.1", | 33 | "on-headers": "^1.0.1", |
28 | "pidusage": "^1.0.4", | 34 | "pidusage": "^1.0.4", |
29 | "socket.io": "^1.4.8" | 35 | "socket.io": "^0.9.17" |
30 | } | 36 | } |
31 | } | 37 | } | ... | ... |
socket.io.min.js
0 → 100644
1 | /*! Socket.IO.min.js build:0.9.16, production. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */ | ||
2 | var io="undefined"==typeof module?{}:module.exports;(function(){(function(a,b){var c=a;c.version="0.9.16",c.protocol=1,c.transports=[],c.j=[],c.sockets={},c.connect=function(a,d){var e=c.util.parseUri(a),f,g;b&&b.location&&(e.protocol=e.protocol||b.location.protocol.slice(0,-1),e.host=e.host||(b.document?b.document.domain:b.location.hostname),e.port=e.port||b.location.port),f=c.util.uniqueUri(e);var h={host:e.host,secure:"https"==e.protocol,port:e.port||("https"==e.protocol?443:80),query:e.query||""};c.util.merge(h,d);if(h["force new connection"]||!c.sockets[f])g=new c.Socket(h);return!h["force new connection"]&&g&&(c.sockets[f]=g),g=g||c.sockets[f],g.of(e.path.length>1?e.path:"")}})("object"==typeof module?module.exports:this.io={},this),function(a,b){var c=a.util={},d=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];c.parseUri=function(a){var b=d.exec(a||""),c={},f=14;while(f--)c[e[f]]=b[f]||"";return c},c.uniqueUri=function(a){var c=a.protocol,d=a.host,e=a.port;return"document"in b?(d=d||document.domain,e=e||(c=="https"&&document.location.protocol!=="https:"?443:document.location.port)):(d=d||"localhost",!e&&c=="https"&&(e=443)),(c||"http")+"://"+d+":"+(e||80)},c.query=function(a,b){var d=c.chunkQuery(a||""),e=[];c.merge(d,c.chunkQuery(b||""));for(var f in d)d.hasOwnProperty(f)&&e.push(f+"="+d[f]);return e.length?"?"+e.join("&"):""},c.chunkQuery=function(a){var b={},c=a.split("&"),d=0,e=c.length,f;for(;d<e;++d)f=c[d].split("="),f[0]&&(b[f[0]]=f[1]);return b};var f=!1;c.load=function(a){if("document"in b&&document.readyState==="complete"||f)return a();c.on(b,"load",a,!1)},c.on=function(a,b,c,d){a.attachEvent?a.attachEvent("on"+b,c):a.addEventListener&&a.addEventListener(b,c,d)},c.request=function(a){if(a&&"undefined"!=typeof XDomainRequest&&!c.ua.hasCORS)return new XDomainRequest;if("undefined"!=typeof XMLHttpRequest&&(!a||c.ua.hasCORS))return new XMLHttpRequest;if(!a)try{return new(window[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(b){}return null},"undefined"!=typeof window&&c.load(function(){f=!0}),c.defer=function(a){if(!c.ua.webkit||"undefined"!=typeof importScripts)return a();c.load(function(){setTimeout(a,100)})},c.merge=function(b,d,e,f){var g=f||[],h=typeof e=="undefined"?2:e,i;for(i in d)d.hasOwnProperty(i)&&c.indexOf(g,i)<0&&(typeof b[i]!="object"||!h?(b[i]=d[i],g.push(d[i])):c.merge(b[i],d[i],h-1,g));return b},c.mixin=function(a,b){c.merge(a.prototype,b.prototype)},c.inherit=function(a,b){function c(){}c.prototype=b.prototype,a.prototype=new c},c.isArray=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},c.intersect=function(a,b){var d=[],e=a.length>b.length?a:b,f=a.length>b.length?b:a;for(var g=0,h=f.length;g<h;g++)~c.indexOf(e,f[g])&&d.push(f[g]);return d},c.indexOf=function(a,b,c){for(var d=a.length,c=c<0?c+d<0?0:c+d:c||0;c<d&&a[c]!==b;c++);return d<=c?-1:c},c.toArray=function(a){var b=[];for(var c=0,d=a.length;c<d;c++)b.push(a[c]);return b},c.ua={},c.ua.hasCORS="undefined"!=typeof XMLHttpRequest&&function(){try{var a=new XMLHttpRequest}catch(b){return!1}return a.withCredentials!=undefined}(),c.ua.webkit="undefined"!=typeof navigator&&/webkit/i.test(navigator.userAgent),c.ua.iDevice="undefined"!=typeof navigator&&/iPad|iPhone|iPod/i.test(navigator.userAgent)}("undefined"!=typeof io?io:module.exports,this),function(a,b){function c(){}a.EventEmitter=c,c.prototype.on=function(a,c){return this.$events||(this.$events={}),this.$events[a]?b.util.isArray(this.$events[a])?this.$events[a].push(c):this.$events[a]=[this.$events[a],c]:this.$events[a]=c,this},c.prototype.addListener=c.prototype.on,c.prototype.once=function(a,b){function d(){c.removeListener(a,d),b.apply(this,arguments)}var c=this;return d.listener=b,this.on(a,d),this},c.prototype.removeListener=function(a,c){if(this.$events&&this.$events[a]){var d=this.$events[a];if(b.util.isArray(d)){var e=-1;for(var f=0,g=d.length;f<g;f++)if(d[f]===c||d[f].listener&&d[f].listener===c){e=f;break}if(e<0)return this;d.splice(e,1),d.length||delete this.$events[a]}else(d===c||d.listener&&d.listener===c)&&delete this.$events[a]}return this},c.prototype.removeAllListeners=function(a){return a===undefined?(this.$events={},this):(this.$events&&this.$events[a]&&(this.$events[a]=null),this)},c.prototype.listeners=function(a){return this.$events||(this.$events={}),this.$events[a]||(this.$events[a]=[]),b.util.isArray(this.$events[a])||(this.$events[a]=[this.$events[a]]),this.$events[a]},c.prototype.emit=function(a){if(!this.$events)return!1;var c=this.$events[a];if(!c)return!1;var d=Array.prototype.slice.call(arguments,1);if("function"==typeof c)c.apply(this,d);else{if(!b.util.isArray(c))return!1;var e=c.slice();for(var f=0,g=e.length;f<g;f++)e[f].apply(this,d)}return!0}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(exports,nativeJSON){function f(a){return a<10?"0"+a:a}function date(a,b){return isFinite(a.valueOf())?a.getUTCFullYear()+"-"+f(a.getUTCMonth()+1)+"-"+f(a.getUTCDate())+"T"+f(a.getUTCHours())+":"+f(a.getUTCMinutes())+":"+f(a.getUTCSeconds())+"Z":null}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return typeof b=="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g=gap,h,i=b[a];i instanceof Date&&(i=date(a)),typeof rep=="function"&&(i=rep.call(b,a,i));switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";gap+=indent,h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c<f;c+=1)h[c]=str(c,i)||"null";return e=h.length===0?"[]":gap?"[\n"+gap+h.join(",\n"+gap)+"\n"+g+"]":"["+h.join(",")+"]",gap=g,e}if(rep&&typeof rep=="object"){f=rep.length;for(c=0;c<f;c+=1)typeof rep[c]=="string"&&(d=rep[c],e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e))}else for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e));return e=h.length===0?"{}":gap?"{\n"+gap+h.join(",\n"+gap)+"\n"+g+"}":"{"+h.join(",")+"}",gap=g,e}}"use strict";if(nativeJSON&&nativeJSON.parse)return exports.JSON={parse:nativeJSON.parse,stringify:nativeJSON.stringify};var JSON=exports.JSON={},cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;JSON.stringify=function(a,b,c){var d;gap="",indent="";if(typeof c=="number")for(d=0;d<c;d+=1)indent+=" ";else typeof c=="string"&&(indent=c);rep=b;if(!b||typeof b=="function"||typeof b=="object"&&typeof b.length=="number")return str("",{"":a});throw new Error("JSON.stringify")},JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&typeof e=="object")for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),d!==undefined?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")}}("undefined"!=typeof io?io:module.exports,typeof JSON!="undefined"?JSON:undefined),function(a,b){var c=a.parser={},d=c.packets=["disconnect","connect","heartbeat","message","json","event","ack","error","noop"],e=c.reasons=["transport not supported","client not handshaken","unauthorized"],f=c.advice=["reconnect"],g=b.JSON,h=b.util.indexOf;c.encodePacket=function(a){var b=h(d,a.type),c=a.id||"",i=a.endpoint||"",j=a.ack,k=null;switch(a.type){case"error":var l=a.reason?h(e,a.reason):"",m=a.advice?h(f,a.advice):"";if(l!==""||m!=="")k=l+(m!==""?"+"+m:"");break;case"message":a.data!==""&&(k=a.data);break;case"event":var n={name:a.name};a.args&&a.args.length&&(n.args=a.args),k=g.stringify(n);break;case"json":k=g.stringify(a.data);break;case"connect":a.qs&&(k=a.qs);break;case"ack":k=a.ackId+(a.args&&a.args.length?"+"+g.stringify(a.args):"")}var o=[b,c+(j=="data"?"+":""),i];return k!==null&&k!==undefined&&o.push(k),o.join(":")},c.encodePayload=function(a){var b="";if(a.length==1)return a[0];for(var c=0,d=a.length;c<d;c++){var e=a[c];b+="\ufffd"+e.length+"\ufffd"+a[c]}return b};var i=/([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/;c.decodePacket=function(a){var b=a.match(i);if(!b)return{};var c=b[2]||"",a=b[5]||"",h={type:d[b[1]],endpoint:b[4]||""};c&&(h.id=c,b[3]?h.ack="data":h.ack=!0);switch(h.type){case"error":var b=a.split("+");h.reason=e[b[0]]||"",h.advice=f[b[1]]||"";break;case"message":h.data=a||"";break;case"event":try{var j=g.parse(a);h.name=j.name,h.args=j.args}catch(k){}h.args=h.args||[];break;case"json":try{h.data=g.parse(a)}catch(k){}break;case"connect":h.qs=a||"";break;case"ack":var b=a.match(/^([0-9]+)(\+)?(.*)/);if(b){h.ackId=b[1],h.args=[];if(b[3])try{h.args=b[3]?g.parse(b[3]):[]}catch(k){}}break;case"disconnect":case"heartbeat":}return h},c.decodePayload=function(a){if(a.charAt(0)=="\ufffd"){var b=[];for(var d=1,e="";d<a.length;d++)a.charAt(d)=="\ufffd"?(b.push(c.decodePacket(a.substr(d+1).substr(0,e))),d+=Number(e)+1,e=""):e+=a.charAt(d);return b}return[c.decodePacket(a)]}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(a,b){function c(a,b){this.socket=a,this.sessid=b}a.Transport=c,b.util.mixin(c,b.EventEmitter),c.prototype.heartbeats=function(){return!0},c.prototype.onData=function(a){this.clearCloseTimeout(),(this.socket.connected||this.socket.connecting||this.socket.reconnecting)&&this.setCloseTimeout();if(a!==""){var c=b.parser.decodePayload(a);if(c&&c.length)for(var d=0,e=c.length;d<e;d++)this.onPacket(c[d])}return this},c.prototype.onPacket=function(a){return this.socket.setHeartbeatTimeout(),a.type=="heartbeat"?this.onHeartbeat():(a.type=="connect"&&a.endpoint==""&&this.onConnect(),a.type=="error"&&a.advice=="reconnect"&&(this.isOpen=!1),this.socket.onPacket(a),this)},c.prototype.setCloseTimeout=function(){if(!this.closeTimeout){var a=this;this.closeTimeout=setTimeout(function(){a.onDisconnect()},this.socket.closeTimeout)}},c.prototype.onDisconnect=function(){return this.isOpen&&this.close(),this.clearTimeouts(),this.socket.onDisconnect(),this},c.prototype.onConnect=function(){return this.socket.onConnect(),this},c.prototype.clearCloseTimeout=function(){this.closeTimeout&&(clearTimeout(this.closeTimeout),this.closeTimeout=null)},c.prototype.clearTimeouts=function(){this.clearCloseTimeout(),this.reopenTimeout&&clearTimeout(this.reopenTimeout)},c.prototype.packet=function(a){this.send(b.parser.encodePacket(a))},c.prototype.onHeartbeat=function(a){this.packet({type:"heartbeat"})},c.prototype.onOpen=function(){this.isOpen=!0,this.clearCloseTimeout(),this.socket.onOpen()},c.prototype.onClose=function(){var a=this;this.isOpen=!1,this.socket.onClose(),this.onDisconnect()},c.prototype.prepareUrl=function(){var a=this.socket.options;return this.scheme()+"://"+a.host+":"+a.port+"/"+a.resource+"/"+b.protocol+"/"+this.name+"/"+this.sessid},c.prototype.ready=function(a,b){b.call(this)}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(a,b,c){function d(a){this.options={port:80,secure:!1,document:"document"in c?document:!1,resource:"socket.io",transports:b.transports,"connect timeout":1e4,"try multiple transports":!0,reconnect:!0,"reconnection delay":500,"reconnection limit":Infinity,"reopen delay":3e3,"max reconnection attempts":10,"sync disconnect on unload":!1,"auto connect":!0,"flash policy port":10843,manualFlush:!1},b.util.merge(this.options,a),this.connected=!1,this.open=!1,this.connecting=!1,this.reconnecting=!1,this.namespaces={},this.buffer=[],this.doBuffer=!1;if(this.options["sync disconnect on unload"]&&(!this.isXDomain()||b.util.ua.hasCORS)){var d=this;b.util.on(c,"beforeunload",function(){d.disconnectSync()},!1)}this.options["auto connect"]&&this.connect()}function e(){}a.Socket=d,b.util.mixin(d,b.EventEmitter),d.prototype.of=function(a){return this.namespaces[a]||(this.namespaces[a]=new b.SocketNamespace(this,a),a!==""&&this.namespaces[a].packet({type:"connect"})),this.namespaces[a]},d.prototype.publish=function(){this.emit.apply(this,arguments);var a;for(var b in this.namespaces)this.namespaces.hasOwnProperty(b)&&(a=this.of(b),a.$emit.apply(a,arguments))},d.prototype.handshake=function(a){function f(b){b instanceof Error?(c.connecting=!1,c.onError(b.message)):a.apply(null,b.split(":"))}var c=this,d=this.options,g=["http"+(d.secure?"s":"")+":/",d.host+":"+d.port,d.resource,b.protocol,b.util.query(this.options.query,"t="+ +(new Date))].join("/");if(this.isXDomain()&&!b.util.ua.hasCORS){var h=document.getElementsByTagName("script")[0],i=document.createElement("script");i.src=g+"&jsonp="+b.j.length,h.parentNode.insertBefore(i,h),b.j.push(function(a){f(a),i.parentNode.removeChild(i)})}else{var j=b.util.request();j.open("GET",g,!0),this.isXDomain()&&(j.withCredentials=!0),j.onreadystatechange=function(){j.readyState==4&&(j.onreadystatechange=e,j.status==200?f(j.responseText):j.status==403?c.onError(j.responseText):(c.connecting=!1,!c.reconnecting&&c.onError(j.responseText)))},j.send(null)}},d.prototype.getTransport=function(a){var c=a||this.transports,d;for(var e=0,f;f=c[e];e++)if(b.Transport[f]&&b.Transport[f].check(this)&&(!this.isXDomain()||b.Transport[f].xdomainCheck(this)))return new b.Transport[f](this,this.sessionid);return null},d.prototype.connect=function(a){if(this.connecting)return this;var c=this;return c.connecting=!0,this.handshake(function(d,e,f,g){function h(a){c.transport&&c.transport.clearTimeouts(),c.transport=c.getTransport(a);if(!c.transport)return c.publish("connect_failed");c.transport.ready(c,function(){c.connecting=!0,c.publish("connecting",c.transport.name),c.transport.open(),c.options["connect timeout"]&&(c.connectTimeoutTimer=setTimeout(function(){if(!c.connected){c.connecting=!1;if(c.options["try multiple transports"]){var a=c.transports;while(a.length>0&&a.splice(0,1)[0]!=c.transport.name);a.length?h(a):c.publish("connect_failed")}}},c.options["connect timeout"]))})}c.sessionid=d,c.closeTimeout=f*1e3,c.heartbeatTimeout=e*1e3,c.transports||(c.transports=c.origTransports=g?b.util.intersect(g.split(","),c.options.transports):c.options.transports),c.setHeartbeatTimeout(),h(c.transports),c.once("connect",function(){clearTimeout(c.connectTimeoutTimer),a&&typeof a=="function"&&a()})}),this},d.prototype.setHeartbeatTimeout=function(){clearTimeout(this.heartbeatTimeoutTimer);if(this.transport&&!this.transport.heartbeats())return;var a=this;this.heartbeatTimeoutTimer=setTimeout(function(){a.transport.onClose()},this.heartbeatTimeout)},d.prototype.packet=function(a){return this.connected&&!this.doBuffer?this.transport.packet(a):this.buffer.push(a),this},d.prototype.setBuffer=function(a){this.doBuffer=a,!a&&this.connected&&this.buffer.length&&(this.options.manualFlush||this.flushBuffer())},d.prototype.flushBuffer=function(){this.transport.payload(this.buffer),this.buffer=[]},d.prototype.disconnect=function(){if(this.connected||this.connecting)this.open&&this.of("").packet({type:"disconnect"}),this.onDisconnect("booted");return this},d.prototype.disconnectSync=function(){var a=b.util.request(),c=["http"+(this.options.secure?"s":"")+":/",this.options.host+":"+this.options.port,this.options.resource,b.protocol,"",this.sessionid].join("/")+"/?disconnect=1";a.open("GET",c,!1),a.send(null),this.onDisconnect("booted")},d.prototype.isXDomain=function(){var a=c.location.port||("https:"==c.location.protocol?443:80);return this.options.host!==c.location.hostname||this.options.port!=a},d.prototype.onConnect=function(){this.connected||(this.connected=!0,this.connecting=!1,this.doBuffer||this.setBuffer(!1),this.emit("connect"))},d.prototype.onOpen=function(){this.open=!0},d.prototype.onClose=function(){this.open=!1,clearTimeout(this.heartbeatTimeoutTimer)},d.prototype.onPacket=function(a){this.of(a.endpoint).onPacket(a)},d.prototype.onError=function(a){a&&a.advice&&a.advice==="reconnect"&&(this.connected||this.connecting)&&(this.disconnect(),this.options.reconnect&&this.reconnect()),this.publish("error",a&&a.reason?a.reason:a)},d.prototype.onDisconnect=function(a){var b=this.connected,c=this.connecting;this.connected=!1,this.connecting=!1,this.open=!1;if(b||c)this.transport.close(),this.transport.clearTimeouts(),b&&(this.publish("disconnect",a),"booted"!=a&&this.options.reconnect&&!this.reconnecting&&this.reconnect())},d.prototype.reconnect=function(){function e(){if(a.connected){for(var b in a.namespaces)a.namespaces.hasOwnProperty(b)&&""!==b&&a.namespaces[b].packet({type:"connect"});a.publish("reconnect",a.transport.name,a.reconnectionAttempts)}clearTimeout(a.reconnectionTimer),a.removeListener("connect_failed",f),a.removeListener("connect",f),a.reconnecting=!1,delete a.reconnectionAttempts,delete a.reconnectionDelay,delete a.reconnectionTimer,delete a.redoTransports,a.options["try multiple transports"]=c}function f(){if(!a.reconnecting)return;if(a.connected)return e();if(a.connecting&&a.reconnecting)return a.reconnectionTimer=setTimeout(f,1e3);a.reconnectionAttempts++>=b?a.redoTransports?(a.publish("reconnect_failed"),e()):(a.on("connect_failed",f),a.options["try multiple transports"]=!0,a.transports=a.origTransports,a.transport=a.getTransport(),a.redoTransports=!0,a.connect()):(a.reconnectionDelay<d&&(a.reconnectionDelay*=2),a.connect(),a.publish("reconnecting",a.reconnectionDelay,a.reconnectionAttempts),a.reconnectionTimer=setTimeout(f,a.reconnectionDelay))}this.reconnecting=!0,this.reconnectionAttempts=0,this.reconnectionDelay=this.options["reconnection delay"];var a=this,b=this.options["max reconnection attempts"],c=this.options["try multiple transports"],d=this.options["reconnection limit"];this.options["try multiple transports"]=!1,this.reconnectionTimer=setTimeout(f,this.reconnectionDelay),this.on("connect",f)}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(a,b){function c(a,b){this.socket=a,this.name=b||"",this.flags={},this.json=new d(this,"json"),this.ackPackets=0,this.acks={}}function d(a,b){this.namespace=a,this.name=b}a.SocketNamespace=c,b.util.mixin(c,b.EventEmitter),c.prototype.$emit=b.EventEmitter.prototype.emit,c.prototype.of=function(){return this.socket.of.apply(this.socket,arguments)},c.prototype.packet=function(a){return a.endpoint=this.name,this.socket.packet(a),this.flags={},this},c.prototype.send=function(a,b){var c={type:this.flags.json?"json":"message",data:a};return"function"==typeof b&&(c.id=++this.ackPackets,c.ack=!0,this.acks[c.id]=b),this.packet(c)},c.prototype.emit=function(a){var b=Array.prototype.slice.call(arguments,1),c=b[b.length-1],d={type:"event",name:a};return"function"==typeof c&&(d.id=++this.ackPackets,d.ack="data",this.acks[d.id]=c,b=b.slice(0,b.length-1)),d.args=b,this.packet(d)},c.prototype.disconnect=function(){return this.name===""?this.socket.disconnect():(this.packet({type:"disconnect"}),this.$emit("disconnect")),this},c.prototype.onPacket=function(a){function d(){c.packet({type:"ack",args:b.util.toArray(arguments),ackId:a.id})}var c=this;switch(a.type){case"connect":this.$emit("connect");break;case"disconnect":this.name===""?this.socket.onDisconnect(a.reason||"booted"):this.$emit("disconnect",a.reason);break;case"message":case"json":var e=["message",a.data];a.ack=="data"?e.push(d):a.ack&&this.packet({type:"ack",ackId:a.id}),this.$emit.apply(this,e);break;case"event":var e=[a.name].concat(a.args);a.ack=="data"&&e.push(d),this.$emit.apply(this,e);break;case"ack":this.acks[a.ackId]&&(this.acks[a.ackId].apply(this,a.args),delete this.acks[a.ackId]);break;case"error":a.advice?this.socket.onError(a):a.reason=="unauthorized"?this.$emit("connect_failed",a.reason):this.$emit("error",a.reason)}},d.prototype.send=function(){this.namespace.flags[this.name]=!0,this.namespace.send.apply(this.namespace,arguments)},d.prototype.emit=function(){this.namespace.flags[this.name]=!0,this.namespace.emit.apply(this.namespace,arguments)}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(a,b,c){function d(a){b.Transport.apply(this,arguments)}a.websocket=d,b.util.inherit(d,b.Transport),d.prototype.name="websocket",d.prototype.open=function(){var a=b.util.query(this.socket.options.query),d=this,e;return e||(e=c.MozWebSocket||c.WebSocket),this.websocket=new e(this.prepareUrl()+a),this.websocket.onopen=function(){d.onOpen(),d.socket.setBuffer(!1)},this.websocket.onmessage=function(a){d.onData(a.data)},this.websocket.onclose=function(){d.onClose(),d.socket.setBuffer(!0)},this.websocket.onerror=function(a){d.onError(a)},this},b.util.ua.iDevice?d.prototype.send=function(a){var b=this;return setTimeout(function(){b.websocket.send(a)},0),this}:d.prototype.send=function(a){return this.websocket.send(a),this},d.prototype.payload=function(a){for(var b=0,c=a.length;b<c;b++)this.packet(a[b]);return this},d.prototype.close=function(){return this.websocket.close(),this},d.prototype.onError=function(a){this.socket.onError(a)},d.prototype.scheme=function(){return this.socket.options.secure?"wss":"ws"},d.check=function(){return"WebSocket"in c&&!("__addTask"in WebSocket)||"MozWebSocket"in c},d.xdomainCheck=function(){return!0},b.transports.push("websocket")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(a,b){function c(){b.Transport.websocket.apply(this,arguments)}a.flashsocket=c,b.util.inherit(c,b.Transport.websocket),c.prototype.name="flashsocket",c.prototype.open=function(){var a=this,c=arguments;return WebSocket.__addTask(function(){b.Transport.websocket.prototype.open.apply(a,c)}),this},c.prototype.send=function(){var a=this,c=arguments;return WebSocket.__addTask(function(){b.Transport.websocket.prototype.send.apply(a,c)}),this},c.prototype.close=function(){return WebSocket.__tasks.length=0,b.Transport.websocket.prototype.close.call(this),this},c.prototype.ready=function(a,d){function e(){var b=a.options,e=b["flash policy port"],g=["http"+(b.secure?"s":"")+":/",b.host+":"+b.port,b.resource,"static/flashsocket","WebSocketMain"+(a.isXDomain()?"Insecure":"")+".swf"];c.loaded||(typeof WEB_SOCKET_SWF_LOCATION=="undefined"&&(WEB_SOCKET_SWF_LOCATION=g.join("/")),e!==843&&WebSocket.loadFlashPolicyFile("xmlsocket://"+b.host+":"+e),WebSocket.__initialize(),c.loaded=!0),d.call(f)}var f=this;if(document.body)return e();b.util.load(e)},c.check=function(){return typeof WebSocket!="undefined"&&"__initialize"in WebSocket&&!!swfobject?swfobject.getFlashPlayerVersion().major>=10:!1},c.xdomainCheck=function(){return!0},typeof window!="undefined"&&(WEB_SOCKET_DISABLE_AUTO_INITIALIZATION=!0),b.transports.push("flashsocket")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports);if("undefined"!=typeof window)var swfobject=function(){function A(){if(t)return;try{var a=i.getElementsByTagName("body")[0].appendChild(Q("span"));a.parentNode.removeChild(a)}catch(b){return}t=!0;var c=l.length;for(var d=0;d<c;d++)l[d]()}function B(a){t?a():l[l.length]=a}function C(b){if(typeof h.addEventListener!=a)h.addEventListener("load",b,!1);else if(typeof i.addEventListener!=a)i.addEventListener("load",b,!1);else if(typeof h.attachEvent!=a)R(h,"onload",b);else if(typeof h.onload=="function"){var c=h.onload;h.onload=function(){c(),b()}}else h.onload=b}function D(){k?E():F()}function E(){var c=i.getElementsByTagName("body")[0],d=Q(b);d.setAttribute("type",e);var f=c.appendChild(d);if(f){var g=0;(function(){if(typeof f.GetVariable!=a){var b=f.GetVariable("$version");b&&(b=b.split(" ")[1].split(","),y.pv=[parseInt(b[0],10),parseInt(b[1],10),parseInt(b[2],10)])}else if(g<10){g++,setTimeout(arguments.callee,10);return}c.removeChild(d),f=null,F()})()}else F()}function F(){var b=m.length;if(b>0)for(var c=0;c<b;c++){var d=m[c].id,e=m[c].callbackFn,f={success:!1,id:d};if(y.pv[0]>0){var g=P(d);if(g)if(S(m[c].swfVersion)&&!(y.wk&&y.wk<312))U(d,!0),e&&(f.success=!0,f.ref=G(d),e(f));else if(m[c].expressInstall&&H()){var h={};h.data=m[c].expressInstall,h.width=g.getAttribute("width")||"0",h.height=g.getAttribute("height")||"0",g.getAttribute("class")&&(h.styleclass=g.getAttribute("class")),g.getAttribute("align")&&(h.align=g.getAttribute("align"));var i={},j=g.getElementsByTagName("param"),k=j.length;for(var l=0;l<k;l++)j[l].getAttribute("name").toLowerCase()!="movie"&&(i[j[l].getAttribute("name")]=j[l].getAttribute("value"));I(h,i,d,e)}else J(g),e&&e(f)}else{U(d,!0);if(e){var n=G(d);n&&typeof n.SetVariable!=a&&(f.success=!0,f.ref=n),e(f)}}}}function G(c){var d=null,e=P(c);if(e&&e.nodeName=="OBJECT")if(typeof e.SetVariable!=a)d=e;else{var f=e.getElementsByTagName(b)[0];f&&(d=f)}return d}function H(){return!u&&S("6.0.65")&&(y.win||y.mac)&&!(y.wk&&y.wk<312)}function I(b,c,d,e){u=!0,r=e||null,s={success:!1,id:d};var g=P(d);if(g){g.nodeName=="OBJECT"?(p=K(g),q=null):(p=g,q=d),b.id=f;if(typeof b.width==a||!/%$/.test(b.width)&&parseInt(b.width,10)<310)b.width="310";if(typeof b.height==a||!/%$/.test(b.height)&&parseInt(b.height,10)<137)b.height="137";i.title=i.title.slice(0,47)+" - Flash Player Installation";var j=y.ie&&y.win?["Active"].concat("").join("X"):"PlugIn",k="MMredirectURL="+h.location.toString().replace(/&/g,"%26")+"&MMplayerType="+j+"&MMdoctitle="+i.title;typeof c.flashvars!=a?c.flashvars+="&"+k:c.flashvars=k;if(y.ie&&y.win&&g.readyState!=4){var l=Q("div");d+="SWFObjectNew",l.setAttribute("id",d),g.parentNode.insertBefore(l,g),g.style.display="none",function(){g.readyState==4?g.parentNode.removeChild(g):setTimeout(arguments.callee,10)}()}L(b,c,d)}}function J(a){if(y.ie&&y.win&&a.readyState!=4){var b=Q("div");a.parentNode.insertBefore(b,a),b.parentNode.replaceChild(K(a),b),a.style.display="none",function(){a.readyState==4?a.parentNode.removeChild(a):setTimeout(arguments.callee,10)}()}else a.parentNode.replaceChild(K(a),a)}function K(a){var c=Q("div");if(y.win&&y.ie)c.innerHTML=a.innerHTML;else{var d=a.getElementsByTagName(b)[0];if(d){var e=d.childNodes;if(e){var f=e.length;for(var g=0;g<f;g++)(e[g].nodeType!=1||e[g].nodeName!="PARAM")&&e[g].nodeType!=8&&c.appendChild(e[g].cloneNode(!0))}}}return c}function L(c,d,f){var g,h=P(f);if(y.wk&&y.wk<312)return g;if(h){typeof c.id==a&&(c.id=f);if(y.ie&&y.win){var i="";for(var j in c)c[j]!=Object.prototype[j]&&(j.toLowerCase()=="data"?d.movie=c[j]:j.toLowerCase()=="styleclass"?i+=' class="'+c[j]+'"':j.toLowerCase()!="classid"&&(i+=" "+j+'="'+c[j]+'"'));var k="";for(var l in d)d[l]!=Object.prototype[l]&&(k+='<param name="'+l+'" value="'+d[l]+'" />');h.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+i+">"+k+"</object>",n[n.length]=c.id,g=P(c.id)}else{var m=Q(b);m.setAttribute("type",e);for(var o in c)c[o]!=Object.prototype[o]&&(o.toLowerCase()=="styleclass"?m.setAttribute("class",c[o]):o.toLowerCase()!="classid"&&m.setAttribute(o,c[o]));for(var p in d)d[p]!=Object.prototype[p]&&p.toLowerCase()!="movie"&&M(m,p,d[p]);h.parentNode.replaceChild(m,h),g=m}}return g}function M(a,b,c){var d=Q("param");d.setAttribute("name",b),d.setAttribute("value",c),a.appendChild(d)}function N(a){var b=P(a);b&&b.nodeName=="OBJECT"&&(y.ie&&y.win?(b.style.display="none",function(){b.readyState==4?O(a):setTimeout(arguments.callee,10)}()):b.parentNode.removeChild(b))}function O(a){var b=P(a);if(b){for(var c in b)typeof b[c]=="function"&&(b[c]=null);b.parentNode.removeChild(b)}}function P(a){var b=null;try{b=i.getElementById(a)}catch(c){}return b}function Q(a){return i.createElement(a)}function R(a,b,c){a.attachEvent(b,c),o[o.length]=[a,b,c]}function S(a){var b=y.pv,c=a.split(".");return c[0]=parseInt(c[0],10),c[1]=parseInt(c[1],10)||0,c[2]=parseInt(c[2],10)||0,b[0]>c[0]||b[0]==c[0]&&b[1]>c[1]||b[0]==c[0]&&b[1]==c[1]&&b[2]>=c[2]?!0:!1}function T(c,d,e,f){if(y.ie&&y.mac)return;var g=i.getElementsByTagName("head")[0];if(!g)return;var h=e&&typeof e=="string"?e:"screen";f&&(v=null,w=null);if(!v||w!=h){var j=Q("style");j.setAttribute("type","text/css"),j.setAttribute("media",h),v=g.appendChild(j),y.ie&&y.win&&typeof i.styleSheets!=a&&i.styleSheets.length>0&&(v=i.styleSheets[i.styleSheets.length-1]),w=h}y.ie&&y.win?v&&typeof v.addRule==b&&v.addRule(c,d):v&&typeof i.createTextNode!=a&&v.appendChild(i.createTextNode(c+" {"+d+"}"))}function U(a,b){if(!x)return;var c=b?"visible":"hidden";t&&P(a)?P(a).style.visibility=c:T("#"+a,"visibility:"+c)}function V(b){var c=/[\\\"<>\.;]/,d=c.exec(b)!=null;return d&&typeof encodeURIComponent!=a?encodeURIComponent(b):b}var a="undefined",b="object",c="Shockwave Flash",d="ShockwaveFlash.ShockwaveFlash",e="application/x-shockwave-flash",f="SWFObjectExprInst",g="onreadystatechange",h=window,i=document,j=navigator,k=!1,l=[D],m=[],n=[],o=[],p,q,r,s,t=!1,u=!1,v,w,x=!0,y=function(){var f=typeof i.getElementById!=a&&typeof i.getElementsByTagName!=a&&typeof i.createElement!=a,g=j.userAgent.toLowerCase(),l=j.platform.toLowerCase(),m=l?/win/.test(l):/win/.test(g),n=l?/mac/.test(l):/mac/.test(g),o=/webkit/.test(g)?parseFloat(g.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,p=!1,q=[0,0,0],r=null;if(typeof j.plugins!=a&&typeof j.plugins[c]==b)r=j.plugins[c].description,r&&(typeof j.mimeTypes==a||!j.mimeTypes[e]||!!j.mimeTypes[e].enabledPlugin)&&(k=!0,p=!1,r=r.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),q[0]=parseInt(r.replace(/^(.*)\..*$/,"$1"),10),q[1]=parseInt(r.replace(/^.*\.(.*)\s.*$/,"$1"),10),q[2]=/[a-zA-Z]/.test(r)?parseInt(r.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if(typeof h[["Active"].concat("Object").join("X")]!=a)try{var s=new(window[["Active"].concat("Object").join("X")])(d);s&&(r=s.GetVariable("$version"),r&&(p=!0,r=r.split(" ")[1].split(","),q=[parseInt(r[0],10),parseInt(r[1],10),parseInt(r[2],10)]))}catch(t){}return{w3:f,pv:q,wk:o,ie:p,win:m,mac:n}}(),z=function(){if(!y.w3)return;(typeof i.readyState!=a&&i.readyState=="complete"||typeof i.readyState==a&&(i.getElementsByTagName("body")[0]||i.body))&&A(),t||(typeof i.addEventListener!=a&&i.addEventListener("DOMContentLoaded",A,!1),y.ie&&y.win&&(i.attachEvent(g,function(){i.readyState=="complete"&&(i.detachEvent(g,arguments.callee),A())}),h==top&&function(){if(t)return;try{i.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}A()}()),y.wk&&function(){if(t)return;if(!/loaded|complete/.test(i.readyState)){setTimeout(arguments.callee,0);return}A()}(),C(A))}(),W=function(){y.ie&&y.win&&window.attachEvent("onunload",function(){var a=o.length;for(var b=0;b<a;b++)o[b][0].detachEvent(o[b][1],o[b][2]);var c=n.length;for(var d=0;d<c;d++)N(n[d]);for(var e in y)y[e]=null;y=null;for(var f in swfobject)swfobject[f]=null;swfobject=null})}();return{registerObject:function(a,b,c,d){if(y.w3&&a&&b){var e={};e.id=a,e.swfVersion=b,e.expressInstall=c,e.callbackFn=d,m[m.length]=e,U(a,!1)}else d&&d({success:!1,id:a})},getObjectById:function(a){if(y.w3)return G(a)},embedSWF:function(c,d,e,f,g,h,i,j,k,l){var m={success:!1,id:d};y.w3&&!(y.wk&&y.wk<312)&&c&&d&&e&&f&&g?(U(d,!1),B(function(){e+="",f+="";var n={};if(k&&typeof k===b)for(var o in k)n[o]=k[o];n.data=c,n.width=e,n.height=f;var p={};if(j&&typeof j===b)for(var q in j)p[q]=j[q];if(i&&typeof i===b)for(var r in i)typeof p.flashvars!=a?p.flashvars+="&"+r+"="+i[r]:p.flashvars=r+"="+i[r];if(S(g)){var s=L(n,p,d);n.id==d&&U(d,!0),m.success=!0,m.ref=s}else{if(h&&H()){n.data=h,I(n,p,d,l);return}U(d,!0)}l&&l(m)})):l&&l(m)},switchOffAutoHideShow:function(){x=!1},ua:y,getFlashPlayerVersion:function(){return{major:y.pv[0],minor:y.pv[1],release:y.pv[2]}},hasFlashPlayerVersion:S,createSWF:function(a,b,c){return y.w3?L(a,b,c):undefined},showExpressInstall:function(a,b,c,d){y.w3&&H()&&I(a,b,c,d)},removeSWF:function(a){y.w3&&N(a)},createCSS:function(a,b,c,d){y.w3&&T(a,b,c,d)},addDomLoadEvent:B,addLoadEvent:C,getQueryParamValue:function(a){var b=i.location.search||i.location.hash;if(b){/\?/.test(b)&&(b=b.split("?")[1]);if(a==null)return V(b);var c=b.split("&");for(var d=0;d<c.length;d++)if(c[d].substring(0,c[d].indexOf("="))==a)return V(c[d].substring(c[d].indexOf("=")+1))}return""},expressInstallCallback:function(){if(u){var a=P(f);a&&p&&(a.parentNode.replaceChild(p,a),q&&(U(q,!0),y.ie&&y.win&&(p.style.display="block")),r&&r(s)),u=!1}}}}();(function(){if("undefined"==typeof window||window.WebSocket)return;var a=window.console;if(!a||!a.log||!a.error)a={log:function(){},error:function(){}};if(!swfobject.hasFlashPlayerVersion("10.0.0")){a.error("Flash Player >= 10.0.0 is required.");return}location.protocol=="file:"&&a.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(a,b,c,d,e){var f=this;f.__id=WebSocket.__nextId++,WebSocket.__instances[f.__id]=f,f.readyState=WebSocket.CONNECTING,f.bufferedAmount=0,f.__events={},b?typeof b=="string"&&(b=[b]):b=[],setTimeout(function(){WebSocket.__addTask(function(){WebSocket.__flash.create(f.__id,a,b,c||null,d||0,e||null)})},0)},WebSocket.prototype.send=function(a){if(this.readyState==WebSocket.CONNECTING)throw"INVALID_STATE_ERR: Web Socket connection has not been established";var b=WebSocket.__flash.send(this.__id,encodeURIComponent(a));return b<0?!0:(this.bufferedAmount+=b,!1)},WebSocket.prototype.close=function(){if(this.readyState==WebSocket.CLOSED||this.readyState==WebSocket.CLOSING)return;this.readyState=WebSocket.CLOSING,WebSocket.__flash.close(this.__id)},WebSocket.prototype.addEventListener=function(a,b,c){a in this.__events||(this.__events[a]=[]),this.__events[a].push(b)},WebSocket.prototype.removeEventListener=function(a,b,c){if(!(a in this.__events))return;var d=this.__events[a];for(var e=d.length-1;e>=0;--e)if(d[e]===b){d.splice(e,1);break}},WebSocket.prototype.dispatchEvent=function(a){var b=this.__events[a.type]||[];for(var c=0;c<b.length;++c)b[c](a);var d=this["on"+a.type];d&&d(a)},WebSocket.prototype.__handleEvent=function(a){"readyState"in a&&(this.readyState=a.readyState),"protocol"in a&&(this.protocol=a.protocol);var b;if(a.type=="open"||a.type=="error")b=this.__createSimpleEvent(a.type);else if(a.type=="close")b=this.__createSimpleEvent("close");else{if(a.type!="message")throw"unknown event type: "+a.type;var c=decodeURIComponent(a.message);b=this.__createMessageEvent("message",c)}this.dispatchEvent(b)},WebSocket.prototype.__createSimpleEvent=function(a){if(document.createEvent&&window.Event){var b=document.createEvent("Event");return b.initEvent(a,!1,!1),b}return{type:a,bubbles:!1,cancelable:!1}},WebSocket.prototype.__createMessageEvent=function(a,b){if(document.createEvent&&window.MessageEvent&&!window.opera){var c=document.createEvent("MessageEvent");return c.initMessageEvent("message",!1,!1,b,null,null,window,null),c}return{type:a,data:b,bubbles:!1,cancelable:!1}},WebSocket.CONNECTING=0,WebSocket.OPEN=1,WebSocket.CLOSING=2,WebSocket.CLOSED=3,WebSocket.__flash=null,WebSocket.__instances={},WebSocket.__tasks=[],WebSocket.__nextId=0,WebSocket.loadFlashPolicyFile=function(a){WebSocket.__addTask(function(){WebSocket.__flash.loadManualPolicyFile(a)})},WebSocket.__initialize=function(){if(WebSocket.__flash)return;WebSocket.__swfLocation&&(window.WEB_SOCKET_SWF_LOCATION=WebSocket.__swfLocation);if(!window.WEB_SOCKET_SWF_LOCATION){a.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf");return}var b=document.createElement("div");b.id="webSocketContainer",b.style.position="absolute",WebSocket.__isFlashLite()?(b.style.left="0px",b.style.top="0px"):(b.style.left="-100px",b.style.top="-100px");var c=document.createElement("div");c.id="webSocketFlash",b.appendChild(c),document.body.appendChild(b),swfobject.embedSWF(WEB_SOCKET_SWF_LOCATION,"webSocketFlash","1","1","10.0.0",null,null,{hasPriority:!0,swliveconnect:!0,allowScriptAccess:"always"},null,function(b){b.success||a.error("[WebSocket] swfobject.embedSWF failed")})},WebSocket.__onFlashInitialized=function(){setTimeout(function(){WebSocket.__flash=document.getElementById("webSocketFlash"),WebSocket.__flash.setCallerUrl(location.href),WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG);for(var a=0;a<WebSocket.__tasks.length;++a)WebSocket.__tasks[a]();WebSocket.__tasks=[]},0)},WebSocket.__onFlashEvent=function(){return setTimeout(function(){try{var b=WebSocket.__flash.receiveEvents();for(var c=0;c<b.length;++c)WebSocket.__instances[b[c].webSocketId].__handleEvent(b[c])}catch(d){a.error(d)}},0),!0},WebSocket.__log=function(b){a.log(decodeURIComponent(b))},WebSocket.__error=function(b){a.error(decodeURIComponent(b))},WebSocket.__addTask=function(a){WebSocket.__flash?a():WebSocket.__tasks.push(a)},WebSocket.__isFlashLite=function(){if(!window.navigator||!window.navigator.mimeTypes)return!1;var a=window.navigator.mimeTypes["application/x-shockwave-flash"];return!a||!a.enabledPlugin||!a.enabledPlugin.filename?!1:a.enabledPlugin.filename.match(/flashlite/i)?!0:!1},window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION||(window.addEventListener?window.addEventListener("load",function(){WebSocket.__initialize()},!1):window.attachEvent("onload",function(){WebSocket.__initialize()}))})(),function(a,b,c){function d(a){if(!a)return;b.Transport.apply(this,arguments),this.sendBuffer=[]}function e(){}a.XHR=d,b.util.inherit(d,b.Transport),d.prototype.open=function(){return this.socket.setBuffer(!1),this.onOpen(),this.get(),this.setCloseTimeout(),this},d.prototype.payload=function(a){var c=[];for(var d=0,e=a.length;d<e;d++)c.push(b.parser.encodePacket(a[d]));this.send(b.parser.encodePayload(c))},d.prototype.send=function(a){return this.post(a),this},d.prototype.post=function(a){function d(){this.readyState==4&&(this.onreadystatechange=e,b.posting=!1,this.status==200?b.socket.setBuffer(!1):b.onClose())}function f(){this.onload=e,b.socket.setBuffer(!1)}var b=this;this.socket.setBuffer(!0),this.sendXHR=this.request("POST"),c.XDomainRequest&&this.sendXHR instanceof XDomainRequest?this.sendXHR.onload=this.sendXHR.onerror=f:this.sendXHR.onreadystatechange=d,this.sendXHR.send(a)},d.prototype.close=function(){return this.onClose(),this},d.prototype.request=function(a){var c=b.util.request(this.socket.isXDomain()),d=b.util.query(this.socket.options.query,"t="+ +(new Date));c.open(a||"GET",this.prepareUrl()+d,!0);if(a=="POST")try{c.setRequestHeader?c.setRequestHeader("Content-type","text/plain;charset=UTF-8"):c.contentType="text/plain"}catch(e){}return c},d.prototype.scheme=function(){return this.socket.options.secure?"https":"http"},d.check=function(a,d){try{var e=b.util.request(d),f=c.XDomainRequest&&e instanceof XDomainRequest,g=a&&a.options&&a.options.secure?"https:":"http:",h=c.location&&g!=c.location.protocol;if(e&&(!f||!h))return!0}catch(i){}return!1},d.xdomainCheck=function(a){return d.check(a,!0)}}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(a,b){function c(a){b.Transport.XHR.apply(this,arguments)}a.htmlfile=c,b.util.inherit(c,b.Transport.XHR),c.prototype.name="htmlfile",c.prototype.get=function(){this.doc=new(window[["Active"].concat("Object").join("X")])("htmlfile"),this.doc.open(),this.doc.write("<html></html>"),this.doc.close(),this.doc.parentWindow.s=this;var a=this.doc.createElement("div");a.className="socketio",this.doc.body.appendChild(a),this.iframe=this.doc.createElement("iframe"),a.appendChild(this.iframe);var c=this,d=b.util.query(this.socket.options.query,"t="+ +(new Date));this.iframe.src=this.prepareUrl()+d,b.util.on(window,"unload",function(){c.destroy()})},c.prototype._=function(a,b){a=a.replace(/\\\//g,"/"),this.onData(a);try{var c=b.getElementsByTagName("script")[0];c.parentNode.removeChild(c)}catch(d){}},c.prototype.destroy=function(){if(this.iframe){try{this.iframe.src="about:blank"}catch(a){}this.doc=null,this.iframe.parentNode.removeChild(this.iframe),this.iframe=null,CollectGarbage()}},c.prototype.close=function(){return this.destroy(),b.Transport.XHR.prototype.close.call(this)},c.check=function(a){if(typeof window!="undefined"&&["Active"].concat("Object").join("X")in window)try{var c=new(window[["Active"].concat("Object").join("X")])("htmlfile");return c&&b.Transport.XHR.check(a)}catch(d){}return!1},c.xdomainCheck=function(){return!1},b.transports.push("htmlfile")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(a,b,c){function d(){b.Transport.XHR.apply(this,arguments)}function e(){}a["xhr-polling"]=d,b.util.inherit(d,b.Transport.XHR),b.util.merge(d,b.Transport.XHR),d.prototype.name="xhr-polling",d.prototype.heartbeats=function(){return!1},d.prototype.open=function(){var a=this;return b.Transport.XHR.prototype.open.call(a),!1},d.prototype.get=function(){function b(){this.readyState==4&&(this.onreadystatechange=e,this.status==200?(a.onData(this.responseText),a.get()):a.onClose())}function d(){this.onload=e,this.onerror=e,a.retryCounter=1,a.onData(this.responseText),a.get()}function f(){a.retryCounter++,!a.retryCounter||a.retryCounter>3?a.onClose():a.get()}if(!this.isOpen)return;var a=this;this.xhr=this.request(),c.XDomainRequest&&this.xhr instanceof XDomainRequest?(this.xhr.onload=d,this.xhr.onerror=f):this.xhr.onreadystatechange=b,this.xhr.send(null)},d.prototype.onClose=function(){b.Transport.XHR.prototype.onClose.call(this);if(this.xhr){this.xhr.onreadystatechange=this.xhr.onload=this.xhr.onerror=e;try{this.xhr.abort()}catch(a){}this.xhr=null}},d.prototype.ready=function(a,c){var d=this;b.util.defer(function(){c.call(d)})},b.transports.push("xhr-polling")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(a,b,c){function e(a){b.Transport["xhr-polling"].apply(this,arguments),this.index=b.j.length;var c=this;b.j.push(function(a){c._(a)})}var d=c.document&&"MozAppearance"in c.document.documentElement.style;a["jsonp-polling"]=e,b.util.inherit(e,b.Transport["xhr-polling"]),e.prototype.name="jsonp-polling",e.prototype.post=function(a){function i(){j(),c.socket.setBuffer(!1)}function j(){c.iframe&&c.form.removeChild(c.iframe);try{h=document.createElement('<iframe name="'+c.iframeId+'">')}catch(a){h=document.createElement("iframe"),h.name=c.iframeId}h.id=c.iframeId,c.form.appendChild(h),c.iframe=h}var c=this,d=b.util.query(this.socket.options.query,"t="+ +(new Date)+"&i="+this.index);if(!this.form){var e=document.createElement("form"),f=document.createElement("textarea"),g=this.iframeId="socketio_iframe_"+this.index,h;e.className="socketio",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.display="none",e.target=g,e.method="POST",e.setAttribute("accept-charset","utf-8"),f.name="d",e.appendChild(f),document.body.appendChild(e),this.form=e,this.area=f}this.form.action=this.prepareUrl()+d,j(),this.area.value=b.JSON.stringify(a);try{this.form.submit()}catch(k){}this.iframe.attachEvent?h.onreadystatechange=function(){c.iframe.readyState=="complete"&&i()}:this.iframe.onload=i,this.socket.setBuffer(!0)},e.prototype.get=function(){var a=this,c=document.createElement("script"),e=b.util.query(this.socket.options.query,"t="+ +(new Date)+"&i="+this.index);this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),c.async=!0,c.src=this.prepareUrl()+e,c.onerror=function(){a.onClose()};var f=document.getElementsByTagName("script")[0];f.parentNode.insertBefore(c,f),this.script=c,d&&setTimeout(function(){var a=document.createElement("iframe");document.body.appendChild(a),document.body.removeChild(a)},100)},e.prototype._=function(a){return this.onData(a),this.isOpen&&this.get(),this},e.prototype.ready=function(a,c){var e=this;if(!d)return c.call(this);b.util.load(function(){c.call(e)})},e.check=function(){return"document"in c},e.xdomainCheck=function(){return!0},b.transports.push("jsonp-polling")}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),typeof define=="function"&&define.amd&&define([],function(){return io})})() | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment