- Theme Decoupling & Cleanup:
- Fully decoupled and vendored the Blowfish theme directly into root directories (layouts/,
assets/, static/, data/, i18n/).
- De-registered and cleaned up legacy Git submodules (themes/blowfish, themes/hugo-admonitions)
from the Git index to protect the build from upstream breakages.
- Configured .gitignore to ignore development preview symlinks (content, static,
config/_default/menus.en.toml), build folders (public/, resources/), and locks.
- TOC & Layout Fixes:
- Replaced the custom layouts/_default/single.html template with the Blowfish default to restore
native container widths and the side-by-side flex layout.
- Restored TOC to float on the right sidebar on desktop viewports and render inline on mobile
viewports.
- Fixed a parameter resolution bug in layouts/partials/toc.html by checking both .Site.Params.
smartTOC and .Site.Params.article.smartTOC (where it is defined in params.toml).
- Upgraded the TOC scrollspy JavaScript to target all '#TableOfContents' containers on the page,
enabling highlight tracking on both desktop and mobile layouts.
- Documentation Updates (README.md):
- Restored YAML front matter metadata block at the top.
- Added detailed notes on the CI/CD build process and Gitea runner deployment targets
(/srv/www/docs-public and /srv/www/docs-private).
- Added a categorized and sorted "Shortcodes Quick Reference" table at the top of the shortcodes
section (ordered by Custom, Hugo Default, and Blowfish).
- Documented custom shortcodes (Include, Screenshot, Raw HTML) and missing Hugo default
shortcodes (Highlight, Instagram, Param, Ref, Relref, Twitter, Vimeo, Youtube).
- Restructured headings to ensure all sub-shortcodes are H3, removed block break tags (<br/>),
and appended horizontal separators (---) after H2 sections.
68 lines
2.4 KiB
JavaScript
68 lines
2.4 KiB
JavaScript
function _toggleZenMode(zendModeButton, options = { scrollToHeader: true }) {
|
|
// Nodes selection
|
|
const body = document.querySelector("body");
|
|
const footer = document.querySelector("footer");
|
|
const tocRight = document.querySelector(".toc-right");
|
|
const tocInside = document.querySelector(".toc-inside");
|
|
const articleContent = document.querySelector(".article-content");
|
|
const header = document.querySelector("#single_header");
|
|
|
|
// Add semantic class into body tag
|
|
body.classList.toggle("zen-mode-enable");
|
|
|
|
// Show/Hide 'toc right' and 'toc inside'
|
|
if (tocRight) tocRight.classList.toggle("lg:block");
|
|
if (tocInside) tocInside.classList.toggle("lg:hidden");
|
|
|
|
// Change width of article content
|
|
articleContent.classList.toggle("max-w-fit");
|
|
articleContent.classList.toggle("max-w-prose");
|
|
|
|
// Change width of article title and footer
|
|
header.classList.toggle("max-w-full");
|
|
header.classList.toggle("max-w-prose");
|
|
footer.classList.toggle("max-w-full");
|
|
footer.classList.toggle("max-w-prose");
|
|
|
|
// Read i18n title from data-attributes
|
|
const titleI18nDisable = zendModeButton.getAttribute("data-title-i18n-disable");
|
|
const titleI18nEnable = zendModeButton.getAttribute("data-title-i18n-enable");
|
|
|
|
if (body.classList.contains("zen-mode-enable")) {
|
|
// Persist configuration
|
|
//localStorage.setItem('blowfish-zen-mode-enabled', 'true');
|
|
|
|
// Change title to enable
|
|
zendModeButton.setAttribute("title", titleI18nEnable);
|
|
// Auto-scroll to title article
|
|
if (options.scrollToHeader) {
|
|
window.scrollTo(window.scrollX, header.getBoundingClientRect().top - 90);
|
|
}
|
|
} else {
|
|
//localStorage.setItem('blowfish-zen-mode-enabled', 'false');
|
|
zendModeButton.setAttribute("title", titleI18nDisable);
|
|
if (options.scrollToHeader) {
|
|
document.querySelector("body").scrollIntoView();
|
|
}
|
|
}
|
|
}
|
|
|
|
function _registerZendModeButtonClick(zendModeButton) {
|
|
zendModeButton.addEventListener("click", function (event) {
|
|
event.preventDefault();
|
|
|
|
// Toggle zen-mode
|
|
_toggleZenMode(zendModeButton);
|
|
});
|
|
}
|
|
|
|
(function init() {
|
|
window.addEventListener("DOMContentLoaded", (event) => {
|
|
// Register click on 'zen-mode-button' node element
|
|
const zendModeButton = document.getElementById("zen-mode-button");
|
|
if (zendModeButton !== null && zendModeButton !== undefined) {
|
|
_registerZendModeButtonClick(zendModeButton);
|
|
}
|
|
});
|
|
})();
|