custommamonts for lolz

Custom mamonts falling from sky!

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         custommamonts for lolz
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Custom mamonts falling from sky!
// @author       k3kzia
// @license      MIT
// @match        https://lolz.live/*
// @grant        GM_xmlhttpRequest
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_registerMenuCommand
// @connect      raw.githubusercontent.com
// @connect      githubraw.com
// ==/UserScript==

(function () {
  "use strict";

  console.log("Custommamonts init..");

  const defaultImageUrl =
    "https://raw.githubusercontent.com/quickyyy/lolzmamonti/refs/heads/main/ja438j6d0-javascript-logo-javascript-logo-vector-eps-136-86-kb-download.webp";

  let customImageUrl = GM_getValue("customImageUrl", defaultImageUrl);

  console.log("Ссылка на картинку:", customImageUrl);

  GM_registerMenuCommand("Поставить кастомную картинку", setCustomImageUrl);

  function setCustomImageUrl() {
    const userUrl = prompt("Введите ссылку на картинку:", customImageUrl);

    if (userUrl && userUrl.trim() !== "") {
      GM_setValue("customImageUrl", userUrl.trim());
      alert("Кастомная картинка обновлена.");

      location.reload();
    } else {
      alert("Неверная ссылка.");
    }
  }

  const githubScriptUrl =
    "https://githubraw.com/quickyyy/lolzmamonti/main/mamonts.js";

  GM_xmlhttpRequest({
    method: "GET",
    url: githubScriptUrl,
    onload: function (response) {
      if (response.status === 200) {
        console.log("Загрузил гитхаб скрипт.");

        let scriptContent = response.responseText.replace(
          /{{CUSTOM_IMAGE_URL}}/g,
          customImageUrl
        );

        console.log("Полученный скрипт:", scriptContent);

        const scriptElement = document.createElement("script");
        scriptElement.textContent = scriptContent;
        document.head.appendChild(scriptElement);
        console.log(
          "Загрузил скрипт с ссылкой:",
          customImageUrl
        );
      } else {
        console.error(
          "Ошибка загрузки скрипта с гитхаб. Статус:",
          response.status
        );
      }
    },
    onerror: function () {
      console.error("Ошибка загрузки скрипта с гитхаба.");
    },
  });
})();