/[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 32 by andrew.betts, Thu Dec 20 21:24:24 2007 UTC revision 53 by andrew.betts, Wed Feb 27 21:58:56 2008 UTC
# Line 25  Meteor = { Line 25  Meteor = {
25          mode: "stream",          mode: "stream",
26          pingtimeout: 20000,          pingtimeout: 20000,
27          pingtimer: null,          pingtimer: null,
28          pollfreq: 5000,          pollfreq: 3000,
29          port: 80,          port: 80,
30          polltimeout: 30000,          polltimeout: 30000,
31          recvtimes: [],          recvtimes: [],
# Line 36  Meteor = { Line 36  Meteor = {
36                  ifr.p = Meteor.process;                  ifr.p = Meteor.process;
37                  ifr.r = Meteor.reset;                  ifr.r = Meteor.reset;
38                  ifr.eof = Meteor.eof;                  ifr.eof = Meteor.eof;
39                    ifr.ch = Meteor.channelInfo;
40                  clearTimeout(Meteor.frameloadtimer);                  clearTimeout(Meteor.frameloadtimer);
41                  Meteor.setstatus(4);                  Meteor.setstatus(4);
42                  Meteor.log("Frame registered");                  Meteor.log("Frame registered");
# Line 91  Meteor = { Line 92  Meteor = {
92    
93          disconnect: function() {          disconnect: function() {
94                  if (Meteor.status) {                  if (Meteor.status) {
                         if (typeof(Meteor.frameref)=="iframe") Meteor.frameref.setAttribute("src", "about:blank");  
                         Meteor.frameref = null;  
95                          clearTimeout(Meteor.pingtimer);                          clearTimeout(Meteor.pingtimer);
96                          clearTimeout(Meteor.updatepollfreqtimer);                          clearTimeout(Meteor.updatepollfreqtimer);
97                          clearTimeout(Meteor.frameloadtimer);                          clearTimeout(Meteor.frameloadtimer);
# Line 126  Meteor = { Line 125  Meteor = {
125          },          },
126    
127          loadFrame: function(url) {          loadFrame: function(url) {
                 Meteor.frameref = null;  
128                  try {                  try {
129                          var transferDoc = new ActiveXObject("htmlfile");                          if (!Meteor.frameref) {
130                          transferDoc.open();                                  var transferDoc = new ActiveXObject("htmlfile");
131                          transferDoc.write("<html><script>");                                  Meteor.frameref = transferDoc;
132                          transferDoc.write("document.domain=\""+(document.domain)+"\";");                          }
133                          transferDoc.write("</"+"script></html>");                          Meteor.frameref.open();
134                          transferDoc.parentWindow.Meteor = Meteor;                          Meteor.frameref.write("<html><script>");
135                          transferDoc.close();                          Meteor.frameref.write("document.domain=\""+(document.domain)+"\";");
136                          var ifrDiv = transferDoc.createElement("div");                          Meteor.frameref.write("</"+"script></html>");
137                          transferDoc.appendChild(ifrDiv);                          Meteor.frameref.parentWindow.Meteor = Meteor;
138                            Meteor.frameref.close();
139                            var ifrDiv = Meteor.frameref.createElement("div");
140                            Meteor.frameref.appendChild(ifrDiv);
141                          ifrDiv.innerHTML = "<iframe src=\""+url+"\"></iframe>";                          ifrDiv.innerHTML = "<iframe src=\""+url+"\"></iframe>";
                         Meteor.frameref = transferDoc;  
142                  } catch (e) {                  } catch (e) {
143                          var ifr = document.createElement("IFRAME");                          if (!Meteor.frameref) {
144                          ifr.style.width = "10px";                                  var ifr = document.createElement("IFRAME");
145                          ifr.style.height = "10px";                                  ifr.style.width = "10px";
146                          ifr.style.border = "none";                                  ifr.style.height = "10px";
147                          ifr.style.position = "absolute";                                  ifr.style.border = "none";
148                          ifr.style.top = "-10px";                                  ifr.style.position = "absolute";
149                          ifr.style.marginTop = "-10px";                                  ifr.style.top = "-10px";
150                          ifr.style.zIndex = "-20";                                  ifr.style.marginTop = "-10px";
151                          ifr.Meteor = Meteor;                                  ifr.style.zIndex = "-20";
152                          ifr.setAttribute("src", url);                                  ifr.Meteor = Meteor;
153                          document.body.appendChild(ifr);                                  document.body.appendChild(ifr);
154                          Meteor.frameref = ifr;                                  Meteor.frameref = ifr;
155                            }
156                            Meteor.frameref.setAttribute("src", url);
157                  }                  }
158                  Meteor.log("Loading URL '"+url+"' into frame...");                  Meteor.log("Loading URL '"+url+"' into frame...");
159                  Meteor.frameloadtimer = setTimeout(Meteor.frameloadtimeout, 5000);                  Meteor.frameloadtimer = setTimeout(Meteor.frameloadtimeout, 5000);
# Line 161  Meteor = { Line 163  Meteor = {
163                  Meteor.log("Ping timeout");                  Meteor.log("Ping timeout");
164                  Meteor.mode="smartpoll";                  Meteor.mode="smartpoll";
165                  clearTimeout(Meteor.pingtimer);                  clearTimeout(Meteor.pingtimer);
                 Meteor.connect();  
166                  Meteor.callbacks["changemode"]("poll");                  Meteor.callbacks["changemode"]("poll");
167                  Meteor.lastpingtime = false;                  Meteor.lastpingtime = false;
168                    Meteor.connect();
169          },          },
170    
171          process: function(id, channel, data) {          process: function(id, channel, data) {
172                  if (id == -1) {                  if (id == -1) {
173                          Meteor.log("Ping");                          Meteor.log("Ping");
174                          Meteor.ping();                          Meteor.ping();
175                  } else if (typeof(Meteor.channels[channel]) != "undefined" && id > Meteor.channels[channel].lastmsgreceived) {                  } else if (typeof(Meteor.channels[channel]) != "undefined") {
176                          Meteor.log("Message "+id+" received on channel "+channel+" (last id on channel: "+Meteor.channels[channel].lastmsgreceived+")\n"+data);                          Meteor.log("Message "+id+" received on channel "+channel+" (last id on channel: "+Meteor.channels[channel].lastmsgreceived+")\n"+data);
177                          Meteor.callbacks["process"](data);                          Meteor.callbacks["process"](data);
178                          Meteor.channels[channel].lastmsgreceived = id;                          Meteor.channels[channel].lastmsgreceived = id;
# Line 206  Meteor = { Line 208  Meteor = {
208    
209          eof: function() {          eof: function() {
210                  Meteor.callbacks["eof"]();                  Meteor.callbacks["eof"]();
211                    Meteor.disconnect();
212            },
213    
214            channelInfo: function(channel, id) {
215                    Meteor.channels[channel].lastmsgreceived = id;
216                    Meteor.log("Received channel info for channel "+channel+": resume from "+id);
217          },          },
218    
219          updatepollfreq: function() {          updatepollfreq: function() {
# Line 241  Meteor = { Line 249  Meteor = {
249                  Meteor.log("Frame load timeout");                  Meteor.log("Frame load timeout");
250                  if (Meteor.frameloadtimer) clearTimeout(Meteor.frameloadtimer);                  if (Meteor.frameloadtimer) clearTimeout(Meteor.frameloadtimer);
251                  Meteor.setstatus(3);                  Meteor.setstatus(3);
252                  setTimeout(Meteor.connect, 5000);                  Meteor.pollmode();
253          },          },
254    
255          extract_xss_domain: function(old_domain) {          extract_xss_domain: function(old_domain) {

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

  ViewVC Help
Powered by ViewVC 1.1.26