File size: 804 Bytes
8ad38af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const navbarListItems = document.getElementsByClassName('navbar-item')

const documentSidebar = document.getElementsByClassName("document-sidebar")[0].querySelector('ul');
const documentText = document.getElementsByClassName("document-text")[0];
const documentCredit = document.getElementsByClassName("document-credit")[0];

function parseHashAndRunCode() {
    const urlHash = window.location.hash;
    let projectName = urlHash.substring(1);
    fetchAndParseYAML(`resources/topics/${projectName}.yaml`, renderDocument);
}

let projectName;
if (window.location.hash) {
    projectName = window.location.hash.substring(1);
} else {
    projectName = 'understanding';
}
fetchAndParseYAML(`resources/topics/${projectName}.yaml`, renderDocument);
window.addEventListener('hashchange', parseHashAndRunCode);