Bookmarklet to alphabetize a selection

[Total: 1    Average: 5/5]

Select some text on any page and run this bookmarklet.

Body Code:

<b> 
Bookmarklets > Selection > <a href="javascript:Wd7W=document.selection.createRange().text;if(!Wd7W)Wd7W=prompt('Type or paste text to be alphabetized.','');if(Wd7W){WddW=0;Wd7W=escape(Wd7W.toLowerCase());for(i=0;i<Wd7W.length;i++){if((Wd7W.charCodeAt(i)<97||Wd7W.charCodeAt(i)>122)&&Wd7W.charAt(i)!='-')Wd7W=Wd7W.replace(Wd7W.charAt(i),' ');};Wd7W=Wd7W.split(' ');Wd5W=window.open('','','width=500,height=430,scrollbars,menubar,directories,resizable');W9m=true;for(;W9m;){W9m=false;for(i=0;i<Wd7W.length-1;i++){if(Wd7W[i]==''){Wd7W.splice(i,1);i--}if(Wd7W[i]>Wd7W[i+1]){W9m=true;temp=Wd7W[i];Wd7W[i]=Wd7W[i+1];Wd7W[i+1]=temp}}}temp='<title>Alphabetized '+Wd7W.length+' words from: '+document.title+'</title><style>a{font-size:80%;text-decoration:none;position:absolute;top:10px;left:420px;}</style>';Wd5W.document.write(temp+Wd7W.length+' words alphabetized. <a href='javascript: for(i=0;i<opener.Wd7W.length;i++){if(opener.Wd7W[i]==opener.Wd7W[i+1]){opener.Wd7W.splice(i,1);opener.WddW++;i--}}document.write(opener.temp+(opener.Wd7W.length)+" unique words shown, "+opener.WddW+" duplicates hidden. <a href=javascript:history.go(-1)>Show duplicates</a><hr><br>"+opener.Wd7W.join("&nbsp; "))'>Hide duplicates</a><hr><br>');for(i=0;i<Wd7W.length;i++)Wd5W.document.write(Wd7W[i]+"&nbsp; ");void(Wd5W.document.close())}else{void(0)}">Alphabetize Selection</a> 
</b>
<HR>
Select some text on any page and run this bookmarklet.
When no selection is made, a prompt will allow typing or pasting a string.
It will display a list of the selected words in alphabetical order, which can be saved in a file or copied for use elsewhere. 
Does not work with text in images. 
Duplicate words can be toggled in and out of view. 
Also displays the number of words. 
Pops in a separate window so the original selection remains accessible.

Note1: 
As the opener blurs, it removes the highlight from the selected area. When you give it focus again, do not click the document body, but a browser bar to conserve the selection. 

Note2: 
Tested in Internet Explorer only. 

Times Viewed: 12

Leave a Reply

Your email address will not be published. Required fields are marked *