| |||||||
| Top Tip : Click here to Boost Your PC & Chrome Browsing Speed |
![]() |
| | Thread Tools | Display Modes |
|
#1
| |||
| |||
| 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: 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! |
|
#2
| |||
| |||
| This sounds like Cleeki, in bookmarklet form. |
|
#3
| |||
| |||
| Yes, Cleeki gave me the idea... but I didn't copied! I've done everything on my own! ![]() I think extensions like that are super useful and I like them a lot, I used them abundantly in Firefox, but I'm a super fan of bookmarklets, so I decided to write YouSearch because I think (and this is my personal idea, some will agree, some not) that a bookmarklet can have its advantages. |
|
#4
| ||||
| ||||
| This is a pretty handy bookmarklet, thanx |
|
#5
| |||
| |||
| Bookmarklets certainly have their advantage. Cleeki is a pretty large extension... and all it's javascript is injected in every page / iframe you visit. Bookmarklets don't have this issue. |
|
#6
| |||
| |||
| I wasn't saying one was better. I just said it was similar in function. |
|
#7
| |||
| |||
| Thanks for this... Cleeki isn't available for Linux, and I missed my search bar from Fx. EDIT: I improved it by simply opening the form if no text was selected (moved the if-statement's beginning). Before, the page would display the source URL instead of a form. 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; var res=window.open(''); res.focus(); pop=writeJS(); res.document.write(pop); if(high!=''){ res.document.intro.SelectedText.value += high; } Last edited by Jesdisciple; 01-04-2010 at 05:16 PM.. |
![]() |
| Tags |
| bookmarklet search |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need a bookmarklet ? Ask ! | Kyrax | Chrome Plugins | 27 | 02-08-2010 04:04 AM |
| Wiki-it! Bookmarklet | Kyrax | Chrome Plugins | 8 | 11-15-2009 09:47 PM |
| Bookmarklet for PageRank | woz2 | Chrome Plugins | 6 | 04-15-2009 01:35 AM |
| Google Translate Selected to Any Language - Bookmarklet | vietnam | Chrome Tips & Tricks | 3 | 04-10-2009 02:06 PM |