public

  • Download Gist
gist_replace_title_with_filename.user.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
// ==UserScript==
// @name gist: replace title with filename
// @namespace http://d.hatena.ne.jp/youpy/
// @include http://gist.github.com/*
// @exclude http://gist.github.com/gists
// @require http://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);
}
})();

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.