class Finder{ appId = "finder" constructor(){ // this.appElem = appElem } /** * @param {string} path */ NewWindow(path){ fetch(`${window.location.origin}/application/${this.appId}/render?` + new URLSearchParams({ isMobile: WebDesktopEnvironment.isMobile, // bar: true, })) //TODO Move to wde func. Or Not? .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 let closeButton = newWindow.children[0].children[0] //TODO to query selector closeButton.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; } } }