add maps ugh

This commit is contained in:
slonkazoid 2025-01-07 15:35:37 +03:00
parent ce2cc460b5
commit 76162edb60
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM

View file

@ -0,0 +1,48 @@
// ==UserScript==
// @name Fuck You Google Maps
// @namespace slonkazoid
// @match https://www.geohub.gg/*
// @grant none
// @version 1.0
// @author slonkazoid
// @description bypasses the google maps api limit invert filter
// ==/UserScript==
let observer = new MutationObserver((mutations) => {
for (let mutation of mutations) {
if (
mutation.target.tagName === "CANVAS" &&
mutation.target.style.filter === "invert(1)" &&
!mutation.oldValue.includes("filter: invert(1)")
) {
console.log("processing", mutation.target);
process(mutation.target);
}
}
});
observer.observe(document.body, {
attributes: true,
attributeFilter: ["style"],
attributeOldValue: true,
subtree: true,
});
function process(canvas) {
let parent = canvas.parentElement;
let containerDiv = document.createElement("div");
containerDiv.style = "position: relative";
parent.removeChild(canvas);
containerDiv.appendChild(canvas);
let filterDiv = document.createElement("div");
filterDiv.style = `top: 0;
left: 0;
position: absolute;
background-color: white;
width: 100%;
height: 100vh;
overflow: hidden;
mix-blend-mode: exclusion;`;
containerDiv.appendChild(filterDiv);
parent.appendChild(containerDiv);
}