您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Redirect to Steam Register Key page when copying key
- // ==UserScript==
- // @name Redeem Steam Key
- // @namespace https://savagecore.eu
- // @version 0.1.0
- // @description Redirect to Steam Register Key page when copying key
- // @author SavageCore
- // @include *
- // @grant GM_openInTab
- // ==/UserScript==
- //
- /* global document window GM_openInTab */
- (function () {
- 'use strict';
- // Automatically accept Steam Subscriber Agreement
- if (window.location.href.match(/^https?:\/\/store.steampowered.com\/account\/registerkey/)) {
- const ssaElem = document.getElementById('accept_ssa');
- if (ssaElem) {
- ssaElem.checked = 'checked';
- }
- } else {
- const activateProduct = function (e) {
- const productKey = window.getSelection().toString().trim() || e.target.value;
- let m;
- if ((m = /^[\d\w]{2,5}(-[\d\w]{4,5}){2,4}$/.exec(productKey)) !== null) {
- // GM_openInTab so that the 'popup' is not blocked by browser
- GM_openInTab('https://store.steampowered.com/account/registerkey?key=' + m[0]); // eslint-disable-line new-cap
- }
- };
- window.addEventListener('copy', activateProduct, false);
- }
- })();