8 changed files with 47 additions and 52 deletions
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -0,0 +1,26 @@
@@ -0,0 +1,26 @@
|
||||
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'}); |
||||
} |
||||
@ -1,42 +0,0 @@
@@ -1,42 +0,0 @@
|
||||
ZeroClipboard.setDefaults( { moviePath: '/js/ZeroClipboard.swf' } ); |
||||
|
||||
$(document).ready(function() { |
||||
if (ZeroClipboard.detectFlashSupport()) { |
||||
createCodeCopyButtons(); |
||||
createCopyButton($('button.copy-button.github')); |
||||
} |
||||
|
||||
$('.github-actions button').click(function() { |
||||
$('.github-actions button').removeClass('active'); |
||||
$(this).addClass('active'); |
||||
|
||||
$('.clone-url').hide(); |
||||
$('.clone-url.' + $(this).data('protocol')).show(); |
||||
}); |
||||
|
||||
if (typeof(sts_import) === 'function') { |
||||
$(".gs-guide-import").show().click(function (e) { |
||||
var linkElement = e.target; |
||||
var url = linkElement.href; |
||||
sts_import("guide", url); |
||||
e.preventDefault(); |
||||
}); |
||||
} |
||||
|
||||
}); |
||||
|
||||
function createCodeCopyButtons() { |
||||
$('article .highlight pre').each(function(index) { |
||||
var codeBlockId = "code-block-"+ index; |
||||
$(this).attr('id', codeBlockId); |
||||
var button = $('<button class="copy-button snippet" id="copy-button-"' + index + ' data-clipboard-target="' + codeBlockId + '"></button>'); |
||||
$(this).before(button); |
||||
createCopyButton(button); |
||||
} |
||||
); |
||||
} |
||||
|
||||
function createCopyButton($el){ |
||||
var zero = new ZeroClipboard($el); |
||||
$(zero.htmlBridge).tooltip({title: "copy to clipboard", placement: 'bottom'}); |
||||
} |
||||
Loading…
Reference in new issue