[Project_owners] Firefox sidebar

HJ bugus at universum.org
Mon Nov 29 16:54:01 EST 2004


Brian King wrote:
> I've set up an extension to load in the Firefox sidebar (using an overlay).
> 
> 2 questions:
> 1) Is there a way to determine from another window (say a settings 
> window) if the sidebar is open, with your extension loaded?
> 2) How to get a handle on it if it is open, say to update styles, add 
> content, etc.

This is some untested (unfinished) code. I hope it help:

function getSideBarStatus(aSideBarID) {

   var sidebar = window.opener.document.getElementById("sidebar-box");

   if (!sidebar.hidden) {
     var selectedSideBarID = sidebar.getAttribute("sideBarcommand");
     var selectedSideBar = 
window.opener.document.getElementById(selectedSideBarID);

     if (selectedSidebar == aSideBarID) {
       var mySidebar = window.opener.document.getElementById(aSideBarID);

       if (!mySidebar)
         return UNKNOWN_SIDEBAR;
       else if (!mySidebar.hidden)
         return SIDEBAR_SELECTED;
     }
   }
   return SIDEBAR_HIDDEN;
}


More information about the Project_owners mailing list