Many times i found myself helping a user on the phone who was unable to log into one of our sites because they forgot thier login information. Typically, we just give them their usename and password over the phone. This can be a pain sometimes if you aren't heard correctly so a while back i wrote a script to spell words using the Phonetic Alphabet.
I need this tool easily accessible because i have the user on the phone and his account information is right infront of me. It would be silly to navigate to this URL and retype the information in. I thought it would be cool to wrap this feature into a bookmarklet.
I've been using these ever since i found one to kill the CSS on a site and i've been playing with it all the time. I started with some a sample i found on grabbing currenlty selected text. Then i changed it to work with Safari as well.
To use this bookmarklet, drag to following link to your favorites to create a bookmark. To activate it, simply highlight any text on the page you are viewing and click the bookmark you created.
The code is pretty stright forward. It first checks for the getSelection method which is the NS and Safari way of getting the current selection. If that doesn't work, it tries the Win IE selection/range object.
var u='http://www.matthewflickinger.com/lab/spellit/';
if (document.getSelection || window.getSelection)
{var Q = getSelection();}
else if (document.selection && document.selection.createRange)
{var range = document.selection.createRange();var Q = range.text;};
if(Q)
{location.href=u+'spellit.asp?q='+(Q.length < 50?Q:Q.substring(0,51));}
else
{location.href=u}
You can then use these basic steps to work with many other sites. If no text is selected, it will simply send you to the main page.