Skip to content

Instantly share code, notes, and snippets.

@pmakholm
Last active November 5, 2024 09:17
Show Gist options
  • Save pmakholm/22879836215c042ba6505d860cc50b02 to your computer and use it in GitHub Desktop.
Save pmakholm/22879836215c042ba6505d860cc50b02 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Hide DR Valg i USA Links
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Hides articles and links that match the specified URLs on dr.dk
// @author Peter Makholm ([email protected])
// @match https://www.dr.dk/nyheder
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Skjul Valg i USA-temaet
document.querySelectorAll("div.dre-share-link-copy-url__copy-link-hidden").forEach(node => {
if (node.textContent.includes('https://www.dr.dk/nyheder/udland/valg-i-usa/')) {
const listItem = node.closest("li.hydra-latest-news-page__short-news-item");
if (listItem) {
listItem.style.display = "none";
}
}
});
document.querySelectorAll("a.hydra-card-title").forEach(node => {
if (node.href.includes('https://www.dr.dk/nyheder/udland/valg-i-usa/')) {
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";
}
}
});
// Skjul artikler om Trump
document.querySelectorAll("div.dre-share-link-copy-url__copy-link-hidden").forEach(node => {
if (node.textContent.includes('trump')) {
const listItem = node.closest("li.hydra-latest-news-page__short-news-item");
if (listItem) {
listItem.style.display = "none";
}
}
});
document.querySelectorAll("a.hydra-card-title").forEach(node => {
if (node.href.includes('trump')) {
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";
}
}
});
// Skjul artikler om Harris
document.querySelectorAll("div.dre-share-link-copy-url__copy-link-hidden").forEach(node => {
if (node.textContent.includes('harris')) {
const listItem = node.closest("li.hydra-latest-news-page__short-news-item");
if (listItem) {
listItem.style.display = "none";
}
}
});
document.querySelectorAll("a.hydra-card-title").forEach(node => {
if (node.href.includes('harris')) {
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