Hi,
after a couple of half nights of loss of sleep I've done the bookmarklet YouSearch (no, it's not just for YouTube...).
This bookmarklet is a wannabe swiss knife for searching selected text. You select some text with the mouse and press the bookmarklet. A new window will open in which you can find an (extremely ugly) interface that will show you:
1) A textarea with the text you selected that you can eventually modify
2) A dropdown list with the engine to which you want to submit your query (Google is default)
3) the button to launch the query.
Ok, just select one option in the dropdown list, press the button "Search" and... YouSearch!
That's the code:
Note that you can quite easily personalize your searches. These are added to the dropdown list as options like:Code:javascript: function writeJS() { var str=''; str+=' <body> <FORM name="intro"> <table align=\'center\' height=\'10%\' valign=\'center\'> <tr><td> <p> You selected: <\/p> <\/td><\/tr> <tr><td> <TEXTAREA NAME="SelectedText" ROWS="3" COLS="20"><\/TEXTAREA> <\/td><\/tr> <tr><td> <p> Search in... <\/p> <\/td><\/tr> <tr><td> <SELECT NAME="Search_list"> <Option value="http://www.google.com/search?hl=en&q=" >Google<\/option> <Option value="http://www.amazon.com/s/ref=nb_ss_gw?url=search-alias%3Daps&field-keywords=" >Amazon<\/option> <Option value="http://dictionary.reference.com/browse/" >Dictionary Reference<\/option> <Option value="http://search.ebay.com/search/search.dll?satitle=" >eBay<\/option> <Option value="http://maps.google.com/maps?q=" >Google Maps<\/option> <Option value="http://en.wikipedia.org/w/index.php?title=Special:Search&search=" >Wikipedia<\/option> <Option value="http://www79.wolframalpha.com/input/?i=" >WolframAlpha<\/option> <Option value="http://www.youtube.com/results?search_type=&search_query=" >YouTube<\/option> <\/SELECT> <\/td><\/tr> <tr><td> <INPUT TYPE=BUTTON OnClick="var aaa = document.intro.Search_list.options[document.intro.Search_list.selectedIndex].value; aaa += document.intro.SelectedText.value; window.location.href=aaa;" VALUE="Search"> <\/td><\/tr> <\/table> <\/form> <\/body>'; return str; } var high=document.getSelection(); ow=location.href; if(high!='') { var res=window.open(''); res.focus(); pop=writeJS(); res.document.write(pop); res.document.intro.SelectedText.value += high; ow= void(null); }
<Option value="url" >Name<\/option>
So to put your own you just need to create a new option with the proper url and name. I added to the dropdown list Google, Amazon, Dictionary Reference, eBay, Google Maps, Wikipedia, WolframAlpha and YouTube.
Which Options are a must for you? Please if you find one that can be very useful post it for everyone!


LinkBack URL
About LinkBacks



Reply With Quote


