-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSlashdot - Adblock.user.js
50 lines (42 loc) · 1.49 KB
/
Slashdot - Adblock.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
42
43
44
45
46
47
48
49
50
// ==UserScript==
// @name Slashdot - Adblock
// @version 0.3.20250105.1
// @grant none
// @icon https://slashdot.org/favicon.ico
// @include https://slashdot.org/*
// @include https://*.slashdot.org/*
// @require https://github.com/adamhotep/nofus.js/raw/main/nofus.js
// ==/UserScript==
/* tweak the CSS */
nf.style$(`
/* older */
#firehose > div > article[id$="-adblocked"], /* high specificity needed */
#announcement, /* this has never been anything but (internal) ads */
#slashdot_deals, .adwrap
{ display:none!important; }
`);
/* new as of Dec 2024:
* these ads actually verify they're visible, so push them off screen */
nf.wait$(`#firehose-message-tray + span[id]:has(iframe),
#slashboxes > :has(iframe),
#slashboxes > :has(~ .block.nosort) /* (requires high karma) */,
#bottomadspace ~ *,
a[target="_blank"]:has(img):not([href^="https://www.reddit.com/"])
`, elem => {
elem.style.position = 'absolute';
elem.style.top = '-200vh';
});
/* older */
nf.wait$('article[id] > header > div.ntv-sponsored-disclaimer',
articleText => {
let sponsoredContent = articleText.parentElement.parentElement;
// this gets overwritten and reverted (thus the CSS above)
sponsoredContent.style.display = "none!important";
// this overrides the bypass slashdot somehow configured:
sponsoredContent.id += "-adblocked";
}
);
// "Disable Advertising" is an option for /. users with high karma
nf.wait$('input[name="adsoff"]', function(adsoff) {
if (!adsoff.checked) adsoff.click();
});