-
Notifications
You must be signed in to change notification settings - Fork 0
/
reddit.js
31 lines (25 loc) · 963 Bytes
/
reddit.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
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-73159092-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = 'https://ssl.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
const redditCommentFilter = function(node) {
hideToxicComments("div.md");
};
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.addedNodes) {
mutation.addedNodes.forEach(function(node) {
if (node.nodeType === 1) { // ELEMENT_NODE
redditCommentFilter(node);
}
});
}
});
});
const config = { attributes: false, childList: true, characterData: false, subtree: true }
observer.observe(document.body, config);
redditCommentFilter(document.body);