Created
May 26, 2011 13:27
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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