Skip to content

Instantly share code, notes, and snippets.

@himedlooff
Last active October 21, 2015 22:14
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 himedlooff/3fa7653f2ab9e6921adb to your computer and use it in GitHub Desktop.
Save himedlooff/3fa7653f2ab9e6921adb to your computer and use it in GitHub Desktop.
Paste this into your console to enable click-to-copy on GitHub.com file paths
(function(){
$('.file-info[title], .file-info [title]')
.css('cursor', 'pointer')
.click(function() {
var range = document.createRange();
$(this).html($(this).attr('title'));
range.selectNode(this);
window.getSelection().addRange(range);
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
console.log('Copying', range.toString(), 'was', msg);
} catch(err) {
console.log('Oops, unable to copy');
}
window.getSelection().removeAllRanges();
});
})();
@himedlooff
Copy link
Author

You can sue http://mrcoles.com/bookmarklet/ to generate a bookmarklet as well

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