// ==UserScript==
// @name		SPAMO
// @description		Reclaim the web from commercial trademarks
// @namespace		http://deoxy.org/gm
// @include		*
// ==/UserScript==

(function () {

// SETUP
// 1. TEXT TO REPLACE
 var spam  = 'myspace|facebook|twitter'

// 2. REPLACEMENT
 var spamo = 'SPAMO'

// 3. HTML ELEMENTS WITH TEXT
 var what  = ['a','p','td','textarea','div','span']
// END

 var match = new RegExp(spam,'ig')
 document.title = document.title.replace(match,spamo)

// destroy links and style text
 var a = document.getElementsByTagName('a')
 for (var i=0; i<a.length; i++) {
  if (a[i].href.match(match)) {
   a[i].style.textDecoration = 'line-through'
   a[i].href = '#'
  }
 }

// replace all text containing "spam" with "spamo" in "what"
 for (var i=0; i<what.length; i++) {
  var e = document.getElementsByTagName(what[i])
  for (var ii=0; ii<e.length; ii++) {
   e[ii].innerHTML = e[ii].innerHTML.replace(match,spamo)
  }
 }

// GREASEMONKEY http://www.greasespot.net/
})();

