Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/js/product-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ document.addEventListener("DOMContentLoaded", function() {
const productSelectorContent = document.getElementById("product-selector");
const productSelectorButton = document.getElementById("product-selector-button");

if (productSelectorButton === null || productSelectorButton == null) {
return;
}

productSelectorButton.addEventListener("click", function() {
if (productSelectorContent.style.display === "block") {
productSelectorContent.style.display = "none";
Expand Down
14 changes: 7 additions & 7 deletions assets/js/site-dropdown.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$(document).ready(function () {
document.addEventListener("DOMContentLoaded", function () {
const dropdownContent = document.getElementById("dropdown-content");
const navbarButton = document.getElementById("navbar-sites-button");
const chevronIcon = document.getElementById("navbar-sites-button-icon");

$("#navbar-sites-button").on("click", () => {
navbarButton.addEventListener("click", function () {
chevronIcon.classList.toggle('rotate-chevron');

if (dropdownContent.style.display === "block") {
Expand All @@ -15,13 +15,13 @@ $(document).ready(function () {
}
});

window.onclick = function(event) {
window.addEventListener("click", function (event) {
if (!event.target.matches('#navbar-sites-button') && !event.target.matches('#navbar-sites-button-icon')) {
if(dropdownContent.style.display !== "none" && dropdownContent.style.display !== ""){
if (dropdownContent.style.display !== "none" && dropdownContent.style.display !== "") {
chevronIcon.classList.toggle('rotate-chevron');
}
dropdownContent.style.display = "none"
dropdownContent.style.display = "none";
navbarButton.classList.remove("remove-bottom-radius");
}
}
})
});
});
52 changes: 0 additions & 52 deletions assets/js/theme-switcher.js

This file was deleted.

215 changes: 149 additions & 66 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,158 @@
<html lang="{{ .Site.LanguageCode }}">

<head>
{{ block "head" . }}

{{ partial "meta.html" . }}

{{ partial "favicon.html" . }}

{{ partial "styles.html" . }}

{{ if in .Params.doctypes "devportal" }}
{{ partial "devportal/style.html" . }}
{{ end }}

{{ if fileExists "/layouts/partials/head_custom.html" }}
{{ partial "head_custom.html" . }}
{{ end }}

{{ if or ( not hugo.IsServer ) ( not ( in .Site.Params.buildtype "package" ) ) }}

{{ partial "trustarc.html" . }}

{{ partial "tealium-profile.html" . }}

{{ end }}

{{ end }}

<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-K5HG9JT');</script>

</head>

<body>
<style>
body {
/* Hide entire body for first paint. This suppresses flicker when theme is loading. */
visibility: hidden;
}
</style>

<noscript>
<style>
/* Styles when JavaScript is disabled. Fallsback to old theme. */
body {
visibility: visible;
}
</style>
</noscript>



<script>

function useNewTheme(isNewTheme) {
localStorage.setItem("useNewTheme", `${isNewTheme}`);

// swap out v1 and v2 css style
const v1cssIds = [
"cssFA1",
"cssFA2",
"cssFA3",
"cssBootstrap",
"css1",
"css2",
"css3",
"css4",
"css5",
"css6"
];

v1cssIds.forEach((cssId) => {
const element = document.getElementById(cssId);
if (element !== null) {
element.disabled = isNewTheme;
}
});

const v2cssIds = ["css7"];
v2cssIds.forEach((cssId) => {
const element = document.getElementById(cssId);
if (element !== null) {
element.disabled = !isNewTheme;
}
});

// swap out v1 and v2 elements
const v1ElementIds = ["sidebar", "toc"]

v1ElementIds.forEach((elementId) => {
const element = document.getElementById(elementId);
if (element !== null) {
element.style.display = isNewTheme ? "none" : "";
}
});

const mfElements = ['[data-mf="true"]'];
mfElements.forEach((elementId) => {
document
.querySelectorAll(elementId)
.forEach(
(element) => (element.style.display = isNewTheme ? "" : "none")
);
});

document.getElementById("body").style.visibility = "visible";
}

const mf = useNewTheme;

document.addEventListener("DOMContentLoaded", function () {
useNewTheme(localStorage.getItem("useNewTheme") === "true");
})


</script>

{{ block "head" . }}

{{ partial "meta.html" . }}

{{ partial "favicon.html" . }}

{{ partial "styles.html" . }}

{{ if in .Params.doctypes "devportal" }}
{{ partial "devportal/style.html" . }}
{{ end }}

{{ if fileExists "/layouts/partials/head_custom.html" }}
{{ partial "head_custom.html" . }}
{{ end }}

{{ if or ( not hugo.IsServer ) ( not ( in .Site.Params.buildtype "package" ) ) }}
{{ partial "universal-tag.html" . }}

{{ partial "trustarc.html" . }}

{{ partial "tealium-profile.html" . }}

{{ end }}

<header>
{{ block "header" . }}{{end}}
</header>

<section class="base-layout">
<section class="breadcrumb-layout">
<div data-mf="true" id="searchbox" style="display:none;">
<div class="CoveoSearchbox" data-placeholder='Search NGINX Docs...'></div>
</div>
{{ if not .IsHome }}
{{ if not (in .Params.display_breadcrumb "false" ) }}
{{ partial "breadcrumb" .}}

{{ end }}

<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-K5HG9JT');</script>

</head>

<body id="body">
{{ if or ( not hugo.IsServer ) ( not ( in .Site.Params.buildtype "package" ) ) }}
{{ partial "universal-tag.html" . }}
{{ end }}

<header>
{{ block "header" . }}{{end}}
</header>

<section class="base-layout">
<section class="breadcrumb-layout">
<div data-mf="true" id="searchbox" style="display:none;">
<div class="CoveoSearchbox" data-placeholder='Search NGINX Docs...'></div>
</div>
{{ if not .IsHome }}
{{ if not (in .Params.display_breadcrumb "false" ) }}
{{ partial "breadcrumb" .}}
{{ end }}
{{ end }}
</section>

<div class="main container-fluid min-page-height" data-menu-id="{{.RelPermalink}}">
{{ block "main" . }}{{ end }}
</div>
</section>

<footer>

{{ block "footer" . }}
{{ partial "footer.html" . }}
{{ end }}
</section>

<div class="main container-fluid min-page-height" data-menu-id="{{.RelPermalink}}">
{{ block "main" . }}{{ end }}
</div>
</section>

<footer>

{{ block "footer" . }}
{{ partial "footer.html" . }}
{{ end }}

</footer>

{{ partial "scripts.html" . }}
<div id="consent_blackbar"></div>

</footer>

{{ partial "scripts.html" . }}
<div id="consent_blackbar"></div>
</body>
</html>
7 changes: 2 additions & 5 deletions layouts/partials/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,11 @@

{{ end }}



<!-- Load Sidebar javascript -->
{{ $jsSidebar := resources.Get "js/sidebar.js" | minify | fingerprint "sha512" }}
<script src="{{ $jsSidebar.RelPermalink }}" type="text/javascript" integrity="{{ $jsSidebar.Data.Integrity }}"></script>

<!-- Inline theme switcher -->
{{ $jsThemeSwitcher := resources.Get "js/theme-switcher.js" | minify | fingerprint "sha512" }}
<script src="{{ $jsThemeSwitcher.RelPermalink }}" type="text/javascript"
integrity="{{ $jsThemeSwitcher.Data.Integrity }}"></script>

<!-- Load Site Dropdown javascript -->
{{ $jsSiteDropdown := resources.Get "js/site-dropdown.js" | minify | fingerprint "sha512" }}
Expand Down