Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
export default async function initClipboard() {
|
|
|
|
const els = document.querySelectorAll('.clipboard');
|
|
|
|
if (!els || !els.length) return;
|
|
|
|
|
|
|
|
const {default: ClipboardJS} = await import(/* webpackChunkName: "clipboard" */'clipboard');
|
|
|
|
|
|
|
|
const clipboard = new ClipboardJS(els);
|
|
|
|
clipboard.on('success', (e) => {
|
|
|
|
e.clearSelection();
|
|
|
|
$(e.trigger).popup('destroy');
|
|
|
|
e.trigger.dataset.content = e.trigger.dataset.success;
|
|
|
|
$(e.trigger).popup('show');
|
|
|
|
e.trigger.dataset.content = e.trigger.dataset.original;
|
|
|
|
});
|
|
|
|
|
|
|
|
clipboard.on('error', (e) => {
|
|
|
|
$(e.trigger).popup('destroy');
|
|
|
|
e.trigger.dataset.content = e.trigger.dataset.error;
|
|
|
|
$(e.trigger).popup('show');
|
|
|
|
e.trigger.dataset.content = e.trigger.dataset.original;
|
|
|
|
});
|
|
|
|
}
|