mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-26 17:34:11 -05:00
19db3f4f0a
* rework eslint config - use explicit config that only enables rules - upgrade eslint to 7.1.0 - add new plugins with selected rules enabled - fix discovered issues, remove global wipPrefixes * remove if * undo template change * add disabled rules as well for easier config updating * add missing disabled rule * update eslint and plugins * fix new violation * remove deprecated rules Co-authored-by: Lauris BH <lauris@nix.lv>
22 lines
754 B
JavaScript
22 lines
754 B
JavaScript
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;
|
|
});
|
|
}
|