Created
September 9, 2023 11:39
-
-
Save zisra/9f684d66cfe96d123fe279844c13150c to your computer and use it in GitHub Desktop.
Remove Google Classroom classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = () => { | |
const blackList = [ | |
"Math", | |
"Science", | |
]; | |
const observer = new MutationObserver((mutationsList) => { | |
for (const mutation of mutationsList) { | |
if (mutation.type === "childList" && mutation.addedNodes.length > 0) { | |
const matchingElements = Array.from( | |
document.querySelectorAll(".YVvGBb.z3vRcc-ZoZQ1"), | |
); | |
matchingElements.forEach((element) => { | |
if (blackList.includes(element.textContent)) { | |
element.parentElement.parentElement.parentElement.parentElement.parentElement.remove(); | |
} | |
}); | |
observer.disconnect(); | |
} | |
} | |
}); | |
observer.observe(document.querySelector(".JwPp0e"), { | |
childList: true, | |
subtree: true, | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment