Drudge Enhancement Suite

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

Verze ze dne 21. 04. 2015. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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///wBubm4AT09OAOPj4wDHx8cAmZmZAHp6eQCUlJQA2dnZAAMDAwDExMQABQUFAMTDwgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICCwsLAAUFAgILCwICDQsCAgsLCwsLBgICCwsCAg0LAgILCwIMCwsFAgsLAgINAwICCwsCAgQLBQILCwIOCwMCAgsLAgIECwUCCwsCCQsOAgILCwICBAsFAgsLCwsBAgICCwsCAgQLBQILCwsLCwcCAgsLAgIECwUCCwsCAgsLCgILCwICBAsFAgsLAgILCwoCCwsCDAsLBQILCwICCwsKAgsLCwsLBgICCwsLCwsHAgILCwsABQUCAgsLCwsIAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=';
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>";
		}
			}
}