GeoGuessr Background Replacer

Replaces the background of the geoguessr homepage with your own image

目前為 2023-05-17 提交的版本,檢視 最新版本

// ==UserScript==
// @name         GeoGuessr Background Replacer
// @description  Replaces the background of the geoguessr homepage with your own image
// @version      1.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://cdn.wallpapersafari.com/6/80/9ZbpYo.jpg",
                 "https://cdn.wallpapersafari.com/25/72/dtkc16.jpg",
                "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fwww.hdwallpapers.in%2Fdownload%2Fcolorful_texture_4k_hd_abstract-HD.jpg&f=1&nofb=1&ipt=e2c589746450fa0ac70e46511b9335bc3e2a377962dfc7cdfaa968d0215f9255&ipo=images"];

/* ############################################################################### */
/* ##### DON'T MODIFY ANYTHING BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING ##### */
/* ############################################################################### */

let imgURL = imgList[Math.floor((Math.random()*imgList.length))];
const updateImage = () => {
    const imgEl = document.querySelector('.signed-in-start-page_backgroundImage__IR0w5');
    if (!imgEl) return;
    imgEl.src = imgURL;
}

new MutationObserver(async (mutations) => {
    const imgEl = document.querySelector('.signed-in-start-page_backgroundImage__IR0w5');
    if (!imgEl) return;
    if (imgEl.src != imgURL) {
        imgEl.src = imgURL;
    }
}).observe(document.body, { subtree: true, childList: true });