mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: solution: get link
This commit is contained in:
1 parent
7d67bd3993
commit
e3dd65c690
4 files changed
+38
-4
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import Clipboard from 'clipboard';
|
||||
import Notification from 'vj/components/notification';
|
||||
import { AutoloadPage } from 'vj/misc/Page';
|
||||
import i18n from 'vj/utils/i18n';
|
||||
|
||||
export default new AutoloadPage('clipboard', () => {
|
||||
$('[data-copy]').each(function () {
|
||||
const clip = new Clipboard(this, { text: () => this.dataset.copy });
|
||||
clip.on('success', () => Notification.success(i18n('Copied to clipboard!')));
|
||||
clip.on('error', () => Notification.error(i18n('Copy failed :(')));
|
||||
});
|
||||
$('[data-copylink]').each(function () {
|
||||
const clip = new Clipboard(this, { text: () => new URL(this.dataset.copylink, document.location.href).toString() });
|
||||
clip.on('success', () => Notification.success(i18n('Link copied to clipboard!')));
|
||||
clip.on('error', () => Notification.error(i18n('Copy failed :(')));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user