-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ignore Users.js
43 lines (41 loc) · 1.91 KB
/
Ignore Users.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
// ==UserScript==
// @name Ignore Users
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Ignore and downvote blacklisted users
// @author You
// @match https://glav.su/forum/*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.addEventListener('load', function() {
var users = ['https://glav.su/members/16811/', 'https://glav.su/members/1482/', 'https://glav.su/members/25900/', 'https://glav.su/members/9955/', 'https://glav.su/members/29612/',
'https://glav.su/members/8634/', 'https://glav.su/members/2633/', 'https://glav.su/members/35969/', 'https://glav.su/members/25900/', 'https://glav.su/members/11505/', 'https://glav.su/members/146/'];
document.querySelectorAll('.a-mp-m').forEach(message => {
// Skip if user is not on the list
if (!users.includes( message.querySelector('.a-mp-m-an > a').href )) return;
// Hide message
let childrenBlocks = message.children;
for (let i = 1; i < childrenBlocks.length; i++)
childrenBlocks[i].setAttribute('style', 'display: none;');
// Downvote message if possible
// let button = message.querySelector('.js-ml-m-v-nb');
// console.log('.js-ml-m-v-nb: ' + !!button);
// if (button) button.dispatchEvent(event);
});
// Hide junk at the top and bottom of the page
let div = this.document.querySelector(".bl-ptrs");
if(div) div.setAttribute('style', 'display: none;');
div = this.document.querySelector(".bl-a.c-m-b-1rem.c-m-t-1rem");
if(div) div.setAttribute('style', 'display: none;');
div = this.document.querySelector(".l-f");
if(div) div.setAttribute('style', 'display: none;');
document.querySelectorAll(".bl-f.c-m-t-1rem").forEach(div => {
div.setAttribute('style', 'display: none;');
});
document.querySelectorAll(".bl-mp-bl:not(.c-p-1rem)").forEach(div => {
div.setAttribute('style', 'display: none;');
});
});
})();