h2g2 Toolbar for Netscape 7/Mozilla Project
Created | Updated Nov 22, 2002
This is a project to develop a toolbar add-on for Netscape 7+ and Mozilla 1.0+. The toolbar’s purpose is to assist users of these browsers when using h2g2.
References
- XUL Tutorial from XulPlanet.
- Creating Applications with Mozilla from mozdev
- XPInstall manual from DevEdge
- Creating a toolbar for Netscape 7 from Dev Edge
Current Status
I have an XUL file containing the following code…
<?xml version="1.0"?>
<window
id="exampleXULWindow"
orient="horizontal"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script>
function h2g2LoadPage(url){
// change the current loaded page
window.content.document.location.href=url;
}
function h2g2toolbarSearch(){
// get the menulist element
var mySearchMenuList = document.getElementById('h2g2toolbarSearchText');
// extract its value
var mySearchTerm = mySearchMenuList.value;
// create the search string
var mySearchString = "http://www.bbc.co.uk/h2g2/guide/Search?searchstring=" + mySearchTerm + "&searchtype=goosearch";
// Add the search term to the menulist's dropdown
//
// insertItemAt ( index, label, value )
//
// We want to add it to the top of the drop down, so index 0.
mySearchMenuList.insertItemAt(0,mySearchTerm);
//load the search string
h2g2toolbarLoadPage(mySearchString);
}
</script>
<toolbox flex="1">
<toolbar id="h2g2-Toolbar">
<toolbarbutton id="h2g2toolbarMenu" label=" h2g2 " type="menu">
<menupopup>
<menuitem label="Front Page" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/h2g2/')"/>
<menuitem label="Life" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/h2g2/C72')"/>
<menuitem label="The Universe" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/h2g2/C73')"/>
<menuitem label="Everything" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/h2g2/C74')"/>
<menuseparator/>
<menuitem label="Dont Panic" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/h2g2/dontpanic')"/>
<menuitem label="Feedback" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/h2g2/Feedback')"/>
<menuitem label="Announcements" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/h2g2/Announcements')"/>
<menuseparator/>
<menuitem label="Peer Review" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/h2g2/PeerReview')"/>
<menuseparator/>
<menuitem label="The Post" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/h2g2/ThePost')"/>
<menuseparator/>
<menuitem label="Smileys" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/h2g2/Smiley')"/>
</menupopup>
</toolbarbutton>
<toolbarbutton id="dnatoolbarMenu" label=" DNA " type="menu">
<menupopup>
<menuitem label="Front Page" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/hub/')"/>
<menuitem label="Announcements" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/hub/Announcements')"/>
<menuseparator/>
<menuitem label="Feedback" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/hub/Feedback')"/>
<menuitem label="Knowledge Base" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/hub/Help')"/>
</menupopup>
</toolbarbutton>
<toolbarbutton id="guidemltoolbarMenu" label=" GuideML " type="menu">
<menupopup>
<menuitem label="GuideML Clinic" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/hub/A787016')"/>
<menuitem label="Introduction" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/hub/GuideML-Introduction')"/>
<menuitem label="Syntax" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/hub/GuideML-Syntax')"/>
<menuitem label="Special Character Codes" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/hub/GuideML-Characters')"/>
<menuitem label="FAQ" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/hub/GuideML-FAQ')"/>
<menuseparator/>
<menuitem label="Approved GuideML" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/h2g2/A264520')"/>
<menuitem label="Picture Library" oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/h2g2/GuideML-PictureLibrary')"/>
</menupopup>
</toolbarbutton>
<toolbarbutton id="myuserspace" label=" My Space " oncommand="devedgetoolbarLoadPage('http://www.bbc.co.uk/dna/h2g2/U150533')" />
<menulist id="h2g2toolbarSearchText" editable="true" onkeypress="if(event.keyCode == 13) {h2g2toolbarSearch();}"
minwidth="160">
<menupopup>
<menuitem label="Life"/>
<menuitem label="The Universe"/>
<menuitem label="Everyting"/>
</menupopup>
</menulist>
</toolbar>
</toolbox>
</window>