Created
May 2, 2023 19:04
-
-
Save mikeatlas/35f9cd2c3df9f64e11ad64542163bfff to your computer and use it in GitHub Desktop.
Tampermonkey script for the AWS SSO login page. Allows keyboard escape key to close the "Get Credentials" modal.
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 AWS SSO - Close 'Get Credentials' Modal | |
// @namespace awsapps.com | |
// @version 1.0 | |
// @description Allow escape key to close modal | |
// @author Mike Atlas | |
// @match https://*.awsapps.com/start* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=awsapps.com | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.onkeydown = function(evt) { | |
evt = evt || window.event; | |
var isEscape = false; | |
if ("key" in evt) { | |
isEscape = (evt.key === "Escape" || evt.key === "Esc"); | |
} else { | |
isEscape = (evt.keyCode === 27); | |
} | |
if (isEscape) { | |
Array.from(document.getElementsByClassName("close")).forEach(x => { | |
x.click(); | |
}); | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment