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
|
* @param {string[]} args
|
||||||
*/
|
*/
|
||||||
NewWindow(args){
|
async NewWindow(args){
|
||||||
fetch(`${window.location.origin}/application/${this.appId}/render?` + new URLSearchParams({
|
const response = await fetch(`app/${this.appId}/render?` + new URLSearchParams({
|
||||||
isMobile: WebDesktopEnvironment.isMobile,
|
isMobile: WebDesktopEnvironment.isMobile,
|
||||||
path: args[0],
|
path: args[0],
|
||||||
}))
|
}))
|
||||||
.then((response) => response.text())
|
if (response.status != 200){
|
||||||
.then((html) => {
|
WebDesktopEnvironment.Alert("Error render TODO") //TODO
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const html = await response.text()
|
||||||
|
|
||||||
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 500, 350 )
|
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 500, 350 )
|
||||||
newWindow.innerHTML = html
|
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"))
|
let scrollBar = new WdeScrollBar(newWindow.querySelector(".ScrollbarPlace"), newWindow.querySelector(".ScrollContent"))
|
||||||
newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) {
|
newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) {
|
||||||
WebDesktopEnvironment.CloseWindow(newWindow)
|
WebDesktopEnvironment.CloseWindow(newWindow)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
WebDesktopEnvironment.Alert(error);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {MouseEvent} event
|
* @param {MouseEvent} event
|
||||||
|
@ -249,7 +249,7 @@ class FinderWindow{
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case "blog":
|
case "blog":
|
||||||
WebDesktopEnvironment.Open("blog-viewer", [`${this.CurPath}/${fileName}`])
|
WebDesktopEnvironment.Open("/Applications/BlogViewer.app", [`${this.CurPath}/${fileName}`])
|
||||||
break
|
break
|
||||||
case "personal-properties":
|
case "personal-properties":
|
||||||
WebDesktopEnvironment.Open("personal-properties", [`${this.CurPath}/${fileName}`])
|
WebDesktopEnvironment.Open("personal-properties", [`${this.CurPath}/${fileName}`])
|
||||||
|
@ -8,35 +8,31 @@ class AboutMe{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} path
|
* @param {string} chroot
|
||||||
* @param {[]string} args
|
* @param {[]string} args
|
||||||
*/
|
*/
|
||||||
NewWindow(path, args){
|
async NewWindow(chroot, args){
|
||||||
if (path == ""){
|
console.log(chroot)
|
||||||
path = "/home/user/aboutme.props" //FIXME
|
if (chroot == ""){
|
||||||
|
chroot = "/home/user" //FIXME
|
||||||
}
|
}
|
||||||
const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile, path: path})
|
console.log(`${chroot}/AboutMe.app/aboutme.props`)
|
||||||
fetch(`/app/${this.appId}/render?`+ params)
|
const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile, path: `${chroot}/AboutMe.app/aboutme.props`})
|
||||||
.then((response) => response.text())
|
const response = await fetch(`/app/${this.appId}/render?`+ params)
|
||||||
.then((html) => {
|
console.log(response)
|
||||||
// console.log(document.body)
|
if (response.status != 200){
|
||||||
// let heigth = Math.max(document.body.clientHeight*0.8, scrollDiv.children[0].scrollHeight) //TODO
|
WebDesktopEnvironment.Alert("Error TODO") //TODO
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const html = await response.text()
|
||||||
|
|
||||||
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 360, document.body.clientHeight*0.8 )
|
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 360, document.body.clientHeight*0.8 )
|
||||||
|
|
||||||
newWindow.innerHTML = html
|
newWindow.innerHTML = html
|
||||||
newWindow.style.height = 'auto'
|
newWindow.style.height = 'auto'
|
||||||
|
|
||||||
// console.log(newWindow.querySelector('.ScrollBarScrollElement'))
|
|
||||||
|
|
||||||
// let scrollBar = new WdeScrollBar(newWindow.querySelector('.ScrollbarPlace'), newWindow.querySelector('.PropsView'))
|
|
||||||
|
|
||||||
newWindow.querySelector("#closeWindowButton").addEventListener('click', () => {
|
newWindow.querySelector("#closeWindowButton").addEventListener('click', () => {
|
||||||
// console.log("qewqweqweqweqwe")
|
|
||||||
WebDesktopEnvironment.CloseWindow(newWindow)
|
WebDesktopEnvironment.CloseWindow(newWindow)
|
||||||
})
|
})
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
WebDesktopEnvironment.Alert(error);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -186,8 +186,6 @@ class WebDesktopEnvironment{
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} appId
|
* @param {string} appId
|
||||||
* @param {number} width
|
* @param {number} width
|
||||||
@ -255,22 +253,22 @@ class WebDesktopEnvironment{
|
|||||||
let newWindow = document.createElement("div")
|
let newWindow = document.createElement("div")
|
||||||
newWindow.setAttribute("class", "WindowFrameless")
|
newWindow.setAttribute("class", "WindowFrameless")
|
||||||
newWindow.setAttribute("windowId", "SuperUniqUUID") //TODO:
|
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")
|
let alertImage = document.createElement("img")
|
||||||
alertImage.setAttribute("src", "http://localhost:8080/res/sys/wde/icons/ohno.png")
|
alertImage.setAttribute("src", "/res/sys/wde/icons/ohno.png")
|
||||||
alertImage.style.cssText = "position:relative;width:64px;height:64px;top:15px;left:15px"
|
alertImage.style.cssText = "position:absolute; width:64px;height:64px;top:15px;left:25px"
|
||||||
newWindow.appendChild(alertImage)
|
newWindow.appendChild(alertImage)
|
||||||
|
|
||||||
let errorText = document.createElement("div")
|
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
|
errorText.innerHTML = alertText
|
||||||
newWindow.appendChild(errorText)
|
newWindow.appendChild(errorText)
|
||||||
|
|
||||||
let closeButton = document.createElement("button")
|
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.innerHTML = "Close"
|
||||||
closeButton.addEventListener('click', console.log('aaaaa'))
|
closeButton.addEventListener('click', () => { newWindow.remove()})
|
||||||
newWindow.appendChild(closeButton)
|
newWindow.appendChild(closeButton)
|
||||||
|
|
||||||
document.body.querySelector('#windows-layer').appendChild(newWindow)
|
document.body.querySelector('#windows-layer').appendChild(newWindow)
|
||||||
@ -332,6 +330,9 @@ class WindowsCompositor{
|
|||||||
* @param {HTMLElement} window
|
* @param {HTMLElement} window
|
||||||
*/
|
*/
|
||||||
static bringWindowToFront(window){ //FIXME
|
static bringWindowToFront(window){ //FIXME
|
||||||
|
if (window == null | window == undefined){
|
||||||
|
return
|
||||||
|
}
|
||||||
let previousWindow = WindowsCompositor.windowsLayer.lastChild
|
let previousWindow = WindowsCompositor.windowsLayer.lastChild
|
||||||
if (window != previousWindow){
|
if (window != previousWindow){
|
||||||
WindowsCompositor.windowsLayer.insertBefore(previousWindow, window)
|
WindowsCompositor.windowsLayer.insertBefore(previousWindow, window)
|
||||||
@ -347,9 +348,6 @@ class WindowsCompositor{
|
|||||||
|
|
||||||
|
|
||||||
class WebFS{
|
class WebFS{
|
||||||
constructor(){
|
|
||||||
console.log("fs loaded")
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @param {string} path
|
* @param {string} path
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
|
Loading…
Reference in New Issue
Block a user