=== GP Forums Greasemonkey scripts ===
=== You will need ===
* Firefox
* Greasemonkey plugin
=== Installing scripts ===
# Create a file called {{{xxx.user.js}}} - the xxx is unimportant, the .user.js is what denotes the file as a Greasemonkey script.
# Copy and paste the script into that file
#Navigate to wherever you created xxx.user.js, at this point, Greasemonkey will prompt you to install it.
=== Clickherebegone ===
A Greasemonkey script to completely remove all trace of ignored posts on the Gameplanet forums.
**DISCLAIMER:** May break stuff, use at own risk, contains traces of peanuts. Copyright vests in the original author of this work, so if I see it on any BT trackers, I'll send you a catty email. You're scared now, I can tell.
// ==UserScript==
// @name Click Here Be Gone
// @namespace http://cynos.waz.ere
// @description GP specific: Make ignored users go away by modifying CSS display attribute of parent row of ignored post
// @include http://www.gpforums.co.nz/*
// @include http://gpforums.co.nz/*
// ==/UserScript==
var xquery = "//a[contains(@onclick, \"javascript:window.open('/showthread.php?s=&action=showpost&postid=\")]";
var nodes = document.evaluate(xquery, document, null, 6, null);
for (var i = 0; i < nodes.snapshotLength; ++i) {
var n = nodes.snapshotItem(i);
n.parentNode.parentNode.parentNode.parentNode.style.display = "none";
}
==== Usage =====
* Browse forums
* People on your ignore list should vanish completely.
* If any strange things happen while using it, PM Cynos.
=== Topic - Open Discussion ===
Converts the Topic breadcrumb to Open Discussion when browsing the former subforums of OD.
// ==UserScript==
// @name Topen
// @namespace http://cynos.waz.ere
// @description GP specific: Make Topics breadcrumb point to GPOD
// @include http://www.gpforums.co.nz/*
// @include http://gpforums.co.nz/*
// ==/UserScript==
function replaceChild(element, child)
{
//Remove all children nodes.
while (element.hasChildNodes())
{
var curr_child = element.firstChild;
element.removeChild(curr_child);
}
element.appendChild(child);
}
function replaceText(element, text)
{
var textNode = document.createTextNode(text);
replaceChild(element, textNode);
}
var xquery = "//a[@href='/forum/Topics/?s=']";
/*------Init------*/
var nodes = document.evaluate(xquery, document, null, 6, null);
for (var i = 0; i < nodes.snapshotLength; ++i)
{
var n = nodes.snapshotItem(i);
var prev = null;
var next = null;
if (n.previousSibling) prev = n.previousSibling.nodeValue;
if (n.nextSibling) next = n.nextSibling.nodeValue;
if ((prev && next) && (prev.indexOf("/") > -1 && next.indexOf("/") > -1))
{
replaceText(n, "Open Discussion");
n.href = "/forum/Open-Discussion";
}
}
=== Collapse Topics ===
Makes the Topics (subforums) in GPOD collapsible - it will remember your preference.
// ==UserScript==
// @name Tollapse
// @namespace http://cynos.waz.ere
// @description GP specific: Make Topics collapsible
// @include http://www.gpforums.co.nz/forum/Open-Discussion/*
// @include http://gpforums.co.nz/forum/Open-Discussion/*
// ==/UserScript==
function replaceChild(element, child)
{
//Remove all children nodes.
while (element.hasChildNodes())
{
var curr_child = element.firstChild;
element.removeChild(curr_child);
}
element.appendChild(child);
}
function replaceText(element, text)
{
var textNode = document.createTextNode(text);
replaceChild(element, textNode);
}
function toggle()
{
showFlag = !showFlag;
GM_setValue("showFlag", showFlag);
setToggleText();
changeDisplay(showFlag);
return false;
}
function setToggleText()
{
if (showFlag) replaceText(toggleLink, "Click here to hide");
else replaceText(toggleLink, "Click here to show sub-forums");
}
function changeDisplay(show)
{
var dp;
if (show) dp = "table-row";
else dp = "none";
var next_sibling = headingTR.nextSibling;
while (next_sibling)
{
if (next_sibling.style) next_sibling.style.display = dp;
next_sibling = next_sibling.nextSibling;
}
}
var toggleLink;
var showFlag = GM_getValue("showFlag", true);
var xquery = "//a[@href='/forum/Topics/?s=']";
/*------Init------*/
var nodes = document.evaluate(xquery, document, null, 6, null);
var topic = nodes.snapshotItem(0); //Topic href
var subHeadingDiv = topic.parentNode.parentNode.lastChild;
var headingTR = topic.parentNode.parentNode.parentNode;
var toggleLink = document.createElement("a");
toggleLink.href = "#";
toggleLink.addEventListener('click', function(event){toggle()}, false);
setToggleText();
replaceChild(subHeadingDiv, toggleLink);
changeDisplay(showFlag);