Forked from youpy/gist_replace_title_with_filename.user.js
Created
October 14, 2009 01:32
-
-
Save taizooo/209715 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==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/raw/3242/1a7950e033a207efcfc233ae8d9939b676bdbf46 | |
| // ==/UserScript== | |
| (function() { | |
| var username = $X('id("owner")//a')[0].textContent; | |
| var filenames = $X('//*[name()="A" or name()="SPAN"][name(..)="DIV"][../@class="info"]').map( | |
| function(span) { | |
| return span.textContent; | |
| } | |
| ); | |
| 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