mirror of
https://github.com/pretix/pretix.git
synced 2026-09-12 16:04:42 +00:00
* ESlint: Ignore vendored and pre-vue code * Format pre-vue code with eslint where possible --------- Co-authored-by: Kara Engelhardt <engelhardt@pretix.eu>
34 lines
666 B
JavaScript
34 lines
666 B
JavaScript
/* global gettext */
|
|
$(function () {
|
|
$('.btn-clipboard').tooltip({
|
|
trigger: 'click',
|
|
placement: 'bottom'
|
|
})
|
|
|
|
function setTooltip (btn, message) {
|
|
$(btn).tooltip('hide')
|
|
.attr('data-original-title', message)
|
|
.tooltip('show')
|
|
}
|
|
|
|
function hideTooltip (btn) {
|
|
setTimeout(function () {
|
|
$(btn).tooltip('hide')
|
|
}, 1000)
|
|
}
|
|
|
|
let clipboard = new Clipboard('.btn-clipboard')
|
|
|
|
clipboard.on('success', function (e) {
|
|
if (e.text.length > 0) {
|
|
setTooltip(e.trigger, gettext('Copied!'))
|
|
hideTooltip(e.trigger)
|
|
}
|
|
})
|
|
|
|
clipboard.on('error', function (e) {
|
|
setTooltip(e.trigger, gettext('Press Ctrl-C to copy!'))
|
|
hideTooltip(e.trigger)
|
|
})
|
|
})
|