From 7f2c7f065c8eab55e1c47e064c3c8c8513d561ed Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Thu, 11 May 2023 02:06:45 +0300 Subject: [PATCH] Fix error window --- resources/wde.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/resources/wde.js b/resources/wde.js index a2cc780..f9201d8 100644 --- a/resources/wde.js +++ b/resources/wde.js @@ -255,22 +255,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 +332,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)