48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
// ==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);
|
|
}
|