You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
882 B
26 lines
882 B
window.Spring = window.Spring || {}; |
|
|
|
ZeroClipboard.setDefaults( { moviePath: siteBaseUrl + '/js/ZeroClipboard.swf' } ); |
|
|
|
$(document).ready(function() { |
|
Spring.configureCopyButtons(); |
|
}); |
|
|
|
Spring.configureCopyButtons = function() { |
|
if (ZeroClipboard.detectFlashSupport()) { |
|
$(".highlight > pre").each(function(index) { |
|
Spring.buildCopyButton($(this), index); |
|
} |
|
); |
|
} |
|
} |
|
|
|
Spring.buildCopyButton = function (preEl, id) { |
|
var codeBlockId = "code-block-"+ id; |
|
var copyButtonId = "copy-button-" + id; |
|
preEl.attr('id', codeBlockId); |
|
var button = $('<button class="copy-button snippet" id="' + copyButtonId + '" data-clipboard-target="' + codeBlockId + '"></button>'); |
|
preEl.before(button); |
|
var zero = new ZeroClipboard(button); |
|
$(zero.htmlBridge).tooltip({title: "copy to clipboard", placement: 'bottom'}); |
|
}
|
|
|