-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
72 lines (69 loc) · 2.33 KB
/
index.js
File metadata and controls
72 lines (69 loc) · 2.33 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
(function () {
var ele = null;
var pollCount = 0;
var pollMax = 50;
var interval = null;
var changeDifficultyBadges = function () {
setTimeout(() => {
var spanList = document.querySelectorAll('td > span.round.label');
for (let i = 0; i < spanList.length; i++) {
var span = spanList[i];
span.innerText = 'Hidden';
span.style['background-color'] = 'purple';
}
clearInterval(interval);
}, 0);
};
if (window.location.pathname === '/problemset/all/') {
interval = setInterval(function () {
ele = document.querySelector('select.form-control');
if (ele !== null) {
changeDifficultyBadges();
clearInterval(interval);
document
.querySelector('tbody.reactable-pagination')
.addEventListener('click', changeDifficultyBadges);
document
.querySelector('tr.reactable-column-header')
.addEventListener('click', changeDifficultyBadges);
document
.querySelector('select.form-control')
.addEventListener('change', changeDifficultyBadges);
} else if (pollCount >= pollMax) {
clearInterval(interval);
return;
} else {
pollCount++;
}
}, 200);
} else if (window.location.pathname.includes('/problems/')) {
interval = setInterval(function () {
ele = document.querySelector('.css-10o4wqw > div');
if (ele !== null) {
ele.innerText = 'Difficulty Hidden';
ele.style.color = 'purple';
clearInterval(interval);
} else if (pollCount >= pollMax) {
clearInterval(interval);
return;
} else {
pollCount++;
}
}, 200);
(function hideDifficultyOfNextChallenges() {
var head = document.head;
var styleEle = document.createElement('style');
var rule =
'div.next-challenge__A4ZV > a.next-challenge-btn__L_19 { background-color: lavender; color: purple; border-color: purple; } div.next-challenge__A4ZV > a.next-challenge-btn__L_19:hover { background-color: lavender; color: purple; border-color: purple; }';
styleEle.type = 'text/css';
if (styleEle.styleSheet) {
css.styleSheet.cssText = rule;
} else {
styleEle.appendChild(document.createTextNode(rule));
}
head.appendChild(styleEle);
})();
} else {
return;
}
})();