Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Forked from Sheile/aws_title_changer.user.js
Last active June 22, 2017 19:44
Show Gist options
  • Save RichardBronosky/4def69bd2fb0c4e0d7b64c71b24ad688 to your computer and use it in GitHub Desktop.
Save RichardBronosky/4def69bd2fb0c4e0d7b64c71b24ad688 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name AWS title changer
// @description Change page title on AWS Management Console
// @namespace dev.sheile.net
// @include https://console.aws.amazon.com/*
// @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 < 3) return;
var keys = [];
for(var key in SERVICE_NAMES) { keys.push(key); }
if(keys.indexOf(matches[2]) == -1) return;
var service = SERVICE_NAMES[matches[2]];
var feature = location.hash.match(/[#&]([^:]*)/)[1];
document.getElementsByTagName("title")[0].textContent = service + " - " + feature;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment