// ==UserScript== // @name Drudge Link Enhancements // @namespace drudgereport.com // @description Enhances links on Drudge Report and neuters links to pay/subscription sites. // // @include http://*.drudgereport.com/* // @include http://drudgereport.com/* // @version 0.1.1 // @grant GM_addStyle // @run-at document-end // @license MIT License // @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js // @downloadURL none // ==/UserScript== $("document").ready(function () { GM_addStyle('.beg-link-prefix { font-size: 0.8em; display: inline; }'); GM_addStyle('.beg-link { font-size: 0.8em; }'); GM_addStyle('.turd-icon { display: inline; }'); var icon = ""; var title = "Dying news sites, like this one, that beg for money or subscriptions have been removed"; var linkStats = {}; function extractDomain(url) { var domain; if (url.indexOf("://") > -1) { domain = url.split('/')[2]; } else { domain = url.split('/')[0]; } domain = domain.split(':')[0]; return domain; } function appendLinkStats(stats) { var tuples = []; var statsHtml = '

Link Stats

'; for (var key in stats) { tuples.push([key, stats[key]]); } // Reverse sort tuples.sort(function(a, b) { a = a[1]; b = b[1]; return a < b ? 1 : (a > b ? -1 : 0); }); for (var i=0; i" } $('body').append(statsHtml); } $("a").each(function() { var link = $(this); var href = link.attr("href"); var domain = extractDomain(href); if (href.indexOf("wsj") > -1) { link.replaceWith(icon + " "); } else if (href.indexOf("washingtonpost.com") > -1) { wptitle = "The Washington Post is a liberal/progressive/communist journal with an agenda and has been removed" link.replaceWith(icon + " "); } else { // Add a popup with the link's domain name link.attr("title", domain); } if (linkStats[domain] == null) { linkStats[domain] = 1; } else { linkStats[domain] += 1; } }); appendLinkStats(linkStats); });