Download script.js from Caner7/AKA: direct link, hf CLI and curl.
- Browser
- Download file 2.89 kB
-
https://huggingface.co/spaces/Caner7/AKA/resolve/main/script.js
- Command line
-
hf download hf://spaces/Caner7/AKA/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Caner7/AKA/resolve/main/script.js
2.89 kB
| // Copy to clipboard functionality | |
| function copyToClipboard(elementId, button) { | |
| const element = document.getElementById(elementId); | |
| const text = element.textContent.trim(); | |
| // Remove spaces from IBAN if it's the IBAN field | |
| const textToCopy = elementId === 'iban' ? text.replace(/\s/g, '') : text; | |
| // Use the Clipboard API | |
| if (navigator.clipboard && window.isSecureContext) { | |
| navigator.clipboard.writeText(textToCopy).then(() => { | |
| showCopyFeedback(button); | |
| }).catch(err => { | |
| console.error('Failed to copy:', err); | |
| fallbackCopyTextToClipboard(textToCopy, button); | |
| }); | |
| } else { | |
| // Fallback for older browsers | |
| fallbackCopyTextToClipboard(textToCopy, button); | |
| } | |
| } | |
| // Fallback copy method for older browsers | |
| function fallbackCopyTextToClipboard(text, button) { | |
| const textArea = document.createElement("textarea"); | |
| textArea.value = text; | |
| textArea.style.position = "fixed"; | |
| textArea.style.left = "-999999px"; | |
| textArea.style.top = "-999999px"; | |
| document.body.appendChild(textArea); | |
| textArea.focus(); | |
| textArea.select(); | |
| try { | |
| const successful = document.execCommand('copy'); | |
| if (successful) { | |
| showCopyFeedback(button); | |
| } else { | |
| showToast('Copy failed'); | |
| } | |
| } catch (err) { | |
| console.error('Fallback copy failed:', err); | |
| showToast('Copy failed'); | |
| } | |
| document.body.removeChild(textArea); | |
| } | |
| // Show visual feedback when copied | |
| function showCopyFeedback(button) { | |
| button.classList.add('copied'); | |
| showToast('Copied to clipboard!'); | |
| setTimeout(() => { | |
| button.classList.remove('copied'); | |
| }, 2000); | |
| } | |
| // Show toast notification | |
| function showToast(message) { | |
| const toast = document.getElementById('toast'); | |
| const toastMessage = document.getElementById('toast-message'); | |
| toastMessage.textContent = message; | |
| toast.classList.add('show'); | |
| setTimeout(() => { | |
| toast.classList.remove('show'); | |
| }, 3000); | |
| } | |
| // Add click to select functionality for info values | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const infoValues = document.querySelectorAll('.info-value'); | |
| infoValues.forEach(value => { | |
| value.addEventListener('click', function() { | |
| // Select all text when clicked | |
| if (document.selection) { | |
| const range = document.body.createTextRange(); | |
| range.moveToElementText(this); | |
| range.select(); | |
| } else if (window.getSelection) { | |
| const range = document.createRange(); | |
| range.selectNodeContents(this); | |
| window.getSelection().removeAllRanges(); | |
| window.getSelection().addRange(range); | |
| } | |
| }); | |
| }); | |
| }); | |