personal-website/resources/sys/personal-properties/personal-properties.js
2023-05-11 02:17:59 +03:00

38 lines
1.2 KiB
JavaScript

class AboutMe{
appId = "AboutMe"
/**
* @param {HTMLElement} appElem
*/
constructor(appElem){
this.appElem = appElem
}
/**
* @param {string} chroot
* @param {[]string} args
*/
async NewWindow(chroot, args){
console.log(chroot)
if (chroot == ""){
chroot = "/home/user" //FIXME
}
console.log(`${chroot}/AboutMe.app/aboutme.props`)
const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile, path: `${chroot}/AboutMe.app/aboutme.props`})
const response = await fetch(`/app/${this.appId}/render?`+ params)
console.log(response)
if (response.status != 200){
WebDesktopEnvironment.Alert("Error TODO") //TODO
return
}
const html = await response.text()
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 360, document.body.clientHeight*0.8 )
newWindow.innerHTML = html
newWindow.style.height = 'auto'
newWindow.querySelector("#closeWindowButton").addEventListener('click', () => {
WebDesktopEnvironment.CloseWindow(newWindow)
})
}
}