Last active
May 7, 2018 23:30
-
-
Save nandub/19c5bf9f84a02595a9ae235602beea7c to your computer and use it in GitHub Desktop.
greasemonkey script - form input filler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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