mirror of
https://github.com/github/choosealicense.com
synced 2024-11-05 03:08:51 +01:00
3c14329ea7
- Replace IDs with classes - Overall specificity reduction - Use .js- prefix for JS hooks
20 lines
582 B
JavaScript
20 lines
582 B
JavaScript
$(document).ready(function() {
|
|
|
|
// Backup the clipboard button's original text.
|
|
$(".js-clipboard-button").data('clipboard-prompt', $('.js-clipboard-button').text());
|
|
|
|
// Hook up copy to clipboard buttons
|
|
var clip = new ZeroClipboard($(".js-clipboard-button"), {
|
|
moviePath: "../../javascripts/ZeroClipboard.swf"
|
|
});
|
|
|
|
clip.on('mouseover', function(client, args) {
|
|
// Restore the clipboard button's original text.
|
|
this.innerText = $(this).data('clipboard-prompt');
|
|
});
|
|
|
|
clip.on('complete', function(client, args) {
|
|
this.innerText = 'Copied!';
|
|
});
|
|
|
|
}); |