Encircle

Script key: Encircle

Posted by Dr. Drang

Install

Details

Label
Voice Over Encircle
Script
function encircle(s) {
  var pchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    , cchars = "ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ⓪①②③④⑤⑥⑦⑧⑨"
    , count  = pchars.length
    , regex  = new RegExp('.', 'g')
    , trans  = {}
    , lookup = function(c) { return trans[c] || c; };
  
  for (var i=0; i<count; i++) {
    trans[pchars[i]] = cchars[i];
  }
  
  return s.replace(regex, lookup);
}

setSelectedText(encircle(getSelectedText()))

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus