Created
January 7, 2021 12:30
-
-
Save lusentis/b57ff82d3721041381a9fb53f8817c62 to your computer and use it in GitHub Desktop.
AWS Account ID in browser's tab title
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 Account ID in Tab Title | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://*.console.aws.amazon.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Your code here... | |
setInterval(() => { | |
const el = document.querySelector('[data-testid="aws-my-account-details"]'); | |
if (el == null) { return; } | |
const accountId = el.innerText; | |
const accountIdSubstr = accountId.substr(-4); | |
if (document.title.startsWith('[')) { | |
document.title = document.title.substr(8); | |
} | |
document.title = '[*' + accountIdSubstr + '] ' + document.title; | |
}, 5000) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment