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

Legend:
Removed from v.10  
changed lines
  Added in v.60

  ViewVC Help
Powered by ViewVC 1.1.26