Compare commits
4 Commits
4426d30342
...
6dc162f3ff
Author | SHA1 | Date | |
---|---|---|---|
6dc162f3ff | |||
3702495714 | |||
50d7924728 | |||
7f2c7f065c |
@ -4,30 +4,28 @@ class BlogViewer{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string[]} chroot //TODO
|
||||
* @param {string[]} args
|
||||
*/
|
||||
NewWindow(args){
|
||||
fetch(`${window.location.origin}/application/${this.appId}/render?` + new URLSearchParams({
|
||||
async NewWindow(args){
|
||||
const response = await fetch(`app/${this.appId}/render?` + new URLSearchParams({
|
||||
isMobile: WebDesktopEnvironment.isMobile,
|
||||
path: args[0],
|
||||
}))
|
||||
.then((response) => response.text())
|
||||
.then((html) => {
|
||||
if (response.status != 200){
|
||||
WebDesktopEnvironment.Alert("Error render TODO") //TODO
|
||||
return
|
||||
}
|
||||
const html = await response.text()
|
||||
|
||||
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 500, 350 )
|
||||
newWindow.innerHTML = html
|
||||
|
||||
// let fileView = new FileView("/kek", newWindow.querySelector(".FileTileView"), Finder.Click)
|
||||
if (!WebDesktopEnvironment.isMobile){
|
||||
let scrollBar = new WdeScrollBar(newWindow.querySelector(".ScrollbarPlace"), newWindow.querySelector(".ScrollContent"))
|
||||
newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) {
|
||||
WebDesktopEnvironment.CloseWindow(newWindow)
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
WebDesktopEnvironment.Alert(error);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MouseEvent} event
|
||||
|
@ -249,7 +249,7 @@ class FinderWindow{
|
||||
}
|
||||
break
|
||||
case "blog":
|
||||
WebDesktopEnvironment.Open("blog-viewer", [`${this.CurPath}/${fileName}`])
|
||||
WebDesktopEnvironment.Open("/Applications/BlogViewer.app", [`${this.CurPath}/${fileName}`])
|
||||
break
|
||||
case "personal-properties":
|
||||
WebDesktopEnvironment.Open("personal-properties", [`${this.CurPath}/${fileName}`])
|
||||
|
@ -8,35 +8,31 @@ class AboutMe{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
* @param {string} chroot
|
||||
* @param {[]string} args
|
||||
*/
|
||||
NewWindow(path, args){
|
||||
if (path == ""){
|
||||
path = "/home/user/aboutme.props" //FIXME
|
||||
async NewWindow(chroot, args){
|
||||
console.log(chroot)
|
||||
if (chroot == ""){
|
||||
chroot = "/home/user" //FIXME
|
||||
}
|
||||
const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile, path: path})
|
||||
fetch(`/app/${this.appId}/render?`+ params)
|
||||
.then((response) => response.text())
|
||||
.then((html) => {
|
||||
// console.log(document.body)
|
||||
// let heigth = Math.max(document.body.clientHeight*0.8, scrollDiv.children[0].scrollHeight) //TODO
|
||||
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'
|
||||
|
||||
// console.log(newWindow.querySelector('.ScrollBarScrollElement'))
|
||||
|
||||
// let scrollBar = new WdeScrollBar(newWindow.querySelector('.ScrollbarPlace'), newWindow.querySelector('.PropsView'))
|
||||
|
||||
newWindow.querySelector("#closeWindowButton").addEventListener('click', () => {
|
||||
// console.log("qewqweqweqweqwe")
|
||||
WebDesktopEnvironment.CloseWindow(newWindow)
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
WebDesktopEnvironment.Alert(error);
|
||||
});
|
||||
}
|
||||
}
|
@ -186,8 +186,6 @@ class WebDesktopEnvironment{
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} appId
|
||||
* @param {number} width
|
||||
@ -255,22 +253,22 @@ class WebDesktopEnvironment{
|
||||
let newWindow = document.createElement("div")
|
||||
newWindow.setAttribute("class", "WindowFrameless")
|
||||
newWindow.setAttribute("windowId", "SuperUniqUUID") //TODO:
|
||||
newWindow.style.cssText = "position:absolute;width:450px;height:116px; margin-left: 225px; margin-top:58px; left: 50%;top: 50%;background-color:#FFFFFF;border: 1px solid #000000;box-shadow: 2px 2px 0px #000000;"
|
||||
newWindow.style.cssText = "position:absolute;width:450px;height:116px; left: 50%;top: 50%;background-color:#FFFFFF;border: 1px solid #000000;box-shadow: 2px 2px 0px #000000;"
|
||||
|
||||
let alertImage = document.createElement("img")
|
||||
alertImage.setAttribute("src", "http://localhost:8080/res/sys/wde/icons/ohno.png")
|
||||
alertImage.style.cssText = "position:relative;width:64px;height:64px;top:15px;left:15px"
|
||||
alertImage.setAttribute("src", "/res/sys/wde/icons/ohno.png")
|
||||
alertImage.style.cssText = "position:absolute; width:64px;height:64px;top:15px;left:25px"
|
||||
newWindow.appendChild(alertImage)
|
||||
|
||||
let errorText = document.createElement("div")
|
||||
errorText.style.cssText = "position:relative; left:128px; top:-30px;font-family: 'Virtue';"
|
||||
errorText.style.cssText = "position:absolute; width: 300px; left:128px; top:30px;font-family: 'Virtue';"
|
||||
errorText.innerHTML = alertText
|
||||
newWindow.appendChild(errorText)
|
||||
|
||||
let closeButton = document.createElement("button")
|
||||
closeButton.style.cssText = "position:relative; left: 382px; bottom: -5px; background-color:#FFFFFF; width: 55px; height:18px; font-family: 'Virtue'; border-radius:4px;border: 1px solid #000000;"
|
||||
closeButton.style.cssText = "position:absolute; left: 382px; bottom: 10px; background-color:#FFFFFF; width: 55px; height:18px; font-family: 'Virtue'; border-radius:4px;border: 1px solid #000000;"
|
||||
closeButton.innerHTML = "Close"
|
||||
closeButton.addEventListener('click', console.log('aaaaa'))
|
||||
closeButton.addEventListener('click', () => { newWindow.remove()})
|
||||
newWindow.appendChild(closeButton)
|
||||
|
||||
document.body.querySelector('#windows-layer').appendChild(newWindow)
|
||||
@ -332,6 +330,9 @@ class WindowsCompositor{
|
||||
* @param {HTMLElement} window
|
||||
*/
|
||||
static bringWindowToFront(window){ //FIXME
|
||||
if (window == null | window == undefined){
|
||||
return
|
||||
}
|
||||
let previousWindow = WindowsCompositor.windowsLayer.lastChild
|
||||
if (window != previousWindow){
|
||||
WindowsCompositor.windowsLayer.insertBefore(previousWindow, window)
|
||||
@ -347,9 +348,6 @@ class WindowsCompositor{
|
||||
|
||||
|
||||
class WebFS{
|
||||
constructor(){
|
||||
console.log("fs loaded")
|
||||
}
|
||||
/**
|
||||
* @param {string} path
|
||||
* @returns {boolean}
|
||||
|
Loading…
Reference in New Issue
Block a user