mirror of
https://gitlab.com/vyla-entertainment/documentation.git
synced 2026-11-16 15:37:23 -05:00
tweaked UI, added landing page
This commit is contained in:
@@ -18,14 +18,8 @@ var SITE_TREE = [
|
||||
{
|
||||
id: "vyla",
|
||||
title: "Vyla",
|
||||
path: "/",
|
||||
path: "/start-here/introduction",
|
||||
groups: [
|
||||
{
|
||||
title: "Welcome",
|
||||
items: [
|
||||
{ title: "Who Are We", file: "/start-here/who-are-we.md", path: "/start-here/who-are-we" }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Start here",
|
||||
items: [
|
||||
@@ -794,6 +788,48 @@ function navigateTo(path) {
|
||||
}
|
||||
|
||||
function loadPage() {
|
||||
var path = window.location.pathname.replace(/\/+$/, "") || "/";
|
||||
var isHome = path === "/";
|
||||
document.body.classList.toggle("is-home", isHome);
|
||||
|
||||
var contentEl = document.getElementById("main-content");
|
||||
|
||||
if (isHome) {
|
||||
document.title = "Vyla Entertainment — Vyla";
|
||||
renderNavTabs(SITE_TREE[0]);
|
||||
|
||||
if (contentEl) {
|
||||
contentEl.classList.remove("content-animate", "caught-up");
|
||||
fetch("/home.txt")
|
||||
.then(function (res) {
|
||||
if (!res.ok) throw new Error();
|
||||
return res.text();
|
||||
})
|
||||
.then(function (html) {
|
||||
contentEl.innerHTML = html;
|
||||
window.scrollTo(0, 0);
|
||||
})
|
||||
.catch(function () {
|
||||
contentEl.innerHTML = "<h1>Home</h1><p>Create /home.txt to customize this page.</p>";
|
||||
});
|
||||
}
|
||||
|
||||
var tocList = document.getElementById("toc-list");
|
||||
if (tocList) tocList.innerHTML = "";
|
||||
|
||||
var prevBtn = document.getElementById("footer-prev");
|
||||
var nextBtn = document.getElementById("footer-next");
|
||||
if (prevBtn) prevBtn.classList.add("hidden");
|
||||
if (nextBtn) nextBtn.classList.add("hidden");
|
||||
|
||||
var sidebar = document.getElementById("sidebar");
|
||||
if (sidebar && sidebar.classList.contains("open")) {
|
||||
sidebar.classList.remove("open");
|
||||
document.body.classList.remove("nav-open");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var route = resolveRoute(window.location.pathname);
|
||||
renderNavTabs(route.tab);
|
||||
renderSidebar(route.tab, route.item);
|
||||
|
||||
Reference in New Issue
Block a user