{(
Default page
)}
global watched menu
watch(function() {
if (menu.curRoute) {
let curRoute = menu.curRoute;
let curRoute2 = curRoute;
if (curRoute2.endsWith(".html")) {
curRoute2 = curRoute2.substring(0,curRoute2.length-".html".length);
} else {
curRoute2 += ".html"
}
let selected = currentElement.querySelectorAll(".pure-menu-selected")
for (el of selected) {
el.classList.remove("pure-menu-selected")
}
let curRouteElem = currentElement.querySelector('[route="'+curRoute+'"],[href="'+curRoute+'"],[route="'+curRoute2+'"],[href="'+curRoute2+'"]')
if (curRouteElem) {
do {
curRouteElem.classList.add("pure-menu-selected")
curRouteElem = curRouteElem.parentElement;
} while (curRouteElem.tagName!="MY-MENU")
}
}
})
global watched menu
let route = currentElement.getAttribute("route")
if (!route) {
let el = currentElement.querySelector("[href]")
if (el) {
route = el.getAttribute("href")
}
}
if (route) {
if (location.hostname.indexOf("a-js.org") < 0) {
if (!route.endsWith(".html")&&route.indexOf(".") < 0) {
route += ".html"
}
}
currentElement.addEventListener("click",(evt) => {
evt.preventDefault();
evt.stopPropagation();
evt.stopImmediatePropagation();
A.importIn(null,route)
history.pushState({route},"",route)
menu.curRoute = route;
},true)
}