AWS Console - Show AWS Account Name

Shows AWS account name in upper right of menu bar for a quick view of current context.

// ==UserScript==
// @name         AWS Console - Show AWS Account Name
// @match        https://*.console.aws.amazon.com/*
// @grant        none
// @version      1.1
// @description  Shows AWS account name in upper right of menu bar for a quick view of current context.
// @author       Bernd VanSkiver
// @namespace    https://greasyfork.dpdns.org/users/1009418
// ==/UserScript==

(function() {
    'use strict';

    // Function to check and update the account name
    function updateAccountName() {
        let accountrolespan = document.querySelector("#awsc-navigation__more-menu--list li:last-child div button span span:first-child");

        // Check if the element exists and if its title starts with "AWSReservedSSO"
        if (accountrolespan && accountrolespan.getAttribute("title").startsWith("AWSReservedSSO")) {
            accountrolespan.innerHTML += " @ " + accountrolespan.getAttribute("title").split(" @ ")[1];
            clearInterval(intervalId); // Stop checking once the update is applied
        }
    }

    // Set an interval to check for the element every second
    let intervalId = setInterval(updateAccountName, 1000);
})();
长期地址
遇到问题?请前往 GitHub 提 Issues,或加Q群1031348184

赞助商

Fishcpy

广告

Rainyun

注册一下就行

Rainyun

一年攒够 12 元