Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@himedlooff himedlooff commented Oct 14, 2015

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
You can’t perform that action at this time.