34 lines
930 B
JavaScript
34 lines
930 B
JavaScript
import rt from "./rt.js";
|
|
import events from "./events.js";
|
|
import lib from "./lib.js";
|
|
|
|
(async () => {
|
|
lib.showLayer("page");
|
|
window.addEventListener("hashchange", events.hashchange);
|
|
|
|
const debug = document.querySelectorAll("span#debug > a");
|
|
debug[0].addEventListener("click", () => { // page
|
|
lib.showLayer("page");
|
|
});
|
|
debug[1].addEventListener("click", () => { // item
|
|
lib.showLayer("item");
|
|
});
|
|
debug[2].addEventListener("click", () => { // item
|
|
lib.showLayer("howto");
|
|
});
|
|
|
|
setTimeout(() => {
|
|
const pn = parseInt(document.location.pathname.split("/").splice(-1));
|
|
const hash = document.location.hash;
|
|
lib.scrolltomiddle(rt.ct.wrapper.pages);
|
|
lib.getItems({
|
|
el: rt.ct.wrapper.pages[1],
|
|
opt: pn > 0 ? `id=${pn + 1}&order=desc` : ""
|
|
});
|
|
|
|
if(hash)
|
|
window.dispatchEvent(new CustomEvent("hashchange", { detail: { newURL: hash } }));
|
|
}, 300);
|
|
|
|
})();
|