SUMMARY: Google search bar hacks
I amended the file "nsSearchService.js" to introduce two new functions to the Google search bar in FireFox:
1- Search the current site with the syntax "site:this"

2- Conduct a Google Image Search with the syntax "img:"

To install this hack, re-name your current 'nsSearchService.js' file (just in case you want to remove the hack) and replace the original with this one:
New and improved 'nsSearchService.js'. See lines 733 and 855 for the edits.
On Vista (and presumably XP), 'nsSearchService.js' is located in this directory: C:\Program Files\Mozilla Firefox\components
On Linux, the file is located here: /usr/lib/firefox/components/nsSearchService.js
This solution is not very modular; the file must be installed or deleted manually. However, it does offer some advantages:
- Functionality is directly integrated into the Google search bar so there is no need for a separate search engine
- No need for a custom bookmark/search via the location bar --- this keeps the suggestions from the Google tool bar in tact. (You can add the special syntax to the end of your search terms.)
- No need for a special button; just type the command in the search bar.
- No need for Google's Advanced Toolbar for Firefox. (Google's Advanced toolbar has buttons for searching the current site and conducting an image search; however, there is no syntax that I know of to automate this procedure. In addition, for searching the current site, the regular expression used in my hack removes the 'www' from the current domain which enables a broader search. Google's Advanced toolbar does not do this; it searches 'www.stanford.edu' rather than 'stanford.edu'.)
1- Search the current site with the syntax "site:this"

2- Conduct a Google Image Search with the syntax "img:"

To install this hack, re-name your current 'nsSearchService.js' file (just in case you want to remove the hack) and replace the original with this one:
New and improved 'nsSearchService.js'. See lines 733 and 855 for the edits.
On Vista (and presumably XP), 'nsSearchService.js' is located in this directory: C:\Program Files\Mozilla Firefox\components
On Linux, the file is located here: /usr/lib/firefox/components/nsSearchService.js
This solution is not very modular; the file must be installed or deleted manually. However, it does offer some advantages:
- Functionality is directly integrated into the Google search bar so there is no need for a separate search engine
- No need for a custom bookmark/search via the location bar --- this keeps the suggestions from the Google tool bar in tact. (You can add the special syntax to the end of your search terms.)
- No need for a special button; just type the command in the search bar.
- No need for Google's Advanced Toolbar for Firefox. (Google's Advanced toolbar has buttons for searching the current site and conducting an image search; however, there is no syntax that I know of to automate this procedure. In addition, for searching the current site, the regular expression used in my hack removes the 'www' from the current domain which enables a broader search. Google's Advanced toolbar does not do this; it searches 'www.stanford.edu' rather than 'stanford.edu'.)

2 Comments:
I would suggest that you change from the "img:" syntax to "type:img" to remain consistant with the google search modifiers as well as to allow it to be anywhere in the search
i prefer img: because it's shorter; though you may be on to something in terms of keeping in line with google's search modifiers.
FWIW, you can append 'img:' to the end of your search. that way the user can get search suggestions from FF as he or she types.
E.g., "baby lemur img:" is the same as "img: baby lemur"
Post a Comment
Links to this post:
Create a Link
<< Home