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

65 lines
2.3 KiB
JavaScript
Raw Normal View History

2023-03-17 01:16:51 +00:00
class PersonalProperties{
2023-03-18 00:34:56 +00:00
appId = "personal-properties"
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
/**
* @param {string} path
*/
NewWindow(path){
2023-03-21 12:38:36 +00:00
fetch(`${window.location.origin}/application/personal-properties/render`) //TODO Move to wde func. Or Not?
2023-03-17 01:16:51 +00:00
.then((response) => response.text())
.then((html) => {
2023-03-21 12:38:36 +00:00
// console.log(document.body)
// let heigth = Math.max(document.body.clientHeight*0.8, scrollDiv.children[0].scrollHeight) //TODO
2023-04-12 17:04:25 +00:00
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 360, document.body.clientHeight*0.8 )
2023-03-18 00:34:56 +00:00
newWindow.innerHTML = html
2023-03-18 02:16:32 +00:00
let closeButton = newWindow.children[0].children[0]
2023-03-20 11:20:37 +00:00
let scrollDiv = newWindow.children[1]
2023-03-21 12:38:36 +00:00
let scrollBar = new WdeScrollBar(scrollDiv.children[1].children[0], scrollDiv.children[0])
2023-03-20 11:20:37 +00:00
2023-03-18 00:34:56 +00:00
closeButton.addEventListener('click', function (params) {
WebDesktopEnvironment.CloseWindow(newWindow)
})
2023-03-17 01:16:51 +00:00
})
.catch((error) => {
WebDesktopEnvironment.Alert(error);
});
}
2023-04-12 17:04:25 +00:00
// Init(){
// console.log("Init")
// fetch(`${window.location.origin}/application/personal-properties/render`) //TODO Move to wde func. Or Not?
// .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, "Personal Properties", 360, document.body.clientHeight*0.8 )
// newWindow.innerHTML = html
// let closeButton = newWindow.children[0].children[0]
// let scrollDiv = newWindow.children[1]
// let scrollBar = new WdeScrollBar(scrollDiv.children[1].children[0], scrollDiv.children[0])
// closeButton.addEventListener('click', function (params) {
// WebDesktopEnvironment.CloseWindow(newWindow)
// })
// })
// .catch((error) => {
// WebDesktopEnvironment.Alert(error);
// });
// }
}
class test{
}