class BlogViewer{ appId = "blog-viewer" constructor(){ } /** * @param {string} path */ NewWindow(path){ fetch(`${window.location.origin}/application/${this.appId}/render?` + new URLSearchParams({ isMobile: WebDesktopEnvironment.isMobile, })) .then((response) => response.text()) .then((html) => { let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 500, 350 ) newWindow.innerHTML = html // let fileView = new FileView("/kek", newWindow.querySelector(".FileTileView"), Finder.Click) if (!WebDesktopEnvironment.isMobile){ // let scrollBar = new WdeScrollBar(newWindow.children[1].children[1], newWindow.children[1].children[0])// TODO to querry selector newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) { WebDesktopEnvironment.CloseWindow(newWindow) }) } }) .catch((error) => { WebDesktopEnvironment.Alert(error); }) } /** * @param {MouseEvent} event * @param {string} path */ static Click(event, path){ let fileType = event.target.getAttribute("fileType") switch (fileType) { case "app": //TODO get real id WebDesktopEnvironment.Open("personal-properties", []) break; case "img": WebDesktopEnvironment.Open("img-viewer", ["pizda"]) break; default: console.log("Unsupported file type") break; } } }