Skip to content

Instantly share code, notes, and snippets.

@AaronJWhite
Created February 3, 2015 04:51
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 AaronJWhite/e17e1fac0eef5f1aaba7 to your computer and use it in GitHub Desktop.
Save AaronJWhite/e17e1fac0eef5f1aaba7 to your computer and use it in GitHub Desktop.
URL-In-Title IE crossrider code
// This script is licensed under the MIT license. See
// http://opensource.org/licenses/mit-license.php for more details.
// ==UserScript==
// @name URL-in-Title
// @namespace http://www.aaronjwhite.org
// @description Adds page's URL to title bar. Works great with KeePass.
// @include *
appAPI.ready(function($) {
titleMod= (function(){
var local = {};
local.start = function(){
addUrlToTitle();
};
function addUrlToTitle()
{
var domainOnly= window.location.href.replace('http://', '').replace('https://', '').split('/').shift();
if(document.title.length > 20)
{
document.title = document.title.substr(0,19) + ' - ' + domainOnly;
}
else
{
document.title = document.title + ' - ' + domainOnly;
}
}
return local;
}());
titleMod.start();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment