-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblueblocker.js
More file actions
96 lines (75 loc) · 3.72 KB
/
blueblocker.js
File metadata and controls
96 lines (75 loc) · 3.72 KB
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
function styler(div, displaymode) {
if (displaymode.displaymodecheckbox === true) {
div.style.color = 'black';
div.style.width = '100%';
div.style.height = '3rem';
div.style.textAlign = 'center';
div.style.fontWeight = 'bold';
div.style.fontSize = '0.75rem';
div.style.fontFamily = 'sans-serif';
div.style.display = 'flex';
div.style.justifyContent = 'center';
div.style.alignItems = 'center';
div.style.opacity = '0.8';
div.style.backgroundColor = '#e5e5f7';
div.style.backgroundImage = 'repeating - linear - gradient(45deg, #444cf7 25 %, transparent 25 %, transparent 75 %, #444cf7 75 %, #444cf7), repeating - linear - gradient(45deg, #444cf7 25 %, #e5e5f7 25 %, #e5e5f7 75 %, #444cf7 75 %, #444cf7)';
div.style.backgroundPosition = '0 0, 10px 10px';
div.style.backgroundSize = '20px 20px';
}
else {
div.remove();
}
}
function noBlueTweets() {
browser.storage.local.get('enabled').then((res) => {
if (res.enabled === true) {
browser.storage.local.get('displaymodecheckbox').then((displaymode) => {
if (displaymode === undefined) displaymode = false;
let count = 0;
if (window.location.href.includes('/status/')) {
let divsWithSvgTemp = document.querySelectorAll('div[data-testid="cellInnerDiv"]:not([style*="transition: transform 0.3s ease-out 0s"])');
// let divsWithSvgTemp = document.querySelectorAll('div[data-testid="cellInnerDiv"]:not([style*="transition: transform 0.3s linear 0s"])');
let divsWithIconVerifiedTemp = Array.from(divsWithSvgTemp).filter((div) => {
if (div.getAttribute("style").includes('transform: translateY(0px);')) {
return false;
}
let svgElement = div.querySelector(':scope svg[data-testid="icon-verified"]');
if (svgElement) {
let pathElement = svgElement.querySelector('path');
if (pathElement && getComputedStyle(pathElement).color === 'rgb(29, 155, 240)') {
return true;
}
}
return false;
});
for (let i = 0; i < divsWithIconVerifiedTemp.length; i++) {
divsWithIconVerifiedTemp[i].innerHTML = "There was Twitter blue tweet here, but we'll spare you that";
divsWithIconVerifiedTemp[i].setAttribute('data-testid', 'cellInnerDivEdited');
styler(divsWithIconVerifiedTemp[i], displaymode);
count++;
}
browser.storage.local.get('count').then((res) => {
let currentCount = res.count;
if (currentCount === undefined) {
browser.storage.local.set({ "count": 0 });
}
let newCount = currentCount + count;
if (newCount > res.count) {
browser.storage.local.set({ "count": newCount });
}
});
}
divsWithSvgTemp = null;
divsWithIconVerifiedTemp = null;
});
}
});
}
window.addEventListener('locationchange', function (event) {
noBlueTweets();
});
// setInterval(noBlueTweets, 1000);
document.addEventListener('scroll', function (event) {
setInterval(noBlueTweets, 200);
});
document.addEventListener("load", noBlueTweets(), false);