-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathembeded-script.js
40 lines (32 loc) · 1018 Bytes
/
embeded-script.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
let tweetDialog = document.getElementById("Tweetstorm-dialog");
const main = function() {
const host = location.hostname;
const path = location.pathname;
setInterval(repeat, 5000);
document.getElementsByClassName("Grid-cell")[0].style.display = "none";
};
const counter = function(str,seq){
return str.split(seq).length - 1;
}
const tweetNode = function(node) {
return node.parentNode.parentNode.parentNode.parentNode;
}
const removeSpam = function() {
[].forEach.call(document.getElementsByClassName("TweetTextSize"),function(e){
let text = e.innerText;
if (counter(text, "#") >= 3) {
tweetNode(e).style.display = "none";
}
});
}
const repeat = function(){
if (window.scrollY === 0 && (tweetDialog.style.display === "" || tweetDialog.style.display === "none") ) {
var evt = document.createEvent("HTMLEvents");
evt.initEvent("uiShortcutGotoTopOfScreen", true, true);
document.dispatchEvent(evt);
}
removeSpam();
}
window.onload = function () {
main();
};