Skip to content

Instantly share code, notes, and snippets.

@cori
Created May 26, 2011 13:27
Show Gist options
  • Save cori/993134 to your computer and use it in GitHub Desktop.
Save cori/993134 to your computer and use it in GitHub Desktop.
expanded bookmarklet code to unescape selected text or text provided in a prompt
sel= function (){
if (window.getSelection){
return window.getSelection();
}else if (document.getSelection){
return document.getSelection();
}else if (document.selection){
return document.selection.createRange().text;
}else return;
};
if (sel()!=""){
alert(unescape(sel()));
}else{
alert(unescape(prompt("Text to unescape","No text selected")));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment