moved packages out of pkg
This commit is contained in:
17
internal/embedfs/web/js/copytoclipboard.js
Normal file
17
internal/embedfs/web/js/copytoclipboard.js
Normal file
@@ -0,0 +1,17 @@
|
||||
function copyToClipboard(elementId, buttonId) {
|
||||
const element = document.getElementById(elementId);
|
||||
const button = document.getElementById(buttonId);
|
||||
|
||||
navigator.clipboard.writeText(element.innerText)
|
||||
.then(() => {
|
||||
const originalText = button.innerText;
|
||||
button.innerText = 'Copied!';
|
||||
setTimeout(() => {
|
||||
button.innerText = originalText;
|
||||
}, 2000);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Failed to copy:', err);
|
||||
button.innerText = 'Failed';
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user