Automatically checks Steam Subscriber Agreement checkboxes
目前為
// ==UserScript==
// @name Steam: Automatically check Subscriber Agreement checkboxes
// @namespace zo8dd7kkrrnquyxs5yd2
// @match https://store.steampowered.com/account/registerkey*
// @match https://steamcommunity.com/*
// @grant none
// @version 1.0
// @description Automatically checks Steam Subscriber Agreement checkboxes
// @inject-into content
// @run-at document-end
// @license MIT
// ==/UserScript==
(function () {
"use strict";
function run(unwrap = (x)=>x, exporter = (f)=>f) {
const realCheckboxGetter = Reflect.getOwnPropertyDescriptor(unwrap(window.HTMLInputElement.prototype), "checked").get;
const blockEvent = (event) => { event.preventDefault(); };
const nop = exporter(() => {});
const chocolates = ["accept_ssa", "market_sell_dialog_accept_ssa", "market_buyorder_dialog_accept_ssa"];
for (let box of chocolates) {
box = document.getElementById(box);
if (box?.type === "checkbox") {
box.checked = true;
box.addEventListener("click", blockEvent);
Reflect.defineProperty(unwrap(box), "checked", {
enumerable: false,
get: realCheckboxGetter,
set: nop
});
}
}
}
if (typeof globalThis.XPCNativeWrapper === "function") {
// Firefox sandbox
run(XPCNativeWrapper.unwrap, (f) => exportFunction(f, window));
} else {
// Chrome, just inject
const script = document.createElement("script");
script.text = `"use strict";(${run})();`;
(document.head ?? document.documentElement).prepend(script);
script.remove();
}
})();