AWS-SSO-Console-User-Title-Fix

With AWS SSO the AWS Console Title is ridiculously long, this aims to shorten and list the account name

  1. // ==UserScript==
  2. // @name AWS-SSO-Console-User-Title-Fix
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description With AWS SSO the AWS Console Title is ridiculously long, this aims to shorten and list the account name
  6. // @author John Polansky
  7. // @icon https://www.google.com/s2/favicons?domain=userscript.zone
  8. // @include https://console.aws.amazon.*
  9. // @include https://*.console.aws.amazon.*
  10. // @run-at document-end
  11. // @inject-into content
  12. // @license MIT
  13. // @noframes
  14. // @grant window.close
  15. // @grant window.focus
  16. // ==/UserScript==
  17.  
  18. (function() {
  19. 'use strict';
  20. // console.log("======================================================")
  21. // The ClassName might change with updates, find the title in inspect and replace it here
  22. // let str = document.getElementsByClassName("ThRjn7o-KwO0459UzmvoU")[0].title
  23. let str = document.getElementsByClassName("_1Vtx1Z7gxtNZJP2MVzVCLO")[2].title
  24. // console.log(`Element: ${str})
  25. // AWSReservedSSO_AWSAdministratorAccess_ca3eaf088602997d/john.polansky@itential.com @ itential-cloudops
  26. let re = /\w+_(\w+)_(\w+)\/(.*)\s+@\s+(.+)/
  27. let results = re.exec(str)
  28. let role = results[1]
  29. let username = results[3].replace(/@.*$/, "")
  30. let account = results[4]
  31. // console.log(`Username: ${username} Account: ${account} Role: ${role}`)
  32. // console.log("======================================================")
  33. document.getElementsByClassName("_1Vtx1Z7gxtNZJP2MVzVCLO")[2].innerHTML = `${account} / ${role} / ${username}`
  34. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址