juggernaut 2.0.4 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.4
1
+ 2.1.0
@@ -1,6 +1,3 @@
1
- // For sprockets:
2
- //
3
- //= require json
4
1
  //= require socket_io
5
2
 
6
3
  var Juggernaut = function(options){
@@ -137,3 +134,9 @@ Juggernaut.Message.prototype.toJSON = function(){
137
134
  }
138
135
  return(JSON.stringify(object));
139
136
  };
137
+
138
+ if (typeof module != "undefined") {
139
+ module.exports = Juggernaut;
140
+ } else {
141
+ window.Juggernaut = Juggernaut;
142
+ }
@@ -1,4 +1,4 @@
1
- /*! Socket.IO.js build:0.8.4, development. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */
1
+ /*! Socket.IO.js build:0.8.6, development. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */
2
2
 
3
3
  /**
4
4
  * socket.io
@@ -6,7 +6,7 @@
6
6
  * MIT Licensed
7
7
  */
8
8
 
9
- (function (exports) {
9
+ (function (exports, global) {
10
10
 
11
11
  /**
12
12
  * IO namespace.
@@ -22,7 +22,7 @@
22
22
  * @api public
23
23
  */
24
24
 
25
- io.version = '0.8.4';
25
+ io.version = '0.8.6';
26
26
 
27
27
  /**
28
28
  * Protocol implemented.
@@ -69,10 +69,11 @@
69
69
  , uuri
70
70
  , socket;
71
71
 
72
- if ('undefined' != typeof document) {
73
- uri.protocol = uri.protocol || document.location.protocol.slice(0, -1);
74
- uri.host = uri.host || document.domain;
75
- uri.port = uri.port || document.location.port;
72
+ if (global && global.location) {
73
+ uri.protocol = uri.protocol || global.location.protocol.slice(0, -1);
74
+ uri.host = uri.host || (global.document
75
+ ? global.document.domain : global.location.hostname);
76
+ uri.port = uri.port || global.location.port;
76
77
  }
77
78
 
78
79
  uuri = io.util.uniqueUri(uri);
@@ -100,7 +101,7 @@
100
101
  return socket.of(uri.path.length > 1 ? uri.path : '');
101
102
  };
102
103
 
103
- })('object' === typeof module ? module.exports : (window.io = {}));
104
+ })('object' === typeof module ? module.exports : (this.io = {}), this);
104
105
 
105
106
  /**
106
107
  * socket.io
@@ -259,20 +260,18 @@
259
260
 
260
261
  util.request = function (xdomain) {
261
262
 
262
- if ('undefined' != typeof window) {
263
- if (xdomain && window.XDomainRequest) {
264
- return new XDomainRequest();
265
- }
263
+ if (xdomain && 'undefined' != typeof XDomainRequest) {
264
+ return new XDomainRequest();
265
+ }
266
266
 
267
- if (window.XMLHttpRequest && (!xdomain || util.ua.hasCORS)) {
268
- return new XMLHttpRequest();
269
- }
267
+ if ('undefined' != typeof XMLHttpRequest && (!xdomain || util.ua.hasCORS)) {
268
+ return new XMLHttpRequest();
269
+ }
270
270
 
271
- if (!xdomain) {
272
- try {
273
- return new window.ActiveXObject('Microsoft.XMLHTTP');
274
- } catch(e) { }
275
- }
271
+ if (!xdomain) {
272
+ try {
273
+ return new ActiveXObject('Microsoft.XMLHTTP');
274
+ } catch(e) { }
276
275
  }
277
276
 
278
277
  return null;
@@ -303,7 +302,7 @@
303
302
  */
304
303
 
305
304
  util.defer = function (fn) {
306
- if (!util.ua.webkit) {
305
+ if (!util.ua.webkit || 'undefined' != typeof importScripts) {
307
306
  return fn();
308
307
  }
309
308
 
@@ -405,7 +404,7 @@
405
404
  }
406
405
 
407
406
  for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0;
408
- i < j && arr[i] !== o; i++);
407
+ i < j && arr[i] !== o; i++) {}
409
408
 
410
409
  return j <= i ? -1 : i;
411
410
  };
@@ -439,8 +438,7 @@
439
438
  * @api public
440
439
  */
441
440
 
442
- util.ua.hasCORS = 'undefined' != typeof window && window.XMLHttpRequest &&
443
- (function () {
441
+ util.ua.hasCORS = 'undefined' != typeof XMLHttpRequest && (function () {
444
442
  try {
445
443
  var a = new XMLHttpRequest();
446
444
  } catch (e) {
@@ -459,10 +457,7 @@
459
457
  util.ua.webkit = 'undefined' != typeof navigator
460
458
  && /webkit/i.test(navigator.userAgent);
461
459
 
462
- })(
463
- 'undefined' != typeof window ? io : module.exports
464
- , this
465
- );
460
+ })('undefined' != typeof io ? io : module.exports, this);
466
461
 
467
462
  /**
468
463
  * socket.io
@@ -1231,7 +1226,6 @@
1231
1226
  'undefined' != typeof io ? io : module.exports
1232
1227
  , 'undefined' != typeof io ? io : module.parent.exports
1233
1228
  );
1234
-
1235
1229
  /**
1236
1230
  * socket.io
1237
1231
  * Copyright(c) 2011 LearnBoost <dev@learnboost.com>
@@ -1275,7 +1269,13 @@
1275
1269
 
1276
1270
  Transport.prototype.onData = function (data) {
1277
1271
  this.clearCloseTimeout();
1278
- this.setCloseTimeout();
1272
+
1273
+ // If the connection in currently open (or in a reopening state) reset the close
1274
+ // timeout since we have just received data. This check is necessary so
1275
+ // that we don't reset the timeout on an explicitly disconnected connection.
1276
+ if (this.connected || this.connecting || this.reconnecting) {
1277
+ this.setCloseTimeout();
1278
+ }
1279
1279
 
1280
1280
  if (data !== '') {
1281
1281
  // todo: we should only do decodePayload for xhr transports
@@ -1334,7 +1334,7 @@
1334
1334
  */
1335
1335
 
1336
1336
  Transport.prototype.onDisconnect = function () {
1337
- if (this.close) this.close();
1337
+ if (this.close && this.open) this.close();
1338
1338
  this.clearTimeouts();
1339
1339
  this.socket.onDisconnect();
1340
1340
  return this;
@@ -1429,8 +1429,8 @@
1429
1429
  }, this.socket.options['reopen delay']);*/
1430
1430
 
1431
1431
  this.open = false;
1432
- this.setCloseTimeout();
1433
1432
  this.socket.onClose();
1433
+ this.onDisconnect();
1434
1434
  };
1435
1435
 
1436
1436
  /**
@@ -1596,12 +1596,12 @@
1596
1596
  var url = [
1597
1597
  'http' + (options.secure ? 's' : '') + ':/'
1598
1598
  , options.host + ':' + options.port
1599
- , this.options.resource
1599
+ , options.resource
1600
1600
  , io.protocol
1601
1601
  , io.util.query(this.options.query, 't=' + +new Date)
1602
1602
  ].join('/');
1603
1603
 
1604
- if (this.isXDomain()) {
1604
+ if (this.isXDomain() && !io.util.ua.hasCORS) {
1605
1605
  var insertAt = document.getElementsByTagName('script')[0]
1606
1606
  , script = document.createElement('script');
1607
1607
 
@@ -1806,10 +1806,11 @@
1806
1806
 
1807
1807
  Socket.prototype.isXDomain = function () {
1808
1808
 
1809
- var port = window.location.port ||
1810
- ('https:' == window.location.protocol ? 443 : 80);
1809
+ var port = global.location.port ||
1810
+ ('https:' == global.location.protocol ? 443 : 80);
1811
1811
 
1812
- return this.options.host !== document.domain || this.options.port != port;
1812
+ return this.options.host !== global.location.hostname
1813
+ || this.options.port != port;
1813
1814
  };
1814
1815
 
1815
1816
  /**
@@ -2235,7 +2236,7 @@
2235
2236
  * MIT Licensed
2236
2237
  */
2237
2238
 
2238
- (function (exports, io) {
2239
+ (function (exports, io, global) {
2239
2240
 
2240
2241
  /**
2241
2242
  * Expose constructor.
@@ -2287,7 +2288,7 @@
2287
2288
 
2288
2289
 
2289
2290
  if (!Socket) {
2290
- Socket = window.MozWebSocket || window.WebSocket;
2291
+ Socket = global.MozWebSocket || global.WebSocket;
2291
2292
  }
2292
2293
 
2293
2294
  this.websocket = new Socket(this.prepareUrl() + query);
@@ -2378,8 +2379,8 @@
2378
2379
  */
2379
2380
 
2380
2381
  WS.check = function () {
2381
- return ('WebSocket' in window && !('__addTask' in WebSocket))
2382
- || 'MozWebSocket' in window;
2382
+ return ('WebSocket' in global && !('__addTask' in WebSocket))
2383
+ || 'MozWebSocket' in global;
2383
2384
  };
2384
2385
 
2385
2386
  /**
@@ -2404,551 +2405,9 @@
2404
2405
  })(
2405
2406
  'undefined' != typeof io ? io.Transport : module.exports
2406
2407
  , 'undefined' != typeof io ? io : module.parent.exports
2408
+ , this
2407
2409
  );
2408
2410
 
2409
- /**
2410
- * socket.io
2411
- * Copyright(c) 2011 LearnBoost <dev@learnboost.com>
2412
- * MIT Licensed
2413
- */
2414
-
2415
- (function (exports, io) {
2416
-
2417
- /**
2418
- * Expose constructor.
2419
- */
2420
-
2421
- exports.flashsocket = Flashsocket;
2422
-
2423
- /**
2424
- * The FlashSocket transport. This is a API wrapper for the HTML5 WebSocket
2425
- * specification. It uses a .swf file to communicate with the server. If you want
2426
- * to serve the .swf file from a other server than where the Socket.IO script is
2427
- * coming from you need to use the insecure version of the .swf. More information
2428
- * about this can be found on the github page.
2429
- *
2430
- * @constructor
2431
- * @extends {io.Transport.websocket}
2432
- * @api public
2433
- */
2434
-
2435
- function Flashsocket () {
2436
- io.Transport.websocket.apply(this, arguments);
2437
- };
2438
-
2439
- /**
2440
- * Inherits from Transport.
2441
- */
2442
-
2443
- io.util.inherit(Flashsocket, io.Transport.websocket);
2444
-
2445
- /**
2446
- * Transport name
2447
- *
2448
- * @api public
2449
- */
2450
-
2451
- Flashsocket.prototype.name = 'flashsocket';
2452
-
2453
- /**
2454
- * Disconnect the established `FlashSocket` connection. This is done by adding a
2455
- * new task to the FlashSocket. The rest will be handled off by the `WebSocket`
2456
- * transport.
2457
- *
2458
- * @returns {Transport}
2459
- * @api public
2460
- */
2461
-
2462
- Flashsocket.prototype.open = function () {
2463
- var self = this
2464
- , args = arguments;
2465
-
2466
- WebSocket.__addTask(function () {
2467
- io.Transport.websocket.prototype.open.apply(self, args);
2468
- });
2469
- return this;
2470
- };
2471
-
2472
- /**
2473
- * Sends a message to the Socket.IO server. This is done by adding a new
2474
- * task to the FlashSocket. The rest will be handled off by the `WebSocket`
2475
- * transport.
2476
- *
2477
- * @returns {Transport}
2478
- * @api public
2479
- */
2480
-
2481
- Flashsocket.prototype.send = function () {
2482
- var self = this, args = arguments;
2483
- WebSocket.__addTask(function () {
2484
- io.Transport.websocket.prototype.send.apply(self, args);
2485
- });
2486
- return this;
2487
- };
2488
-
2489
- /**
2490
- * Disconnects the established `FlashSocket` connection.
2491
- *
2492
- * @returns {Transport}
2493
- * @api public
2494
- */
2495
-
2496
- Flashsocket.prototype.close = function () {
2497
- WebSocket.__tasks.length = 0;
2498
- io.Transport.websocket.prototype.close.call(this);
2499
- return this;
2500
- };
2501
-
2502
- /**
2503
- * The WebSocket fall back needs to append the flash container to the body
2504
- * element, so we need to make sure we have access to it. Or defer the call
2505
- * until we are sure there is a body element.
2506
- *
2507
- * @param {Socket} socket The socket instance that needs a transport
2508
- * @param {Function} fn The callback
2509
- * @api private
2510
- */
2511
-
2512
- Flashsocket.prototype.ready = function (socket, fn) {
2513
- function init () {
2514
- var options = socket.options
2515
- , port = options['flash policy port']
2516
- , path = [
2517
- 'http' + (options.secure ? 's' : '') + ':/'
2518
- , options.host + ':' + options.port
2519
- , options.resource
2520
- , 'static/flashsocket'
2521
- , 'WebSocketMain' + (socket.isXDomain() ? 'Insecure' : '') + '.swf'
2522
- ];
2523
-
2524
- // Only start downloading the swf file when the checked that this browser
2525
- // actually supports it
2526
- if (!Flashsocket.loaded) {
2527
- if (typeof WEB_SOCKET_SWF_LOCATION === 'undefined') {
2528
- // Set the correct file based on the XDomain settings
2529
- WEB_SOCKET_SWF_LOCATION = path.join('/');
2530
- }
2531
-
2532
- if (port !== 843) {
2533
- WebSocket.loadFlashPolicyFile('xmlsocket://' + options.host + ':' + port);
2534
- }
2535
-
2536
- WebSocket.__initialize();
2537
- Flashsocket.loaded = true;
2538
- }
2539
-
2540
- fn.call(self);
2541
- }
2542
-
2543
- var self = this;
2544
- if (document.body) return init();
2545
-
2546
- io.util.load(init);
2547
- };
2548
-
2549
- /**
2550
- * Check if the FlashSocket transport is supported as it requires that the Adobe
2551
- * Flash Player plug-in version `10.0.0` or greater is installed. And also check if
2552
- * the polyfill is correctly loaded.
2553
- *
2554
- * @returns {Boolean}
2555
- * @api public
2556
- */
2557
-
2558
- Flashsocket.check = function () {
2559
- if (
2560
- typeof WebSocket == 'undefined'
2561
- || !('__initialize' in WebSocket) || !swfobject
2562
- ) return false;
2563
-
2564
- return swfobject.getFlashPlayerVersion().major >= 10;
2565
- };
2566
-
2567
- /**
2568
- * Check if the FlashSocket transport can be used as cross domain / cross origin
2569
- * transport. Because we can't see which type (secure or insecure) of .swf is used
2570
- * we will just return true.
2571
- *
2572
- * @returns {Boolean}
2573
- * @api public
2574
- */
2575
-
2576
- Flashsocket.xdomainCheck = function () {
2577
- return true;
2578
- };
2579
-
2580
- /**
2581
- * Disable AUTO_INITIALIZATION
2582
- */
2583
-
2584
- if (typeof window != 'undefined') {
2585
- WEB_SOCKET_DISABLE_AUTO_INITIALIZATION = true;
2586
- }
2587
-
2588
- /**
2589
- * Add the transport to your public io.transports array.
2590
- *
2591
- * @api private
2592
- */
2593
-
2594
- io.transports.push('flashsocket');
2595
- })(
2596
- 'undefined' != typeof io ? io.Transport : module.exports
2597
- , 'undefined' != typeof io ? io : module.parent.exports
2598
- );
2599
- /* SWFObject v2.2 <http://code.google.com/p/swfobject/>
2600
- is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
2601
- */
2602
- var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();// Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
2603
- // License: New BSD License
2604
- // Reference: http://dev.w3.org/html5/websockets/
2605
- // Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol
2606
-
2607
- (function() {
2608
-
2609
- if (window.WebSocket) return;
2610
-
2611
- var console = window.console;
2612
- if (!console || !console.log || !console.error) {
2613
- console = {log: function(){ }, error: function(){ }};
2614
- }
2615
-
2616
- if (!swfobject.hasFlashPlayerVersion("10.0.0")) {
2617
- console.error("Flash Player >= 10.0.0 is required.");
2618
- return;
2619
- }
2620
- if (location.protocol == "file:") {
2621
- console.error(
2622
- "WARNING: web-socket-js doesn't work in file:///... URL " +
2623
- "unless you set Flash Security Settings properly. " +
2624
- "Open the page via Web server i.e. http://...");
2625
- }
2626
-
2627
- /**
2628
- * This class represents a faux web socket.
2629
- * @param {string} url
2630
- * @param {array or string} protocols
2631
- * @param {string} proxyHost
2632
- * @param {int} proxyPort
2633
- * @param {string} headers
2634
- */
2635
- WebSocket = function(url, protocols, proxyHost, proxyPort, headers) {
2636
- var self = this;
2637
- self.__id = WebSocket.__nextId++;
2638
- WebSocket.__instances[self.__id] = self;
2639
- self.readyState = WebSocket.CONNECTING;
2640
- self.bufferedAmount = 0;
2641
- self.__events = {};
2642
- if (!protocols) {
2643
- protocols = [];
2644
- } else if (typeof protocols == "string") {
2645
- protocols = [protocols];
2646
- }
2647
- // Uses setTimeout() to make sure __createFlash() runs after the caller sets ws.onopen etc.
2648
- // Otherwise, when onopen fires immediately, onopen is called before it is set.
2649
- setTimeout(function() {
2650
- WebSocket.__addTask(function() {
2651
- WebSocket.__flash.create(
2652
- self.__id, url, protocols, proxyHost || null, proxyPort || 0, headers || null);
2653
- });
2654
- }, 0);
2655
- };
2656
-
2657
- /**
2658
- * Send data to the web socket.
2659
- * @param {string} data The data to send to the socket.
2660
- * @return {boolean} True for success, false for failure.
2661
- */
2662
- WebSocket.prototype.send = function(data) {
2663
- if (this.readyState == WebSocket.CONNECTING) {
2664
- throw "INVALID_STATE_ERR: Web Socket connection has not been established";
2665
- }
2666
- // We use encodeURIComponent() here, because FABridge doesn't work if
2667
- // the argument includes some characters. We don't use escape() here
2668
- // because of this:
2669
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Functions#escape_and_unescape_Functions
2670
- // But it looks decodeURIComponent(encodeURIComponent(s)) doesn't
2671
- // preserve all Unicode characters either e.g. "\uffff" in Firefox.
2672
- // Note by wtritch: Hopefully this will not be necessary using ExternalInterface. Will require
2673
- // additional testing.
2674
- var result = WebSocket.__flash.send(this.__id, encodeURIComponent(data));
2675
- if (result < 0) { // success
2676
- return true;
2677
- } else {
2678
- this.bufferedAmount += result;
2679
- return false;
2680
- }
2681
- };
2682
-
2683
- /**
2684
- * Close this web socket gracefully.
2685
- */
2686
- WebSocket.prototype.close = function() {
2687
- if (this.readyState == WebSocket.CLOSED || this.readyState == WebSocket.CLOSING) {
2688
- return;
2689
- }
2690
- this.readyState = WebSocket.CLOSING;
2691
- WebSocket.__flash.close(this.__id);
2692
- };
2693
-
2694
- /**
2695
- * Implementation of {@link <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration">DOM 2 EventTarget Interface</a>}
2696
- *
2697
- * @param {string} type
2698
- * @param {function} listener
2699
- * @param {boolean} useCapture
2700
- * @return void
2701
- */
2702
- WebSocket.prototype.addEventListener = function(type, listener, useCapture) {
2703
- if (!(type in this.__events)) {
2704
- this.__events[type] = [];
2705
- }
2706
- this.__events[type].push(listener);
2707
- };
2708
-
2709
- /**
2710
- * Implementation of {@link <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration">DOM 2 EventTarget Interface</a>}
2711
- *
2712
- * @param {string} type
2713
- * @param {function} listener
2714
- * @param {boolean} useCapture
2715
- * @return void
2716
- */
2717
- WebSocket.prototype.removeEventListener = function(type, listener, useCapture) {
2718
- if (!(type in this.__events)) return;
2719
- var events = this.__events[type];
2720
- for (var i = events.length - 1; i >= 0; --i) {
2721
- if (events[i] === listener) {
2722
- events.splice(i, 1);
2723
- break;
2724
- }
2725
- }
2726
- };
2727
-
2728
- /**
2729
- * Implementation of {@link <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration">DOM 2 EventTarget Interface</a>}
2730
- *
2731
- * @param {Event} event
2732
- * @return void
2733
- */
2734
- WebSocket.prototype.dispatchEvent = function(event) {
2735
- var events = this.__events[event.type] || [];
2736
- for (var i = 0; i < events.length; ++i) {
2737
- events[i](event);
2738
- }
2739
- var handler = this["on" + event.type];
2740
- if (handler) handler(event);
2741
- };
2742
-
2743
- /**
2744
- * Handles an event from Flash.
2745
- * @param {Object} flashEvent
2746
- */
2747
- WebSocket.prototype.__handleEvent = function(flashEvent) {
2748
- if ("readyState" in flashEvent) {
2749
- this.readyState = flashEvent.readyState;
2750
- }
2751
- if ("protocol" in flashEvent) {
2752
- this.protocol = flashEvent.protocol;
2753
- }
2754
-
2755
- var jsEvent;
2756
- if (flashEvent.type == "open" || flashEvent.type == "error") {
2757
- jsEvent = this.__createSimpleEvent(flashEvent.type);
2758
- } else if (flashEvent.type == "close") {
2759
- // TODO implement jsEvent.wasClean
2760
- jsEvent = this.__createSimpleEvent("close");
2761
- } else if (flashEvent.type == "message") {
2762
- var data = decodeURIComponent(flashEvent.message);
2763
- jsEvent = this.__createMessageEvent("message", data);
2764
- } else {
2765
- throw "unknown event type: " + flashEvent.type;
2766
- }
2767
-
2768
- this.dispatchEvent(jsEvent);
2769
- };
2770
-
2771
- WebSocket.prototype.__createSimpleEvent = function(type) {
2772
- if (document.createEvent && window.Event) {
2773
- var event = document.createEvent("Event");
2774
- event.initEvent(type, false, false);
2775
- return event;
2776
- } else {
2777
- return {type: type, bubbles: false, cancelable: false};
2778
- }
2779
- };
2780
-
2781
- WebSocket.prototype.__createMessageEvent = function(type, data) {
2782
- if (document.createEvent && window.MessageEvent && !window.opera) {
2783
- var event = document.createEvent("MessageEvent");
2784
- event.initMessageEvent("message", false, false, data, null, null, window, null);
2785
- return event;
2786
- } else {
2787
- // IE and Opera, the latter one truncates the data parameter after any 0x00 bytes.
2788
- return {type: type, data: data, bubbles: false, cancelable: false};
2789
- }
2790
- };
2791
-
2792
- /**
2793
- * Define the WebSocket readyState enumeration.
2794
- */
2795
- WebSocket.CONNECTING = 0;
2796
- WebSocket.OPEN = 1;
2797
- WebSocket.CLOSING = 2;
2798
- WebSocket.CLOSED = 3;
2799
-
2800
- WebSocket.__flash = null;
2801
- WebSocket.__instances = {};
2802
- WebSocket.__tasks = [];
2803
- WebSocket.__nextId = 0;
2804
-
2805
- /**
2806
- * Load a new flash security policy file.
2807
- * @param {string} url
2808
- */
2809
- WebSocket.loadFlashPolicyFile = function(url){
2810
- WebSocket.__addTask(function() {
2811
- WebSocket.__flash.loadManualPolicyFile(url);
2812
- });
2813
- };
2814
-
2815
- /**
2816
- * Loads WebSocketMain.swf and creates WebSocketMain object in Flash.
2817
- */
2818
- WebSocket.__initialize = function() {
2819
- if (WebSocket.__flash) return;
2820
-
2821
- if (WebSocket.__swfLocation) {
2822
- // For backword compatibility.
2823
- window.WEB_SOCKET_SWF_LOCATION = WebSocket.__swfLocation;
2824
- }
2825
- if (!window.WEB_SOCKET_SWF_LOCATION) {
2826
- console.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf");
2827
- return;
2828
- }
2829
- var container = document.createElement("div");
2830
- container.id = "webSocketContainer";
2831
- // Hides Flash box. We cannot use display: none or visibility: hidden because it prevents
2832
- // Flash from loading at least in IE. So we move it out of the screen at (-100, -100).
2833
- // But this even doesn't work with Flash Lite (e.g. in Droid Incredible). So with Flash
2834
- // Lite, we put it at (0, 0). This shows 1x1 box visible at left-top corner but this is
2835
- // the best we can do as far as we know now.
2836
- container.style.position = "absolute";
2837
- if (WebSocket.__isFlashLite()) {
2838
- container.style.left = "0px";
2839
- container.style.top = "0px";
2840
- } else {
2841
- container.style.left = "-100px";
2842
- container.style.top = "-100px";
2843
- }
2844
- var holder = document.createElement("div");
2845
- holder.id = "webSocketFlash";
2846
- container.appendChild(holder);
2847
- document.body.appendChild(container);
2848
- // See this article for hasPriority:
2849
- // http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36cfb8137124318eebc6-7ffd.html
2850
- swfobject.embedSWF(
2851
- WEB_SOCKET_SWF_LOCATION,
2852
- "webSocketFlash",
2853
- "1" /* width */,
2854
- "1" /* height */,
2855
- "10.0.0" /* SWF version */,
2856
- null,
2857
- null,
2858
- {hasPriority: true, swliveconnect : true, allowScriptAccess: "always"},
2859
- null,
2860
- function(e) {
2861
- if (!e.success) {
2862
- console.error("[WebSocket] swfobject.embedSWF failed");
2863
- }
2864
- });
2865
- };
2866
-
2867
- /**
2868
- * Called by Flash to notify JS that it's fully loaded and ready
2869
- * for communication.
2870
- */
2871
- WebSocket.__onFlashInitialized = function() {
2872
- // We need to set a timeout here to avoid round-trip calls
2873
- // to flash during the initialization process.
2874
- setTimeout(function() {
2875
- WebSocket.__flash = document.getElementById("webSocketFlash");
2876
- WebSocket.__flash.setCallerUrl(location.href);
2877
- WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG);
2878
- for (var i = 0; i < WebSocket.__tasks.length; ++i) {
2879
- WebSocket.__tasks[i]();
2880
- }
2881
- WebSocket.__tasks = [];
2882
- }, 0);
2883
- };
2884
-
2885
- /**
2886
- * Called by Flash to notify WebSockets events are fired.
2887
- */
2888
- WebSocket.__onFlashEvent = function() {
2889
- setTimeout(function() {
2890
- try {
2891
- // Gets events using receiveEvents() instead of getting it from event object
2892
- // of Flash event. This is to make sure to keep message order.
2893
- // It seems sometimes Flash events don't arrive in the same order as they are sent.
2894
- var events = WebSocket.__flash.receiveEvents();
2895
- for (var i = 0; i < events.length; ++i) {
2896
- WebSocket.__instances[events[i].webSocketId].__handleEvent(events[i]);
2897
- }
2898
- } catch (e) {
2899
- console.error(e);
2900
- }
2901
- }, 0);
2902
- return true;
2903
- };
2904
-
2905
- // Called by Flash.
2906
- WebSocket.__log = function(message) {
2907
- console.log(decodeURIComponent(message));
2908
- };
2909
-
2910
- // Called by Flash.
2911
- WebSocket.__error = function(message) {
2912
- console.error(decodeURIComponent(message));
2913
- };
2914
-
2915
- WebSocket.__addTask = function(task) {
2916
- if (WebSocket.__flash) {
2917
- task();
2918
- } else {
2919
- WebSocket.__tasks.push(task);
2920
- }
2921
- };
2922
-
2923
- /**
2924
- * Test if the browser is running flash lite.
2925
- * @return {boolean} True if flash lite is running, false otherwise.
2926
- */
2927
- WebSocket.__isFlashLite = function() {
2928
- if (!window.navigator || !window.navigator.mimeTypes) {
2929
- return false;
2930
- }
2931
- var mimeType = window.navigator.mimeTypes["application/x-shockwave-flash"];
2932
- if (!mimeType || !mimeType.enabledPlugin || !mimeType.enabledPlugin.filename) {
2933
- return false;
2934
- }
2935
- return mimeType.enabledPlugin.filename.match(/flashlite/i) ? true : false;
2936
- };
2937
-
2938
- if (!window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION) {
2939
- if (window.addEventListener) {
2940
- window.addEventListener("load", function(){
2941
- WebSocket.__initialize();
2942
- }, false);
2943
- } else {
2944
- window.attachEvent("onload", function(){
2945
- WebSocket.__initialize();
2946
- });
2947
- }
2948
- }
2949
-
2950
- })();
2951
-
2952
2411
  /**
2953
2412
  * socket.io
2954
2413
  * Copyright(c) 2011 LearnBoost <dev@learnboost.com>
@@ -3495,7 +2954,17 @@ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="Sho
3495
2954
  * MIT Licensed
3496
2955
  */
3497
2956
 
3498
- (function (exports, io) {
2957
+ (function (exports, io, global) {
2958
+ /**
2959
+ * There is a way to hide the loading indicator in Firefox. If you create and
2960
+ * remove a iframe it will stop showing the current loading indicator.
2961
+ * Unfortunately we can't feature detect that and UA sniffing is evil.
2962
+ *
2963
+ * @api private
2964
+ */
2965
+
2966
+ var indicator = global.document && "MozAppearance" in
2967
+ global.document.documentElement.style;
3499
2968
 
3500
2969
  /**
3501
2970
  * Expose constructor.
@@ -3606,7 +3075,9 @@ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="Sho
3606
3075
 
3607
3076
  initIframe();
3608
3077
 
3609
- this.area.value = data;
3078
+ // we temporarily stringify until we figure out how to prevent
3079
+ // browsers from turning `\n` into `\r\n` in form inputs
3080
+ this.area.value = io.JSON.stringify(data);
3610
3081
 
3611
3082
  try {
3612
3083
  this.form.submit();
@@ -3654,6 +3125,14 @@ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="Sho
3654
3125
  var insertAt = document.getElementsByTagName('script')[0]
3655
3126
  insertAt.parentNode.insertBefore(script, insertAt);
3656
3127
  this.script = script;
3128
+
3129
+ if (indicator) {
3130
+ setTimeout(function () {
3131
+ var iframe = document.createElement('iframe');
3132
+ document.body.appendChild(iframe);
3133
+ document.body.removeChild(iframe);
3134
+ }, 100);
3135
+ }
3657
3136
  };
3658
3137
 
3659
3138
  /**
@@ -3671,6 +3150,23 @@ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="Sho
3671
3150
  return this;
3672
3151
  };
3673
3152
 
3153
+ /**
3154
+ * The indicator hack only works after onload
3155
+ *
3156
+ * @param {Socket} socket The socket instance that needs a transport
3157
+ * @param {Function} fn The callback
3158
+ * @api private
3159
+ */
3160
+
3161
+ JSONPPolling.prototype.ready = function (socket, fn) {
3162
+ var self = this;
3163
+ if (!indicator) return fn.call(this);
3164
+
3165
+ io.util.load(function () {
3166
+ fn.call(self);
3167
+ });
3168
+ };
3169
+
3674
3170
  /**
3675
3171
  * Checks if browser supports this transport.
3676
3172
  *
@@ -3679,7 +3175,7 @@ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="Sho
3679
3175
  */
3680
3176
 
3681
3177
  JSONPPolling.check = function () {
3682
- return true;
3178
+ return 'document' in global;
3683
3179
  };
3684
3180
 
3685
3181
  /**
@@ -3704,4 +3200,5 @@ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="Sho
3704
3200
  })(
3705
3201
  'undefined' != typeof io ? io.Transport : module.exports
3706
3202
  , 'undefined' != typeof io ? io : module.parent.exports
3203
+ , this
3707
3204
  );
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: juggernaut
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-27 00:00:00.000000000Z
12
+ date: 2011-10-31 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
16
- requirement: &70348826143020 !ruby/object:Gem::Requirement
16
+ requirement: &70257045823580 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70348826143020
24
+ version_requirements: *70257045823580
25
25
  description: Use Juggernaut to easily implement realtime chat, collaboration, gaming
26
26
  and much more!
27
27
  email: info@eribium.org