Last active
February 20, 2023 21:05
-
-
Save pjstadig/6361fda0885ded9182740a2d0885710a to your computer and use it in GitHub Desktop.
Focus MFA: if a page has a single text or password field (usually an MFA page), then focus on it
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 Focus MFA | |
// @namespace http://paul.stadig.name/ | |
// @version 0.5 | |
// @description if a page has a single text or password field (usually an MFA page), then focus on it | |
// @author Paul Stadig | |
// @match *://*/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
if (document.querySelectorAll('input').length <= 2) { | |
if (document.querySelectorAll('input[type="text"]').length == 1) { | |
document.querySelectorAll('input[type="text"]')[0].focus(); | |
} else if (document.querySelectorAll('input[type="tel"]').length == 1) { | |
document.querySelectorAll('input[type="tel"]')[0].focus(); | |
} else if (document.querySelectorAll('input[type="password"]').length == 1) { | |
document.querySelectorAll('input[type="password"]')[0].focus(); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment