personal-website/res/dev-fs/apps/ImgViewer/img-viewer.js

28 lines
863 B
JavaScript
Raw Normal View History

2023-04-12 21:05:23 +00:00
class ImgViewer{
appId = "img-viewer"
/**
2023-04-29 16:47:12 +00:00
* @param {string[]} args
2023-04-12 21:05:23 +00:00
*/
2023-04-29 16:47:12 +00:00
NewWindow(args){
2023-04-13 01:09:07 +00:00
fetch(`${window.location.origin}/application/${this.appId}/render?`+ new URLSearchParams({
isMobile: WebDesktopEnvironment.isMobile,
2023-04-29 16:47:12 +00:00
path: args[0]
2023-04-13 01:09:07 +00:00
}))
2023-04-12 21:05:23 +00:00
.then((response) => response.text())
.then((html) => {
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 450,400 )
newWindow.innerHTML = html
2023-04-13 18:28:28 +00:00
if (!WebDesktopEnvironment.isMobile){
newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) {
WebDesktopEnvironment.CloseWindow(newWindow)
})
}
2023-04-12 21:05:23 +00:00
})
.catch((error) => {
WebDesktopEnvironment.Alert(error);
});
}
}