-
Notifications
You must be signed in to change notification settings - Fork 0
/
content.js
36 lines (28 loc) · 1.04 KB
/
content.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
// content.js
console.log("Hide Elo extension loaded ♟️");
// // Chat room code for when you play a rematch
// const chatRoomComponent = document.querySelector(".chat-room-component");
// document.addEventListener("click", function (event) {
// const spans = chatRoomComponent.querySelectorAll("span");
// if (!chatRoomComponent) return;
// if (!spans) return;
// spans.forEach((span) => {
// if (span.textContent.includes("rating")) {
// span.remove();
// }
// });
// });
const disableButton = document.getElementById("action-btn");
disableButton.addEventListener("click", function () {
const isEnabled = disableButton.innerHTML == "Enable";
const styleSheet = document.styleSheets[1]; //TODO - add validation to ensure this is the correct style sheet
//Currently only updating the stylesheet locally, not updating on chess.com
if (!isEnabled) {
disableButton.innerHTML = "Enable";
styleSheet.disabled = false;
return;
}
disableButton.innerHTML = "Disable";
styleSheet.disabled = true;
console.log("Button clicked - ");
});