Drudge Enhancement Suite

Drudge Enhancement Suite. Main focus is on readability. I recommend using this in conjunction with an adblock extension like uBlock.

Fra og med 21.04.2015. Se den nyeste version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name Drudge Enhancement Suite
// @include http://drudgereport.com/
// @include http://www.drudgereport.com/
// @version 2
// @grant none
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js 
// @description:en Drudge Enhancement Suite. Main focus is on readability. I recommend using this in conjunction with an adblock extension like uBlock.
// 
// @namespace https://greasyfork.org/users/10724
// @description Drudge Enhancement Suite. Main focus is on readability. I recommend using this in conjunction with an adblock extension like uBlock.
// ==/UserScript==

var link = document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = 'data:image/x-icon;base64,AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAACKiYgAjIyMAP///wBubm4AT09OAOPj4wDHx8cAmZmZAHp6eQCUlJQA2dnZAAMDAwDExMQABQUFAMTDwgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICCwsLAAUFAgILCwICDQsCAgsLCwsLBgICCwsCAg0LAgILCwIMCwsFAgsLAgINAwICCwsCAgQLBQILCwIOCwMCAgsLAgIECwUCCwsCCQsOAgILCwICBAsFAgsLCwsBAgICCwsCAgQLBQILCwsLCwcCAgsLAgIECwUCCwsCAgsLCgILCwICBAsFAgsLAgILCwoCCwsCDAsLBQILCwICCwsKAgsLCwsLBgICCwsLCwsHAgILCwsABQUCAgsLCwsIAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=';
document.getElementsByTagName('head')[0].appendChild(link);

document.title = "Drudge Report";

document.styleSheets[0].insertRule("a:visited { color: #A3A3A3 }", 1);
document.styleSheets[0].insertRule("i { font-style: normal }", 1); 
document.body.style.color="white";
//$('a').css('font-weight', 'normal');
document.styleSheets[0].insertRule("a { font-weight: normal; text-decoration: none }", 1); 
document.styleSheets[0].insertRule("#drudgeTopHeadlines a { text-align: center; font-weight: bold }", 2);
document.styleSheets[0].insertRule("#drudgeTopHeadlines { text-align: center }", 2);
document.styleSheets[0].insertRule("img {display: block; margin-left: auto; margin-right: auto; height:auto; width:auto; max-width:400px; max-height:400px}", 2);

var topHeadlines=document.getElementById('drudgeTopHeadlines');
//alert(topHeadlines.innerHTML);
topHeadlines.innerHTML = topHeadlines.innerHTML.replace(/<br><br><br>/g,"")

var allTTs = document.getElementsByTagName('tt');
for(var k=0; k<allTTs.length; k++) {
	allTTs[k].style.fontFamily="Helvetica";
	allTTs[k].style.fontSize="small";
}

var allInputs = document.getElementsByTagName('input');
for(var k=0; k<allInputs.length; k++) {
	allInputs[k].parentNode.removeChild(allInputs[k]);
}

var allForms = document.getElementsByTagName('form');
for(var j=0; j<allForms.length; j++) {
	allForms[j].parentNode.removeChild(allForms[j]);
}

var allForms = document.getElementsByTagName('form');
for(var j=0; j<allForms.length; j++) {
	allForms[j].parentNode.removeChild(allForms[j]);
}


var allButtons = document.getElementsByTagName('button');
for(var l=0; l<allButtons.length; l++) {
	allButtons[l].parentNode.removeChild(allButtons[l]);
}

var allURLs = document.getElementsByTagName('a');
for(var i=0; i<allURLs.length; i++) {
	thisURL = allURLs[i].getAttribute('href');	
	
	if( /^http:\/\/news\.myway\.com\/index\/id\/world%7Cap.html$/.test(thisURL) ) {
		do {			
			allURLs[i].innerHTML = "";			
			i++;
		} while( /x17online.com/.test(allURLs[i-1].getAttribute('href')) == false);
		i--;
	} else if ( /^http:\/\/wabcradio\.com\/$/.test(thisURL) ) {
		do {			
			allURLs[i].innerHTML = "";			
			i++;
		} while( /^http:\/\/www\.suntimes\.com\/entertainment\/zwecker\/index\.html$/.test(allURLs[i-1].getAttribute('href')) == false);
		i--;
	} else if ( /^http:\/\/www\.france24\.com\/en\/timeline\/global\/$/.test(thisURL) ) {
		do {			
			allURLs[i].innerHTML = "";			
			i++;
		} while( /privacypolicy\.html/.test(allURLs[i-1].getAttribute('href')) == false);
		i--;
	}	
	else if ( /^http:\/\/www.drudgereport.com\/$/.test(thisURL) ) {
		allURLs[i].innerHTML = "";
	} else {
		allURLs[i].target="_blank";
		
		thisHostname = allURLs[i].hostname;
		thisHostname=thisHostname.replace(".com", "");
		thisHostname=thisHostname.replace(".org", "");
		thisHostname=thisHostname.replace(".co.uk", ""); 
		thisHostnameSplit=thisHostname.split(".");
		thisHostname=thisHostnameSplit[thisHostnameSplit.length-1];
		thisHostname=thisHostname.toUpperCase();
		
		replaced1Inner=allURLs[i].textContent.replace(/\.\.\./g,"");
		
		if( /([A-Z]){5}/.test(replaced1Inner)) {
			replaced1Inner=replaced1Inner.toLowerCase();
			replaced1Inner=replaced1Inner.replace(/(^|\s|\ ')(\w)/g, function(x) {
   			 return x.toUpperCase();
  			});
		}
		
		
		var multiple = false;
		
		if(/\n/.test(replaced1Inner)) {
			multiple=true;
		}
		
		if(i > 0 && allURLs[i].getAttribute('href') != allURLs[i-1].getAttribute('href')) {
			replaced2Inner=replaced1Inner.replace(/\n\n/, "<b><em><font size=1> &#124&#124 "+thisHostname+"</font></b></em><br>... ")
		}
		else {
			replaced2Inner=replaced1Inner;
		}
		
		replaced2Inner=replaced2Inner.replace(/\n\n/g, "<br>... ")
		
		
		if(replaced2Inner == replaced1Inner ) {
			if(i > 0 && allURLs[i].getAttribute('href') != allURLs[i-1].getAttribute('href')) {
				replaced2Inner=replaced2Inner.replace(/\n/, "<b><em><font size=1> &#124&#124 "+thisHostname+"</font></b></em><br>... ")
			}
			else {
				replaced2Inner=replaced1Inner;
			}
			
			replaced2Inner=replaced2Inner.replace(/\n/g, "<br>... ")
		}
		
		if(i > 0 && allURLs[i].getAttribute('href') == allURLs[i-1].getAttribute('href')) {
			allURLs[i].innerHTML = "... " + replaced2Inner ;
		}
		else if(multiple) {
			allURLs[i].innerHTML = replaced2Inner ;
		} 
		else {
			allURLs[i].innerHTML = replaced2Inner + "<b><em><font size=1> &#124&#124 "+thisHostname+"</b></em></font>";
		}
			}
}