29484dc7 by Jabis Sevon

downgraded to express@^3.23 and socket.io@^0.9.16

1 parent eec9eab8
1 index.rendered.html 1 index.rendered.html
2 node_modules 2 node_modules
3 examples/node_modules
......
1 ### Issues with HTTPS (including Heroku) has been resolved, module is working again 1 ### Issues with HTTPS (including Heroku) has been resolved, module is working again
2 # express-status-monitor 2 # express-status-monitor
3 Simple, self-hosted module based on Socket.io and Chart.js to report realtime server metrics for Express-based node servers. More Node frameworks coming soon. 3 Simple, self-hosted module based on Socket.io and Chart.js to report realtime server metrics for Express-based node servers. More Node frameworks coming soon.
4 4
5 ![Monitoring Page](http://i.imgur.com/AHizEWq.gif "Monitoring Page") 5 ![Monitoring Page](http://i.imgur.com/AHizEWq.gif "Monitoring Page")
6 6
7 ## Installation & setup 7 ## Installation & setup
8 1. Run `npm install express-status-monitor --save` 8 1. Run `npm install express-status-monitor --save`
9 2. Before any other middleware or router add following line: 9 2. Before any other middleware or router add following line:
10 `app.use(require('express-status-monitor')());` 10 `app.use(require('express-status-monitor')());`
11 3. Run server and go to `/status` 11 3. Run server and go to `/status`
12 12
13 ## Run examples 13 ## Run examples
14 14
15 1. Go to `examples/` 15 1. Go to `examples/`
16 2. Run `npm install` 16 2. Run `npm install`
17 3. Run server `node index.js` 17 3. Run server `node index.js`
18 4. Go to `http://0.0.0.0:3000` 18 4. Go to `http://0.0.0.0:3000`
19 19
20 ## Options 20 ## Options
21 21
22 Monitor can be configured by passing options object into `expressMonitor` constructor. 22 Monitor can be configured by passing options object into `expressMonitor` constructor.
23 23
24 Default config: 24 Default config:
25 ``` 25 ```
26 title: 'Express Status', // Default title 26 title: 'Express Status', // Default title
27 path: '/status', 27 path: '/status',
28 spans: [{ 28 spans: [{
29 interval: 1, // Every second 29 interval: 1, // Every second
30 retention: 60 // Keep 60 datapoints in memory 30 retention: 60 // Keep 60 datapoints in memory
31 }, { 31 }, {
32 interval: 5, // Every 5 seconds 32 interval: 5, // Every 5 seconds
33 retention: 60 33 retention: 60
34 }, { 34 }, {
35 interval: 15, // Every 15 seconds 35 interval: 15, // Every 15 seconds
36 retention: 60 36 retention: 60
37 }] 37 }]
38 38
39 ``` 39 ```
40 40
41 ## License 41 ## License
42 42
43 [MIT License](https://opensource.org/licenses/MIT) © Rafal Wilinski 43 [MIT License](https://opensource.org/licenses/MIT) © Rafal Wilinski
......
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 config = { 4 const io = require('socket.io');
5 path: '/', 5 const config = {
6 title: 'Express Status', 6 uri: 'www.cert.coder.fi',
7 spans: [{ 7 port: 4000,
8 interval: 1, 8 path: '/',
9 retention: 60 9 title: 'Express Status',
10 }, { 10 spans: [{
11 interval: 5, 11 interval: 1,
12 retention: 60 12 retention: 60
13 }, { 13 }, {
14 interval: 15, 14 interval: 5,
15 retention: 60 15 retention: 60
16 }] 16 }, {
17 } 17 interval: 15,
18 18 retention: 60
19 app.use(require('../index')(config)); 19 }]
20 20 }
21 app.listen(3000, () => { 21
22 console.log('🌏 http://0.0.0.0:3000'); 22 var server = http.createServer(app);
23 }); 23 app.use(require('../index')(config, server));
24
25 server.listen(config.port, config.uri, () => {
26 console.log('🌏 http://'+config.uri+':'+config.port);
27 });
......
1 { 1 {
2 "name": "express-status-monitor-example", 2 "name": "express-status-monitor-example",
3 "version": "0.0.1", 3 "version": "0.0.1",
4 "description": "Examples", 4 "description": "Examples",
5 "main": "index.js", 5 "main": "index.js",
6 "author": "Rafal Wilinski raf.wilinski@gmail.com", 6 "author": "Rafal Wilinski raf.wilinski@gmail.com",
7 "contributors": [ 7 "contributors": [
8 { 8 {
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 } 12 },
13 ], 13 {
14 "license": "MIT", 14 "name": "Jabis Sevon",
15 "dependencies": { 15 "email": "jabis.is@gmail.com",
16 "express": "^4.14.0", 16 "url": "https://jscodex.com"
17 "on-headers": "^1.0.1", 17 }
18 "pidusage": "^1.0.4", 18 ],
19 "socket.io": "^1.4.8" 19 "license": "MIT",
20 } 20 "dependencies": {
21 } 21 "express": "^3.21.2",
22 "on-headers": "^1.0.1",
23 "pidusage": "^1.0.4",
24 "socket.io": "^0.9.16"
25 }
26 }
......
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 <head> 3
4 <title>{{title}}</title> 4 <head>
5 <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.bundle.min.js"></script> 5 <title>{{title}}</title>
6 <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.5/socket.io.min.js"></script> 6 <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.bundle.min.js"></script>
7 <style> 7 <script type="text/javascript">
8 * { 8 /*! Socket.IO.min.js build:0.9.16, production. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */
9 font-family: Helvetica Neue, Helvetica, Arial, sans-serif; 9 var io = "undefined" == typeof module ? {} : module.exports;
10 } 10 (function() {
11 11 (function(a, b) {
12 h1 { 12 var c = a;
13 font-size: 3em; 13 c.version = "0.9.16", c.protocol = 1, c.transports = [], c.j = [], c.sockets = {}, c.connect = function(a, d) {
14 color: #222222; 14 var e = c.util.parseUri(a),
15 margin: 0; 15 f, g;
16 } 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 17 var h = {
18 h5 { 18 host: e.host,
19 margin: 0; 19 secure: "https" == e.protocol,
20 color: #888888; 20 port: e.port || ("https" == e.protocol ? 443 : 80),
21 } 21 query: e.query || ""
22 22 };
23 p { 23 c.util.merge(h, d);
24 font-size: 0.7em; 24 if (h["force new connection"] || !c.sockets[f]) g = new c.Socket(h);
25 color: #888888; 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 } 26 }
27 27 })("object" == typeof module ? module.exports : this.io = {}, this),
28 span { 28 function(a, b) {
29 cursor: pointer; 29 var c = a.util = {},
30 font-size: 10px; 30 d = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,
31 margin-left: 5px; 31 e = ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"];
32 border: 1px solid #DDD; 32 c.parseUri = function(a) {
33 padding: 3px 10px 4px 10px; 33 var b = d.exec(a || ""),
34 } 34 c = {},
35 35 f = 14;
36 canvas { 36 while (f--) c[e[f]] = b[f] || "";
37 width: 400px; 37 return c
38 height: 100px; 38 }, c.uniqueUri = function(a) {
39 } 39 var c = a.protocol,
40 40 d = a.host,
41 .active { 41 e = a.port;
42 background: #eeeeee; 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 } 43 }, c.query = function(a, b) {
44 44 var d = c.chunkQuery(a || ""),
45 .stats-column { 45 e = [];
46 flex: 0 0 200px; 46 c.merge(d, c.chunkQuery(b || ""));
47 } 47 for (var f in d) d.hasOwnProperty(f) && e.push(f + "=" + d[f]);
48 48 return e.length ? "?" + e.join("&") : ""
49 .container { 49 }, c.chunkQuery = function(a) {
50 display: flex; 50 var b = {},
51 flex-direction: row; 51 c = a.split("&"),
52 margin-top: 20px; 52 d = 0,
53 height: 100px; 53 e = c.length,
54 } 54 f;
55 55 for (; d < e; ++d) f = c[d].split("="), f[0] && (b[f[0]] = f[1]);
56 .chart-container { 56 return b
57 width: 400px; 57 };
58 height: 100px; 58 var f = !1;
59 } 59 c.load = function(a) {
60 60 if ("document" in b && document.readyState === "complete" || f) return a();
61 .footer { 61 c.on(b, "load", a, !1)
62 position: fixed; 62 }, c.on = function(a, b, c, d) {
63 margin: auto; 63 a.attachEvent ? a.attachEvent("on" + b, c) : a.addEventListener && a.addEventListener(b, c, d)
64 text-align: center; 64 }, c.request = function(a) {
65 left: 0; 65 if (a && "undefined" != typeof XDomainRequest && !c.ua.hasCORS) return new XDomainRequest;
66 right: 0; 66 if ("undefined" != typeof XMLHttpRequest && (!a || c.ua.hasCORS)) return new XMLHttpRequest;
67 bottom: 0; 67 if (!a) try {
68 } 68 return new(window[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")
69 69 } catch (b) {}
70 .span-controls { 70 return null
71 float: right; 71 }, "undefined" != typeof window && c.load(function() {
72 } 72 f = !0
73 </style> 73 }), c.defer = function(a) {
74 </head> 74 if (!c.ua.webkit || "undefined" != typeof importScripts) return a();
75 <body> 75 c.load(function() {
76 <div style="width: 600px; margin: auto"> 76 setTimeout(a, 100)
77 <div class="header"> 77 })
78 <b>{{title}}</b> 78 }, c.merge = function(b, d, e, f) {
79 <div id="span-controls" class="span-controls"> 79 var g = f || [],
80 </div> 80 h = typeof e == "undefined" ? 2 : e,
81 </div> 81 i;
82 <div class="container"> 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 <div class="stats-column"> 83 return b
84 <h5>CPU Usage</h5> 84 }, c.mixin = function(a, b) {
85 <h1 id="cpuStat">- %</h1> 85 c.merge(a.prototype, b.prototype)
86 </div> 86 }, c.inherit = function(a, b) {
87 <div class="chart-container"> 87 function c() {}
88 <canvas id="cpuChart" width="400" height="100"></canvas> 88 c.prototype = b.prototype, a.prototype = new c
89 </div> 89 }, c.isArray = Array.isArray || function(a) {
90 </div> 90 return Object.prototype.toString.call(a) === "[object Array]"
91 <div class="container"> 91 }, c.intersect = function(a, b) {
92 <div class="stats-column"> 92 var d = [],
93 <h5>Memory Usage</h5> 93 e = a.length > b.length ? a : b,
94 <h1 id="memStat">- %</h1> 94 f = a.length > b.length ? b : a;
95 </div> 95 for (var g = 0, h = f.length; g < h; g++) ~c.indexOf(e, f[g]) && d.push(f[g]);
96 <div class="chart-container"> 96 return d
97 <canvas id="memChart" width="200" height="100"></canvas> 97 }, c.indexOf = function(a, b, c) {
98 </div> 98 for (var d = a.length, c = c < 0 ? c + d < 0 ? 0 : c + d : c || 0; c < d && a[c] !== b; c++);
99 </div> 99 return d <= c ? -1 : c
100 <div class="container"> 100 }, c.toArray = function(a) {
101 <div class="stats-column"> 101 var b = [];
102 <h5>One Minute Load Avg</h5> 102 for (var c = 0, d = a.length; c < d; c++) b.push(a[c]);
103 <h1 id="loadStat">-</h1> 103 return b
104 </div> 104 }, c.ua = {}, c.ua.hasCORS = "undefined" != typeof XMLHttpRequest && function() {
105 <div class="chart-container"> 105 try {
106 <canvas id="loadChart" width="200" height="100"></canvas> 106 var a = new XMLHttpRequest
107 </div> 107 } catch (b) {
108 </div> 108 return !1
109 <div class="container"> 109 }
110 <div class="stats-column"> 110 return a.withCredentials != undefined
111 <h5>Response Time</h5> 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 <h1 id="responseTimeStat">-</h1> 112 }("undefined" != typeof io ? io : module.exports, this),
113 </div> 113 function(a, b) {
114 <div class="chart-container"> 114 function c() {}
115 <canvas id="responseTimeChart" width="200" height="100"></canvas> 115 a.EventEmitter = c, c.prototype.on = function(a, c) {
116 </div> 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 </div> 117 }, c.prototype.addListener = c.prototype.on, c.prototype.once = function(a, b) {
118 <div class="container"> 118 function d() {
119 <div class="stats-column"> 119 c.removeListener(a, d), b.apply(this, arguments)
120 <h5>Requests per Second</h5> 120 }
121 <h1 id="rpsStat">-</h1> 121 var c = this;
122 </div> 122 return d.listener = b, this.on(a, d), this
123 <div class="chart-container"> 123 }, c.prototype.removeListener = function(a, c) {
124 <canvas id="rpsChart" width="200" height="100"></canvas> 124 if (this.$events && this.$events[a]) {
125 </div> 125 var d = this.$events[a];
126 </div> 126 if (b.util.isArray(d)) {
127 <div class="footer"> 127 var e = -1;
128 <p>Made with &#9829; with Socket.io & Chart.js</p> 128 for (var f = 0, g = d.length; f < g; f++)
129 </div> 129 if (d[f] === c || d[f].listener && d[f].listener === c) {
130 </div> 130 e = f;
131 <script> 131 break
132 Chart.defaults.global.defaultFontSize = 8; 132 }
133 Chart.defaults.global.animation.duration = 500; 133 if (e < 0) return this;
134 Chart.defaults.global.legend.display = false; 134 d.splice(e, 1), d.length || delete this.$events[a]
135 Chart.defaults.global.elements.line.backgroundColor = "rgba(0,0,0,0)"; 135 } else(d === c || d.listener && d.listener === c) && delete this.$events[a]
136 Chart.defaults.global.elements.line.borderColor = "rgba(0,0,0,0.9)"; 136 }
137 Chart.defaults.global.elements.line.borderWidth = 2; 137 return this
138 138 }, c.prototype.removeAllListeners = function(a) {
139 var socket = io(location.protocol + '//' + location.hostname + ':' + location.port); 139 return a === undefined ? (this.$events = {}, this) : (this.$events && this.$events[a] && (this.$events[a] = null), this)
140 var defaultSpan = 0; 140 }, c.prototype.listeners = function(a) {
141 var spans = []; 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 142 }, c.prototype.emit = function(a) {
143 var defaultDataset = { 143 if (!this.$events) return !1;
144 label: '', 144 var c = this.$events[a];
145 data: [], 145 if (!c) return !1;
146 lineTension: 0.2, 146 var d = Array.prototype.slice.call(arguments, 1);
147 pointRadius: 0 147 if ("function" == typeof c) c.apply(this, d);
148 }; 148 else {
149 149 if (!b.util.isArray(c)) return !1;
150 var defaultOptions = { 150 var e = c.slice();
151 scales: { 151 for (var f = 0, g = e.length; f < g; f++) e[f].apply(this, d)
152 yAxes: [{ 152 }
153 ticks: { 153 return !0
154 beginAtZero: true 154 }
155 } 155 }("undefined" != typeof io ? io : module.exports, "undefined" != typeof io ? io : module.parent.exports),
156 }], 156 function(exports, nativeJSON) {
157 xAxes: [{ 157 function f(a) {
158 type: 'time', 158 return a < 10 ? "0" + a : a
159 time: { 159 }
160 unitStepSize: 30 160
161 }, 161 function date(a, b) {
162 gridLines: { 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 display: false 163 }
164 } 164
165 }] 165 function quote(a) {
166 }, 166 return escapable.lastIndex = 0, escapable.test(a) ? '"' + a.replace(escapable, function(a) {
167 tooltips: { 167 var b = meta[a];
168 enabled: false 168 return typeof b == "string" ? b : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4)
169 }, 169 }) + '"' : '"' + a + '"'
170 responsive: true, 170 }
171 maintainAspectRatio: false, 171
172 animation: false 172 function str(a, b) {
173 }; 173 var c, d, e, f, g = gap,
174 174 h, i = b[a];
175 var createChart = function (ctx, dataset) { 175 i instanceof Date && (i = date(a)), typeof rep == "function" && (i = rep.call(b, a, i));
176 return new Chart(ctx, { 176 switch (typeof i) {
177 type: 'line', 177 case "string":
178 data: { 178 return quote(i);
179 labels: [], 179 case "number":
180 datasets: dataset 180 return isFinite(i) ? String(i) : "null";
181 }, 181 case "boolean":
182 options: defaultOptions 182 case "null":
183 }); 183 return String(i);
184 }; 184 case "object":
185 185 if (!i) return "null";
186 var addTimestamp = function(point) { 186 gap += indent, h = [];
187 return point.timestamp; 187 if (Object.prototype.toString.apply(i) === "[object Array]") {
188 }; 188 f = i.length;
189 189 for (c = 0; c < f; c += 1) h[c] = str(c, i) || "null";
190 var cpuDataset = [Object.create(defaultDataset)]; 190 return e = h.length === 0 ? "[]" : gap ? "[\n" + gap + h.join(",\n" + gap) + "\n" + g + "]" : "[" + h.join(",") + "]", gap = g, e
191 var memDataset = [Object.create(defaultDataset)]; 191 }
192 var loadDataset = [Object.create(defaultDataset)]; 192 if (rep && typeof rep == "object") {
193 var responseTimeDataset = [Object.create(defaultDataset)]; 193 f = rep.length;
194 var rpsDataset = [Object.create(defaultDataset)]; 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 195 } else
196 var cpuStat = document.getElementById('cpuStat'); 196 for (d in i) Object.prototype.hasOwnProperty.call(i, d) && (e = str(d, i), e && h.push(quote(d) + (gap ? ": " : ":") + e));
197 var memStat = document.getElementById('memStat'); 197 return e = h.length === 0 ? "{}" : gap ? "{\n" + gap + h.join(",\n" + gap) + "\n" + g + "}" : "{" + h.join(",") + "}", gap = g, e
198 var loadStat = document.getElementById('loadStat'); 198 }
199 var responseTimeStat = document.getElementById('responseTimeStat'); 199 }
200 var rpsStat = document.getElementById('rpsStat'); 200 "use strict";
201 201 if (nativeJSON && nativeJSON.parse) return exports.JSON = {
202 var cpuChartCtx = document.getElementById("cpuChart"); 202 parse: nativeJSON.parse,
203 var memChartCtx = document.getElementById("memChart"); 203 stringify: nativeJSON.stringify
204 var loadChartCtx = document.getElementById("loadChart"); 204 };
205 var responseTimeChartCtx = document.getElementById("responseTimeChart"); 205 var JSON = exports.JSON = {},
206 var rpsChartCtx = document.getElementById("rpsChart"); 206 cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
207 207 escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
208 var cpuChart = createChart(cpuChartCtx, cpuDataset); 208 gap, indent, meta = {
209 var memChart = createChart(memChartCtx, memDataset); 209 "\b": "\\b",
210 var loadChart = createChart(loadChartCtx, loadDataset); 210 "\t": "\\t",
211 var responseTimeChart = createChart(responseTimeChartCtx, responseTimeDataset); 211 "\n": "\\n",
212 var rpsChart = createChart(rpsChartCtx, rpsDataset); 212 "\f": "\\f",
213 213 "\r": "\\r",
214 var charts = [cpuChart, memChart, loadChart, responseTimeChart, rpsChart]; 214 '"': '\\"',
215 215 "\\": "\\\\"
216 var onSpanChange = function (e) { 216 },
217 e.target.classList.add('active'); 217 rep;
218 defaultSpan = parseInt(e.target.id); 218 JSON.stringify = function(a, b, c) {
219 219 var d;
220 var otherSpans = document.getElementsByTagName('span'); 220 gap = "", indent = "";
221 for (var i = 0; i < otherSpans.length; i++) { 221 if (typeof c == "number")
222 if (otherSpans[i] !== e.target) otherSpans[i].classList.remove('active'); 222 for (d = 0; d < c; d += 1) indent += " ";
223 } 223 else typeof c == "string" && (indent = c);
224 224 rep = b;
225 socket.emit('change'); 225 if (!b || typeof b == "function" || typeof b == "object" && typeof b.length == "number") return str("", {
226 }; 226 "": a
227 227 });
228 socket.on('start', function (data) { 228 throw new Error("JSON.stringify")
229 // Remove last element of Array because it contains malformed responses data. 229 }, JSON.parse = function(text, reviver) {
230 // To keep consistency we also remove os data. 230 function walk(a, b) {
231 data[defaultSpan].responses.pop(); 231 var c, d, e = a[b];
232 data[defaultSpan].os.pop(); 232 if (e && typeof e == "object")
233 233 for (c in e) Object.prototype.hasOwnProperty.call(e, c) && (d = walk(e, c), d !== undefined ? e[c] = d : delete e[c]);
234 cpuStat.textContent = data[defaultSpan].os[data[defaultSpan].os.length - 1].cpu.toFixed(1) + '%'; 234 return reviver.call(a, b, e)
235 cpuChart.data.datasets[0].data = data[defaultSpan].os.map(function (point) { 235 }
236 return point.cpu; 236 var j;
237 }); 237 text = String(text), cx.lastIndex = 0, cx.test(text) && (text = text.replace(cx, function(a) {
238 cpuChart.data.labels = data[defaultSpan].os.map(addTimestamp); 238 return "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4)
239 239 }));
240 memStat.textContent = data[defaultSpan].os[data[defaultSpan].os.length - 1].memory.toFixed(1) + 'MB'; 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 memChart.data.datasets[0].data = data[defaultSpan].os.map(function (point) { 241 "": j
242 return point.memory; 242 }, "") : j;
243 }); 243 throw new SyntaxError("JSON.parse")
244 memChart.data.labels = data[defaultSpan].os.map(addTimestamp); 244 }
245 245 }("undefined" != typeof io ? io : module.exports, typeof JSON != "undefined" ? JSON : undefined),
246 loadStat.textContent = data[defaultSpan].os[data[defaultSpan].os.length - 1].load[defaultSpan].toFixed(2); 246 function(a, b) {
247 loadChart.data.datasets[0].data = data[defaultSpan].os.map(function (point) { 247 var c = a.parser = {},
248 return point.load[0]; 248 d = c.packets = ["disconnect", "connect", "heartbeat", "message", "json", "event", "ack", "error", "noop"],
249 }); 249 e = c.reasons = ["transport not supported", "client not handshaken", "unauthorized"],
250 loadChart.data.labels = data[defaultSpan].os.map(addTimestamp); 250 f = c.advice = ["reconnect"],
251 251 g = b.JSON,
252 responseTimeStat.textContent = data[defaultSpan].responses[data[defaultSpan].responses.length - 1].mean.toFixed(2) + 'ms'; 252 h = b.util.indexOf;
253 responseTimeChart.data.datasets[0].data = data[defaultSpan].responses.map(function (point) { 253 c.encodePacket = function(a) {
254 return point.mean; 254 var b = h(d, a.type),
255 }); 255 c = a.id || "",
256 responseTimeChart.data.labels = data[defaultSpan].responses.map(addTimestamp); 256 i = a.endpoint || "",
257 257 j = a.ack,
258 if (data[defaultSpan].responses.length >= 2) { 258 k = null;
259 var deltaTime = data[defaultSpan].responses[data[defaultSpan].responses.length - 1].timestamp - data[defaultSpan].responses[data[defaultSpan].responses.length - 2].timestamp; 259 switch (a.type) {
260 rpsStat.textContent = (data[defaultSpan].responses[data[defaultSpan].responses.length - 1].count / deltaTime * 1000).toFixed(2); 260 case "error":
261 rpsChart.data.datasets[0].data = data[defaultSpan].responses.map(function (point) { 261 var l = a.reason ? h(e, a.reason) : "",
262 return point.count / deltaTime * 1000; 262 m = a.advice ? h(f, a.advice) : "";
263 }); 263 if (l !== "" || m !== "") k = l + (m !== "" ? "+" + m : "");
264 rpsChart.data.labels = data[defaultSpan].responses.map(addTimestamp); 264 break;
265 } 265 case "message":
266 266 a.data !== "" && (k = a.data);
267 charts.forEach(function(chart) { 267 break;
268 chart.update(); 268 case "event":
269 }); 269 var n = {
270 270 name: a.name
271 var spanControls = document.getElementById('span-controls'); 271 };
272 if (data.length !== spans.length) { 272 a.args && a.args.length && (n.args = a.args), k = g.stringify(n);
273 data.forEach(function (span, index) { 273 break;
274 spans.push({ 274 case "json":
275 retention: span.retention, 275 k = g.stringify(a.data);
276 interval: span.interval 276 break;
277 }); 277 case "connect":
278 278 a.qs && (k = a.qs);
279 var spanNode = document.createElement('span'); 279 break;
280 var textNode = document.createTextNode((span.retention * span.interval) / 60 + "M"); 280 case "ack":
281 spanNode.appendChild(textNode); 281 k = a.ackId + (a.args && a.args.length ? "+" + g.stringify(a.args) : "")
282 spanNode.setAttribute('id', index); 282 }
283 spanNode.onclick = onSpanChange; 283 var o = [b, c + (j == "data" ? "+" : ""), i];
284 spanControls.appendChild(spanNode); 284 return k !== null && k !== undefined && o.push(k), o.join(":")
285 }); 285 }, c.encodePayload = function(a) {
286 document.getElementsByTagName('span')[0].classList.add('active'); 286 var b = "";
287 } 287 if (a.length == 1) return a[0];
288 }); 288 for (var c = 0, d = a.length; c < d; c++) {
289 289 var e = a[c];
290 socket.on('stats', function (data) { 290 b += "\ufffd" + e.length + "\ufffd" + a[c]
291 if (data.retention === spans[defaultSpan].retention && data.interval === spans[defaultSpan].interval) { 291 }
292 cpuStat.textContent = data.os.cpu.toFixed(1) + '%'; 292 return b
293 cpuChart.data.datasets[0].data.push(data.os.cpu); 293 };
294 cpuChart.data.labels.push(data.os.timestamp); 294 var i = /([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]*)?/;
295 295 c.decodePacket = function(a) {
296 memStat.textContent = data.os.memory.toFixed(1) + 'MB'; 296 var b = a.match(i);
297 memChart.data.datasets[0].data.push(data.os.memory); 297 if (!b) return {};
298 memChart.data.labels.push(data.os.timestamp); 298 var c = b[2] || "",
299 299 a = b[5] || "",
300 loadStat.textContent = data.os.load[0].toFixed(2); 300 h = {
301 loadChart.data.datasets[0].data.push(data.os.load[0]); 301 type: d[b[1]],
302 loadChart.data.labels.push(data.os.timestamp); 302 endpoint: b[4] || ""
303 303 };
304 responseTimeStat.textContent = data.responses.mean.toFixed(2) + 'ms'; 304 c && (h.id = c, b[3] ? h.ack = "data" : h.ack = !0);
305 responseTimeChart.data.datasets[0].data.push(data.responses.mean); 305 switch (h.type) {
306 responseTimeChart.data.labels.push(data.responses.timestamp); 306 case "error":
307 307 var b = a.split("+");
308 var deltaTime = data.responses.timestamp - rpsChart.data.labels[rpsChart.data.labels.length - 1]; 308 h.reason = e[b[0]] || "", h.advice = f[b[1]] || "";
309 rpsStat.textContent = (data.responses.count / deltaTime * 1000).toFixed(2); 309 break;
310 rpsChart.data.datasets[0].data.push(data.responses.count / deltaTime * 1000); 310 case "message":
311 rpsChart.data.labels.push(data.responses.timestamp); 311 h.data = a || "";
312 312 break;
313 charts.forEach(function (chart) { 313 case "event":
314 if (spans[defaultSpan].retention < chart.data.labels.length) { 314 try {
315 chart.data.datasets[0].data.shift(); 315 var j = g.parse(a);
316 chart.data.labels.shift(); 316 h.name = j.name, h.args = j.args
317 } 317 } catch (k) {}
318 318 h.args = h.args || [];
319 chart.update(); 319 break;
320 }); 320 case "json":
321 } 321 try {
322 }); 322 h.data = g.parse(a)
323 </script> 323 } catch (k) {}
324 </body> 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>
1422 <style>
1423 * {
1424 font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
1425 }
1426
1427 h1 {
1428 font-size: 3em;
1429 color: #222222;
1430 margin: 0;
1431 }
1432
1433 h5 {
1434 margin: 0;
1435 color: #888888;
1436 }
1437
1438 p {
1439 font-size: 0.7em;
1440 color: #888888;
1441 }
1442
1443 span {
1444 cursor: pointer;
1445 font-size: 10px;
1446 margin-left: 5px;
1447 border: 1px solid #DDD;
1448 padding: 3px 10px 4px 10px;
1449 }
1450
1451 canvas {
1452 width: 400px;
1453 height: 100px;
1454 }
1455
1456 .active {
1457 background: #eeeeee;
1458 }
1459
1460 .stats-column {
1461 flex: 0 0 200px;
1462 }
1463
1464 .container {
1465 display: flex;
1466 flex-direction: row;
1467 margin-top: 20px;
1468 height: 100px;
1469 }
1470
1471 .chart-container {
1472 width: 400px;
1473 height: 100px;
1474 }
1475
1476 .footer {
1477 position: fixed;
1478 margin: auto;
1479 text-align: center;
1480 left: 0;
1481 right: 0;
1482 bottom: 0;
1483 }
1484
1485 .span-controls {
1486 float: right;
1487 }
1488 </style>
1489 </head>
1490
1491 <body>
1492 <div style="width: 600px; margin: auto">
1493 <div class="header">
1494 <b>{{title}}</b>
1495 <div id="span-controls" class="span-controls">
1496 </div>
1497 </div>
1498 <div class="container">
1499 <div class="stats-column">
1500 <h5>CPU Usage</h5>
1501 <h1 id="cpuStat">- %</h1>
1502 </div>
1503 <div class="chart-container">
1504 <canvas id="cpuChart" width="400" height="100"></canvas>
1505 </div>
1506 </div>
1507 <div class="container">
1508 <div class="stats-column">
1509 <h5>Memory Usage</h5>
1510 <h1 id="memStat">- %</h1>
1511 </div>
1512 <div class="chart-container">
1513 <canvas id="memChart" width="200" height="100"></canvas>
1514 </div>
1515 </div>
1516 <div class="container">
1517 <div class="stats-column">
1518 <h5>One Minute Load Avg</h5>
1519 <h1 id="loadStat">-</h1>
1520 </div>
1521 <div class="chart-container">
1522 <canvas id="loadChart" width="200" height="100"></canvas>
1523 </div>
1524 </div>
1525 <div class="container">
1526 <div class="stats-column">
1527 <h5>Response Time</h5>
1528 <h1 id="responseTimeStat">-</h1>
1529 </div>
1530 <div class="chart-container">
1531 <canvas id="responseTimeChart" width="200" height="100"></canvas>
1532 </div>
1533 </div>
1534 <div class="container">
1535 <div class="stats-column">
1536 <h5>Requests per Second</h5>
1537 <h1 id="rpsStat">-</h1>
1538 </div>
1539 <div class="chart-container">
1540 <canvas id="rpsChart" width="200" height="100"></canvas>
1541 </div>
1542 </div>
1543 <div class="footer">
1544 <p>Made with &#9829; with Socket.io & Chart.js</p>
1545 </div>
1546 </div>
1547 <script>
1548 Chart.defaults.global.defaultFontSize = 8;
1549 Chart.defaults.global.animation.duration = 500;
1550 Chart.defaults.global.legend.display = false;
1551 Chart.defaults.global.elements.line.backgroundColor = "rgba(0,0,0,0)";
1552 Chart.defaults.global.elements.line.borderColor = "rgba(0,0,0,0.9)";
1553 Chart.defaults.global.elements.line.borderWidth = 2;
1554
1555 var socket = io.connect(location.protocol + '//' + location.hostname + ':' + location.port);
1556 var defaultSpan = 0;
1557 var spans = [];
1558
1559 var defaultDataset = {
1560 label: '',
1561 data: [],
1562 lineTension: 0.2,
1563 pointRadius: 0
1564 };
1565
1566 var defaultOptions = {
1567 scales: {
1568 yAxes: [{
1569 ticks: {
1570 beginAtZero: true
1571 }
1572 }],
1573 xAxes: [{
1574 type: 'time',
1575 time: {
1576 unitStepSize: 30
1577 },
1578 gridLines: {
1579 display: false
1580 }
1581 }]
1582 },
1583 tooltips: {
1584 enabled: false
1585 },
1586 responsive: true,
1587 maintainAspectRatio: false,
1588 animation: false
1589 };
1590
1591 var createChart = function(ctx, dataset) {
1592 return new Chart(ctx, {
1593 type: 'line',
1594 data: {
1595 labels: [],
1596 datasets: dataset
1597 },
1598 options: defaultOptions
1599 });
1600 };
1601
1602 var addTimestamp = function(point) {
1603 return point.timestamp;
1604 };
1605
1606 var cpuDataset = [Object.create(defaultDataset)];
1607 var memDataset = [Object.create(defaultDataset)];
1608 var loadDataset = [Object.create(defaultDataset)];
1609 var responseTimeDataset = [Object.create(defaultDataset)];
1610 var rpsDataset = [Object.create(defaultDataset)];
1611
1612 var cpuStat = document.getElementById('cpuStat');
1613 var memStat = document.getElementById('memStat');
1614 var loadStat = document.getElementById('loadStat');
1615 var responseTimeStat = document.getElementById('responseTimeStat');
1616 var rpsStat = document.getElementById('rpsStat');
1617
1618 var cpuChartCtx = document.getElementById("cpuChart");
1619 var memChartCtx = document.getElementById("memChart");
1620 var loadChartCtx = document.getElementById("loadChart");
1621 var responseTimeChartCtx = document.getElementById("responseTimeChart");
1622 var rpsChartCtx = document.getElementById("rpsChart");
1623
1624 var cpuChart = createChart(cpuChartCtx, cpuDataset);
1625 var memChart = createChart(memChartCtx, memDataset);
1626 var loadChart = createChart(loadChartCtx, loadDataset);
1627 var responseTimeChart = createChart(responseTimeChartCtx, responseTimeDataset);
1628 var rpsChart = createChart(rpsChartCtx, rpsDataset);
1629
1630 var charts = [cpuChart, memChart, loadChart, responseTimeChart, rpsChart];
1631
1632 var onSpanChange = function(e) {
1633 e.target.classList.add('active');
1634 defaultSpan = parseInt(e.target.id);
1635
1636 var otherSpans = document.getElementsByTagName('span');
1637 for (var i = 0; i < otherSpans.length; i++) {
1638 if (otherSpans[i] !== e.target) otherSpans[i].classList.remove('active');
1639 }
1640
1641 socket.emit('change');
1642 };
1643
1644 socket.on('start', function(data) {
1645 // Remove last element of Array because it contains malformed responses data.
1646 // To keep consistency we also remove os data.
1647 data[defaultSpan].responses.pop();
1648 data[defaultSpan].os.pop();
1649
1650 cpuStat.textContent = data[defaultSpan].os[data[defaultSpan].os.length - 1].cpu.toFixed(1) + '%';
1651 cpuChart.data.datasets[0].data = data[defaultSpan].os.map(function(point) {
1652 return point.cpu || 0;
1653 });
1654 cpuChart.data.labels = data[defaultSpan].os.map(addTimestamp);
1655
1656 memStat.textContent = data[defaultSpan].os[data[defaultSpan].os.length - 1].memory.toFixed(1) + 'MB';
1657 memChart.data.datasets[0].data = data[defaultSpan].os.map(function(point) {
1658 return point.memory;
1659 });
1660 memChart.data.labels = data[defaultSpan].os.map(addTimestamp);
1661
1662 loadStat.textContent = data[defaultSpan].os[data[defaultSpan].os.length - 1].load[defaultSpan].toFixed(2);
1663 loadChart.data.datasets[0].data = data[defaultSpan].os.map(function(point) {
1664 return point.load[0];
1665 });
1666 loadChart.data.labels = data[defaultSpan].os.map(addTimestamp);
1667
1668 responseTimeStat.textContent = data[defaultSpan].responses[data[defaultSpan].responses.length - 1].mean.toFixed(2) + 'ms';
1669 responseTimeChart.data.datasets[0].data = data[defaultSpan].responses.map(function(point) {
1670 return point.mean;
1671 });
1672 responseTimeChart.data.labels = data[defaultSpan].responses.map(addTimestamp);
1673
1674 if (data[defaultSpan].responses.length >= 2) {
1675 var deltaTime = data[defaultSpan].responses[data[defaultSpan].responses.length - 1].timestamp - data[defaultSpan].responses[data[defaultSpan].responses.length - 2].timestamp;
1676 rpsStat.textContent = (data[defaultSpan].responses[data[defaultSpan].responses.length - 1].count / deltaTime * 1000).toFixed(2);
1677 rpsChart.data.datasets[0].data = data[defaultSpan].responses.map(function(point) {
1678 return point.count / deltaTime * 1000;
1679 });
1680 rpsChart.data.labels = data[defaultSpan].responses.map(addTimestamp);
1681 }
1682
1683 charts.forEach(function(chart) {
1684 chart.update();
1685 });
1686
1687 var spanControls = document.getElementById('span-controls');
1688 if (data.length !== spans.length) {
1689 data.forEach(function(span, index) {
1690 spans.push({
1691 retention: span.retention,
1692 interval: span.interval
1693 });
1694
1695 var spanNode = document.createElement('span');
1696 var textNode = document.createTextNode((span.retention * span.interval) / 60 + "M");
1697 spanNode.appendChild(textNode);
1698 spanNode.setAttribute('id', index);
1699 spanNode.onclick = onSpanChange;
1700 spanControls.appendChild(spanNode);
1701 });
1702 document.getElementsByTagName('span')[0].classList.add('active');
1703 }
1704 });
1705
1706 socket.on('stats', function(data) {
1707 if (data.retention === spans[defaultSpan].retention && data.interval === spans[defaultSpan].interval) {
1708 cpuStat.textContent = (data.os.cpu || 0).toFixed(1) + '%';
1709 cpuChart.data.datasets[0].data.push(data.os.cpu);
1710 cpuChart.data.labels.push(data.os.timestamp);
1711
1712 memStat.textContent = data.os.memory.toFixed(1) + 'MB';
1713 memChart.data.datasets[0].data.push(data.os.memory);
1714 memChart.data.labels.push(data.os.timestamp);
1715
1716 loadStat.textContent = data.os.load[0].toFixed(2);
1717 loadChart.data.datasets[0].data.push(data.os.load[0]);
1718 loadChart.data.labels.push(data.os.timestamp);
1719
1720 responseTimeStat.textContent = data.responses.mean.toFixed(2) + 'ms';
1721 responseTimeChart.data.datasets[0].data.push(data.responses.mean);
1722 responseTimeChart.data.labels.push(data.responses.timestamp);
1723
1724 var deltaTime = data.responses.timestamp - rpsChart.data.labels[rpsChart.data.labels.length - 1];
1725 rpsStat.textContent = (data.responses.count / deltaTime * 1000).toFixed(2);
1726 rpsChart.data.datasets[0].data.push(data.responses.count / deltaTime * 1000);
1727 rpsChart.data.labels.push(data.responses.timestamp);
1728
1729 charts.forEach(function(chart) {
1730 if (spans[defaultSpan].retention < chart.data.labels.length) {
1731 chart.data.datasets[0].data.shift();
1732 chart.data.labels.shift();
1733 }
1734
1735 chart.update();
1736 });
1737 }
1738 });
1739 </script>
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');
5 const path = require('path'); 5 const path = require('path');
6 const os = require('os'); 6 const os = require('os');
7 const onHeaders = require('on-headers'); 7 const onHeaders = require('on-headers');
8 const pidusage = require('pidusage'); 8 const pidusage = require('pidusage');
9 let io; 9 let io;
10 10
11 const defaultConfig = { 11 const defaultConfig = {
12 title: 'Express Status', 12 uri: 'www.cert.coder.fi',
13 path: '/status', 13 port: 4000,
14 spans: [{ 14 title: 'Express Status',
15 interval: 1, 15 path: '/status',
16 retention: 60 16 spans: [{
17 }, { 17 interval: 1,
18 interval: 5, 18 retention: 60
19 retention: 60 19 }, {
20 }, { 20 interval: 5,
21 interval: 15, 21 retention: 60
22 retention: 60 22 }, {
23 }] 23 interval: 15,
24 }; 24 retention: 60
25 25 }]
26 const gatherOsMetrics = (io, span) => { 26 };
27 const defaultResponse = { 27
28 '2': 0, 28 const gatherOsMetrics = (io, span) => {
29 '3': 0, 29 const defaultResponse = {
30 '4': 0, 30 '2': 0,
31 '5': 0, 31 '3': 0,
32 count: 0, 32 '4': 0,
33 mean: 0, 33 '5': 0,
34 timestamp: Date.now() 34 count: 0,
35 }; 35 mean: 0,
36 36 timestamp: Date.now()
37 pidusage.stat(process.pid, (err, stat) => { 37 };
38 const last = span.responses[span.responses.length - 1]; 38
39 // Convert from B to MB 39 pidusage.stat(process.pid, (err, stat) => {
40 stat.memory = stat.memory / 1024 / 1024; 40 const last = span.responses[span.responses.length - 1];
41 stat.load = os.loadavg(); 41 // Convert from B to MB
42 stat.timestamp = Date.now(); 42 stat.memory = stat.memory / 1024 / 1024;
43 43 stat.load = os.loadavg();
44 span.os.push(stat); 44 stat.timestamp = Date.now();
45 if (!span.responses[0] || last.timestamp + (span.interval * 1000) < Date.now()) span.responses.push(defaultResponse); 45
46 46 span.os.push(stat);
47 if (span.os.length >= span.retention) span.os.shift(); 47 if (!span.responses[0] || last.timestamp + (span.interval * 1000) < Date.now()) span.responses.push(defaultResponse);
48 if (span.responses[0] && span.responses.length > span.retention) span.responses.shift(); 48
49 49 if (span.os.length >= span.retention) span.os.shift();
50 sendMetrics(io, span); 50 if (span.responses[0] && span.responses.length > span.retention) span.responses.shift();
51 }); 51
52 }; 52 sendMetrics(io, span);
53 53 });
54 const sendMetrics = (io, span) => { 54 };
55 io.emit('stats', { 55
56 os: span.os[span.os.length - 2], 56 const sendMetrics = (io, span) => {
57 responses: span.responses[span.responses.length - 2], 57 io.emit('stats', {
58 interval: span.interval, 58 os: span.os[span.os.length - 2],
59 retention: span.retention 59 responses: span.responses[span.responses.length - 2],
60 }); 60 interval: span.interval,
61 }; 61 retention: span.retention
62 62 });
63 const middlewareWrapper = (config) => { 63 };
64 if (config === null || config === undefined) { 64
65 config = defaultConfig; 65 const middlewareWrapper = (config, server) => {
66 } 66 if (config === null || config === undefined) {
67 67 config = defaultConfig;
68 if (config.path === undefined || !config instanceof String) { 68 }
69 config.path = defaultConfig.path; 69
70 } 70 if (config.path === undefined || !config instanceof String) {
71 71 config.path = defaultConfig.path;
72 if (config.spans === undefined || !config instanceof Array) { 72 }
73 config.spans = defaultConfig.spans; 73
74 } 74 if (config.spans === undefined || !config instanceof Array) {
75 75 config.spans = defaultConfig.spans;
76 if (config.title === undefined || !config instanceof String) { 76 }
77 config.title = 'Express Status'; 77
78 } 78 if (config.title === undefined || !config instanceof String) {
79 79 config.title = 'Express Status';
80 let renderedHtml; 80 }
81 fs.readFile(path.join(__dirname, '/index.html'), function(err, html){ 81
82 renderedHtml = html.toString().replace(/{{title}}/g, config.title); 82 let renderedHtml;
83 }); 83 fs.readFile(path.join(__dirname, '/index.html'), function(err, html) {
84 84 renderedHtml = html.toString().replace(/{{title}}/g, config.title);
85 return (req, res, next) => { 85 });
86 if (io === null || io === undefined) { 86
87 87 return (req, res, next) => {
88 io = require('socket.io')(req.socket.server); 88 if (io === null || io === undefined) {
89 89 //console.log(req)
90 io.on('connection', (socket) => { 90 io = require('socket.io').listen(server);
91 socket.emit('start', config.spans); 91
92 socket.on('change', function() { socket.emit('start', config.spans); }); 92 io.on('connection', (socket) => {
93 }); 93 socket.emit('start', config.spans);
94 94 socket.on('change', function() {
95 config.spans.forEach((span) => { 95 socket.emit('start', config.spans);
96 span.os = []; 96 });
97 span.responses = []; 97 });
98 setInterval(() => gatherOsMetrics(io, span), span.interval * 1000); 98
99 }); 99 config.spans.forEach((span) => {
100 } 100 span.os = [];
101 101 span.responses = [];
102 const startTime = process.hrtime(); 102 setInterval(() => gatherOsMetrics(io, span), span.interval * 1000);
103 if (req.path === config.path) { 103 });
104 res.send(renderedHtml); 104 }
105 } else { 105
106 onHeaders(res, () => { 106 const startTime = process.hrtime();
107 const diff = process.hrtime(startTime); 107 if (req.path === config.path) {
108 const responseTime = diff[0] * 1e3 + diff[1] * 1e-6; 108 res.send(renderedHtml);
109 const category = Math.floor(res.statusCode / 100); 109 } else {
110 110 onHeaders(res, () => {
111 config.spans.forEach((span) => { 111 const diff = process.hrtime(startTime);
112 const last = span.responses[span.responses.length - 1]; 112 const responseTime = diff[0] * 1e3 + diff[1] * 1e-6;
113 if (last !== undefined && 113 const category = Math.floor(res.statusCode / 100);
114 last.timestamp / 1000 + span.interval > Date.now() / 1000) { 114
115 last[category]++; 115 config.spans.forEach((span) => {
116 last.count++; 116 const last = span.responses[span.responses.length - 1];
117 last.mean = last.mean + ((responseTime - last.mean) / last.count); 117 if (last !== undefined &&
118 } else { 118 last.timestamp / 1000 + span.interval > Date.now() / 1000) {
119 span.responses.push({ 119 last[category]++;
120 '2': category === 2 ? 1 : 0, 120 last.count++;
121 '3': category === 3 ? 1 : 0, 121 last.mean = last.mean + ((responseTime - last.mean) / last.count);
122 '4': category === 4 ? 1 : 0, 122 } else {
123 '5': category === 5 ? 1 : 0, 123 span.responses.push({
124 count: 1, 124 '2': category === 2 ? 1 : 0,
125 mean: responseTime, 125 '3': category === 3 ? 1 : 0,
126 timestamp: Date.now() 126 '4': category === 4 ? 1 : 0,
127 }); 127 '5': category === 5 ? 1 : 0,
128 } 128 count: 1,
129 }); 129 mean: responseTime,
130 }); 130 timestamp: Date.now()
131 131 });
132 next(); 132 }
133 } 133 });
134 }; 134 });
135 }; 135
136 136 next();
137 module.exports = middlewareWrapper; 137 }
138 138 };
139 }()); 139 };
140
141 module.exports = middlewareWrapper;
142
143 }());
......
1 MIT License 1 MIT License
2 2
3 Copyright (c) 2016 Rafal Wilinski 3 Copyright (c) 2016 Rafal Wilinski
4 4
5 Permission is hereby granted, free of charge, to any person obtaining a copy 5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal 6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights 7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is 9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions: 10 furnished to do so, subject to the following conditions:
11 11
12 The above copyright notice and this permission notice shall be included in all 12 The above copyright notice and this permission notice shall be included in all
13 copies or substantial portions of the Software. 13 copies or substantial portions of the Software.
14 14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 SOFTWARE. 21 SOFTWARE.
...\ No newline at end of file ...\ No newline at end of file
......
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": [
7 "node", 7 "node",
8 "status", 8 "status",
9 "monitoring", 9 "monitoring",
10 "express", 10 "express",
11 "charts" 11 "charts"
12 ], 12 ],
13 "author": "Rafal Wilinski <raf.wilinski@gmail.com> (http://rwilinski.me)", 13 "author": "Rafal Wilinski <raf.wilinski@gmail.com> (http://rwilinski.me)",
14 "contributors": [ 14 "contributors": [
15 { 15 {
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 } 19 },
20 ], 20 {
21 "repository": { 21 "name": "Jabis Sevon",
22 "type": "git", 22 "email": "jabis.is@gmail.com",
23 "url": "https://github.com/RafalWilinski/express-status-monitor.git" 23 "url": "https://jscodex.com"
24 }, 24 }
25 "license": "MIT", 25
26 "dependencies": { 26 ],
27 "on-headers": "^1.0.1", 27 "repository": {
28 "pidusage": "^1.0.4", 28 "type": "git",
29 "socket.io": "^1.4.8" 29 "url": "https://github.com/RafalWilinski/express-status-monitor.git"
30 } 30 },
31 } 31 "license": "MIT",
32 "dependencies": {
33 "on-headers": "^1.0.1",
34 "pidusage": "^1.0.4",
35 "socket.io": "^0.9.17"
36 }
37 }
......
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
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!