// ==UserScript== // @name The Redeemer // @namespace raina // @description Pops up the Steam product activation dialog when copying steam keys. Obviously requires that Steam is installed but also that it's allowed as the handler of steam:// protocol messages. // @include * // @version 1.3 // @grant none // ==/UserScript== (function() { "use strict"; var activateProduct = function(e) { if ("copy" === e.type || ("KeyC" === e.code && (e.ctrlKey || e.metaKey))) { var key = window.getSelection().toString().trim(); var split = key.split('-'); if (split.length == 3) { if (split[0].length == 5 && split[1].length == 5 && split[2].length == 5) window.location.href = "steam://open/activateproduct"; } } }; window.addEventListener("copy", activateProduct, false); window.addEventListener("keypress", activateProduct, false); }());