Compare commits

..

No commits in common. "6dc162f3ff8b2ae0dd44ff7a5a7c27d77fd50c6d" and "4426d30342f93965a3d035cf1016c32caee23b6f" have entirely different histories.

4 changed files with 53 additions and 45 deletions

View File

@ -4,28 +4,30 @@ class BlogViewer{
} }
/** /**
* @param {string[]} chroot //TODO
* @param {string[]} args * @param {string[]} args
*/ */
async NewWindow(args){ NewWindow(args){
const response = await fetch(`app/${this.appId}/render?` + new URLSearchParams({ fetch(`${window.location.origin}/application/${this.appId}/render?` + new URLSearchParams({
isMobile: WebDesktopEnvironment.isMobile, isMobile: WebDesktopEnvironment.isMobile,
path: args[0], path: args[0],
})) }))
if (response.status != 200){ .then((response) => response.text())
WebDesktopEnvironment.Alert("Error render TODO") //TODO .then((html) => {
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

View File

@ -249,7 +249,7 @@ class FinderWindow{
} }
break break
case "blog": case "blog":
WebDesktopEnvironment.Open("/Applications/BlogViewer.app", [`${this.CurPath}/${fileName}`]) WebDesktopEnvironment.Open("blog-viewer", [`${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}`])

View File

@ -8,31 +8,35 @@ class AboutMe{
} }
/** /**
* @param {string} chroot * @param {string} path
* @param {[]string} args * @param {[]string} args
*/ */
async NewWindow(chroot, args){ NewWindow(path, args){
console.log(chroot) if (path == ""){
if (chroot == ""){ path = "/home/user/aboutme.props" //FIXME
chroot = "/home/user" //FIXME
} }
console.log(`${chroot}/AboutMe.app/aboutme.props`) const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile, path: path})
const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile, path: `${chroot}/AboutMe.app/aboutme.props`}) fetch(`/app/${this.appId}/render?`+ params)
const response = await fetch(`/app/${this.appId}/render?`+ params) .then((response) => response.text())
console.log(response) .then((html) => {
if (response.status != 200){ // console.log(document.body)
WebDesktopEnvironment.Alert("Error TODO") //TODO // let heigth = Math.max(document.body.clientHeight*0.8, scrollDiv.children[0].scrollHeight) //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);
});
} }
} }

View File

@ -186,6 +186,8 @@ class WebDesktopEnvironment{
}) })
} }
/** /**
* @param {string} appId * @param {string} appId
* @param {number} width * @param {number} width
@ -253,22 +255,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; 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; margin-left: 225px; margin-top:58px; 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", "/res/sys/wde/icons/ohno.png") alertImage.setAttribute("src", "http://localhost:8080/res/sys/wde/icons/ohno.png")
alertImage.style.cssText = "position:absolute; width:64px;height:64px;top:15px;left:25px" alertImage.style.cssText = "position:relative;width:64px;height:64px;top:15px;left:15px"
newWindow.appendChild(alertImage) newWindow.appendChild(alertImage)
let errorText = document.createElement("div") let errorText = document.createElement("div")
errorText.style.cssText = "position:absolute; width: 300px; left:128px; top:30px;font-family: 'Virtue';" errorText.style.cssText = "position:relative; 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:absolute; left: 382px; bottom: 10px; background-color:#FFFFFF; width: 55px; height:18px; font-family: 'Virtue'; border-radius:4px;border: 1px solid #000000;" 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.innerHTML = "Close" closeButton.innerHTML = "Close"
closeButton.addEventListener('click', () => { newWindow.remove()}) closeButton.addEventListener('click', console.log('aaaaa'))
newWindow.appendChild(closeButton) newWindow.appendChild(closeButton)
document.body.querySelector('#windows-layer').appendChild(newWindow) document.body.querySelector('#windows-layer').appendChild(newWindow)
@ -330,9 +332,6 @@ 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)
@ -348,6 +347,9 @@ class WindowsCompositor{
class WebFS{ class WebFS{
constructor(){
console.log("fs loaded")
}
/** /**
* @param {string} path * @param {string} path
* @returns {boolean} * @returns {boolean}