Created
September 26, 2013 02:19
-
-
Save sizzlemctwizzle/6708974 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Remember SignOn | |
| // @namespace sizzlemctwizzle | |
| // @description Sign on once and forever | |
| // @include https://sso.queensu.ca/amserver/UI/Login | |
| // @grant none | |
| // @version 1 | |
| // ==/UserScript== | |
| // Uncomment this if you fuck up. | |
| // Reload the page and then comment it out again. | |
| // Then reload the page again and sign in. | |
| //localStorage.removeItem('signon'); | |
| HTMLFormElement.prototype.oldSubmit = HTMLFormElement.prototype.submit; | |
| HTMLFormElement.prototype.submit = function() { | |
| var inputs = this.getElementsByTagName('input'); | |
| var vals = {'formName': this.name}; | |
| for (var i = 0, len = inputs.length; i < len; ++i) { | |
| vals[inputs[i].name] = inputs[i].value; | |
| } | |
| localStorage.setItem('signon', JSON.stringify(vals)); | |
| this.oldSubmit(); | |
| }; | |
| var str = localStorage.getItem('signon'); | |
| if (str) { | |
| var vals = JSON.parse(str); | |
| var formName = vals['formName']; | |
| var form = document.forms[formName]; | |
| for (var i in vals) { | |
| if (i == 'formName') continue; | |
| form[i].value = vals[i]; | |
| } | |
| form.oldSubmit(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment