Saturday, 19 June 2010

MUDBytes and post bloat

The most active MUD-related forum is currently MUDBytes. One of the good things is that the team there maintain their own forum software, and as the idea or need arises, it gets extended to support new features. However this is both good and bad, as the amount of feature "cruft" that decorates each displayed post increases.


Finding the "cruft" distracting, I decided to write a greasemonkey script to remove as much as possible. Here's the result:


And the greasemonkey script:

// ==UserScript==
// @name MUDBytes Page Cleaner
// @namespace http://disinterest.org
// @description Makes the pages less cluttered.
// @include http://www.mudbytes.net/topic-*
// @include http://www.mudbytes.net/index.php*
// ==/UserScript==

var tds = document.getElementsByTagName("td");
var posterInfoTD = null;
var classNames = "";
for(var i = 0; i < tds.length; i++){
classNames = tds[i].className;
if (classNames == "posterinfo") {
posterInfoTD = tds[i];
} else if (classNames == "posttop") {
for (var j = 0; j < tds[i].childNodes.length; j++) {
var topElement = tds[i].childNodes[j];
if (topElement.className == "button butright") {
topElement.className = "butright";
topElement.innerHTML = " ["+ topElement.innerHTML +"]";
}
}

// Remove the arrows.
var divs = tds[i].getElementsByTagName("div");
divs[0].innerHTML = "";
// Inject the poster name.
var posterText = document.createTextNode(" -- ");
var posterNameB = document.createElement("b");
var as = posterInfoTD.getElementsByTagName("a");
if (as.length > 0) {
posterNameB.appendChild(as[0].cloneNode(true));
} else {
var posterNameText = document.createTextNode("Guest");
posterNameB.appendChild(posterNameText);
}
divs[divs.length-1].appendChild(posterText);
divs[divs.length-1].appendChild(posterNameB);
// Remove the LHS poster info area.
posterInfoTD.parentNode.removeChild(posterInfoTD);
} else if (classNames == "postbottom") {
tds[i].innerHTML = "";
}
}

// Reduce the reading area width to make it more readable.
var tableElements = document.getElementsByTagName("table");
for (var i = 0; i < tableElements.length; i++) {
if (tableElements[i].className == "stand")
tableElements[i].style.width = '700px';
}

As cluttered as MUDBytes posts are getting, at least they haven't added header and footer frame areas like The MUD Connector.

No comments:

Post a Comment