GC - Quickstock Keeper

Set ignore lists to keep specific items in the inventory

  1. // ==UserScript==
  2. // @name GC - Quickstock Keeper
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Set ignore lists to keep specific items in the inventory
  6. // @author jess (wibreth)
  7. // @match https://www.grundos.cafe/quickstock*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=grundos.cafe
  9. // @grant GM_getValue
  10. // @grant GM_setValue
  11. // @grant GM_registerMenuCommand
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. /* globals $ */
  17.  
  18. $(document).ready(() => {
  19.  
  20. function ignoreItems(ignore) {
  21. $('input[disabled]').prop('disabled', false);
  22. $('.data.justify-right.align-right span').each(function() {
  23. if (ignore.indexOf($(this).text()) >= 0) {
  24. const id = $(this).data('itemid');
  25. $(`input[name="${id}"]`).prop('disabled', true);
  26. }
  27. });
  28.  
  29. }
  30.  
  31. let ignore = GM_getValue('ignore', []).join(',');
  32.  
  33. GM_registerMenuCommand('Set Ignore List', function() {
  34. let value = prompt('Enter a comma separated list of which items to ignore', GM_getValue('ignore', []).join(','));
  35. if (value) {
  36. ignore = [];
  37. for (const item of value.split(','))
  38. ignore.push(item.trim());
  39. GM_setValue('ignore', ignore);
  40. ignoreItems(ignore);
  41. }
  42. }, 'i');
  43.  
  44. ignoreItems(ignore);
  45. $('.action input').change(() => {
  46. $('input[disabled]').prop('checked', false);
  47. });
  48. });
  49. })();