Skip to content

Instantly share code, notes, and snippets.

@haakonn
Created December 4, 2016 12:51
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/100964a4593d4f65ca22164741818934 to your computer and use it in GitHub Desktop.
Save haakonn/100964a4593d4f65ca22164741818934 to your computer and use it in GitHub Desktop.
btno-nopaywall.user.js - bt.no uten betalingsmurinnhold
// ==UserScript==
// @name btno-nopaywall
// @namespace haakonnilsen.com
// @include http://www.bt.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 remSection(name) {
remAll("//section[contains(@class, '" + name + "')]");
}
function remDiv(className) {
remAll("//div[contains(@class, '" + className + "')]");
}
remDiv("df-skin-paywall-closed");
remDiv("stripe-promo");
remDiv("ch-subscribe-btn-container");
remSection('ad');
remSection('kundesider');
remAll("//div[@id='widget-perks-frontpage']");
window.addEventListener('load', function() {
remAll("//iframe");
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment