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

36 lines
1.1 KiB
JavaScript
Raw Normal View History

2023-05-09 03:17:34 +00:00
class AboutMe{
appId = "AboutMe"
2023-03-17 01:16:51 +00:00
/**
* @param {HTMLElement} appElem
*/
constructor(appElem){
2023-03-18 00:34:56 +00:00
this.appElem = appElem
2023-03-17 01:16:51 +00:00
}
2023-04-12 17:04:25 +00:00
/**
2023-05-10 23:17:59 +00:00
* @param {string} chroot
2023-05-09 03:17:34 +00:00
* @param {[]string} args
2023-04-12 17:04:25 +00:00
*/
2023-05-10 23:17:59 +00:00
async NewWindow(chroot, args){
console.log(chroot)
if (chroot == ""){
2023-05-15 23:04:16 +00:00
chroot = "/Applications" //FIXME
2023-05-09 03:17:34 +00:00
}
2023-05-10 23:17:59 +00:00
const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile, path: `${chroot}/AboutMe.app/aboutme.props`})
const response = await fetch(`/app/${this.appId}/render?`+ params)
if (response.status != 200){
WebDesktopEnvironment.Alert("Error TODO") //TODO
return
}
const html = await response.text()
2023-05-07 19:56:40 +00:00
2023-05-10 23:17:59 +00:00
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 360, document.body.clientHeight*0.8 )
newWindow.innerHTML = html
newWindow.style.height = 'auto'
2023-03-20 11:20:37 +00:00
2023-05-10 23:17:59 +00:00
newWindow.querySelector("#closeWindowButton").addEventListener('click', () => {
WebDesktopEnvironment.CloseWindow(newWindow)
2023-03-17 01:16:51 +00:00
})
}
2023-04-13 01:09:07 +00:00
}