Skip to content

Instantly share code, notes, and snippets.

@haakonn
Last active December 5, 2016 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haakonn/3fa529011dc71665db7154419736f243 to your computer and use it in GitHub Desktop.
Save haakonn/3fa529011dc71665db7154419736f243 to your computer and use it in GitHub Desktop.
Les ba.no uten betalingsmurede artikler
// ==UserScript==
// @name bano-nopaywall
// @namespace haakonnilsen.com
// @include http://www.ba.no/*
// @version 1
// @grant none
// ==/UserScript==
function remAll(xpath) {
var els = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < els.snapshotLength; i++) {
var node = els.snapshotItem(i);
node.parentNode.removeChild(node);
}
}
function remByClass(el, className) {
remAll("//" + el + "[contains(@class, '" + className + "')]");
}
function remDiv(className) {
remByClass("div", className);
}
function remArticle(className) {
remByClass("article", className);
}
function remSection(className) {
remByClass("section", className)
}
remDiv("df-skin-paywall");
remDiv("df-skin-annonse");
remSection("lp_challengedeck");
remAll("//bazaar-ad-container");
remAll("//amedia-subscriber-link");
remDiv("am-adContainer");
remDiv("am-promo-text");
remAll("//tivoli-realestatecarousel");
remAll("//tivoli-servicebar");
remAll("//tivoli-jobcarousel");
remArticle("am-eavis-teaser");
remArticle("am-familyshare-teaser");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment