mlsoc-pico / scripts /projects-page.js
Yacine Jernite
initial
8ad38af
raw
history blame contribute delete
801 Bytes
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/projects/${projectName}.yaml`, renderDocument);
}
let projectName;
if (window.location.hash) {
projectName = window.location.hash.substring(1);
} else {
projectName = 'policy';
}
fetchAndParseYAML(`resources/projects/${projectName}.yaml`, renderDocument);
window.addEventListener('hashchange', parseHashAndRunCode);