Update app.js
This commit is contained in:
parent
d63654f1cf
commit
4924a4ae06
1 changed files with 7 additions and 8 deletions
|
|
@ -15,7 +15,6 @@ const els = {
|
||||||
|
|
||||||
let indexData = null;
|
let indexData = null;
|
||||||
let sidebarOpen = false;
|
let sidebarOpen = false;
|
||||||
let currentIframe = null;
|
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -34,11 +33,13 @@ async function init() {
|
||||||
|
|
||||||
function populateNav() {
|
function populateNav() {
|
||||||
els.primaryNav.innerHTML = '<a href="#/">Home</a>';
|
els.primaryNav.innerHTML = '<a href="#/">Home</a>';
|
||||||
indexData.sections.forEach(s => {
|
const navSections = [...new Set(
|
||||||
const hasIndex = indexData.flat.some(f => f.path.startsWith(s + "/") && f.isIndex);
|
indexData.flat
|
||||||
if (hasIndex) {
|
.filter(f => f.isIndex)
|
||||||
els.primaryNav.innerHTML += `<a href="#/${s}/">${s.charAt(0).toUpperCase() + s.slice(1)}</a>`;
|
.map(f => f.path.split("/")[0])
|
||||||
}
|
)].sort();
|
||||||
|
navSections.forEach(s => {
|
||||||
|
els.primaryNav.innerHTML += `<a href="#/${s}/">${s.charAt(0).toUpperCase() + s.slice(1)}</a>`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -169,8 +170,6 @@ function renderIframe(rel) {
|
||||||
iframe.setAttribute("sandbox", "allow-same-origin allow-scripts allow-forms");
|
iframe.setAttribute("sandbox", "allow-same-origin allow-scripts allow-forms");
|
||||||
els.viewer.appendChild(iframe);
|
els.viewer.appendChild(iframe);
|
||||||
|
|
||||||
currentIframe = iframe;
|
|
||||||
|
|
||||||
iframe.onload = () => {
|
iframe.onload = () => {
|
||||||
try {
|
try {
|
||||||
const doc = iframe.contentDocument;
|
const doc = iframe.contentDocument;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue