Skip to content

Instantly share code, notes, and snippets.

@antonva
Created May 21, 2015 15:53
Show Gist options
  • Save antonva/cdb4e887bd1be08c1568 to your computer and use it in GitHub Desktop.
Save antonva/cdb4e887bd1be08c1568 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name cleanmbl.
// @namespace mbl.is
// @version 1
// @grant none
// @include http://*.mbl.is/*cd
// @include http://www.mbl.is/*
// ==/UserScript==
// Clean up the menu.
var menu = document.querySelectorAll("#menu a");
for (var i = 0; i < menu.length; i++) {
if (menu[i].href == "http://www.mbl.is/sport/") { menu[i].parentNode.removeChild(menu[i]) };
if (menu[i].href == "http://www.mbl.is/smartland/") { menu[i].parentNode.removeChild(menu[i]) };
if (menu[i].href == "http://www.mbl.is/folk/") { menu[i].parentNode.removeChild(menu[i]) };
if (menu[i].href == "http://www.mbl.is/bill/") { menu[i].parentNode.removeChild(menu[i]) };
if (menu[i].href == "http://icelandmonitor.mbl.is/news/") { menu[i].parentNode.removeChild(menu[i]) };
}
// Clean up the top post..
var top_post = document.querySelector(".dlk-fp-v a");
console.log(top_post.href.indexOf("/frettir/"));
if (top_post.href.indexOf("/sport/") != -1 || top_post.href.indexOf("/smartland/") != -1) {
var node =document.querySelector(".dlk-fp-v");
while (node.firstChild) {
node.removeChild(node.firstChild);
}
};
// Clean up the teasers.
var teasers = document.querySelectorAll(".teaser a");
for (var i = 0; i < teasers.length; i++) {
if (teasers[i].href.indexOf("/sport/") != -1) { teasers[i].parentNode.parentNode.remove() };
if (teasers[i].href.indexOf("/smartland/") != -1) { teasers[i].parentNode.parentNode.remove() };
if (teasers[i].href.indexOf("/folk/") != -1) { teasers[i].parentNode.parentNode.remove() };
}
// Burt med SmartLand boxid.
var sl = document.getElementById("cpick-smartpop");
sl.parentNode.removeChild(sl);
// Sports row begone
var ts = document.querySelectorAll(".theme_sport");
for (var i = 0; i < ts.length; i++) {
ts[i].parentNode.removeChild(ts[i]);
}
// Folk begone
var tf = document.querySelectorAll(".theme_folk");
for (var i = 0; i < tf.length; i++) {
tf[i].parentNode.removeChild(tf[i]);
}
// Folk list begone
var lf = document.getElementById("popularity-tab-12hours-100");
lf.parentNode.removeChild(lf);
// Sport list begone
var ls = document.getElementById("popularity-tab-12hours-3");
ls.parentNode.removeChild(ls);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment