Skip to content

Instantly share code, notes, and snippets.

@AshKyd
Last active February 23, 2025 01:10
Show Gist options
  • Save AshKyd/a3c5c2b61a49533d4e1b991a3d6a6af3 to your computer and use it in GitHub Desktop.
Save AshKyd/a3c5c2b61a49533d4e1b991a3d6a6af3 to your computer and use it in GitHub Desktop.
Tampermonkey scripts to remove US politics from ABC News and Brisbane Times
// ==UserScript==
// @name Tidy up news homepage
// @namespace http://tampermonkey.net/
// @version 2025-02-03
// @description try to take over the world!
// @author You
// @match https://www.abc.net.au/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=abc.net.au
// @grant none
// ==/UserScript==
(function() {
'use strict';
const selectors = ['[data-component="Banner"]', 'div[class*="forYou"]', 'div[class*="videoShorts"]', 'div[class*="theBigPicture"]', '#sport']
selectors.forEach(selector => document.querySelectorAll(selectors).forEach(el => {
el.innerHTML = '';
}));
})();
// ==UserScript==
// @name Hide USPol on various news sites
// @namespace http://tampermonkey.net/
// @version 2025-02-03
// @description try to take over the world!
// @author You
// @match https://www.theverge.com/*
// @match https://www.abc.net.au/*
// @match https://www.brisbanetimes.com.au/*
// @match https://theconversation.com/*
// @match https://www.theguardian.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=abc.net.au
// @grant none
// ==/UserScript==
(function() {
'use strict';
const selectors = {
'www.abc.net.au': '[data-component="TopStoriesCard"], [data-component="DetailCard"], [data-component="ListItem"], [data-component="GenericCard"], [data-component="RichCardLayout"]',
'www.theverge.com': '.duet--content-cards--content-card',
'www.brisbanetimes.com.au': '[data-testid="story-tile"],[data-testid="latest-story-tile"]',
'theconversation.com': 'a',
'www.theguardian.com': 'li > *'
}
const go = () => {
const theseSelectors = selectors[location.hostname];
console.log(location.hostname,{theseSelectors})
if(!theseSelectors){
return;
}
document.querySelectorAll(theseSelectors).forEach(tile => {
const keywords = ['trump','musk', 'tarriff', 'united states', 'america'];
const keywordsUpper = ['US'];
const isCrap = keywords.find(keyword => tile.innerHTML.toLowerCase().includes(keyword)) || keywordsUpper.find(keyword => tile.innerHTML.includes(keyword));
if(isCrap){
const height = getComputedStyle(tile).height;
tile.innerHTML = '💩';
Object.assign(tile.style, {
height: height,
maxHeight:'100px',
border:'2px solid brown',
background:'lightbrown',
padding:'5px',
borderRadius:'3px',
display:'flex',
width:'100%',
alignItems:'center',
justifyContent: 'center',
});
} else {
}
})
}
go();
setInterval(go, 500);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment