/[jsFind]/trunk/html/js/search.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/html/js/search.js

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

revision 30 by dpavlin, Thu Oct 7 22:41:16 2004 UTC revision 31 by dpavlin, Sun Oct 10 04:53:22 2004 UTC
# Line 88  function debug(msg) Line 88  function debug(msg)
88    
89    if (! debug_div) debug_div = document.getElementById('debug');    if (! debug_div) debug_div = document.getElementById('debug');
90    
91      // this will create debug div if it doesn't exist.
92      if (! debug_div) {
93            debug_div = document.createElement('div');
94            document.body.appendChild(debug_div);
95      }
96    if (debug_div) {    if (debug_div) {
97          debug_div.appendChild(document.createTextNode(msg));          debug_div.appendChild(document.createTextNode(msg));
98          debug_div.appendChild(document.createElement("br"));          debug_div.appendChild(document.createElement("br"));
99    }    }
100  }  }
101    
 //  
   
102  // Convert a number into a base 62 alphanumeric number string  // Convert a number into a base 62 alphanumeric number string
103  function convert(num)  function convert(num)
104  {  {
# Line 157  function loadXML(url, handler, data, res Line 160  function loadXML(url, handler, data, res
160    
161        // And tell it what URL to load        // And tell it what URL to load
162        xmldoc.load(url);        xmldoc.load(url);
163          return true;
164      }      }
165      // Otherwise use Microsoft's proprietary API for Internet Explorer      // Otherwise use Microsoft's proprietary API for Internet Explorer
166      // Something about not following standards once again      // Something about not following standards once again
# Line 170  function loadXML(url, handler, data, res Line 174  function loadXML(url, handler, data, res
174          if (xmldoc.readyState == 4) handler(xmldoc, url, data, result_handler);          if (xmldoc.readyState == 4) handler(xmldoc, url, data, result_handler);
175        }        }
176        xmldoc.load(url);                                     // Start loading!        xmldoc.load(url);                                     // Start loading!
177          return true;
178        }
179        // else fallback on usage of iframes to load xml (Opera 7.53 without Java and maybe old Mac browsers)
180        else {
181          debug("using iframe xml loader - experimental and slow");
182          if (! window.xml_iframe) {
183            debug("creating iframe");
184            window.xml_iframe = document.createElement('div');
185            window.xml_iframe.innerHTML = '<iframe src="'+url+'" name="xml_iframe" height="0" width="0" style="display: none;"></iframe>';
186            document.body.appendChild(window.xml_iframe);
187          } else {
188            debug("loading xml in existing iframe");
189            window.frames.xml_iframe.window.document.location.href = url;
190          }
191    
192          // set timeout to re-check if iframe is loaded
193          window.iframe_timeout = window.setInterval('iframe_xml_loaded();',100);
194    
195          // save some data for iframe_xml_loaded()
196          window.xml_handler = handler;
197          window.xml_url = url;
198          window.xml_data = data;
199          window.xml_result_handler = result_handler;
200          return true;
201      }      }
202        clearTimeout(watchdog_id);
203        debug("Browser incompatilibity: can't request XML document by one of supported methods");
204        return false;
205    }    }
206    catch(ex)    catch(ex)
207    {    {
# Line 184  function loadXML(url, handler, data, res Line 215  function loadXML(url, handler, data, res
215    return true;    return true;
216  }  }
217    
218    function iframe_xml_loaded() {
219      debug("iframe_xmldoc_loaded");
220      if (! window.frames['xml_iframe']) return;
221      var xml = eval('window.frames.xml_iframe.window.document');
222      if (xml) {
223            clearTimeout(window.iframe_timeout);
224            debug("calling handler with ("+window.xml_url+","+window.xml_data+",...)");
225            window.xml_handler(window.frames.xml_iframe.window.document, window.xml_url, window.xml_data, window.xml_result_handler);
226      } else {
227            debug("can't eval iframe with xml");
228      }
229    }
230    
231  function loadData(xmldoc, url, pos, result_handler)  function loadData(xmldoc, url, pos, result_handler)
232  {  {
233    clearTimeout(watchdog_id);    clearTimeout(watchdog_id);

Legend:
Removed from v.30  
changed lines
  Added in v.31

  ViewVC Help
Powered by ViewVC 1.1.26