mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
Revert "Update ZeroClipboard and remove Copy buttons when Flash is unavailable"
This reverts commit 229e888929
.
ZeroClipboard v2.x drops IE < 9 support.
This commit is contained in:
parent
16a44c208d
commit
438cae9d90
Binary file not shown.
@ -127,7 +127,7 @@
|
||||
|
||||
// Config ZeroClipboard
|
||||
ZeroClipboard.config({
|
||||
swfPath: '/assets/flash/ZeroClipboard.swf',
|
||||
moviePath: '/assets/flash/ZeroClipboard.swf',
|
||||
hoverClass: 'btn-clipboard-hover'
|
||||
})
|
||||
|
||||
@ -136,25 +136,25 @@
|
||||
var btnHtml = '<div class="zero-clipboard"><span class="btn-clipboard">Copy</span></div>'
|
||||
$(this).before(btnHtml)
|
||||
})
|
||||
|
||||
var zeroClipboard = new ZeroClipboard($('.btn-clipboard'))
|
||||
var htmlBridge = $('#global-zeroclipboard-html-bridge')
|
||||
|
||||
// Handlers for ZeroClipboard
|
||||
zeroClipboard.on('ready', function () {
|
||||
zeroClipboard.on('load', function () {
|
||||
htmlBridge
|
||||
.data('placement', 'top')
|
||||
.attr('title', 'Copy to clipboard')
|
||||
.tooltip()
|
||||
})
|
||||
|
||||
// Copy to clipboard
|
||||
zeroClipboard.on('copy', function (event) {
|
||||
var highlight = $(event.target).parent().nextAll('.highlight').first()
|
||||
event.clipboardData.setData('text/plain', highlight.text())
|
||||
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('aftercopy', function () {
|
||||
zeroClipboard.on('complete', function () {
|
||||
htmlBridge
|
||||
.attr('title', 'Copied!')
|
||||
.tooltip('fixTitle')
|
||||
@ -162,12 +162,13 @@
|
||||
.attr('title', 'Copy to clipboard')
|
||||
.tooltip('fixTitle')
|
||||
})
|
||||
})
|
||||
|
||||
// Hide copy button on error
|
||||
zeroClipboard.on('error', function () {
|
||||
$('.zero-clipboard').remove()
|
||||
ZeroClipboard.destroy()
|
||||
// Notify copy failure
|
||||
zeroClipboard.on('noflash wrongflash', function () {
|
||||
htmlBridge
|
||||
.attr('title', 'Flash required')
|
||||
.tooltip('fixTitle')
|
||||
.tooltip('show')
|
||||
})
|
||||
|
||||
})
|
||||
|
6
docs/assets/js/vendor/ZeroClipboard.min.js
vendored
6
docs/assets/js/vendor/ZeroClipboard.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user