LazyyRedd/lazyboost-windows-optimization-wizard
0
1 2// Execute PowerShell commands (simulated for demo)3function executePowerShell(command) {4 return new Promise((resolve) => {5 // In a real app, this would use Electron's child_process or similar6 console.log('Executing:', command);7 setTimeout(() => {8 resolve({ success: true, output: 'Command executed successfully' });9 }, 1500);10 });11}12 13document.addEventListener('DOMContentLoaded', () => {14// Initialize tooltips15 const tooltipElements = document.querySelectorAll('[data-tooltip]');16 17 tooltipElements.forEach(el => {18 const tooltipText = el.getAttribute('data-tooltip');19 const tooltip = document.createElement('div');20 tooltip.className = 'tooltip hidden absolute z-10 bg-gray-800 text-white px-2 py-1 text-sm rounded-md';21 tooltip.textContent = tooltipText;22 el.appendChild(tooltip);23 24 el.addEventListener('mouseenter', () => {25 tooltip.classList.remove('hidden');26 });27 28 el.addEventListener('mouseleave', () => {29 tooltip.classList.add('hidden');30 });31 });32 // Handle optimization form submissions33 document.querySelectorAll('.optimize-form').forEach(form => {34 form.addEventListener('submit', async (e) => {35 e.preventDefault();36 const button = form.querySelector('button');37 const originalText = button.innerHTML;38 39 // Show loading state40 button.disabled = true;41 button.innerHTML = `<i data-feather="loader" class="animate-spin mr-2 w-4 h-4"></i> Applying...`;42 feather.replace();43 44 // Simulate applying tweaks45 await new Promise(resolve => setTimeout(resolve, 2000));46 47 // Restore button48 button.disabled = false;49 button.innerHTML = originalText;50 feather.replace();51 52 // Show success notification53 const notification = document.createElement('div');54 notification.className = 'fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded-md shadow-lg flex items-center';55 notification.innerHTML = `56 <i data-feather="check-circle" class="mr-2"></i>57 Tweaks applied successfully!58 `;59 document.body.appendChild(notification);60 feather.replace();61 62 // Remove notification after delay63 setTimeout(() => {64 notification.classList.add('opacity-0', 'transition-all', 'duration-300');65 setTimeout(() => notification.remove(), 300);66 }, 3000);67 });68 });69 70 // Smooth scroll for anchor links71document.querySelectorAll('a[href^="#"]').forEach(anchor => {72 anchor.addEventListener('click', function (e) {73 e.preventDefault();74 const targetId = this.getAttribute('href');75 const targetElement = document.querySelector(targetId);76 77 if (targetElement) {78 window.scrollTo({79 top: targetElement.offsetTop - 100,80 behavior: 'smooth'81 });82 }83 });84 });85});