Skip to content

Instantly share code, notes, and snippets.

@Sheile
Last active June 22, 2017 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Sheile/5158166 to your computer and use it in GitHub Desktop.
Save Sheile/5158166 to your computer and use it in GitHub Desktop.
This greasemonkey script change a page title in the "AWS Management Console" automatically when access another page.
// ==UserScript==
// @name AWS title changer
// @description Change page title on AWS Management Console
// @namespace dev.sheile.net
// @include https://console.aws.amazon.com/*
// @version 1
// ==/UserScript==
(function() {
var SERVICE_NAMES = {
"ec2": "EC2",
"vpc": "VPC",
"iam": "IAM",
"cloudwatch": "CloudWatch",
};
setInterval(refreshTitle, 1000);
refreshTitle();
var previous = "";
function refreshTitle() {
if(previous == location.href) return;
previous = location.href;
var matches = location.href.match(/https:\/\/console\.aws\.amazon\.com\/([^/]+)\//);
if(matches.length < 2) return;
var keys = []
for(var key in SERVICE_NAMES) { keys.push(key); }
if(keys.indexOf(matches[1]) == -1) rerturn;
var service = SERVICE_NAMES[matches[1]];
var feature = location.hash.match(/[#&]s=([^&]*)/)[1];
document.getElementsByTagName("title")[0].textContent = service + " - " + feature;
}
})();
@RichardBronosky
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment