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