Skip to content

Instantly share code, notes, and snippets.

@mkanenobu
Last active January 15, 2019 08:36
Show Gist options
  • Save mkanenobu/3bd3a4208b27d06025cff33436487b41 to your computer and use it in GitHub Desktop.
Save mkanenobu/3bd3a4208b27d06025cff33436487b41 to your computer and use it in GitHub Desktop.
(function() {
let c = window.getSelection().toString();
if (c == ""){
c = window.prompt("Input character.", "");
}
let a = [];
for (let i of c) {
a.push(i.charCodeAt());
}
alert(a);
})();
// Bookmarlet (compiled with Closure Compiler)
// javascript:function a(){var e=b,f=0;return function(){return f<e.length?{done:!1,value:e[f++]}:{done:!0}}}var c=window.getSelection().toString();""==c&&(c=window.prompt("Input character.",""));var d=[],g,b=c,h="undefined"!=typeof Symbol&&Symbol.iterator&&b[Symbol.iterator];g=h?h.call(b):{next:a()};for(var k=g.next();!k.done;k=g.next())d.push(k.value.charCodeAt());alert(d);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment