* details, see http://creativecommons.org/licenses/by/3.0/.
*/
+/* global ZeroClipboard */
!function ($) {
'use strict';
})
// Insert copy to clipboard button before .highlight or .bs-example
- $('.highlight').each(function() {
+ $('.highlight').each(function () {
var highlight = $(this)
var previous = highlight.prev()
var btnHtml = '<div class="zero-clipboard"><span class="btn-clipboard">Copy</span></div>'
var htmlBridge = $('#global-zeroclipboard-html-bridge')
// Handlers for ZeroClipboard
- zeroClipboard.on('load', function(client) {
+ zeroClipboard.on('load', function () {
htmlBridge
.data('placement', 'top')
.attr('title', 'Copy to clipboard')
})
// Copy to clipboard
- zeroClipboard.on('dataRequested', function(client) {
+ zeroClipboard.on('dataRequested', function (client) {
var highlight = $(this).parent().nextAll('.highlight').first()
client.setText(highlight.text())
})
// Notify copy success and reset tooltip title
- zeroClipboard.on('complete', function(client) {
+ zeroClipboard.on('complete', function () {
htmlBridge
.attr('title', 'Copied!')
.tooltip('fixTitle')
})
// Notify copy failure
- zeroClipboard.on('noflash wrongflash', function(client) {
+ zeroClipboard.on('noflash wrongflash', function () {
htmlBridge
.attr('title', 'Flash required')
.tooltip('fixTitle')