Created
October 25, 2024 07:04
-
-
Save pmakholm/35f9d8ad449ce04ecadc1e222237d507 to your computer and use it in GitHub Desktop.
Userscript to hide links to Sporten on dr.dk/nyheder
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 Hide DR Sporten Links | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.0 | |
| // @description Hides articles and links that match the specified URLs on dr.dk | |
| // @author Peter Makholm (peter@makholm.net) | |
| // @match https://www.dr.dk/nyheder | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| // Hide articles containing specific links | |
| document.querySelectorAll("div.dre-share-link-copy-url__copy-link-hidden").forEach(node => { | |
| if (node.textContent.includes('https://www.dr.dk/sporten/')) { | |
| const listItem = node.closest("li.hydra-latest-news-page__short-news-item"); | |
| if (listItem) { | |
| listItem.style.display = "none"; | |
| } | |
| } | |
| }); | |
| // Hide list items containing specific links | |
| document.querySelectorAll("a.hydra-card-title").forEach(node => { | |
| if (node.href.includes('https://www.dr.dk/sporten')) { | |
| const listItem = node.closest("li.hydra-latest-news-page__index-list-item, li.hydra-latest-news-page__short-news-item"); | |
| if (listItem) { | |
| listItem.style.display = "none"; | |
| } | |
| } | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment