GC - Quickstock Keeper

Set ignore lists to keep specific items in the inventory

当前为 2023-08-25 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         GC - Quickstock Keeper
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Set ignore lists to keep specific items in the inventory
// @author       jess (wibreth)
// @match        https://www.grundos.cafe/quickstock*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=grundos.cafe
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// ==/UserScript==

(function() {
    'use strict';
    /* globals $ */

    $(document).ready(() => {

        function ignoreItems(ignore) {
            $('input[disabled]').prop('disabled', false);
            $('.data.justify-right.align-right span').each(function() {
                if (ignore.indexOf($(this).text()) >= 0) {
                    const id = $(this).data('itemid');
                    $(`input[name="${id}"]`).prop('disabled', true);
                }
            });

        }

        let ignore = GM_getValue('ignore', []).join(',');

        GM_registerMenuCommand('Set Ignore List', function() {
            let value = prompt('Enter a comma separated list of which items to ignore', GM_getValue('ignore', []).join(','));
            if (value) {
                ignore = [];
                for (const item of value.split(','))
                    ignore.push(item.trim());
                GM_setValue('ignore', ignore);
                ignoreItems(ignore);
            }
        }, 'i');

        ignoreItems(ignore);
        $('.action input').change(() => {
            $('input[disabled]').prop('checked', false);
        });
    });
})();