Created
January 23, 2016 17:13
-
-
Save haakonn/0f5e118df3e60d6433b1 to your computer and use it in GitHub Desktop.
Sportsfri Bergens Tidende
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 Bergens Tidende | |
// @namespace http://haakonnilsen.com | |
// @description Bergens Tidende uten sport | |
// @include http://www.bt.no/* | |
// @grant none | |
// ==/UserScript== | |
var boring = "sport|fotball|live|sprek"; | |
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