Replaces the background of the geoguessr homepage with your own image
当前为
// ==UserScript==
// @name GeoGuessr Background Replacer
// @description Replaces the background of the geoguessr homepage with your own image
// @version 1.1
// @author Tyow#3742
// @match *://*.geoguessr.com/
// @license MIT
// @run-at document-start
// @namespace https://greasyfork.org/users/1011193
// ==/UserScript==
//Add image links in this list
const imgList = ["https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fcdn.wallpapersafari.com%2F6%2F80%2F9ZbpYo.jpg&f=1&nofb=1&ipt=ddb30ffb037e46ee933b0e3a566175f927faf57e5162b27bb15a5d71cf6e888d&ipo=images",
"https://sites.breakingmedia.com/uploads/sites/3/2022/11/iStock-1333071678-e1669760260420.jpg",
"https://natureconservancy-h.assetsadobe.com/is/image/content/dam/tnc/nature/en/photos/Zugpsitze_mountain.jpg?crop=0%2C214%2C3008%2C1579&wid=1200&hei=630&scl=2.506666666666667"];
/* ############################################################################### */
/* ##### DON'T MODIFY ANYTHING BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING ##### */
/* ############################################################################### */
let imgURL = imgList[Math.floor((Math.random()*imgList.length))];
let done = false;
let observing = false;
let c = 0;
let mutated = false;
let m = new MutationObserver(async (mutations) => {
updateImage();
console.log(mutations);
mutated = true;
});
const updateImage = () => {
console.log("fire " + c++);
const imgEl = document.querySelector('.signed-in-start-page_backgroundImage__IR0w5');
if (!imgEl) return;
imgEl.src = imgURL;
done = true;
if (!observing) {
observing = true;
m.observe(imgEl, { attributes: true });
}
if (mutated) {
m.disconnect();
}
}
updateImage()
while (!done) {
updateImage()
}