Last active
October 24, 2025 17:39
-
-
Save framp/c6a6f96bb48229f710dd92bfb6e9ef91 to your computer and use it in GitHub Desktop.
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
| const removeWarnings = (element: HTMLElement) => { | |
| if (element.nodeName === "SPAN") { | |
| const span = element as HTMLSpanElement; | |
| if (span.innerText.trim() === "For development purposes only") { | |
| span.innerText = ""; | |
| } | |
| if ( | |
| span.innerText.trim() === "For development purposes only" || | |
| span.innerText.trim() === | |
| "This page can't load Google Maps correctly." | |
| ) { | |
| const grandparent = span.parentElement?.parentElement; | |
| if (grandparent) { | |
| grandparent.remove(); | |
| } | |
| } | |
| } | |
| if (element.nodeName === "IMG") { | |
| const img = element as HTMLImageElement; | |
| if ( | |
| img.src === | |
| "https://maps.gstatic.com/mapfiles/api-3/images/google_gray.svg" | |
| ) { | |
| const grandparent = img.parentElement?.parentElement; | |
| if (grandparent) { | |
| grandparent.remove(); | |
| } | |
| } | |
| } | |
| if (element.nodeName === "DIV") { | |
| const div = element as HTMLDivElement; | |
| const bgColor = div.style.backgroundColor; | |
| if (bgColor === "rgba(0, 0, 0, 0.5)" || bgColor === "rgba(0,0,0,0.5)") { | |
| div.style.backgroundColor = ""; | |
| } | |
| } | |
| }; | |
| const observer = new MutationObserver((mutations) => { | |
| mutations.forEach((mutation) => { | |
| mutation.addedNodes.forEach((node) => { | |
| if (node.nodeName === "SPAN" || node.nodeName === "IMG" || node.nodeName === "DIV") { | |
| removeWarnings(node as HTMLElement); | |
| } | |
| if (node instanceof Element) { | |
| node.querySelectorAll("span").forEach((span) => { | |
| removeWarnings(span as HTMLElement); | |
| }); | |
| node.querySelectorAll("img").forEach((img) => { | |
| removeWarnings(img as HTMLElement); | |
| }); | |
| node.querySelectorAll("div").forEach((div) => { | |
| removeWarnings(div as HTMLElement); | |
| }); | |
| } | |
| }); | |
| }); | |
| }); | |
| observer.observe(document.body, { | |
| childList: true, | |
| subtree: true, | |
| }); | |
| document.querySelectorAll("span").forEach((span) => { | |
| removeWarnings(span as HTMLElement); | |
| }); | |
| document.querySelectorAll("img").forEach((img) => { | |
| removeWarnings(img as HTMLElement); | |
| }); | |
| document.querySelectorAll("div").forEach((div) => { | |
| removeWarnings(div as HTMLElement); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment