Skip to content

Instantly share code, notes, and snippets.

@DavidRogersDev
Last active May 5, 2022 02:27
Show Gist options
  • Save DavidRogersDev/335fb26372be40291ad0887c295f68a9 to your computer and use it in GitHub Desktop.
Save DavidRogersDev/335fb26372be40291ad0887c295f68a9 to your computer and use it in GitHub Desktop.
A very small Greasemonkey script to remove the Video from pages on news.com.au It also removes the ad banner at the top.
// ==UserScript==
// @name news.com.au - Video Be Gone
// @description removes video and top ad from news.com.au stories
// @version 1
// @grant none
// @match https://www.news.com.au/
// @match https://www.news.com.au/*
// @noframes
// ==/UserScript==
(function() {
'use strict';
const removeMainMedia = () => {
const mediaDiv = document.querySelector("#primary-media");
if(mediaDiv) {
const storyBody = document.querySelector("#story-body")
const buffer = document.createElement("div"); // create a very small spacer div where video used to be.
buffer.style.height = "50px";
mediaDiv.remove();
storyBody.insertBefore(buffer, storyBody.firstChild); // set as first child
}
};
const removeAdTop = () => {
const addContainer = document.querySelector(".header_ads-container");
addContainer.remove();
};
const removeAdRightSide = () => {
const addContainer = document.querySelector("aside#rhc");
if(addContainer) {
addContainer.remove();
}
};
const removeClickBait = () => {
const clickBaitDiv = document.querySelector("#taboola");
if(clickBaitDiv){
clickBaitDiv.remove();
}
else
console.log('Does not exist')
};
removeAdTop();
removeMainMedia();
removeAdRightSide();
removeClickBait();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment