您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
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()
- }