Created
January 23, 2016 17:14
-
-
Save haakonn/7a2fef373a495d4805de to your computer and use it in GitHub Desktop.
Sportsfri Aftenposten
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Sportsfri Aftenposten | |
// @namespace http://haakonnilsen.com | |
// @description Aftenposten uten sport | |
// @include http://www.aftenposten.no/* | |
// @include https://www.aftenposten.no/* | |
// @include http://www.ba.no/ | |
// @include http://www.bt.no/* | |
// @include https://www.vg.no/ | |
// @grant none | |
// ==/UserScript== | |
var boring = "sport|fotball|live|spillsenteret"; | |
var filterRE = new RegExp(boring); | |
var links = document.evaluate("//a", | |
document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); | |
for (var i = 0; i < links.snapshotLength; i++) { | |
var item = links.snapshotItem(i); | |
if (filterRE.test(item)) { | |
var parent = item.parentNode; | |
parent.parentNode.removeChild(parent); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment