Skip to content

Instantly share code, notes, and snippets.

@neilio
Last active June 3, 2018 15:03
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 neilio/2698b38569df97e9c9eb91bffda934a9 to your computer and use it in GitHub Desktop.
Save neilio/2698b38569df97e9c9eb91bffda934a9 to your computer and use it in GitHub Desktop.
Fast-and-dirty bookmarklet that turns all of a webpage's text into fake german to test for layout breakage.
javascript:(function()%7Bvar%20prefixes=%5B'','glocken','das','borfa','maushe','uber'%5D,suffixes=%5B'','hausen','%20die%20vander','gleuten','noshan','flagellan','mek','dak','en%20das','ga'%5D,xPathResult=document.evaluate('.//text()%5Bnormalize-space(.)!=%5C'%5C'%5D',document.body,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),i,textNode,cnt,out,j,pfx,sfx;for(i=0,l=xPathResult.snapshotLength;i%3Cl;i++)%7BtextNode=xPathResult.snapshotItem(i);if(textNode.parentNode.nodeName.toLowerCase()=='script'%7C%7CtextNode.tagName=='style')continue;cnt=textNode.data.split(/%5Cs/g);out=%5B%5D;for(j=0;j%3Ccnt.length;j++)%7Bif(cnt%5Bj%5D.replace(/%5B%5Cs%5D/g,'')=='')continue;pfx=(!Math.floor(Math.random()*10))?'':prefixes%5BMath.floor(Math.random()*prefixes.length)%5D;sfx=(!Math.floor(Math.random()*10))?'':suffixes%5BMath.floor(Math.random()*suffixes.length)%5D;out.push(pfx+cnt%5Bj%5D+sfx);%7DtextNode.data='%20'+out.join('%20')+'%20';%7D%7D)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment