/[meteor]/googlecode.com/svn/trunk/public_html/meteor.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /googlecode.com/svn/trunk/public_html/meteor.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8 by andrew.betts, Thu Nov 23 16:35:37 2006 UTC revision 53 by andrew.betts, Wed Feb 27 21:58:56 2008 UTC
# Line 1  Line 1 
1  // Set domain at highest level  /*
2  var domainparts = document.domain.split(".");  stream: xhrinteractive, iframe, serversent
3  document.domain = domainparts[domainparts.length-2]+"."+domainparts[domainparts.length-1];  longpoll
4    smartpoll
5  Function.prototype.bind = function(obj) {  simplepoll
6          var method = this,  */
7          temp = function() {  
8                  return method.apply(obj, arguments);  Meteor = {
9          };  
10          return temp;          callbacks: {
11  }                  process: function() {},
12  Function.prototype.andThen=function(g) {                  reset: function() {},
13          var f=this;                  eof: function() {},
14          var a=this.arguments                  statuschanged: function() {},
15          return function(args) {                  changemode: function() {}
16                  f(a);g(args);          },
17          }          channelcount: 0,
18  };          channels: {},
19  function addUnLoadEvent(func) {          debugmode: false,
20    var oldonunload = window.onunload;          frameref: null,
21    if (typeof window.onunload != 'function') {          host: null,
22      window.onunload = func;          hostid: null,
23    } else {          maxpollfreq: 60000,
24      window.onunload = function() {          minpollfreq: 2000,
25        if (oldonunload) {          mode: "stream",
26          oldonunload();          pingtimeout: 20000,
27        }          pingtimer: null,
28        func();          pollfreq: 3000,
29      }          port: 80,
30    }          polltimeout: 30000,
31  }          recvtimes: [],
32  addUnLoadEvent(meteordestroy);          status: 0,
33  function meteordestroy() {          updatepollfreqtimer: null,
34          var x = Meteor.instances.length;  
35          for(var i=0; i<x; i++) {          register: function(ifr) {
36                  if (typeof(Meteor.instances[i].transferDoc)=="object") {                  ifr.p = Meteor.process;
37                          Meteor.instances[i].transferDoc.open();                  ifr.r = Meteor.reset;
38                          Meteor.instances[i].transferDoc.close();                  ifr.eof = Meteor.eof;
39                          delete Meteor.instances[i].transferDoc;                  ifr.ch = Meteor.channelInfo;
40                  }                  clearTimeout(Meteor.frameloadtimer);
41                  if (document.getElementById("meteorframe_"+Meteor.instances[i].instID)) {                  Meteor.setstatus(4);
42                          document.body.removeChild(document.getElementById("meteorframe_"+Meteor.instances[i].instID));                  Meteor.log("Frame registered");
43                  }          },
44                  delete Meteor.instances[i];  
45          }          joinChannel: function(channelname, backtrack) {
46  }                  if (typeof(Meteor.channels[channelname]) != "undefined") throw "Cannot join channel "+channelname+": already subscribed";
47                    Meteor.channels[channelname] = {backtrack:backtrack, lastmsgreceived:0};
48  function Meteor(instID) {                  Meteor.log("Joined channel "+channelname);
49                    Meteor.channelcount++;
50          this.lastmsgreceived = -1;                  if (Meteor.status != 0) Meteor.connect();
51          this.transferDoc = false;          },
52          this.pingtimer = false;  
53          this.updatepollfreqtimer = false;          leaveChannel: function(channelname) {
54          this.lastrequest = 0;                  if (typeof(Meteor.channels[channelname]) == "undefined") throw "Cannot leave channel "+channelname+": not subscribed";
55          this.recvtimes = new Array();                  delete Meteor.channels[channelname];
56          this.MHostId = false;                  Meteor.log("Left channel "+channelname);
57          this.callback_process = function() {};                  if (Meteor.status != 0) Meteor.connect();
58          this.callback_reset = function() {};                  Meteor.channelcount--;
59          this.callback_eof = function() {};          },
60          this.callback_changemode = function() {};  
61          this.callback_statuschanged = function() {};          connect: function() {
62          this.persist = true;                  Meteor.log("Connecting");
63          this.frameloadtimer = false;                  if (!Meteor.host) throw "Meteor host not specified";
64          this.frameurl = false;                  if (isNaN(Meteor.port)) throw "Meteor port not specified";
65                    if (!Meteor.channelcount) throw "No channels specified";
66          // Documented public properties                  if (Meteor.status) Meteor.disconnect();
67          this.channel = false;                  Meteor.setstatus(1);
68          this.subdomain = "data";                  var now = new Date();
69          this.dynamicpageaddress = "push";                  var t = now.getTime();
70          this.backtrack = 0;                  if (!Meteor.hostid) Meteor.hostid = t+""+Math.floor(Math.random()*1000000)
71          this.smartpoll = true;                  document.domain = Meteor.extract_xss_domain(document.domain);
72          this.pollfreq = 2000;                  if (Meteor.mode=="stream") Meteor.mode = Meteor.selectStreamTransport();
73          this.minpollfreq = 2000;                  Meteor.log("Selected "+Meteor.mode+" transport");
74          this.mode = "stream";                  if (Meteor.mode=="xhrinteractive" || Meteor.mode=="iframe" || Meteor.mode=="serversent") {
75          this.polltimeout=30000;                          if (Meteor.mode == "iframe") {
76          this.maxmessages=0;                                  Meteor.loadFrame(Meteor.getSubsUrl());
77          this.pingtimeout = 10000;                          } else {
78          this.status = 0;                                  Meteor.loadFrame("http://"+Meteor.host+((Meteor.port==80)?"":":"+Meteor.port)+"/stream.html");
79                            }
80          /* Statuses:    0 = Uninitialised,                          clearTimeout(Meteor.pingtimer);
81                                          1 = Loading stream,                          Meteor.pingtimer = setTimeout(Meteor.pollmode, Meteor.pingtimeout);
82                                          2 = Loading controller frame,  
83                                          3 = Controller frame timeout, retrying every 5 seconds                  } else {
84                                          4 = Controller frame loaded and ready                          Meteor.loadFrame("http://"+Meteor.host+((Meteor.port==80)?"":":"+Meteor.port)+"/poll.html");
85                                          5 = Receiving data                          Meteor.recvtimes[0] = t;
86          */                          if (Meteor.updatepollfreqtimer) clearTimeout(Meteor.updatepollfreqtimer);
87                            if (Meteor.mode=='smartpoll') Meteor.updatepollfreqtimer = setInterval(Meteor.updatepollfreq, 2500);
88          // Set or retrieve host id.  Cookie takes this form:                          if (Meteor.mode=='longpoll') Meteor.pollfreq = Meteor.minpollfreq;
89          // MeteorID=123:6356353/124:098320454;                  }
90          var MeteIds = Meteor.readCookie("MeteorID");                  Meteor.lastrequest = t;
91          var regex1 = new RegExp("^([0-9\:\/M]+\/)*"+instID+"\:([^\/]+)(\/[0-9\:\/M]+)*$");          },
92          var regex2 = new RegExp("^([0-9\:\/M]+\/)*M\:([^\/]+)(\/[0-9\:\/M]+)*$");  
93          if (typeof(instID) == "Number" && regex1.exec(MeteIds)) {          disconnect: function() {
94                  this.MHostId = ma[2];                  if (Meteor.status) {
95          } else if (typeof(instID) == "Number") {                          clearTimeout(Meteor.pingtimer);
96                  this.MHostId = Math.floor(Math.random()*1000000);                          clearTimeout(Meteor.updatepollfreqtimer);
97                  var newcookie = (MeteIds)?MeteIds+"/":"";                          clearTimeout(Meteor.frameloadtimer);
98                  newcookie += instID+":"+this.MHostId;                          if (typeof CollectGarbage == 'function') CollectGarbage();
99                  Meteor.createCookie("MeteorID", newcookie);                          Meteor.setstatus(0);
100          } else if (ma = regex2.exec(MeteIds)) {                  }
101                  this.MHostId = ma[2];          },
102          } else {          
103                  this.MHostId = Math.floor(Math.random()*1000000);          selectStreamTransport: function() {
104                  var newcookie = (MeteIds)?MeteIds+"/":"";                  try {
105                  newcookie += "M:"+this.MHostId;                          var test = ActiveXObject;
106                  Meteor.createCookie("MeteorID", newcookie);                          return "iframe";
107          }                  } catch (e) {}
108          this.instID = (typeof(instID) != "undefined") ? instID : 0;                  if ((typeof window.addEventStream) == "function") return "iframe";
109  }                  return "xhrinteractive";
110            },
111  Meteor.instances = new Array();  
112  Meteor.servertimeoffset = 0;          getSubsUrl: function() {
113                    var surl = "http://" + Meteor.host + ((Meteor.port==80)?"":":"+Meteor.port) + "/push/" + Meteor.hostid + "/" + Meteor.mode;
114  Meteor.create = function(instID) {                  for (var c in Meteor.channels) {
115          if (!instID) instID = 0;                          surl += "/"+c;
116          Meteor.instances[instID] = new Meteor(instID);                          if (Meteor.channels[c].lastmsgreceived > 0) {
117          return Meteor.instances[instID];                                  surl += ".r"+(Meteor.channels[c].lastmsgreceived+1);
118  }                          } else if (Meteor.channels[c].backtrack > 0) {
119                                    surl += ".b"+Meteor.channels[c].backtrack;
120  Meteor.register = function(ifr) {                          } else if (Meteor.channels[c].backtrack < 0 || isNaN(Meteor.channels[c].backtrack)) {
121          instid = new String(ifr.window.frameElement.id);                                  surl += ".h";
122          instid = instid.replace("meteorframe_", "");                          }
123          ifr.p = this.instances[instid].process.bind(this.instances[instid]);                  }
124          ifr.r = this.instances[instid].reset.bind(this.instances[instid]);                  return surl;
125          ifr.eof = this.instances[instid].eof.bind(this.instances[instid]);          },
126          ifr.get = this.instances[instid].get.bind(this.instances[instid]);  
127          ifr.increasepolldelay = this.instances[instid].increasepolldelay.bind(this.instances[instid]);          loadFrame: function(url) {
128          clearTimeout(this.instances[instid].frameloadtimer);                  try {
129          this.instances[instid].setstatus(4);                          if (!Meteor.frameref) {
130  }                                  var transferDoc = new ActiveXObject("htmlfile");
131                                    Meteor.frameref = transferDoc;
132  Meteor.setServerTime = function(timestamp) {                          }
133          var now = new Date();                          Meteor.frameref.open();
134          var clienttime = (now.getTime() / 1000);                          Meteor.frameref.write("<html><script>");
135          Meteor.servertimeoffset = timestamp - clienttime;                          Meteor.frameref.write("document.domain=\""+(document.domain)+"\";");
136  }                          Meteor.frameref.write("</"+"script></html>");
137                            Meteor.frameref.parentWindow.Meteor = Meteor;
138  Meteor.prototype.start = function() {                          Meteor.frameref.close();
139          this.persist = (this.maxmessages)?1:0;                          var ifrDiv = Meteor.frameref.createElement("div");
140          this.smartpoll = (this.smartpoll)?1:0;                          Meteor.frameref.appendChild(ifrDiv);
141          this.mode = (this.mode=="stream")?"stream":"poll";                          ifrDiv.innerHTML = "<iframe src=\""+url+"\"></iframe>";
142          if (!this.subdomain || !this.channel) throw "Channel or Meteor subdomain host not specified";                  } catch (e) {
143          var now = new Date();                          if (!Meteor.frameref) {
144          var t = now.getTime();                                  var ifr = document.createElement("IFRAME");
145          if (typeof(this.transferDoc)=="object") {                                  ifr.style.width = "10px";
146                  this.transferDoc.open();                                  ifr.style.height = "10px";
147                  this.transferDoc.close();                                  ifr.style.border = "none";
148                  delete this.transferDoc;                                  ifr.style.position = "absolute";
149          }                                  ifr.style.top = "-10px";
150          if (document.getElementById("meteorframe_"+this.instID)) {                                  ifr.style.marginTop = "-10px";
151                  document.body.removeChild(document.getElementById("meteorframe_"+this.instID));                                  ifr.style.zIndex = "-20";
152          }                                  ifr.Meteor = Meteor;
153          if (this.mode=="stream") {                                  document.body.appendChild(ifr);
154                  if (document.all) {                                  Meteor.frameref = ifr;
155                          this.setstatus(1);                          }
156                          this.transferDoc = new ActiveXObject("htmlfile");                          Meteor.frameref.setAttribute("src", url);
157                          this.transferDoc.open();                  }
158                          this.transferDoc.write("<html>");                  Meteor.log("Loading URL '"+url+"' into frame...");
159                          this.transferDoc.write("<script>document.domain=\""+(document.domain)+"\";</"+"script>");                  Meteor.frameloadtimer = setTimeout(Meteor.frameloadtimeout, 5000);
160                          this.transferDoc.write("</html>");          },
161                          var selfref = this;  
162                          this.transferDoc.parentWindow.Meteor = Meteor;          pollmode: function() {
163                          this.transferDoc.close();                  Meteor.log("Ping timeout");
164                          var ifrDiv = this.transferDoc.createElement("div");                  Meteor.mode="smartpoll";
165                          this.transferDoc.appendChild(ifrDiv);                  clearTimeout(Meteor.pingtimer);
166                          var url = "http://"+this.subdomain+"."+location.hostname+"/"+this.dynamicpageaddress+"?channel="+this.channel+"&id="+this.MHostId;                  Meteor.callbacks["changemode"]("poll");
167                          if (this.lastmsgreceived >= 0) {                  Meteor.lastpingtime = false;
168                                  url += "&restartfrom="+this.lastmsgreceived;                  Meteor.connect();
169                          } else if (this.backtrack > 0) {          },
170                                  url += "&backtrack="+this.backtrack;  
171                          } else if (this.backtrack < 0 || isNaN(this.backtrack)) {          process: function(id, channel, data) {
172                                  url += "&restartfrom=";                  if (id == -1) {
173                          }                          Meteor.log("Ping");
174                          ifrDiv.innerHTML = "<iframe id=\"meteorframe_"+this.instID+"\" src=\""+url+"&nocache="+t+"\" style=\"display: none;\"></iframe>";                          Meteor.ping();
175                  } else {                  } else if (typeof(Meteor.channels[channel]) != "undefined") {
176                          var ifr = document.createElement("IFRAME");                          Meteor.log("Message "+id+" received on channel "+channel+" (last id on channel: "+Meteor.channels[channel].lastmsgreceived+")\n"+data);
177                          ifr.style.width = "10px";                          Meteor.callbacks["process"](data);
178                          ifr.style.height = "10px";                          Meteor.channels[channel].lastmsgreceived = id;
179                          ifr.style.border = "none";                          if (Meteor.mode=="smartpoll") {
180                          ifr.style.position = "absolute";                                  var now = new Date();
181                          ifr.style.top = "-10px";                                  Meteor.recvtimes[Meteor.recvtimes.length] = now.getTime();
182                          ifr.style.marginTop = "-10px";                                  while (Meteor.recvtimes.length > 5) Meteor.recvtimes.shift();
183                          ifr.style.zIndex = "-20";                          }
184                          ifr.id = "meteorframe_"+this.instID;                  }
185                          document.body.appendChild(ifr);                  Meteor.setstatus(5);
186                          this.frameurl = "http://"+this.subdomain+"."+location.hostname+"/stream.html";          },
187                          this.frameload();  
188                  }          ping: function() {
189                  var f = this.pollmode.bind(this);                  if (Meteor.pingtimer) {
190                  clearTimeout(this.pingtimer);                          clearTimeout(Meteor.pingtimer);
191                  this.pingtimer = setTimeout(f, this.pingtimeout);                          Meteor.pingtimer = setTimeout(Meteor.pollmode, Meteor.pingtimeout);
192                            var now = new Date();
193          } else {                          Meteor.lastpingtime = now.getTime();
194                  var ifr = document.createElement("IFRAME");                  }
195                  ifr.style.width = "10px";                  Meteor.setstatus(5);
196                  ifr.style.height = "10px";          },
197                  ifr.style.border = "none";  
198                  if (document.all) {          reset: function() {
199                          ifr.style.display = "none";                  Meteor.log("Stream reset");
200                  } else {                  Meteor.ping();
201                          ifr.style.position = "absolute";                  Meteor.callbacks["reset"]();
202                          ifr.style.marginTop = "-10px";                  var now = new Date();
203                          ifr.style.zIndex = "-20";                  var t = now.getTime();
204                  }                  var x = Meteor.pollfreq - (t-Meteor.lastrequest);
205                  ifr.id = "meteorframe_"+this.instID;                  if (x < 10) x = 10;
206                  document.body.appendChild(ifr);                  setTimeout(Meteor.connect, x);
207                  this.frameurl = "http://"+this.subdomain+"."+location.hostname+"/poll.html";          },
208                  this.frameload();  
209                  this.recvtimes[0] = t;          eof: function() {
210                  if (this.updatepollfreqtimer) clearTimeout(this.updatepollfreqtimer);                  Meteor.callbacks["eof"]();
211                  this.updatepollfreqtimer = setInterval(this.updatepollfreq.bind(this), 2500);                  Meteor.disconnect();
212          }          },
213          this.lastrequest = t;  
214  }          channelInfo: function(channel, id) {
215                    Meteor.channels[channel].lastmsgreceived = id;
216  Meteor.prototype.pollmode = function() {                  Meteor.log("Received channel info for channel "+channel+": resume from "+id);
217          this.mode="poll";          },
218          this.start();  
219          this.callback_changemode("poll");          updatepollfreq: function() {
220          this.lastpingtime = false;                  var now = new Date();
221  }                  var t = now.getTime();
222                    var avg = 0;
223  Meteor.prototype.process = function(id, data) {                  for (var i=1; i<Meteor.recvtimes.length; i++) {
224          if (id > this.lastmsgreceived) {                          avg += (Meteor.recvtimes[i]-Meteor.recvtimes[i-1]);
225                  this.callback_process(data);                  }
226                  if (id != -1) this.lastmsgreceived = id;                  avg += (t-Meteor.recvtimes[Meteor.recvtimes.length-1]);
227                  if (this.mode=="poll") {                  avg /= Meteor.recvtimes.length;
228                          var now = new Date();                  var target = avg/2;
229                          var t = now.getTime();                  if (target < Meteor.pollfreq && Meteor.pollfreq > Meteor.minpollfreq) Meteor.pollfreq = Math.ceil(Meteor.pollfreq*0.9);
230                          this.recvtimes[this.recvtimes.length] = t;                  if (target > Meteor.pollfreq && Meteor.pollfreq < Meteor.maxpollfreq) Meteor.pollfreq = Math.floor(Meteor.pollfreq*1.05);
231                          while (this.recvtimes.length > 5) this.recvtimes.shift();          },
232                  }  
233          } else if (id == -1) {          registerEventCallback: function(evt, funcRef) {
234                  this.ping();                  Function.prototype.andThen=function(g) {
235          }                          var f=this;
236          this.setstatus(5);                          var a=Meteor.arguments
237  }                          return function(args) {
238                                    f(a);g(args);
239  Meteor.prototype.ping = function() {                          }
240          if (this.mode=="stream" && this.pingtimer) {                  };
241                  clearTimeout(this.pingtimer);                  if (typeof Meteor.callbacks[evt] == "function") {
242                  var f = this.pollmode.bind(this);                          Meteor.callbacks[evt] = (Meteor.callbacks[evt]).andThen(funcRef);
243                  this.pingtimer = setTimeout(f, this.pingtimeout);                  } else {
244                  var now = new Date();                          Meteor.callbacks[evt] = funcRef;
245                  this.lastpingtime = now.getTime();                  }
246          }          },
247          this.setstatus(5);  
248  }          frameloadtimeout: function() {
249                    Meteor.log("Frame load timeout");
250  Meteor.prototype.reset = function() {                  if (Meteor.frameloadtimer) clearTimeout(Meteor.frameloadtimer);
251          var now = new Date();                  Meteor.setstatus(3);
252          var t = now.getTime();                  Meteor.pollmode();
253          var x = this.pollfreq - (t-this.lastrequest);          },
254          if (x < 10) x = 10;  
255          this.ping();          extract_xss_domain: function(old_domain) {
256          this.callback_reset();                  if (old_domain.match(/^(\d{1,3}\.){3}\d{1,3}$/)) return old_domain;
257          setTimeout(this.start.bind(this), x);                  domain_pieces = old_domain.split('.');
258  }                  return domain_pieces.slice(-2, domain_pieces.length).join(".");
259            },
260  Meteor.prototype.eof = function() {  
261          this.callback_eof();          setstatus: function(newstatus) {
262  }                  // Statuses:    0 = Uninitialised,
263                    //                              1 = Loading stream,
264  Meteor.prototype.get = function(varname) {                  //                              2 = Loading controller frame,
265          eval("var a = this."+varname+";");                  //                              3 = Controller frame timeout, retrying.
266          if (typeof(a) == "undefined") throw "Cannot get value of "+varname;                  //                              4 = Controller frame loaded and ready
267          return a;                  //                              5 = Receiving data
268  }  
269                    if (Meteor.status != newstatus) {
270  Meteor.prototype.increasepolldelay = function() {                          Meteor.status = newstatus;
271          this.pollfreq *= 2;                          Meteor.callbacks["statuschanged"](newstatus);
272  }                  }
273            },
274  Meteor.prototype.updatepollfreq = function() {  
275          if (this.smartpoll) {          log: function(logstr) {
276                  var now = new Date();                  if (Meteor.debugmode) {
277                  var t = now.getTime();                          if (window.console) {
278                  var avg = 0;                                  window.console.log(logstr);
279                  for (var i=1; i<this.recvtimes.length; i++) {                          } else if (document.getElementById("meteorlogoutput")) {
280                          var x = (this.recvtimes[i]-this.recvtimes[i-1]);                                  document.getElementById("meteorlogoutput").innerHTML += logstr+"<br/>";
281                          avg += (x>60000)? 60000 : x;                          }
282                  }                  }
283                  x = (t-this.recvtimes[this.recvtimes.length-1]);          }
284                  avg += (x>180000)? 180000 : x;  }
285                  avg /= this.recvtimes.length;  
286                  if ((avg/3) < this.pollfreq && (avg/3) >= this.minpollfreq) this.pollfreq = Math.ceil(this.pollfreq*0.9);  var oldonunload = window.onunload;
287                  if ((avg/3) > this.pollfreq) this.pollfreq = Math.floor(this.pollfreq*1.05);  if (typeof window.onunload != 'function') {
288          }          window.onunload = Meteor.disconnect;
289  }  } else {
290            window.onunload = function() {
291  Meteor.prototype.registerEventCallback = function(evt, funcRef) {                  if (oldonunload) oldonunload();
292          if (evt=="process") {                  Meteor.disconnect();
293                  this.callback_process = (this.callback_process).andThen(funcRef);          }
         } else if (evt=="reset") {  
                 this.callback_reset = (this.callback_reset).andThen(funcRef);  
         } else if (evt=="eof") {  
                 this.callback_eof = (this.callback_eof).andThen(funcRef);  
         } else if (evt=="changemode") {  
                 this.callback_changemode = (this.callback_changemode).andThen(funcRef);  
         } else if (evt=="changestatus") {  
                 this.callback_statuschanged = (this.callback_statuschanged).andThen(funcRef);  
         }  
 }  
   
 Meteor.prototype.frameload = function() {  
         this.setstatus(2);  
         if (document.getElementById("meteorframe_"+this.instID)) {  
                 var f = this.frameloadtimeout.bind(this);  
                 this.frameloadtimer = setTimeout(f, 5000);  
                 document.getElementById("meteorframe_"+this.instID).src = "about:blank";  
                 setTimeout(this.doloadurl.bind(this), 100);  
         }  
 }  
 Meteor.prototype.doloadurl = function() {  
         var now = new Date();  
         var t = now.getTime();  
         document.getElementById("meteorframe_"+this.instID).src = this.frameurl+"?nocache="+t;  
 }  
 Meteor.prototype.frameloadtimeout = function() {  
         if (this.frameloadtimer) clearTimeout(this.frameloadtimer);  
         this.setstatus(3);  
         this.frameload();  
 }  
 Meteor.prototype.setstatus = function(newstatus) {  
         if (this.status != newstatus) {  
                 this.status = newstatus;  
                 this.callback_statuschanged(newstatus);  
         }  
 }  
   
 Meteor.createCookie = function(name,value,days) {  
         if (days) {  
                 var date = new Date();  
                 date.setTime(date.getTime()+(days*24*60*60*1000));  
                 var expires = "; expires="+date.toGMTString();  
         }  
         else var expires = "";  
         document.cookie = name+"="+value+expires+"; path=/";  
 }  
   
 Meteor.readCookie = function(name) {  
         var nameEQ = name + "=";  
         var ca = document.cookie.split(';');  
         for(var i=0;i < ca.length;i++) {  
                 var c = ca[i];  
                 while (c.charAt(0)==' ') c = c.substring(1,c.length);  
                 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);  
         }  
         return null;  
 }  
   
 Meteor.eraseCookie = function(name) {  
         createCookie(name,"",-1);  
294  }  }

Legend:
Removed from v.8  
changed lines
  Added in v.53

  ViewVC Help
Powered by ViewVC 1.1.26