OneConversorTemplate/OnlyOneAccessTemplate/Views/Shared/_Layout.cshtml
2025-06-08 12:44:02 -03:00

98 lines
3.6 KiB
Plaintext

<!DOCTYPE html>
<html lang="@ViewBag.Language" prefix="og: http://ogp.me/ns#" dir="@ViewBag.Direction">
<head>
@await Html.PartialAsync("_Head")
<!-- Page specific head content -->
@await RenderSectionAsync("Head", required: false)
</head>
<body class="@ViewBag.BodyClass">
<!-- Google Tag Manager (noscript) -->
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id=@ViewBag.GTMId"
height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<!-- End Google Tag Manager (noscript) -->
@await Html.PartialAsync("_Header")
<main role="main" id="main-content">
@RenderBody()
</main>
@await Html.PartialAsync("_Footer")
<!-- Schema.org structured data --
<script type="application/ld+json">
@Html.Raw(ViewBag.StructuredData ?? "{}")
</script>
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
<!-- AOS Animation JS -->
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<!-- Custom JS -->
@if (!string.IsNullOrEmpty(ViewBag.GTMId?.ToString()))
{
<script src="~/js/conversion.js" asp-append-version="true"></script>
<script src="~/js/analytics.js" asp-append-version="true"></script>
}
@await RenderSectionAsync("Scripts", required: false)
<!-- Conversion tracking -->
@if (!string.IsNullOrEmpty(ViewBag.ConversionPixel as string))
{
<script>@Html.Raw(ViewBag.ConversionPixel)</script>
}
<script>
window.ModuleSystem = {
async loadModule(moduleId, targetElementId) {
try {
const response = await fetch(`/modules/${moduleId}`);
if (response.ok) {
const content = await response.text();
const targetElement = document.getElementById(targetElementId);
if (targetElement) {
targetElement.innerHTML = content;
// Disparar evento customizado para módulos que precisam de JS
const event = new CustomEvent('moduleLoaded', {
detail: { moduleId, targetElementId, content }
});
document.dispatchEvent(event);
}
return true;
} else {
console.error(`Erro ao carregar módulo ${moduleId}:`, response.status);
return false;
}
} catch (error) {
console.error(`Erro ao carregar módulo ${moduleId}:`, error);
return false;
}
},
async loadModules() {
// Auto-carregar módulos com data-module
const moduleElements = document.querySelectorAll('[data-module]');
for (const element of moduleElements) {
const moduleId = element.dataset.module;
if (moduleId) {
await this.loadModule(moduleId, element.id);
}
}
}
};
// Auto-executar quando página carrega
document.addEventListener('DOMContentLoaded', () => {
window.ModuleSystem.loadModules();
});
</script>
</body>
</html>