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

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

  ViewVC Help
Powered by ViewVC 1.1.26