-
Notifications
You must be signed in to change notification settings - Fork 1
/
Chefkoch NoAd.user.js
42 lines (38 loc) · 1.24 KB
/
Chefkoch NoAd.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// ==UserScript==
// @name Chefkoch NoAd
// @version 3
// @grant none
// @include https://www.chefkoch.de/*
// @exclude https://www.chefkoch.de/magazin/*
// ==/UserScript==
(function() {
'use strict';
var removable = 0;
var callsremaining = 100;
function waitforAds() {
--callsremaining;
var removables = document.querySelectorAll('img[referrerpolicy="unsafe-url"]');
console.log(callsremaining, removable, removables);
if (removables.length != removable || removable < 4) {
removable = removables.length;
if (callsremaining < 1) return;
window.setTimeout(waitforAds, 100);
console.log("waiting", document.location);
return;
}
removables.forEach( e => {
var grandparent = e.parentNode.parentNode;
if (grandparent.tagName == 'DIV' ) {
e.remove();
console.log(e);
}
});
document.querySelectorAll('div.swiper-slide').forEach( e => {
if (e.textContent.match(/^Ad\s/)) e.remove()
});
document.querySelectorAll('guj-ad').forEach( e => {
e.remove();
});
}
window.setTimeout(waitforAds, 1);
})();