home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 December / PCWorld_2006-12_cd.bin / komunikace / netscape / nsb-install-8-1-2.exe / chrome / browser.jar / content / browser / web-panels.js < prev    next >
Text File  |  2006-01-06  |  3KB  |  73 lines

  1.  
  2. var panelProgressListener = {
  3.     onProgressChange : function (aWebProgress, aRequest,
  4.                                     aCurSelfProgress, aMaxSelfProgress,
  5.                                     aCurTotalProgress, aMaxTotalProgress) {
  6.     },
  7.     
  8.     onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
  9.     {
  10.         if (!aRequest)
  11.           return;
  12.  
  13.         //ignore local/resource:/chrome: files
  14.         if (aStatus == NS_NET_STATUS_READ_FROM || aStatus == NS_NET_STATUS_WROTE_TO)
  15.            return;
  16.  
  17.         const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
  18.         const nsIChannel = Components.interfaces.nsIChannel;
  19.         if (aStateFlags & nsIWebProgressListener.STATE_START && 
  20.             aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
  21.             window.parent.document.getElementById('sidebar-throbber').setAttribute("loading", "true");
  22.         }
  23.         else if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
  24.                 aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
  25.             window.parent.document.getElementById('sidebar-throbber').removeAttribute("loading");
  26.         }
  27.     }
  28.     ,
  29.  
  30.     onLocationChange : function(aWebProgress, aRequest, aLocation) {
  31.     },
  32.  
  33.     onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage) {
  34.     },
  35.  
  36.     onSecurityChange : function(aWebProgress, aRequest, aState) { 
  37.     },
  38.  
  39.     QueryInterface : function(aIID)
  40.     {
  41.         if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
  42.             aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
  43.             aIID.equals(Components.interfaces.nsISupports))
  44.         return this;
  45.         throw Components.results.NS_NOINTERFACE;
  46.     }
  47. };
  48.  
  49. var gLoadFired = false;
  50. function loadWebPanel(aURI) {
  51.     var panelBrowser = document.getElementById('web-panels-browser');
  52.     if (gLoadFired)
  53.         panelBrowser.webNavigation.loadURI(aURI, nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
  54.     panelBrowser.setAttribute("cachedurl", aURI);
  55. }
  56.  
  57. function load()
  58. {
  59.   var panelBrowser = document.getElementById('web-panels-browser');
  60.   panelBrowser.webProgress.addProgressListener(panelProgressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
  61.   if (panelBrowser.getAttribute("cachedurl"))
  62.     panelBrowser.webNavigation.loadURI(panelBrowser.getAttribute("cachedurl"), nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
  63.   gNavigatorBundle = document.getElementById("bundle_browser");
  64.     
  65.   gLoadFired = true;
  66. }
  67.  
  68. function unload()
  69. {
  70.   var panelBrowser = document.getElementById('web-panels-browser');
  71.   panelBrowser.webProgress.removeProgressListener(panelProgressListener);
  72. }
  73.