XUL overlays

Talk about add-ons and extension development.
Post Reply
[Dude]
Posts: 108
Joined: May 9th, 2006, 4:17 am

XUL overlays

Post by [Dude] »

hi,

Can you add more then one overlay in one XUL file (for example a menuitem in a menu and also a button to a toolbar) or do you have to make a new xul file for each overlay to a firefox element you make?

thanks
Last edited by [Dude] on May 25th, 2006, 10:01 am, edited 1 time in total.
supernova_00
Posts: 4832
Joined: June 24th, 2004, 8:03 pm
Location: Maryland, USA

Post by supernova_00 »

separte files since you are overlaying two separate things and in your chrome.manifest you have to sepcify which file you are overlaying.
asqueella
Posts: 4019
Joined: November 16th, 2003, 3:05 am
Location: Russia, Moscow

Post by asqueella »

At least one overlay per document. So if those elements are all in the same document/window, you'll only need one overlay.
[Dude]
Posts: 108
Joined: May 9th, 2006, 4:17 am

Post by [Dude] »

hi,

Can somebody tell me what's wrong here in my chrome.manifest file:

Code: Select all

content   myextension content/
overlay   chrome://browser/content/browser.xul chrome://myextension/content/overlay.xul
overlay   chrome://browser/content/browser.xul chrome://myextension/content/gbltutorial.xul

locale myextension en-US locale/en-US/

skin myextension classic/1.0   skin/
style chrome://global/content/customizeToolbar.xul chrome://myextension/skin/overlay.css
style chrome://global/content/customizeToolbar.xul chrome://myextension/skin/tut_overlay.css


So I have 2 overlay files overlay.xul and gbltutorial.xul and also 2 style files overlay.css and tut_overlay.css.
The result in firefox is that only gbltutorial.xul and tut_overlay.css are visible, however when I delete the entries for gbltutorial.xul from the chrome.manifest file, the overlay.xul is displayed. But I want them to display both but I don't know why this does not work ...

thanks in advance
supernova_00
Posts: 4832
Joined: June 24th, 2004, 8:03 pm
Location: Maryland, USA

Post by supernova_00 »

not sure if this is a problem or not but add chrome/ in front of content/ and skin/

like:

Code: Select all

content   myextension chrome/content/

skin myextension classic/1.0   chrome/skin/
[Dude]
Posts: 108
Joined: May 9th, 2006, 4:17 am

Post by [Dude] »

supernova_00 wrote:not sure if this is a problem or not but add chrome/ in front of content/ and skin/


hi

this is not the problem since I'm working in my development environment so there is no chrome folder.
I tried to package the XPI file (so there is the chrome folder then) but still no result :(

I hope somebody knows what's wrong because I can't get 2 or more overlays to work at the same time (1 overlay is working well)

thanks in advance
[Dude]
Posts: 108
Joined: May 9th, 2006, 4:17 am

Post by [Dude] »

hi,

Is it possible to have 2 or more overlays for some XUL file at the same time?
I my case for the file chrome://browser/content/browser.xul?

thanks
supernova_00
Posts: 4832
Joined: June 24th, 2004, 8:03 pm
Location: Maryland, USA

Post by supernova_00 »

[Dude] wrote:hi,

Is it possible to have 2 or more overlays for some XUL file at the same time?
I my case for the file chrome://browser/content/browser.xul?

thanks

yes it is, if you look at one of the examples I gave you the other day in a thread i overlaid browser.xul a few times
[Dude]
Posts: 108
Joined: May 9th, 2006, 4:17 am

Post by [Dude] »

supernova_00 wrote:
[Dude] wrote:hi,

Is it possible to have 2 or more overlays for some XUL file at the same time?
I my case for the file chrome://browser/content/browser.xul?

thanks

yes it is, if you look at one of the examples I gave you the other day in a thread i overlaid browser.xul a few times


any idea why my example isn't working? I use the file like posted above here

I can't figure out what's wrong. I only get 1 overlay displayedat once , never 2 at the same time ...
asqueella
Posts: 4019
Joined: November 16th, 2003, 3:05 am
Location: Russia, Moscow

Post by asqueella »

what about posting the overlay's code?
[Dude]
Posts: 108
Joined: May 9th, 2006, 4:17 am

Post by [Dude] »

hi

Here is the code of my 2 overlays (these are just toturial overlays for testing)

file: overlay.xul

Code: Select all

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://myextension/skin/overlay.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://myextension/locale/overlay.dtd">
<overlay id="helloworld-overlay"
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <script src="overlay.js" />

   <!-- <menupopup id="menu_ToolsPopup">
      <menuitem id="helloworld-hello" label="&helloworld;"
         oncommand="MyExtension.onMenuItemCommand(event);" />
   </menupopup> -->
   
   <toolbarpalette id="BrowserToolbarPalette">
        <toolbarbutton
           id="myextension-button" class="toolbarbutton-1"
          label="test" tooltiptext="test"
          oncommand="MyExtension.onToolbarButtonCommand(event);"/>
   </toolbarpalette>
</overlay>


file: glbtutorial.xul

Code: Select all

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://myextension/skin/tut_overlay.css" type="text/css"?>

<overlay id="GBLTut-Overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script type="application/x-javascript" src="chrome://myextension/content/gbltutorial.js"/>
      
<toolbox id="navigator-toolbox">

   <toolbar id="GBLTut-Toolbar" accesskey="T" class="chromeclass-toolbar"
   context="toolbar-context-menu" toolbarname="Navigation toolbar"
   hidden="false" persist="hidden">
   
      <!-- The following toolbaritem element surrounds the main menu toolbarbutton element,
      and includes a flex attribute value of 0. The goal is to prevent a cosmetic sizing
      problem when using the resize bar on the toolbar. -->
      <toolbaritem flex="0">
      
         <toolbarbutton id="GBLTut-MainMenu" type="menu"
                     tooltiptext="Main menu">
            <menupopup>
               <menuitem label="Google" accesskey="G"
                       tooltiptext="Visit Google's website"
                       oncommand="GBLTut_LoadURL('http://www.google.com/')" />
               
               <menuseparator />
               
               <menuitem label="Mozilla" accesskey="M"
                       tooltiptext="Visit Mozilla's website"
                       oncommand="GBLTut_LoadURL('http://www.mozilla.org/')" />
            </menupopup>
         </toolbarbutton>
      
      </toolbaritem>
   
      <toolbaritem id="GBLTut-SearchTerms-TBItem" persist="width">
         <menulist id="GBLTut-SearchTerms" editable="true" flex="1"
                 minwidth="100" width="250"
                 onkeypress="if(event.which == 13) { GBLTut_Search(event, 'web'); }">
            <menupopup id="GBLTut-SearchTermsMenu" onpopupshowing="GBLTut_Populate()" />
         </menulist>
      </toolbaritem>
   
      <splitter id="GBLTut-ResizeSplitter" state="open" collapse="none"
              resizebefore="closest" resizeafter="farthest"
              tooltiptext="Resize the Search Box" />
   
      <toolbaritem flex="0">
      
         <toolbarbutton id="GBLTut-TB-Combined" label="Search"
                     type="menu-button" tooltiptext="Combined Search Menu"
                     oncommand="GBLTut_Search(event)">
      
            <menupopup>
               <menuitem id="GBLTut-TB-Combined-Web" label="Web Search"
                       class="menuitem-iconic" tooltiptext="Search the Web"
                       oncommand="GBLTut_Search(event, 'web'); event.preventBubble();" />
                      
               <menuitem id="GBLTut-TB-Combined-Image" label="Image Search"
                       class="menuitem-iconic" tooltiptext="Search Images"
                       oncommand="GBLTut_Search(event, 'image'); event.preventBubble();" />
            </menupopup>
            
         </toolbarbutton>
      
         <!-- The following toolbarseparator element was included for cosmetic purposes only -->
         <toolbarseparator />
      
         <toolbarbutton id="GBLTut-TB-Web" tooltiptext="Search the Web"
                     label="Web Search" oncommand="GBLTut_Search(event, 'web')" />
      
      </toolbaritem>
   
      <!-- The following toolbarspring element is included to help illustrate the resize bar's
      capability. Without this element, the resize bar would not be able to move to the far right
      as we would like it to. -->
      <toolbarspring />
   
   </toolbar>
</toolbox>
</overlay>


These overlays work seperately but I can't get them to work together for overlaying chrome://browser/content/browser.xul

Maybe somebody knows what's wrong

thanks in advance
Post Reply