Commit 900195f8 authored by Chris Rebert's avatar Chris Rebert
Browse files

Merge pull request #16386 from twbs/zeroclipboard

Downgrade ZeroClipboard for IE8 support
parents 16a44c20 07e76a57
4 merge requests!28721Hot test,!16605Test pull please ignore,!22103test,!25326Adjust examples
Showing with 27 additions and 26 deletions
+27 -26
No preview for this file type
This diff is collapsed.
......@@ -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')
......@@ -164,8 +164,9 @@
})
})
// Hide copy button on error
zeroClipboard.on('error', function () {
// Hide copy button when no Flash is found
// or wrong Flash version is present
zeroClipboard.on('noflash wrongflash', function () {
$('.zero-clipboard').remove()
ZeroClipboard.destroy()
})
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment