mirror of
https://github.com/glenndehaan/unifi-voucher-site.git
synced 2026-03-31 06:24:02 -04:00
Hide copy to clipboard button if browser API is not available
This commit is contained in:
@@ -508,18 +508,22 @@
|
|||||||
spinnerCreate.style.display = '';
|
spinnerCreate.style.display = '';
|
||||||
});
|
});
|
||||||
shareButtons.forEach((el) => {
|
shareButtons.forEach((el) => {
|
||||||
el.addEventListener('click', async () => {
|
if(typeof navigator.clipboard !== 'undefined') {
|
||||||
try {
|
el.addEventListener('click', async () => {
|
||||||
await navigator.clipboard.writeText(el.dataset.code);
|
try {
|
||||||
copyNotification.style.display = '';
|
await navigator.clipboard.writeText(el.dataset.code);
|
||||||
|
copyNotification.style.display = '';
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
copyNotification.style.display = 'none';
|
copyNotification.style.display = 'none';
|
||||||
}, 5000);
|
}, 5000);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error.message);
|
console.error(error.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
el.classList.add('hidden');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
removeButtons.forEach((el) => {
|
removeButtons.forEach((el) => {
|
||||||
el.addEventListener('click', async () => {
|
el.addEventListener('click', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user