Colorizing the snot out of a page.
HTML
<div id="wrapper">
<div id="root">
<layer name="root">
<div id="nb20" class="navbarSprite">
<div id="supertab">
</div>
<div id="injected_navstrip_reflow_helper"></div>
<!-- end injectable INJECTED_NAVSTRIP -->
<div id="pagecontent">
<div id="tn15" class="bio">
<div id="tn15main">
<div id="tn15title">
<h1><small>Biography for<br></small><a class="main" href="http://www.imdb.com/name/nm0877894/">Ted Turner</a> <span>(I)</span></h1>
</div>
<div id="tn15content">
<h5>Trade Mark</h5>
<p style="font-size: 24px;">Licensing classic black-and-white movies to colorize them (the
process is sometimes referred to as "Turnerizing", frequently in a
derogatory context)</p>
<br>
<h5>Date of Birth</h5>
<a href="http://www.imdb.com/search/name?birth_monthday=11-19&refine=birth_monthday">19 November</a> <a href="http://www.imdb.com/search/name?birth_year=1938">1938</a>, <a href="http://www.imdb.com/search/name?birth_place=Cincinnati,%20Ohio,%20USA">Cincinnati, Ohio, USA</a>
<br><br>
<h5>Birth Name</h5>
Robert Edward Turner III
<br><br>
<h5>Spouse</h5>
<table border="0">
<tbody><tr>
<td valign="top"><a href="http://www.imdb.com/name/nm0000404/">Jane Fonda</a></td>
<td valign="top"> (<a href="http://www.imdb.com/date/12-21/">21 December</a> 1991 - <a href="http://www.imdb.com/date/05-22/">22 May</a> 2001) (divorced)</td>
</tr>
<tr>
<td valign="top">Jane Shirley Smith</td>
<td valign="top"> (<a href="http://www.imdb.com/date/06-02/">2 June</a> 1965 - 1988) (divorced) 3 children</td>
</tr>
<tr>
<td valign="top">Judy Nye</td>
<td valign="top"> (<a href="http://www.imdb.com/date/06-23/">23 June</a> 1960 - 1964) (divorced) 2 children</td>
</tr>
</tbody></table>
<br>
<a name="trademark"></a>
<a name="trivia"></a>
<h5>Trivia</h5>
<p>Born at 8:50am-EST</p><p>Founder/owner of CNN, WTBS, TNT, and other media properties.</p><p>Announced plans to donate $1 billion to the United Nations over a 10-year period. [18 September 1997]</p><p>Managed the Atlanta Braves for one game (he lost)....
JavaScript
buggerTextNodesIn (document.body);
function buggerTextNodesIn (node) {
var wrapClass = 'gmColorCor';
function turnerizeTextNodes (node) {
if (node.nodeType === Node.TEXT_NODE) {
//--- Skip this node if it's already been wrapped.
if ( ! node.parentNode.classList.contains (wrapClass) ) {
var oldText = node.nodeValue;
var parent = node.parentNode;
for (var J = 0, len = oldText.length; J < len; ++J) {
var wrapSpan = document.createElement ("span");
wrapSpan.classList.add (wrapClass);
wrapSpan.textContent = oldText[J];
wrapSpan.style.color = getRandomColor ();
parent.insertBefore (wrapSpan, node);
}
parent.removeChild (node);
}
}
else if (node.nodeType === Node.ELEMENT_NODE) {
/*--- IMPORTANT! Start "bottom up" since we will be adding
gazillions of nodes and "top down" would skew our length measurement.
*/
for (var K = node.childNodes.length - 1; K >= 0; --K) {
turnerizeTextNodes (node.childNodes[K] );
}
}
}
turnerizeTextNodes (node);
}
function getRandomColor () {
var letters = '0123456789ABCDEF'.split ('');
var color = '#';
for (var J = 0; J < 6; ++J) {
color += letters[Math.round(Math.random() * 15)];
}
return color;
}