Github-Copilot-Blocker/remove-by-element.js

21 lines
630 B
JavaScript
Raw Normal View History

2024-12-18 17:33:52 -06:00
function doSomething() {
2024-12-18 17:43:40 -06:00
const copilotHeaderDivs = document.querySelectorAll('.AppHeader-CopilotChat');
const copilotHomePageDivs = document.querySelectorAll('.copilotPreview__container');
2024-12-18 17:33:52 -06:00
2024-12-18 17:43:40 -06:00
copilotHeaderDivs.forEach(function(div) {
div.remove(); // Remove each matching div
});
copilotHomePageDivs.forEach(function(div) {
div.remove(); // Remove each matching div
});
2024-12-18 17:33:52 -06:00
}
if (document.readyState === "loading") {
// Loading hasn't finished yet
2024-12-18 17:43:40 -06:00
document.addEventListener("DOMContentLoaded", doSomething);
2024-12-18 17:33:52 -06:00
} else {
// `DOMContentLoaded` has already fired
2024-12-18 17:43:40 -06:00
doSomething();
}