Skip to content

Instantly share code, notes, and snippets.

@Ferk
Last active March 1, 2021 14:51
Show Gist options
  • Select an option

  • Save Ferk/3d87d13b62645bbb886f5488c7f9fc18 to your computer and use it in GitHub Desktop.

Select an option

Save Ferk/3d87d13b62645bbb886f5488c7f9fc18 to your computer and use it in GitHub Desktop.
Zap - Greasemonkey script
// ==UserScript==
// @name zap
// @namespace http://ferk.gitlab.io/
// @version 1.0
// @description zap distractions from websites
// @author Ferk
// @grant none
// @downloadUrl https://gist.github.com/Ferk/3d87d13b62645bbb886f5488c7f9fc18/raw/zap.user.js
// @updateUrl https://gist.github.com/Ferk/3d87d13b62645bbb886f5488c7f9fc18/raw/zap.user.js
// @include https?://*
// @exclude https?://github.com/*#diff-*
// @exclude https?://github.com/*/files
// @exclude https?://www.cashlog.com/*
// @exclude https?://web.whatsapp.com/*
// @exclude https?://discordapp.com/*
// @exclude https?://localhost:*/*
// @exclude https?://*.deutsche-bank.de/*
// @exclude https?://*.wikipedia.org/*
// ==/UserScript==
(function() {
function R(w) {
try {
var d = w.document,
j, i, t, T, N, b, r = 1,
C;
for (j = 0; t = ["object", "embed", "applet", "iframe"][j]; ++j) {
T = d.getElementsByTagName(t);
for (i = T.length - 1;
(i + 1) && (N = T[i]); --i)
if (j != 3 || !R((C = N.contentWindow) ? C : N.contentDocument.defaultView)) {
b = d.createElement("div");
b.style.width = N.width;
b.style.height = N.height;
b.innerHTML = "<del>" + (j == 3 ? "third-party " + t : t) + "</del>";
N.parentNode.replaceChild(b, N);
}
}
} catch (E) {
r = 0
}
return r
}
R(self);
var i, x;
for (i = 0; x = frames[i]; ++i) R(x);;;
var d = document;
function K(N, w) {
var nn = d.createElement(w),
C = N.childNodes,
i;
for (i = C.length - 1; i >= 0; --i) nn.insertBefore(C[i], nn.childNodes[0]);
N.parentNode.replaceChild(nn, N);
}
function Z(t, w) {
var T = document.getElementsByTagName(t),
j;
for (j = T.length - 1; j >= 0; --j) K(T[j], w);
}
Z("blink", "span");
Z("marquee", "div");
Z("iframe", "blocked-iframe");;;
//Z("iframe", document.createTextNode("-iframe-"));;;
var css = document.body.appendChild(document.createElement('style'));
css.innerHTML = "*{background:white!important;color:black!important}:link,:link *{color:#00A!important} :visited,:visited *{color:#81A!important} img,img *{filter:opacity(2%)!important;} img:hover{filter:opacity(33%)!important;} img:active{filter:opacity(75%)!important;}";;;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment