diff --git a/Qrrapido - PageSpeed Insights.v2.pdf b/Qrrapido - PageSpeed Insights.v2.pdf new file mode 100644 index 0000000..5accdaf Binary files /dev/null and b/Qrrapido - PageSpeed Insights.v2.pdf differ diff --git a/Views/Shared/_AdSpace.cshtml b/Views/Shared/_AdSpace.cshtml index 43805fe..31a438d 100644 --- a/Views/Shared/_AdSpace.cshtml +++ b/Views/Shared/_AdSpace.cshtml @@ -60,8 +60,22 @@ break; } - } else if (User.Identity.IsAuthenticated) diff --git a/Views/Shared/_Layout.cshtml b/Views/Shared/_Layout.cshtml index 42dc6a7..92d8753 100644 --- a/Views/Shared/_Layout.cshtml +++ b/Views/Shared/_Layout.cshtml @@ -10,6 +10,11 @@ @ViewData["Title"] - QR Rapido | Gerador QR Code Ultrarrápido + + + + + @@ -40,9 +45,12 @@ - + + + + - - - + + + } - - - + + + - - + + - - + + - - + + @await RenderSectionAsync("Scripts", required: false) diff --git a/wwwroot/js/performance-optimizations.js b/wwwroot/js/performance-optimizations.js new file mode 100644 index 0000000..7785019 --- /dev/null +++ b/wwwroot/js/performance-optimizations.js @@ -0,0 +1,53 @@ +// QR Rapido - Performance Optimizations +// Moved from inline scripts to improve LCP and reduce render-blocking + +// Fallback inline para garantir funcionamento do theme toggle +document.addEventListener('DOMContentLoaded', function() { + // Theme toggle functionality + const btn = document.getElementById('theme-toggle'); + if (btn) { + btn.onclick = function() { + const html = document.documentElement; + const current = html.getAttribute('data-theme') || 'light'; + const newTheme = current === 'light' ? 'dark' : 'light'; + html.setAttribute('data-theme', newTheme); + + // Save preference to localStorage + localStorage.setItem('theme-preference', newTheme); + + const icon = document.getElementById('theme-icon'); + const text = document.getElementById('theme-text'); + if (icon) { + icon.className = newTheme === 'dark' ? 'fas fa-moon' : 'fas fa-sun'; + } + if (text) { + text.textContent = newTheme === 'dark' ? 'Escuro' : 'Claro'; + } + }; + } + + // Load saved theme preference on page load + const savedTheme = localStorage.getItem('theme-preference'); + if (savedTheme) { + document.documentElement.setAttribute('data-theme', savedTheme); + const icon = document.getElementById('theme-icon'); + const text = document.getElementById('theme-text'); + if (icon) { + icon.className = savedTheme === 'dark' ? 'fas fa-moon' : 'fas fa-sun'; + } + if (text) { + text.textContent = savedTheme === 'dark' ? 'Escuro' : 'Claro'; + } + } +}); + +// Optimize CSS loading fallback +document.addEventListener('DOMContentLoaded', function() { + // Ensure non-critical CSS loads properly + const printLinks = document.querySelectorAll('link[media="print"]'); + printLinks.forEach(link => { + if (link.onload === null) { + link.media = 'all'; + } + }); +}); \ No newline at end of file