From d82e2fe9754f7dc55d7a0d4fcaa69c710fb07e37 Mon Sep 17 00:00:00 2001 From: just-boris Date: Mon, 23 Dec 2013 13:28:42 +0400 Subject: [PATCH] Update atmosphere.js to 2.1.2 --- ajax/libs/atmosphere/2.1.2/atmosphere-min.js | 27 + ajax/libs/atmosphere/2.1.2/atmosphere.js | 3048 ++++++++++++++++++ ajax/libs/atmosphere/package.json | 2 +- 3 files changed, 3076 insertions(+), 1 deletion(-) create mode 100644 ajax/libs/atmosphere/2.1.2/atmosphere-min.js create mode 100644 ajax/libs/atmosphere/2.1.2/atmosphere.js diff --git a/ajax/libs/atmosphere/2.1.2/atmosphere-min.js b/ajax/libs/atmosphere/2.1.2/atmosphere-min.js new file mode 100644 index 000000000..59052c43d --- /dev/null +++ b/ajax/libs/atmosphere/2.1.2/atmosphere-min.js @@ -0,0 +1,27 @@ +/** + * Copyright 2013 Jeanfrancois Arcand + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * Highly inspired by Portal v1.0 + * http://github.com/flowersinthesand/portal + * + * Copyright 2011-2013, Donghwan Kim + * Licensed under the Apache License, Version 2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + */ +/** + * Official documentation of this library: https://github.com/Atmosphere/atmosphere/wiki/jQuery.atmosphere.js-API + */ +(function(){var c="2.1.2-javascript",a={},d,g=[],f=[],e=0,b=Object.prototype.hasOwnProperty;a={onError:function(h){},onClose:function(h){},onOpen:function(h){},onReopen:function(h){},onMessage:function(h){},onReconnect:function(i,h){},onMessagePublished:function(h){},onTransportFailure:function(i,h){},onLocalMessage:function(h){},onFailureToReconnect:function(i,h){},onClientTimeout:function(h){},AtmosphereRequest:function(M){var O={timeout:300000,method:"GET",headers:{},contentType:"",callback:null,url:"",data:"",suspend:true,maxRequest:-1,reconnect:true,maxStreamingLength:10000000,lastIndex:0,logLevel:"info",requestCount:0,fallbackMethod:"GET",fallbackTransport:"streaming",transport:"long-polling",webSocketImpl:null,webSocketBinaryType:null,dispatchUrl:null,webSocketPathDelimiter:"@@",enableXDR:false,rewriteURL:false,attachHeadersAsQueryString:true,executeCallbackBeforeReconnect:false,readyState:0,lastTimestamp:0,withCredentials:false,trackMessageLength:false,messageDelimiter:"|",connectTimeout:-1,reconnectInterval:0,dropHeaders:true,uuid:0,async:true,shared:false,readResponsesHeaders:false,maxReconnectOnClose:5,enableProtocol:true,onError:function(aA){},onClose:function(aA){},onOpen:function(aA){},onMessage:function(aA){},onReopen:function(aB,aA){},onReconnect:function(aB,aA){},onMessagePublished:function(aA){},onTransportFailure:function(aB,aA){},onLocalMessage:function(aA){},onFailureToReconnect:function(aB,aA){},onClientTimeout:function(aA){}};var W={status:200,reasonPhrase:"OK",responseBody:"",messages:[],headers:[],state:"messageReceived",transport:"polling",error:null,request:null,partialMessage:"",errorHandled:false,closedByClientTimeout:false};var Z=null;var o=null;var v=null;var E=null;var G=null;var ak=true;var l=0;var aw=false;var aa=null;var aq;var q=null;var J=a.util.now();var K;var az;ay(M);function ar(){ak=true;aw=false;l=0;Z=null;o=null;v=null;E=null}function A(){am();ar()}function L(aB,aA){if(W.partialMessage===""&&(aA.transport==="streaming")&&(aB.responseText.length>aA.maxStreamingLength)){W.messages=[];ai(true);D();am();R(aB,aA,0)}}function D(){if(O.enableProtocol&&!O.firstMessage){var aC="X-Atmosphere-Transport=close&X-Atmosphere-tracking-id="+O.uuid;a.util.each(O.headers,function(aE,aG){var aF=a.util.isFunction(aG)?aG.call(this,O,O,W):aG;if(aF!=null){aC+="&"+encodeURIComponent(aE)+"="+encodeURIComponent(aF)}});var aA=O.url.replace(/([?&])_=[^&]*/,aC);aA=aA+(aA===O.url?(/\?/.test(O.url)?"&":"?")+aC:"");var aB={connected:false};var aD=new a.AtmosphereRequest(aB);aD.attachHeadersAsQueryString=false;aD.dropHeaders=true;aD.url=aA;aD.contentType="text/plain";aD.transport="polling";aD.async=false;n("",aD)}}function an(){if(O.reconnectId){clearTimeout(O.reconnectId);delete O.reconnectId}O.reconnect=false;aw=true;W.request=O;W.state="unsubscribe";W.responseBody="";W.status=408;W.partialMessage="";C();D();am()}function am(){W.partialMessage="";if(O.id){clearTimeout(O.id)}if(E!=null){E.close();E=null}if(G!=null){G.abort();G=null}if(v!=null){v.abort();v=null}if(Z!=null){if(Z.webSocketOpened){Z.close()}Z=null}if(o!=null){o.close();o=null}at()}function at(){if(aq!=null){clearInterval(K);document.cookie=az+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";aq.signal("close",{reason:"",heir:!aw?J:(aq.get("children")||[])[0]});aq.close()}if(q!=null){q.close()}}function ay(aA){A();O=a.util.extend(O,aA);O.mrequest=O.reconnect;if(!O.reconnect){O.reconnect=true}}function p(){return O.webSocketImpl!=null||window.WebSocket||window.MozWebSocket}function S(){return window.EventSource}function t(){if(O.shared){q=ah(O);if(q!=null){if(O.logLevel==="debug"){a.util.debug("Storage service available. All communication will be local")}if(q.open(O)){return}}if(O.logLevel==="debug"){a.util.debug("No Storage service available.")}q=null}O.firstMessage=e==0?true:false;O.isOpen=false;O.ctime=a.util.now();if(O.uuid===0){O.uuid=e}W.closedByClientTimeout=false;if(O.transport!=="websocket"&&O.transport!=="sse"){s(O)}else{if(O.transport==="websocket"){if(!p()){Q("Websocket is not supported, using request.fallbackTransport ("+O.fallbackTransport+")")}else{aj(false)}}else{if(O.transport==="sse"){if(!S()){Q("Server Side Events(SSE) is not supported, using request.fallbackTransport ("+O.fallbackTransport+")")}else{I(false)}}}}}function ah(aE){var aF,aD,aI,aA="atmosphere-"+aE.url,aB={storage:function(){function aJ(aN){if(aN.key===aA&&aN.newValue){aC(aN.newValue)}}if(!a.util.storage){return}var aM=window.localStorage,aK=function(aN){return a.util.parseJSON(aM.getItem(aA+"-"+aN))},aL=function(aN,aO){aM.setItem(aA+"-"+aN,a.util.stringifyJSON(aO))};return{init:function(){aL("children",aK("children").concat([J]));a.util.on(window,"storage",aJ);return aK("opened")},signal:function(aN,aO){aM.setItem(aA,a.util.stringifyJSON({target:"p",type:aN,data:aO}))},close:function(){var aN=aK("children");a.util.off(window,"storage",aJ);if(aN){if(aG(aN,aE.id)){aL("children",aN)}}}}},windowref:function(){var aJ=window.open("",aA.replace(/\W/g,""));if(!aJ||aJ.closed||!aJ.callbacks){return}return{init:function(){aJ.callbacks.push(aC);aJ.children.push(J);return aJ.opened},signal:function(aK,aL){if(!aJ.closed&&aJ.fire){aJ.fire(a.util.stringifyJSON({target:"p",type:aK,data:aL}))}},close:function(){if(!aI){aG(aJ.callbacks,aC);aG(aJ.children,J)}}}}};function aG(aM,aL){var aJ,aK=aM.length;for(aJ=0;aJ1000){return}aD=aB.storage()||aB.windowref();if(!aD){return}return{open:function(){var aJ;K=setInterval(function(){var aK=aF;aF=aH();if(!aF||aK.ts===aF.ts){aC(a.util.stringifyJSON({target:"c",type:"close",data:{reason:"error",heir:aK.heir}}))}},1000);aJ=aD.init();if(aJ){setTimeout(function(){N("opening","local",aE)},50)}return aJ},send:function(aJ){aD.signal("send",aJ)},localSend:function(aJ){aD.signal("localSend",a.util.stringifyJSON({id:J,event:aJ}))},close:function(){if(!aw){clearInterval(K);aD.signal("close");aD.close()}}}}function ad(){var aB,aA="atmosphere-"+O.url,aF={storage:function(){function aG(aI){if(aI.key===aA&&aI.newValue){aC(aI.newValue)}}if(!a.util.storage){return}var aH=window.localStorage;return{init:function(){a.util.on(window,"storage",aG)},signal:function(aI,aJ){aH.setItem(aA,a.util.stringifyJSON({target:"c",type:aI,data:aJ}))},get:function(aI){return a.util.parseJSON(aH.getItem(aA+"-"+aI))},set:function(aI,aJ){aH.setItem(aA+"-"+aI,a.util.stringifyJSON(aJ))},close:function(){a.util.off(window,"storage",aG);aH.removeItem(aA);aH.removeItem(aA+"-opened");aH.removeItem(aA+"-children")}}},windowref:function(){var aH=aA.replace(/\W/g,""),aG=document.getElementById(aH),aI;if(!aG){aG=document.createElement("div");aG.id=aH;aG.style.display="none";aG.innerHTML='