personal-website/resources/sys/personal-properties/personal-properties.js

37 lines
1.3 KiB
JavaScript

class PersonalProperties{
appId = "personal-properties"
/**
* @param {HTMLElement} appElem
*/
constructor(appElem){
this.appElem = appElem
}
/**
* @param {string} path
*/
NewWindow(path){
fetch(`${window.location.origin}/application/personal-properties/render?`+ new URLSearchParams({
isMobile: WebDesktopEnvironment.isMobile,
path: path
}))
.then((response) => response.text())
.then((html) => {
// console.log(document.body)
// let heigth = Math.max(document.body.clientHeight*0.8, scrollDiv.children[0].scrollHeight) //TODO
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 360, document.body.clientHeight*0.8 )
newWindow.innerHTML = html
let scrollBar = new WdeScrollBar(newWindow.querySelector('.ScrollBarScrollElement'), newWindow.querySelector('.ScrollContent'))
newWindow.querySelector("#closeWindowButton").addEventListener('click', () => {
console.log("qewqweqweqweqwe")
WebDesktopEnvironment.CloseWindow(newWindow)
})
})
.catch((error) => {
WebDesktopEnvironment.Alert(error);
});
}
}