Skip to content

Instantly share code, notes, and snippets.

@Haoose
Forked from pedrofracassi/quicksteamactivator.user.js
Last active November 28, 2023 17:58
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Haoose/c081fa5dd95c4d2139f3e3bb310598cb to your computer and use it in GitHub Desktop.
Save Haoose/c081fa5dd95c4d2139f3e3bb310598cb to your computer and use it in GitHub Desktop.
Steam Key Quick Activator
// ==UserScript==
// @name Steam Key Quick Activator
// @namespace http://pedrofracassi.me/
// @version 1.2
// @description Activates Steam Keys Quickly!
// @author Pedro Fracassi (http://pedrofracassi.me)
// @match https://store.steampowered.com/account/registerkey?key=*
// @grant none
// @run-at document-end
// ==/UserScript==
'use strict';
var key = document.getElementById('product_key').value;
if (key != '') {
// Check for Key
var flag = true;
var array = key.split("-");
if (array.length === 3 || array.length === 5){
array.forEach(y => {
if (y.length !== 5) flag = false;
});
}
else flag = false;
if (flag === true) {
document.getElementById('accept_ssa').click();
document.getElementById('register_btn').click();
}
}
javascript:
var selection = window.getSelection().toString();
if (selection) {
location.href = 'https://store.steampowered.com/account/registerkey?key=' + selection;
} else {
result = prompt('Insert Steam Key');
if(result != null){
location.href = 'https://store.steampowered.com/account/registerkey?key=' + result;
} else {
location.href = 'https://store.steampowered.com/account/registerkey';
}
}
@Haoose
Copy link
Author

Haoose commented Sep 2, 2017

How do I install this?
Install tampermonkey, and then click this link

If you want to be even faster, add this code to your bookmarks and click it whenever you need to activate a key.
It will open steam's activation page with your selected text as a key. If you don't have anything selected, it will ask you for a key.

AAAAA-BBBBB-CCCCC

@DaniDipp
Copy link

DaniDipp commented Sep 3, 2017

It took way too long, but I managed to work out the regex for the steam key formats:

key.match(/((((?![osuOSU])[a-zA-z1-9]){5}-){2}){1,2}((?![osuOSU])[a-zA-z1-9]){5}$|((?![osuOSU])[a-zA-z1-9]){15}$/g);

It matches to
AAAAA-BBBBB-CCCCC
AAAAA-BBBBB-CCCCC-DDDDD-EEEEE
237ABCDGHJLPRST
With case-insensitive alphabet and digits but without O, S, U, and 0, probably because they look too similar to other characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment