-
Notifications
You must be signed in to change notification settings - Fork 0
/
FTNFTs.user.js
97 lines (72 loc) · 3.19 KB
/
FTNFTs.user.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// ==UserScript==
// @name FuckTwitterNFTs
// @namespace http://tampermonkey.net/
// @description FuckTwitterNFTs - Automatically hide NFT Users in twitter Timeline
// @author Blumlaut
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?domain=twitter.com
// @grant none
// @version 1.0.0
// @updateURL https://raw.githubusercontent.com/Blumlaut/FuckTwitterNFTs/main/FTNFTs.user.js
// @downloadURL https://raw.githubusercontent.com/Blumlaut/FuckTwitterNFTs/main/FTNFTs.user.js
// ==/UserScript==
function WaitUntilFound(parent, query) {
var found = parent.querySelector(query)
if (found) {
return found
} else {
SetTimeout( function() {
WaitUntilFound(parent,query)
}, 10)
}
}
(async function() {
var BlockingMode = 0; // 0 = Hide Tweets Only, 1 = Actively Block (might have false positives!)
async function RemoveNFTUsers() {
var tweets = document.querySelectorAll('[role="article"]')
// searches tweets for NFT Avatars and delets those tweets from TL.
tweets.forEach(tweet => {
var NFTard = tweet.querySelector('[style*="hex-hw-shapeclip-clipconfig"]')
if (NFTard) {
console.log("Found NFT Avatar..")
if (BlockingMode == 1) {
var isQuoteTweet = false
var tempParent = NFTard.parentElement
for (var i = 0; i < 16; i++) {
if (!tempParent.attributes.role) {
tempParent = tempParent.parentElement
} else if (tempParent.attributes.role.value == "link") {
isQuoteTweet = true
}
}
var moreButton = tweet.querySelector('[aria-label="More"]')
if ((moreButton) && (!isQuoteTweet)) {
console.log("This is an actual tweet, blocking user.")
moreButton.click()
var blockButton = WaitUntilFound(document,'[data-testid="block"]')
if (blockButton) {
blockButton.click()
var blockConfirmButton = WaitUntilFound(document,'[data-testid="confirmationSheetConfirm"]')
if (blockConfirmButton) {
blockConfirmButton.click()
}
}
}
} else if (BlockingMode == 0) {
tweet.remove();
}
}
})
// this searches "Who to Follow" for NFT Avatars and deletes the recommendation, currently causes a blank space.
var UserCells = document.querySelectorAll('[data-testid="UserCell"]')
UserCells.forEach(user => {
var NFTard = user.querySelector('[style*="hex-hw-shapeclip-clipconfig"]')
if (NFTard) {
console.log("Found NFT Avatar in UserCell, Deleting..")
user.remove();
}
})
setTimeout(RemoveNFTUsers, 100)
}
setTimeout(RemoveNFTUsers, 100)
})();