Steam: Automatically check Subscriber Agreement checkboxes

Automatically checks Steam Subscriber Agreement checkboxes

当前为 2022-07-10 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Steam: Automatically check Subscriber Agreement checkboxes
  3. // @namespace zo8dd7kkrrnquyxs5yd2
  4. // @match https://store.steampowered.com/account/registerkey*
  5. // @match https://store.steampowered.com/checkout/*
  6. // @match https://steamcommunity.com/*
  7. // @grant none
  8. // @version 1.4
  9. // @description Automatically checks Steam Subscriber Agreement checkboxes
  10. // @inject-into content
  11. // @run-at document-end
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. "use strict";
  17.  
  18. const keepChecked = function (event) {
  19. if (!this.checked) {
  20. event.preventDefault();
  21. }
  22. };
  23.  
  24. const chocolates = ["accept_ssa", "market_sell_dialog_accept_ssa", "market_buyorder_dialog_accept_ssa", "market_buynow_dialog_accept_ssa", "market_multi_accept_ssa"].map(document.getElementById.bind(document));
  25.  
  26. for (const box of chocolates) {
  27. if (box?.type === "checkbox") {
  28. box.checked = true;
  29. box.defaultChecked = true;
  30. box.addEventListener("click", keepChecked);
  31. }
  32. }
  33. })();