mirror of
https://github.com/Wan-Video/Wan2.1.git
synced 2025-06-08 00:04:53 +00:00
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
// Client-side JavaScript for the Wan2.1 web interface
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Initialize tooltips
|
|
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
|
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
|
|
|
|
// Handle active nav links
|
|
const currentPath = window.location.pathname;
|
|
document.querySelectorAll('.navbar-nav .nav-link').forEach(link => {
|
|
if (link.getAttribute('href') === currentPath) {
|
|
link.classList.add('active');
|
|
}
|
|
});
|
|
|
|
// Function to copy generated video URL
|
|
window.copyVideoUrl = function(btn) {
|
|
const videoUrl = window.location.origin + btn.getAttribute('data-url');
|
|
navigator.clipboard.writeText(videoUrl).then(() => {
|
|
const originalText = btn.innerHTML;
|
|
btn.innerHTML = '<i class="fas fa-check"></i> Copied!';
|
|
setTimeout(() => {
|
|
btn.innerHTML = originalText;
|
|
}, 2000);
|
|
}).catch(err => {
|
|
console.error('Error copying URL: ', err);
|
|
});
|
|
};
|
|
});
|