Skip to content

Instantly share code, notes, and snippets.

@evadne
Created April 26, 2010 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evadne/379439 to your computer and use it in GitHub Desktop.
Save evadne/379439 to your computer and use it in GitHub Desktop.
Barker.js — works with Safari only for now
// barker.js
// Evadne Wu at Iridia, 2010
// One-liner (bookmarklet):
// javascript:eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('0 2=/[\\8-\\9]/b;0 1=((c(){0 a=d("e a f g?","汪");3(a==h||a=="")4 i;4 a})());3(1)5.6.7=5.6.7.j(2,1);',20,20,'var|substitutionGlyph|chineseRegexRange|if|return|document|body|innerHTML|u4E00|u9FFF||ig|function|prompt|Enter|candidate|glyph|null|undefined|replace'.split('|'),0,{}));
var chineseRegexRange = /[\u4E00-\u9FFF]/ig;
var substitutionGlyph = ((function () {
var plausibleGlyph = prompt("Enter a candidate glyph?", "汪");
if (plausibleGlyph == null || plausibleGlyph == "") return undefined;
return plausibleGlyph;
})());
if (substitutionGlyph) document.body.innerHTML = document.body.innerHTML.replace(chineseRegexRange, substitutionGlyph);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment