Skip to content

Instantly share code, notes, and snippets.

@mikeatlas
Created May 2, 2023 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeatlas/35f9cd2c3df9f64e11ad64542163bfff to your computer and use it in GitHub Desktop.
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.
// ==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