Skip to content

Instantly share code, notes, and snippets.

@nandub
Last active May 7, 2018 23:30
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 nandub/19c5bf9f84a02595a9ae235602beea7c to your computer and use it in GitHub Desktop.
Save nandub/19c5bf9f84a02595a9ae235602beea7c to your computer and use it in GitHub Desktop.
greasemonkey script - form input filler
// ==UserScript==
// @name Form input filler
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// ==/UserScript==
//var $ = unsafeWindow.jQuery;
// From http://papermashup.com/read-url-get-variables-withjavascript/
// Added: decodeURI
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = decodeURI(value);
});
return vars;
}
var vars = getUrlVars();
for (name in vars) {
$("input[name=" + name + "]").val(vars[name]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment