-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinbox-interrupt.user.js
59 lines (51 loc) · 2.24 KB
/
inbox-interrupt.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
51
52
53
54
55
56
57
58
59
// ==UserScript==
// @name Inbox Interrupt
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://*.stackexchange.com/*
// @match https://stackoverflow.com/*
// @match https://*.stackoverflow.com/*
// @match https://superuser.com/*
// @match https://*.superuser.com/*
// @match https://serverfault.com/*
// @match https://*.serverfault.com/*
// @match https://stackapps.com/*
// @match https://*.stackapps.com/*
// @match https://askubuntu.com/*
// @match https://*.askubuntu.com/*
// @match https://mathoverflow.com/*
// @match https://*.mathoverflow.com/*
// @exclude https://api.stackexchange.com/*
// @exclude https://chat.stackexchange.com/*
// @exclude https://chat.meta.stackexchange.com/*
// @exclude https://chat.stackoverflow.com/*
// @exclude https://data.stackexchange.com/*
// @exclude https://dev.stackexchange.com/*
// @exclude https://openid.stackexchange.com/*
// @exclude https://insights.stackoverflow.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
(() => {
var observer = new MutationObserver((records) => {
var inbox = false;
var achievements = false;
for (var i = 0; i < records.length; i++) {
if (records[i].type == "childList" && records[i].target.parentNode && records[i].target.parentNode.querySelector("a.js-inbox-button")) {
records[i].target.parentNode.querySelector("a.js-inbox-button").href = "javascript:void(0)";
inbox = true;
if (achievements)
observer.disconnect();
}
if (records[i].type == "childList" && records[i].target.parentNode && records[i].target.parentNode.querySelector("a.js-achievements-button")) {
records[i].target.parentNode.querySelector("a.js-achievements-button").href = "javascript:void(0)";
achievements = true;
if (inbox)
observer.disconnect();
}
}
});
observer.observe(document, {attributes: false, childList: true, subtree: true});
})();