Skip to content

Instantly share code, notes, and snippets.

@jcayzac
Created December 10, 2013 02:49
Show Gist options
  • Select an option

  • Save jcayzac/7885015 to your computer and use it in GitHub Desktop.

Select an option

Save jcayzac/7885015 to your computer and use it in GitHub Desktop.
javascript:%28function%20%28%29%20%7Bvar%20selection%20%3D%20window.getSelection%20%3F%20window.getSelection%28%29%20%3Adocument.getSelection%20%3F%20document.getSelection%28%29%20%3Adocument.selection%20%3F%20document.selection.createRange%28%29.text%20%3A%20%27%27%3Bif%20%28selection%29%20%7Bselection%20%3D%20String%28selection%29%3B%7Dif%20%28selection%29%20%7Bvar%20match%20%3D%20selection.match%28%27%5C%2F%28.%2A%29%5C%2F%27%29%3Bvar%20ipa%3Bif%20%28match%20%26%26%20match%5B1%5D%29%20%7Bipa%20%3D%20match%5B1%5D%3B%7Dif%20%28%21ipa%29%20%7Bipa%20%3D%20prompt%28%22Couldn%27t%20find%20any%20IPA.%20Type%20it%20in%20instead%3F%22%29%3B%7Dif%20%28ipa%29%20%7Bipa%20%3D%20ipa.replace%28%2F.%2Fg%2C%20function%20%28c%29%20%7Bif%20%28%2F%25u0%28...%29%2F.test%28escape%28c%29%29%29%20%7Breturn%20escape%28c%29.replace%28%2F%25u0%28...%29%2Fg%2C%20%27%26%23x%241%3B%27%29%3B%7D%20else%20%7Breturn%20c%3B%7D%7D%29%3Bvar%20request%20%3D%20%7Btxt%3A%20%27%3Cphoneme%20alphabet%3D%22ipa%22%20ph%3D%22%27%2Bipa%2B%27%22%3E%20%3C%2Fphoneme%3E%27%2Cvoice%3A%20%27crystal%27%7D%3Bvar%20iframe%20%3D%20document.createElement%28%27iframe%27%29%3Biframe.name%20%3D%20iframe.id%20%3D%20%22iframe%22%2Bnew%20Date%28%29.getTime%28%29%3Bdocument.body.appendChild%28iframe%29%3Bvar%20form%20%3D%20document.createElement%28%27form%27%29%3Bform.target%20%3D%20iframe.name%3Bform.method%20%3D%20%27post%27%3Bform.action%20%3D%20%27http%3A//204.178.9.51/tts/cgi-bin/nph-nvttsdemo%27%3Bform.acceptCharset%20%3D%20%22iso-8859-1%22%3Bform.style.display%20%3D%20%27none%27%3Bfor%20%28var%20name%20in%20request%29%20%7Bvar%20input%20%3D%20document.createElement%28%27input%27%29%3Binput.name%20%3D%20name%3Binput.value%20%3D%20request%5Bname%5D%3Bform.appendChild%28input%29%3B%7Ddocument.body.appendChild%28form%29%3Bform.submit%28%29%3B%7D%7D%20else%20%7Balert%28%22Select%20some%20IPA.%22%29%3B%7D%7D%29%28%29%0A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment