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

49 lines
1.5 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
}
Init(){
2023-03-18 00:34:56 +00:00
console.log("Init")
// this.appElem.innerHTML = WebDesktopEnvironment.GetBasicWindow()
// console.log(this.appElem)
// let contentFrame = this.appElem.children[0].children[0].children[1]
fetch("http://localhost:8080/application/personal-properties/render") //TODO Move to wde func
2023-03-17 01:16:51 +00:00
.then((response) => response.text())
.then((html) => {
2023-03-18 02:16:32 +00:00
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, "Personal Properties", 350, 750) //TODO Get ~70% of user screen height
2023-03-18 00:34:56 +00:00
newWindow.innerHTML = html
// document.getElementById("closeWindowButton").onclick = function jsFunc() {
// console.log("keeek")
// }
2023-03-18 02:16:32 +00:00
// console.log(newWindow.children[0].children[0])
let closeButton = newWindow.children[0].children[0]
// console.log(closeButton)
// // closeButton.onclick = this.CloseWindow("test")
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-03-18 00:34:56 +00:00
CloseWindow(id){
console.log(id+"Close")
}
2023-03-17 01:16:51 +00:00
}
2023-03-18 00:34:56 +00:00
function reply_click(){
console.log("QQQQQQQQQQQQQQQQQQQ")
2023-03-17 01:16:51 +00:00
}