-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhideUserChannels.plugin.js
44 lines (37 loc) · 1.12 KB
/
hideUserChannels.plugin.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
/**
* @name hideUserChannels
* @author secuestrador
* @description A BetterDiscord plugin used to hide voice channels where a blacklisted username is detected
* @version 0.0.1
*/
module.exports = class YourPlugin {
start() {
function executeCode() {
var namesToDetect = [`Username1`, `Username2`, `Username3`];
var elements = document.getElementsByClassName('usernameFont__71dd5');
for (var i = 0; i < elements.length; i++) {
var currentElement = elements[i];
var username = currentElement.textContent.trim();
if (namesToDetect.includes(username)) {
var fifthParent = getNthParent(currentElement, 5);
if (fifthParent) {
fifthParent.style.display = 'none';
}
}
}
function getNthParent(element, n) {
for (var i = 0; i < n; i++) {
if (element.parentNode) {
element = element.parentNode;
} else {
return null;
}
}
return element;
}
}
setInterval(executeCode, 100);
}
stop() {
}
}