Skip to content

Instantly share code, notes, and snippets.

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 Neil-Smithline/2794329 to your computer and use it in GitHub Desktop.
Save Neil-Smithline/2794329 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name gist: replace title with filename
// @namespace http://d.hatena.ne.jp/youpy/
// @include http://gist.github.com/*
// @include https://gist.github.com/*
// @exclude http://gist.github.com/gists
// @exclude https://gist.github.com/gists
// @require https://gist.github.com/3242.txt
// ==/UserScript==
(function() {
var username = $X('id("owner")//a')[0].textContent;
var filenames = $X('(//a|//span)[parent::div[@class="info"]]').map(
function(span) {
return span.textContent.replace(/ #$/,'');
}
);
if(filenames.length) {
document.title = document.title.
replace(/^(gist: \d+)/,
'$1 (' + filenames.join(', ') + ') by ' + username);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment