Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Neil-Smithline/2794345 to your computer and use it in GitHub Desktop.
Save Neil-Smithline/2794345 to your computer and use it in GitHub Desktop.
Replace Titlename With Filename
// ==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://raw.github.com/gist/3242/
// ==/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);
}
})();
@Neil-Smithline
Copy link
Author

Corrects error in gist so that it works. Seems Github changed the URLs of raw gists so the @require failed. Seems to work now.

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