add maps ugh
This commit is contained in:
parent
ce2cc460b5
commit
76162edb60
1 changed files with 48 additions and 0 deletions
48
js/userscripts/gmaps.user.js
Normal file
48
js/userscripts/gmaps.user.js
Normal 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);
|
||||
}
|
Loading…
Reference in a new issue