Last active
May 28, 2021 16:14
-
-
Save jordiclariana/37e412146913a2b8e836ee13f95961c0 to your computer and use it in GitHub Desktop.
Greeasemonkey/Tampermonkey script to change the logged in title to show simplify and show the account
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 Console menu SSO role and account setter | |
// @version 1.0 | |
// @include /^https?://(.+\.)?console.aws.amazon.com/.*$/ | |
// @run-at document-end | |
// @grant none | |
// @icon https://www.google.com/s2/favicons?domain=amazon.com | |
// ==/UserScript== | |
const regex = /AWSReservedSSO_([^_]+)_[^/]+\/([^ ]+).*@ (.*)/; | |
var title = document.getElementById("nav-usernameMenu").childNodes[0].childNodes[1].title; | |
var matches = title.match(regex); | |
var accountNumber = document.querySelectorAll(`[data-testid*="aws-my-account-details"]`)[0].innerText; | |
document.getElementById("nav-usernameMenu").childNodes[0].childNodes[1].textContent = `SSO ${matches[1]}/${matches[2]} @ ${matches[3]} (${accountNumber})`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment