• The Cycling News forum is looking to add some volunteer moderators with Red Rick's recent retirement. If you're interested in helping keep our discussions on track, send a direct message to @SHaines here on the forum, or use the Contact Us form to message the Community Team.

    In the meanwhile, please use the Report option if you see a post that doesn't fit within the forum rules.

    Thanks!

Firefox user: script to remove spoilers from homepage

Jun 18, 2009
4
0
0
Visit site
Hi,

I wrote a little greasemonkey scirpt to remove spoilers from race results section:

// ==UserScript==
// @name despoil cyn
// @namespace http://www.random-productions.co.uk
// @description Removes spoiler headlines from Cycling News
// @include http://www.cyclingnews.com/
// ==/UserScript==


var allDivs, thisDiv;
allDivs = document.evaluate(
"//ul[@class='articles']",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);

for (var i = 0; i < allDivs.snapshotLength; i++)
{
thisDiv = allDivs.snapshotItem(i);
var as = thisDiv.getElementsByTagName('a');

for (var j=0;j<as.length; j++)
{
if (as[j].href.indexOf('/stages/') != -1)
{
var pos = as[j].innerHTML.indexOf('Stage');
if (pos == 0)
as[j].innerHTML = as[j].innerHTML.substring(0,10);
}
}
}

To use it, install greasemonkey. Then, go to cyclingnews homepage, go to your menu 'tools - greasemonkey - new user script', fill in & submit form, paste the code above into your text file and save it. Then reload cycling news.

Any problem let me know!

NB. the script will probably break eventually since the site developers will almost certainly change how stuff is displayed eventually. But for now...
 
Jun 18, 2009
19
0
0
Visit site
Perhaps you could create a separate website that takes the CN page, modifies it according to the hacks described and then reposts the results...you could probably sell a lot of adspace on a site like that...