Liberry Humor

Justin from 8bitlibrary posted a question to Twitter this morning, wondering if he should register 8bitliberry and redirect traffic over to the new URL.

This question led me to wonder how difficult it would be to write a browser plugin that would replace every instance of the word "library" with "liberry". A very short Google session later, I learned that w/ Javascript and Greasemonkey, this is very easily done. In fact, I didn't have to do much of anything. An existing script was available, so all that really needed to be done was to enter in the words I wanted changed.

The resulting Greasemonkey script (liberry_word_change.user) is nothing more than the above script with a list of liberry words to be changed.

It's small, but fun. When it's time to climb down off our liberry high horse, this is a fun little trick to help us relax and stop taking ourselves so seriously.

Liberries FTW!!1!

Code:

// ==UserScript==// @name Liberry Changer // @namespace http://guest2424.blogspot.com/2008/12/greasemonkey-replace-words-on-websites.html/ // @include */ // ==/UserScript==

(function() {
var replacements, regex, key, textnodes, node, s;
textnodes = document.evaluate( "//body//text()", document, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < textnodes.snapshotLength; i++) {
node = textnodes.snapshotItem(i);
if(node != null && node.nodeName == '#text' && /S/.test(node.nodeValue))
{

s = node.data;

s = s.replace( /bWORD OR WORDS TO GET RID OFb/g, "WORDS THAT IT IS REPLACED WITH OR JUST 2 QUOTES FOR NOTHING");
s = s.replace( /bWORDS CAN NOT CONTAIN PERIODS OR COMMAS OR SINGLE OR DOUBLE QUOTESb/g, "IF YOU DO IT WILL NOT WORK");
s = s.replace( /bBEFORE EACH THING WILL BE A SMALL LETTER B AND END WITH SLASH B AND IF YOU REMOVE ANYTHING BUT THESE BOLD WORLDS IT WONT WORKb/g, "BELOW ARE SHORTER EXAMPLES");
s = s.replace( /blibraryb/g, "liberry");
s = s.replace( /bLibraryb/g, "Liberry");
s = s.replace( /bLibrariesb/g, "Liberries");
s = s.replace( /blibrariesb/g, "liberries");
s = s.replace( /bLibrarianb/g, "Liberrian");
s = s.replace( /blibrarianb/g, "liberrian");
s = s.replace( /bLibrariansb/g, "Liberrians");
s = s.replace( /blibrariansb/g, "liberrians");
node.data = s;

 

}} })();

Leave a Reply