mozdev.org

QLookup   

Home | Mailing List | Installation | Uninstallation | Extending | Source Code | Screenshots

Extending

Hints.


A simple lookup.

Re-uses existing functionality, demonstrates html character code for ampersand.

This code goes in qlookup.xul, found in <mozilla install dir>/chrome/qlookup/content/
<menuitem id="qlookup-thes" label="Lookup at thesaurus.com" oncommand="doLookup('http://www.thesaurus.com/cgi-bin/search?config=roget&#38;words=')"/>
The 'qlookup-thes' id must be added to qlookup.js, found in <mozilla install dir>/chrome/qlookup/content/
var elementTags = new Array('qlookup-dict',
                            'qlookup-goog',
                            'qlookup-url',
                            'qlookup-thes');

An advanced lookup, inserting term in the middle of a URL.

Also features a popup dialog box if no-thing is selected. You would not want to disable this sort of item when no-thing is selected, since it has valid functionality in such a case.

This code goes in qlookup.js, found in <mozilla install dir>/chrome/qlookup/content/
// ==============
function doGoogleAdvanced() {
   var selection = getSelection();
   if (selection.length < 1)
      selection = prompt('Keywords...','');
   if (selection.length < 1)
      return;

   urlPrefix  = 'http://www.google.com/search?as_q=';
   urlPostfix = '&num=100&hl=en&ie=ISO-8859-1&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_occt=any&as_dt=i&as_sitesearch=&safe=images';

   doUrl(urlPrefix + selection + urlPostfix);
}
// ==============
This code goes in qlookup.xul, found in <mozilla install dir>/chrome/qlookup/content/
<menuitem id="qlookup-adv" label="Google Advanced" oncommand="doGoogleAdvanced()"/>

The qlookup project can be contacted through the mailing list or the member list.
Copyright © 2000-2017. All rights reserved. Terms of Use & Privacy Policy.