home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 March / PCWorld_2005-03_cd.bin / komunikace / kmeleon / kmeleon09.exe / toolkit.jar / content / global / netError.js < prev    next >
Text File  |  2002-10-31  |  2KB  |  72 lines

  1. // Error url MUST be formatted like this:
  2. //   chrome://neterror.xhtml?e=error&u=url&d=desc
  3.  
  4. function getErrorCode()
  5. {
  6.   url = document.location.href;
  7.   error = url.search(/e\=/);
  8.   duffUrl = url.search(/\&u\=/);
  9.   return unescape(url.slice(error + 2, duffUrl));
  10. }
  11.  
  12. function getDuffUrl()
  13. {
  14.   url = document.location.href;
  15.   duffUrl = url.search(/u\=/);
  16.   desc = url.search(/\&d\=/);
  17.   return unescape(url.slice(duffUrl + 2, desc));
  18. }
  19.  
  20. function getDescription()
  21. {
  22.   url = document.location.href;
  23.   desc = url.search(/d\=/);
  24.   return unescape(url.slice(desc + 2));
  25. }
  26.  
  27. function retryThis() {
  28.     //var duffUrl = getDuffUrl();
  29.     //document.location.href = duffUrl;
  30.     document.location.href = document.getElementById("searchfield").value
  31. }
  32.  
  33. function searchThis() {
  34.     searchForThis(document.getElementById("searchfield").value);
  35. }
  36.  
  37. function searchForThis(url) {
  38.     document.location.href = "http://www.google.com/search?q=" + url;
  39. }
  40.  
  41. function fillIn() {
  42.     var err = getErrorCode();
  43.     var duffUrl = getDuffUrl();
  44.     var i;
  45.  
  46.     var titleText = document.getElementById(err + ".title").innerHTML;
  47.     document.title = titleText;
  48.     document.getElementById("title").firstChild.nodeValue = titleText;
  49.     //document.getElementById("title").firstChild.appendValue = titleText;
  50.     document.getElementById("shortDesc").firstChild.nodeValue = getDescription();
  51.     document.getElementById("longDesc").firstChild.nodeValue = document.getElementById(err + ".longDesc").innerHTML;
  52.  
  53.     document.getElementById("searchfield").value = duffUrl;
  54. /*
  55.     // Fill in the short description
  56.  
  57.     var sd = document.getElementById("shortDesc");
  58.     for (i = 0; i < sd.childNodes.length; i++)
  59.     {
  60.         var n = sd.childNodes.item(i);
  61.         if (n.nodeType == Node.TEXT_NODE) {
  62.             n.nodeValue = getDescription();
  63.             break;
  64.         }
  65.     }
  66.  
  67.     // Long description
  68.     var d = document.getElementById(err);
  69.     d.setAttribute("style", "display:block;");
  70. */
  71. }
  72.