"Refactor database structures and templates for improved performance and maintainability"
This commit is contained in:
@@ -266,4 +266,102 @@ async function startJob() {
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
updateDateTime();
|
||||
setInterval(updateDateTime, 1000);
|
||||
});
|
||||
|
||||
function updateDateTime() {
|
||||
const now = new Date();
|
||||
document.getElementById('current-time').textContent = now.toLocaleTimeString('de-DE');
|
||||
}
|
||||
|
||||
// Code-Kopier-Funktion für genehmigte Anfragen
|
||||
function copyCode() {
|
||||
const codeElement = document.getElementById('otpCode');
|
||||
if (codeElement) {
|
||||
const code = codeElement.textContent;
|
||||
|
||||
// Versuche den Code in die Zwischenablage zu kopieren
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(code).then(function() {
|
||||
showCopySuccess();
|
||||
}).catch(function(err) {
|
||||
console.error('Fehler beim Kopieren:', err);
|
||||
fallbackCopyText(code);
|
||||
});
|
||||
} else {
|
||||
fallbackCopyText(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback für ältere Browser
|
||||
function fallbackCopyText(text) {
|
||||
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 {
|
||||
document.execCommand('copy');
|
||||
showCopySuccess();
|
||||
} catch (err) {
|
||||
console.error('Fallback-Kopieren fehlgeschlagen:', err);
|
||||
alert('Code konnte nicht kopiert werden. Bitte manuell markieren und kopieren.');
|
||||
}
|
||||
|
||||
document.body.removeChild(textArea);
|
||||
}
|
||||
|
||||
// Erfolgs-Animation für das Kopieren
|
||||
function showCopySuccess() {
|
||||
const button = event.target.closest('button');
|
||||
const originalHTML = button.innerHTML;
|
||||
|
||||
button.innerHTML = `
|
||||
<svg class="w-5 h-5 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
|
||||
</svg>
|
||||
`;
|
||||
|
||||
// Nach 2 Sekunden zurück zum Original
|
||||
setTimeout(() => {
|
||||
button.innerHTML = originalHTML;
|
||||
}, 2000);
|
||||
|
||||
// Optional: Toast-Benachrichtigung
|
||||
showToast('Code wurde in die Zwischenablage kopiert!');
|
||||
}
|
||||
|
||||
// Toast-Benachrichtigung
|
||||
function showToast(message) {
|
||||
// Toast-Element erstellen, falls nicht vorhanden
|
||||
let toast = document.getElementById('copyToast');
|
||||
if (!toast) {
|
||||
toast = document.createElement('div');
|
||||
toast.id = 'copyToast';
|
||||
toast.className = 'fixed top-4 right-4 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg transform transition-all duration-300 translate-x-full opacity-0 z-50';
|
||||
document.body.appendChild(toast);
|
||||
}
|
||||
|
||||
toast.textContent = message;
|
||||
|
||||
// Animation einblenden
|
||||
setTimeout(() => {
|
||||
toast.classList.remove('translate-x-full', 'opacity-0');
|
||||
}, 100);
|
||||
|
||||
// Nach 3 Sekunden ausblenden
|
||||
setTimeout(() => {
|
||||
toast.classList.add('translate-x-full', 'opacity-0');
|
||||
}, 3000);
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user