Skip to content

Instantly share code, notes, and snippets.

@lusentis
Created January 7, 2021 12:30
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 lusentis/b57ff82d3721041381a9fb53f8817c62 to your computer and use it in GitHub Desktop.
Save lusentis/b57ff82d3721041381a9fb53f8817c62 to your computer and use it in GitHub Desktop.
AWS Account ID in browser's tab title
// ==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