Last active
January 13, 2020 12:27
-
-
Save michaelotto/6cc73f17bafe00615fa7ecc5b622021f to your computer and use it in GitHub Desktop.
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 Remove Spiegel+ stories from spiegel.de | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @description Remove Spiegel+ stories from spiegel.de | |
// @author Michael Otto | |
// @match https://www.spiegel.de/ | |
// @match http://www.spiegel.de/ | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var search_string = [ | |
"//article" | |
]; | |
function parse_and_remove(xpath) { | |
for (var i = 0; i < xpath.snapshotLength; i++) { | |
var el = xpath.snapshotItem(i); | |
var uses = el.getElementsByTagName('title'); | |
for (var j=0; j < uses.length; j++) { | |
if (uses[j].innerHTML == "Icon: Spiegel Plus") { | |
console.log("Removing element "+el); | |
el.parentNode.removeChild(el); | |
break; | |
} | |
} | |
} | |
} | |
for (var j = 0; j < search_string.length; j++) { | |
parse_and_remove(document.evaluate(search_string[j], document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null)); | |
} | |
;})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment