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

42 lines
1.4 KiB
JavaScript

class AboutMe{
appId = "AboutMe"
/**
* @param {HTMLElement} appElem
*/
constructor(appElem){
this.appElem = appElem
}
/**
* @param {string} path
* @param {[]string} args
*/
NewWindow(path, args){
if (path == ""){
path = "/home/user/aboutme.props" //FIXME
}
const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile, path: path})
fetch(`/app/${this.appId}/render?`+ params)
.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
newWindow.style.height = 'auto'
// console.log(newWindow.querySelector('.ScrollBarScrollElement'))
// let scrollBar = new WdeScrollBar(newWindow.querySelector('.ScrollbarPlace'), newWindow.querySelector('.PropsView'))
newWindow.querySelector("#closeWindowButton").addEventListener('click', () => {
// console.log("qewqweqweqweqwe")
WebDesktopEnvironment.CloseWindow(newWindow)
})
})
.catch((error) => {
WebDesktopEnvironment.Alert(error);
});
}
}