GC - Quickstock Keeper

Set ignore lists to keep specific items in the inventory

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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);
        });
    });
})();