Item 'Feed to Pet' Hider

Hides the options for feeding an item to a pet. Can toggle back on if want to feed something to a pet.

当前为 2023-10-26 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Item 'Feed to Pet' Hider
// @namespace    http://tampermonkey.net/
// @version      1
// @description  Hides the options for feeding an item to a pet. Can toggle back on if want to feed something to a pet.
// @author       Cherri & Twiggies
// @match        *://www.grundos.cafe/itemview/*
// @icon         https://i.imgur.com/DWN7LkC.png
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    //get the item action select element
    const itemselect = document.getElementById('itemaction_select');
    //Add the toggle for showing/hiding
    itemselect.parentElement.insertAdjacentHTML('beforebegin','<label for="feedtoggle"><input type="checkbox" id="feedtoggle" style="width:auto" checked />Hide Feed Options</label>')

    //Hide the options in the selection that is a feed action. (where value starts with 'feed|')
    function hidefeed() {
        for (let i = itemselect.length-1; i >= 0; i--) {
            if (itemselect[i].value.startsWith('feed|')) {
                itemselect[i].style.display = "none";
            }
        }
    };

    //Shows everything that was hidden.
    function showfeed() {
        for (let i = 0; i < itemselect.length; i++) {
            if (itemselect[i].style.display === "none") {
                itemselect[i].style.display = "";
            }
        }
    };

    //Automatically hide the feed options when loading in.
    hidefeed();

    document.getElementById('feedtoggle').addEventListener("click", function (e) {
        if (this.checked) {
            hidefeed();
        } else {
            showfeed();
        }
      });
})();