By Smiths
—
Last update
Jul 27, 2007
—
Installed
1,749 times.
// ==UserScript==
// @name CNN for Me v1.5.51
// @namespace Smiths
// @include http://*.cnn.com/*
// ==/UserScript==
var allLinks, thisLink, textonly, linktext, link;
allLinks = document.evaluate('//a[@href]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < allLinks.snapshotLength; i++) {
thisLink = allLinks.snapshotItem(i);
/*if (thisLink.href.search('cnnLive') != -1) {
thisLink.innerHTML = '';
}*/
if ((thisLink.href.search('/#/video') != -1 || thisLink.href.search('cnnLive') != -1) && (thisLink.innerHTML.indexOf('img') != 1)){
textonly = thisLink.innerHTML;
if ((thisLink.href.search('\'live\'\,') != -1) && (thisLink.innerHTML.indexOf('cnnInsertPipelineIcon')) != -1)
{
//didn't notice the "Live NOW" pipeline options with headlines, those get excluded to avoid ugly "URL copying"
//Can uncomment below to replace the "Live" icon
thisLink.innerHTML = '';
}
//New layout seems to have gotten rid of the "VIDEO" links
/*else if (thisLink.innerHTML.indexOf('Video') != -1)
{
//this is the link that says "Video" only, uncomment the next line to blank those out
thisLink.innerHTML = '';
}
*/
else {
//every other video link gets its 'headline' posted, but link removed
link = document.createElement('i');
//what the hell? italics in a headline?
textonly = textonly.replace(/<(.?|\/)(br|u|i)>/g," ");
linktext = document.createTextNode(textonly);
link.appendChild(linktext);
thisLink.parentNode.insertBefore(link, thisLink);
thisLink.parentNode.removeChild(thisLink);
}
}
}
//god I hate all these sections that make CNN unreadable.
var remove = ['cnnMarketplace','cnnAnywhereContainer','cnnPartner','cnnHeadSrchTypeArea', 'cnnMostPopMod', 'ad-822693', 'ad-982200', 'cnnCallOut', 'cnnMpPopNews','cnnMpVideoBox','pipeline','cnnContextualLinks','CNN_homeRightCol','cnnRRad','cnnSCRightColumn','storyCLLinkSpots','storyCLSponsoredLinks','cnnSCCBBox','cnnMPBestFreeVideoModule', 'cnnPipelineModBox', 'cnnOnly', 'cnnIreportBox', 'cnnTopStoriesFooter', 'cnnPipelineMPFooter', 'cnnOnCnnTvBox', 'cnnIconMap'];
for (var i = 0; i < remove.length; i++)
{
var adSidebar = document.getElementById(remove[i]);
if (adSidebar)
{
adSidebar.parentNode.removeChild(adSidebar);
}
}
//Get all the page tags to compare classes to
var allPageTags=document.getElementsByTagName("*");
//find the class of something you don't want and add it to the classes array
var classes = ['cnn728Container','cnnUGCBox','cnnWCAdBox', 'cnnOpin','cnnSuperBox', 'cnnGlobalHeaderTopics', 'cnnIrptBox'];
for (var j=0; j<classes.length; j++) {
for (i=0; i<allPageTags.length; i++) {
if (allPageTags[i].className==classes[j]) {
allPageTags[i].style.display='none';
}
}
}