Skip to content

Instantly share code, notes, and snippets.

@corsonr
Last active March 29, 2019 07:58
Show Gist options
  • Save corsonr/5cedaf808e4e79b48c07c2228e8989ed to your computer and use it in GitHub Desktop.
Save corsonr/5cedaf808e4e79b48c07c2228e8989ed to your computer and use it in GitHub Desktop.
A8C - Once key field auto-filler
// ==UserScript==
// @name A8C - Once key field auto-filler
// @namespace http://automattic.com/
// @version 0.1
// @description Pre-fill Once fields
// @author Remi Corson
// @match https://<place_mc_url_here>/once/*
// @require http://code.jquery.com/jquery-latest.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
var key = getUrlParameter('key');
$("input[name='key']").val(key);
})();
@Luminus
Copy link

Luminus commented Jul 24, 2018

@corsonr I'd like to propose small addition. If we pop this on line 32, this can be a mouseless operation

$( 'input[type="submit"]' ).focus();

The Show Message button gets focus and you can just hit Enter on the keyboard.

I tried to go one step further and .click(); the button but that was causing all sorts of weirdness so I left it off.

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