Last active
December 6, 2023 19:01
-
-
Save RayBB/3cc8d1609b83235ecea97477b447aa44 to your computer and use it in GitHub Desktop.
Small website fixes
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 ! Small Website Fixes | |
// @namespace Small Fixes | |
// @match *://*/* | |
// @grant none | |
// @version 0.0.4 | |
// @author RayBB | |
// @updateURL https://gist.github.com/RayBB/3cc8d1609b83235ecea97477b447aa44/raw/e09ca5366af0d4369d79bdcd450fcde937ecce8a/smallfixes.user.js | |
// @downloadURL https://gist.github.com/RayBB/3cc8d1609b83235ecea97477b447aa44/raw/e09ca5366af0d4369d79bdcd450fcde937ecce8a/smallfixes.user.js | |
// @description Autofills passwords on some sites once they've been entered once. | |
// ==/UserScript== | |
/* | |
* This script mainly autofills passwords once they've already been filled once. | |
* Very handy on FF Android where BitWarden is funky | |
*/ | |
const configs = [ | |
{ | |
url: "https://weblogin.univie.ac.at/idp/profile/SAML2/Redirect/SSO", | |
selectors: ["#userid", "#password"], | |
callback: ()=>{document.querySelector(".loginform button").click();} | |
}, | |
{ | |
url: "https://login.uva.nl/adfs/ls", | |
selectors: ["#userNameInput", "#passwordInput"], | |
callback: ()=>{setTimeout(document.querySelector("#submitButton").click(), 1000)} | |
}, | |
{ | |
url: "https://secure.nelnet.com/account/login", | |
selectors: [], | |
callback: ()=>setTimeout(()=>{document.querySelector("#user-name-button").click();}, 2000) | |
}, | |
{ | |
url: "https://www.gixen.com/main/home_2.php", | |
selectors: [], | |
callback: ()=>{ | |
setTimeout(()=>{document.querySelector("#gbutton").disabled = false}, 1000) | |
setTimeout(()=>{document.querySelector("#gbutton").click() = false}, 1100) | |
} | |
} | |
] | |
for (const config of configs){ | |
if (window.location.href.startsWith(config.url)){ | |
console.log("running on", config.url) | |
config.selectors.forEach(autoFillInput); | |
config.callback() | |
} | |
} | |
function autoFillInput(selector){ | |
console.log("filling", selector) | |
const elementInDom = document.querySelector(selector); | |
const storedValue = localStorage.getItem(selector); | |
if (storedValue) { elementInDom.value = storedValue; } | |
elementInDom.addEventListener('input', ()=>{saveInputToLocalStorage(selector)}); | |
} | |
function saveInputToLocalStorage(selector){ | |
const input = document.querySelector(selector); | |
localStorage.setItem(selector, input.value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment