-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathno-likey.js
45 lines (43 loc) · 1.24 KB
/
no-likey.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
// let localChrome = window.chrome
var postsHidden = 0;
function hidey() {
{
let classes = [
"update-components-text-view",
"white-space-pre-wrap",
"break-words",
];
let elements = document.querySelectorAll(
// lmao
classes.map((c) => `.${c}`).join("")
);
elements.forEach((e) => {
// get all span children, print
let spans = e.querySelectorAll("span");
spans.forEach((s) => {
// if it contains the word this
if (s.innerHTML.includes("this")) {
postsHidden++;
parent_classes = ["feed-shared-update-v2"];
let parent = e.closest(parent_classes.map((c) => `.${c}`).join(""));
// 2 second fade out
parent.style.transition = "opacity 2s";
parent.style.opacity = 0;
parent.style.color = "red";
// Hide the element after the transition is complete
setTimeout(() => {
parent.style.display = "none";
// remove from DOM
parent.remove();
}, 1000);
}
});
});
}
console.log("posts hidden: ", postsHidden);
}
window.onload = function () {
console.log("loaded :*");
// rerun every 2 seconds
setInterval(() => hidey(), 2000);
};