mirror of
https://github.com/quantum5/correcthorsebatterystaple.git
synced 2025-04-25 02:31:57 -04:00
19 lines
522 B
JavaScript
19 lines
522 B
JavaScript
const Clipboard = require('clipboard/dist/clipboard')
|
|
import $ from 'jquery/dist/jquery'
|
|
import 'popper.js'
|
|
import 'bootstrap/js/dist/tooltip'
|
|
|
|
$(() => {
|
|
function showTooltip ($element, message) {
|
|
$element.tooltip('dispose')
|
|
.attr('data-original-title', message)
|
|
.tooltip('show')
|
|
|
|
setTimeout(() => $element.tooltip('dispose'), 1000)
|
|
}
|
|
|
|
new Clipboard('.copy', {})
|
|
.on('success', e => showTooltip($(e.trigger), 'Copied!'))
|
|
.on('error', e => showTooltip($(e.trigger), 'Failed to copy!'))
|
|
})
|