Skip to content

Instantly share code, notes, and snippets.

@zisra
Created September 9, 2023 11:39
Show Gist options
  • Save zisra/9f684d66cfe96d123fe279844c13150c to your computer and use it in GitHub Desktop.
Save zisra/9f684d66cfe96d123fe279844c13150c to your computer and use it in GitHub Desktop.
Remove Google Classroom classes
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