Compare commits

...

4 Commits

Author SHA1 Message Date
6dc162f3ff Fix blog after refactoring 2023-05-11 02:26:57 +03:00
3702495714 Refactor AboutMe app 2023-05-11 02:17:59 +03:00
50d7924728 Delete empty strings 2023-05-11 02:17:50 +03:00
7f2c7f065c Fix error window 2023-05-11 02:06:45 +03:00
4 changed files with 45 additions and 53 deletions

View File

@ -4,28 +4,26 @@ 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) => {
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);
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 scrollBar = new WdeScrollBar(newWindow.querySelector(".ScrollbarPlace"), newWindow.querySelector(".ScrollContent"))
newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) {
WebDesktopEnvironment.CloseWindow(newWindow)
})
}

View File

@ -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}`])

View File

@ -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
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 360, document.body.clientHeight*0.8 )
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'
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)
})
newWindow.querySelector("#closeWindowButton").addEventListener('click', () => {
WebDesktopEnvironment.CloseWindow(newWindow)
})
.catch((error) => {
WebDesktopEnvironment.Alert(error);
});
}
}

View File

@ -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}