Skip to content

Instantly share code, notes, and snippets.

@chrisvoo
Last active September 19, 2019 13:10
Show Gist options
  • Save chrisvoo/df162e7aa844b0e729f274b4ae3fad8c to your computer and use it in GitHub Desktop.
Save chrisvoo/df162e7aa844b0e729f274b4ae3fad8c to your computer and use it in GitHub Desktop.
Removes unnecessary parts from virginradio.it
// ==UserScript==
// @name VirginRadio Reducer
// @namespace http://tampermonkey.net/
// @version 0.6
// @description Removes unnecessary parts from virginradio.it
// @author Christian Castelli <[email protected]>
// @match https://www.virginradio.it/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Turning background to black
document.querySelector("body").style.background = "black"
document.querySelector("body").style.backgroundSize = "auto"
console.log("VRR: background style modified")
// Removing analytics scripts
let totFramesRemoved = 0
const interval = setInterval(function() {
console.log("VRR: waiting for iframes remotion...")
const frames = document.querySelectorAll("iframe")
if (frames.length > 1) {
frames.forEach(function (node) {
// filters out RadioCommando
if (node.getAttribute("class") !== "futuri-engage-iframe") {
node.remove()
}
})
totFramesRemoved += frames.length
} else {
console.log(`Removed ${totFramesRemoved} frames`)
clearInterval(interval)
// Lifting up the content
document.querySelector("div[class^='cont_banner']").remove()
console.log("VRR: header banner removed")
// Removing GoogleAds containers
document.querySelectorAll("div[id^='google_ads'").forEach (function (ad) { ad.remove() })
document.getElementById("contenitore-sito-x-adv").remove()
document.querySelector(".adv_esterno").remove()
console.log("VRR: GoogleAds containers removed")
// Automatically open last songs played box
document.querySelector("div[class*='button_latest_song'] a").click()
// It doesn't make work javascript:void(0) anymore for a tags (eg the volume control opens a blank page)
document.querySelector("base").remove()
// upper part of the player
document.querySelector(".meta-infos").remove()
// Rock trends
document.querySelector(".vc_box_trends").remove()
let elements = document.querySelector(".container.vc_bg_extradark_gray").children
for (const el of elements) {
if (!el.getAttribute("class").includes("row")) {
el.remove()
}
}
}
}, 3000)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment