Skip to content

Instantly share code, notes, and snippets.

@mikeatlas
Created September 5, 2023 20:05
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/8ca3451215b3bdf1fd65e7775c8dd96e to your computer and use it in GitHub Desktop.
Save mikeatlas/8ca3451215b3bdf1fd65e7775c8dd96e to your computer and use it in GitHub Desktop.
Tampermonkey userscript: AWS SSO - Close '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