Skip to content

Instantly share code, notes, and snippets.

@scragg0x
Created March 3, 2020 23:14
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 scragg0x/773c09a6ff22f1f0234418c27a75adb2 to your computer and use it in GitHub Desktop.
Save scragg0x/773c09a6ff22f1f0234418c27a75adb2 to your computer and use it in GitHub Desktop.
(function FakeNewsify() {
String.prototype.sarcasm = function(x) {
return ((x || this).match(/.{1,2}/g) || []).map(s => s[0].toUpperCase() + (s[1] || '').toLowerCase()).join('');
};
var el = document.getElementsByTagName('body')[0];
var n,
a = [],
walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false);
while ((n = walk.nextNode())) a.push(n);
a.forEach(node => (node.nodeValue = node.nodeValue.toString().sarcasm()));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment