Skip to content

Instantly share code, notes, and snippets.

@Ming-Tang
Created April 14, 2018 04:52
Show Gist options
  • Save Ming-Tang/37fcc2bd265411c35e05f53fac561689 to your computer and use it in GitHub Desktop.
Save Ming-Tang/37fcc2bd265411c35e05f53fac561689 to your computer and use it in GitHub Desktop.
Bitcoin to Beanie Babies userscript
// ==UserScript==
// @name Bitcoin to Beanie Babies
// @namespace beaniebabies
// @description Replaces "bitcoin" with "beanie babies"
// @include *
// @version 1.0.2
// @grant none
// ==/UserScript==
// Based on Cloud to Butt userscript:
// https://gist.github.com/kalmanolah/5764435/raw/e2f78a6ced8bac19d0465580b3c6e83261d3da6d/cloudtobutt.user.js
(function() {
function walk(node)
{
// I stole this function from here:
// http://is.gd/mwZp7E
var child, next;
if (!node) return;
switch ( node.nodeType )
{
case 1: // Element
case 9: // Document
case 11: // Document fragment
child = node.firstChild;
while ( child )
{
next = child.nextSibling;
walk(child);
child = next;
}
break;
case 3: // Text node
handleText(node);
break;
}
}
function handleText(textNode)
{
var v = textNode.nodeValue;
v = v.replace(/\b(BTC|ETH|LTC|BCH)\b/gi, "Beanie Babies");
v = v.replace(/(bit|alt|shit)coins?/gi, "Beanie Babies");
v = v.replace(/\b(digital|virtual) currenc(y|ies)\b/gi, "Beanie Babies");
v = v.replace(/\b(digital |virtual |crypto\s?)assets?\b/gi, "Beanie Babies");
v = v.replace(/\bblockchain\b/gi, "Beanie Babies");
v = v.replace(/ethereum/gi, "Beanie Babies");
v = v.replace(/litecoin/gi, "Beanie Babies");
v = v.replace(/\bcrypto(currenc(y|ies)|coins?|s)?\b/gi, "Beanie Babies");
v = v.replace(/\bBeanie Babies(([,;]\s*(and|or|with))\s*(Beanie Babies|\(Beanie Babies\)))+/gi, "Beanie Babies");
v = v.replace(/\bBeanie Babies('s)?(\s+\(?Beanie Babies\)?)+/gi, "Beanie Babies");
v = v.replace(/\bBeanie Babies is/gi, "Beanie Babies are");
textNode.nodeValue = v;
}
function run()
{
walk(document.getElementsByTagName('body')[0]);
walk(document.getElementsByTagName('title')[0]);
}
run();
setTimeout(run, 80);
setTimeout(run, 120);
setTimeout(run, 320);
setTimeout(run, 700);
setInterval(run, 5000);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment