From 76162edb60877f15d8a03df692a860235afbc1d9 Mon Sep 17 00:00:00 2001 From: slonkazoid Date: Tue, 7 Jan 2025 15:35:37 +0300 Subject: [PATCH] add maps ugh --- js/userscripts/gmaps.user.js | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 js/userscripts/gmaps.user.js diff --git a/js/userscripts/gmaps.user.js b/js/userscripts/gmaps.user.js new file mode 100644 index 0000000..154f42a --- /dev/null +++ b/js/userscripts/gmaps.user.js @@ -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); +}