| | document.addEventListener('DOMContentLoaded', function() { |
| | |
| | const tooltipTriggers = document.querySelectorAll('.tooltip-trigger'); |
| | |
| | tooltipTriggers.forEach(trigger => { |
| | trigger.addEventListener('mouseenter', function() { |
| | const tooltip = this.nextElementSibling; |
| | tooltip.classList.remove('hidden'); |
| | tooltip.classList.add('block'); |
| | }); |
| | |
| | trigger.addEventListener('mouseleave', function() { |
| | const tooltip = this.nextElementSibling; |
| | tooltip.classList.remove('block'); |
| | tooltip.classList.add('hidden'); |
| | }); |
| | }); |
| |
|
| | |
| | const mobileMenuButton = document.getElementById('mobile-menu-button'); |
| | const mobileMenu = document.getElementById('mobile-menu'); |
| | |
| | if (mobileMenuButton && mobileMenu) { |
| | mobileMenuButton.addEventListener('click', function() { |
| | mobileMenu.classList.toggle('hidden'); |
| | }); |
| | } |
| |
|
| | |
| | const darkModeToggle = document.getElementById('dark-mode-toggle'); |
| | if (darkModeToggle) { |
| | darkModeToggle.addEventListener('click', function() { |
| | document.documentElement.classList.toggle('dark'); |
| | localStorage.setItem('darkMode', document.documentElement.classList.contains('dark')); |
| | }); |
| | |
| | |
| | if (localStorage.getItem('darkMode') === 'false') { |
| | document.documentElement.classList.remove('dark'); |
| | } |
| | } |
| |
|
| | |
| | const favoriteButtons = document.querySelectorAll('.favorite-btn'); |
| | favoriteButtons.forEach(button => { |
| | button.addEventListener('click', function() { |
| | this.classList.toggle('text-red-500'); |
| | this.classList.toggle('text-gray-400'); |
| | }); |
| | }); |
| | }); |
| |
|
| | |
| | function calculateCrewEfficiency(crewSkills) { |
| | |
| | return Math.min(100, crewSkills.length * 10 + 30); |
| | } |
| | |
| | async function analyzeCrew(crewData) { |
| | try { |
| | const response = await fetch('https://api-inference.huggingface.co/models/your-model-name', { |
| | method: 'POST', |
| | headers: { |
| | 'Authorization': 'Bearer your-huggingface-token', |
| | 'Content-Type': 'application/json' |
| | }, |
| | body: JSON.stringify(crewData) |
| | }); |
| | return await response.json(); |
| | } catch (error) { |
| | console.error('Error analyzing crew:', error); |
| | return null; |
| | } |
| | } |
| |
|
| | function shareCrewBuild(buildId) { |
| | |
| | const shareUrl = `${window.location.origin}/crew/${buildId}`; |
| | if (navigator.share) { |
| | navigator.share({ |
| | title: 'Check out my WoT Blitz crew build', |
| | text: 'I created this awesome crew configuration for WoT Blitz!', |
| | url: shareUrl, |
| | }).catch(err => { |
| | console.error('Error sharing:', err); |
| | }); |
| | } else { |
| | |
| | navigator.clipboard.writeText(shareUrl).then(() => { |
| | alert('Link copied to clipboard!'); |
| | }).catch(err => { |
| | console.error('Could not copy text: ', err); |
| | }); |
| | } |
| | } |