Steam: Automatically check Subscriber Agreement checkboxes

Automatically checks Steam Subscriber Agreement checkboxes

当前为 2023-06-29 提交的版本,查看 最新版本

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