Skip to content

Instantly share code, notes, and snippets.

@WillBrubaker
Forked from corsonr/oncefiller.user.js
Last active June 27, 2018 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WillBrubaker/0d065b10f149822ed1ec8c6eef0fc644 to your computer and use it in GitHub Desktop.
Save WillBrubaker/0d065b10f149822ed1ec8c6eef0fc644 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://mc.a8c.com/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];
}
}
};
$(document).ready(function() {
var key = getUrlParameter('key');
if (key.length > 0) {
$("input[name='key']").val(key);
$('#once-get form').submit();
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment