Greasy Fork 还支持 简体中文。

[GC] Overfeed Preventer

Track pet bloat status and modify and notify if your pet is already bloated to prevent over-feeding

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         [GC] Overfeed Preventer
// @namespace    http://tampermonkey.net/
// @version      1.2
// @license      MIT
// @description  Track pet bloat status and modify and notify if your pet is already bloated to prevent over-feeding
// @author       Heda
// @match        https://www.grundos.cafe/itemview/*
// @match        https://www.grundos.cafe/useobject/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let q = s => document.querySelector(s),
        itemName = [...document.querySelectorAll("div.flex-column.justify-center span")]
            ?.find(e => e.textContent.includes("Item"))?.textContent.replace("Item :", "").trim();

    if (window.location.href.includes("itemview")) {
        if (itemName) localStorage.setItem("currentItem", itemName);
        if (localStorage.getItem("bloated") === "true" && itemName !== "Bloatershroom") {
            q("input#submit")?.remove();
            let itemActionSelect = q("select#itemaction_select");
            let parentContainer = itemActionSelect?.parentElement;
            if (parentContainer) {
                let alertDiv = document.createElement("div");
                alertDiv.style = "background:red;color:white;font-weight:bold;padding:10px;text-align:center;cursor:pointer;margin-top:10px;border-radius:5px;width:100%;max-width:400px;margin:auto;";
                alertDiv.innerHTML = "PET IS BLOATED <br> CLICK TO RESET";
                alertDiv.onclick = () => {
                    localStorage.setItem("bloated", "false");
                    let btn = document.createElement("input");
                    btn.type = "submit";
                    btn.id = "submit";
                    btn.value = "Submit";
                    btn.className = "form-control flex-grow";
                    parentContainer.insertAdjacentElement('afterend', btn);
                    alertDiv.remove();
                };
                parentContainer.insertAdjacentElement('afterend', alertDiv);
            }
        }
    } else if (window.location.href.includes("useobject")) {
        let t = document.body.textContent;
        localStorage.setItem("bloated", t.includes("and now is bloated") ? "true" : t.includes("now is very full") ? "false" : localStorage.getItem("bloated"));
    }
})();