Created
September 30, 2021 09:17
-
-
Save BananaAcid/bdf2aa3fb224580af74dd68193bdb4a8 to your computer and use it in GitHub Desktop.
Remember User name, and fix spacings in inserted one-time-passwords (copied from Authy)
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 schule.hessen.de - Nabil | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @description Remember User name, and fix spacings in inserted one-time-passwords (copied from Authy) | |
// @author NR 2021 | |
// @match https://owa.hessen.de/logon/LogonPoint/tmindex.html | |
// @icon https://www.google.com/s2/favicons?domain=hessen.de | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// prefill username, if stored | |
let i = setInterval(function() { | |
let el = document.querySelector('#login'); | |
if (el) { | |
el.value = localStorage.user || ''; | |
clearInterval(i); | |
}; | |
}, 300); | |
// update username | |
let saveUser = function(ev) { | |
if (ev.target.id == 'login') { | |
console.log('user changed:', ev.target.value); | |
localStorage.user = ev.target.value; | |
} | |
} | |
document.addEventListener('keyup', saveUser); | |
document.addEventListener('change', saveUser); | |
// remove spaces from inserted one-time-passwords | |
let fixAuthy = function(ev) { | |
console.log(ev); | |
if (ev.target.id === 'passwd') { | |
ev.stopPropagation(); | |
console.log('passwd', ev.target, ev.target.value); | |
ev.target.value = ev.target.value.replaceAll(' ', ''); | |
} | |
}; | |
document.addEventListener('keyup', fixAuthy); | |
document.addEventListener('change', fixAuthy); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment