Last active
July 2, 2024 11:52
-
-
Save ideadapt/d293e31b80a68a7e00c7c9c8fcc6d50a to your computer and use it in GitHub Desktop.
AWS Management Console signed in account name label - Tampermonkey / Greasemonkey Userscript
This file contains 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 account name label in AWS Console | |
// @namespace userscripts | |
// @version 0.2 | |
// @description Adds AWS account name label to navigation bar in AWS Console | |
// @author [email protected] | |
// @match https://*.console.aws.amazon.com/* | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
window.setTimeout(() => { | |
const label = (unsafeWindow || window).ConsoleNavService.AccountInfo.loginDisplayNameAccount; | |
const o = document.createElement("div"); | |
const color = {dev:'green',int:'brown',prd:'red'}[label.split('-').pop()]; // adjust to your account name schema | |
o.innerHTML="<div style='position: absolute; top: 33px; right: 32px; background-color: "+color+"; color: white; z-index: 2000; font-family: sans-serif; padding: 5px;'>"+label+"</div>"; | |
const i = o.firstChild; | |
document.body.appendChild(i); | |
}, 5000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍