From 70bcc60edd9a6638192899d29d1966ed4b94c78a Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Tue, 2 May 2023 14:32:56 +0300 Subject: [PATCH] Add initial alert ui window --- resources/sys/finder/finder.js | 3 ++- resources/sys/wde/icons/ohno.png | 3 +++ resources/wde.js | 32 +++++++++++++++++++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 resources/sys/wde/icons/ohno.png diff --git a/resources/sys/finder/finder.js b/resources/sys/finder/finder.js index 8eb95e3..5f836eb 100644 --- a/resources/sys/finder/finder.js +++ b/resources/sys/finder/finder.js @@ -133,7 +133,8 @@ class Finder{ WebDesktopEnvironment.Open("img-viewer", [this.path + "/" + fileName]) break; default: - console.log("Unsupported file type") + // console.log("Unsupported file type") + WebDesktopEnvironment.Alert("Unsupported file type") break; } } diff --git a/resources/sys/wde/icons/ohno.png b/resources/sys/wde/icons/ohno.png new file mode 100644 index 0000000..0581cdd --- /dev/null +++ b/resources/sys/wde/icons/ohno.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e6b3bab266893bb392a45568132c034b5e39e4203a22f2de855f1f571111987 +size 4037 diff --git a/resources/wde.js b/resources/wde.js index bd05eb5..19535bf 100644 --- a/resources/wde.js +++ b/resources/wde.js @@ -184,7 +184,37 @@ class WebDesktopEnvironment{ * @param {string} alertText */ static Alert(alertText){ - console.log(alertText) + WebDesktopEnvironment.CreateAlertWindow(alertText) + // console.log(alertText) + } + + /** + * @param {string} alertText + */ + static CreateAlertWindow(alertText){ + console.log("alertWinfdo") + let newWindow = document.createElement("div") + newWindow.setAttribute("class", "WindowFrameless") + newWindow.setAttribute("windowId", "SuperUniqUUID") //TODO: + newWindow.style.cssText = "postiton: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") + 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" + newWindow.appendChild(alertImage) + + let errorText = document.createElement("div") + errorText.style.cssText = "position:relative; 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.innerHTML = "Close" + closeButton.addEventListener('click', console.log('aaaaa')) + newWindow.appendChild(closeButton) + + document.body.querySelector('#windows-layer').appendChild(newWindow) } static CheckMobile(){