Created
August 6, 2015 19:32
-
-
Save gaelanadams/baa6cafc2fceb83de9d6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Hacked to Cyber | |
| // @namespace hacktocyber | |
| // @description Replaces instances of "hacked" with "cybered". Ported from and Inspired by panicsteve's cloud-to-butt extension for Google Chrome, and DaveRandom's ports thereof. | |
| // @include * | |
| // @version 1.0.2 | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| function walk(node) | |
| { | |
| // I stole this function from here: | |
| // http://is.gd/mwZp7E | |
| var child, next; | |
| 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(/\bhack\b/g, "cyber"); | |
| v = v.replace(/\bhacked\b/g, "cybered"); | |
| v = v.replace(/\bhacking\b/g, "cybering"); | |
| textNode.nodeValue = v; | |
| } | |
| function dothat() { | |
| walk(document.getElementsByTagName('body')[0]); | |
| walk(document.getElementsByTagName('title')[0]); | |
| } | |
| document.addEventListener('NamesSynced',dothat); | |
| }()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment