Greasy Fork

Greasy Fork is available in English.

Welcome Image Changer (Kemono.su)

Changes the mascot image on kemono.su to a random one from a predefined list

当前为 2025-07-03 提交的版本,查看 最新版本

// ==UserScript==
// @name         Welcome Image Changer (Kemono.su)
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Changes the mascot image on kemono.su to a random one from a predefined list
// @author       Delzon
// @match        https://kemono.su/*
// @copyright    2025, Delzon (https://openuserjs.org/users/Delzon)
// @license      MIT
// @run-at       document-body
// ==/UserScript==

/*jshint esversion: 6 */
(function () {
  'use strict';

  // Array of random image URLs
  const randomImages = [
    "https://i.bandori.party/u/asset/hXOOXlReona-Nyubara-Key-Visual-e8PBWd.png",
    "https://i.bandori.party/u/asset/PlxWU93rd-Anniversary-Kasumi-Splash-2kcZ3c.png",
    // Add more images as needed, you can set only one if you want.
  ];

  // Function to change the image to a random one
  function changeImage() {
    const img = document.querySelector(".jumbo-welcome-mascot img");
    if (img) {
      img.src = "";
      const randomIndex = Math.floor(Math.random() * randomImages.length);
      img.src = randomImages[randomIndex];
      console.log("Image changed to: " + img.src);
    }
  }

  // Observe DOM changes (for SPAs)
  const observer = new MutationObserver(() => {
    changeImage();
  });

  // Start observing the body for changes
  observer.observe(document.body, {
    childList: true,
    subtree: true
  });

  // Also run on initial page load
  changeImage();

  // Listen for URL changes (hash/pushState)
  window.addEventListener('hashchange', changeImage);
  window.addEventListener('popstate', changeImage);
})();