Add todo to old scrollbar

This commit is contained in:
cyber-dream 2023-04-13 19:33:29 +03:00
parent 8cb9b62b9d
commit dc7bf44576
2 changed files with 20 additions and 10 deletions

View File

@ -1,3 +1,4 @@
//TODO Delete this file
;(function(root, factory) { ;(function(root, factory) {
if (typeof exports === 'object') { if (typeof exports === 'object') {
module.exports = factory(window, document) module.exports = factory(window, document)

View File

@ -3,6 +3,7 @@ document.addEventListener('DOMContentLoaded', function() {
wde = new WebDesktopEnvironment wde = new WebDesktopEnvironment
if (!WebDesktopEnvironment.isMobile){ if (!WebDesktopEnvironment.isMobile){
WebDesktopEnvironment.Open("finder", ["kek"]) WebDesktopEnvironment.Open("finder", ["kek"])
WebDesktopEnvironment.Open("personal-properties", ["kek"])
} }
@ -13,9 +14,8 @@ class WebDesktopEnvironment{
static Applications = {}; static Applications = {};
static isMobile = false static isMobile = false
constructor(){ constructor(){
this.wc = new WindowsCompositor
WebDesktopEnvironment.isMobile = WebDesktopEnvironment.CheckMobile() WebDesktopEnvironment.isMobile = WebDesktopEnvironment.CheckMobile()
let applications = document.createElement("div") let applications = document.createElement("div")
applications.setAttribute('id', 'applications') applications.setAttribute('id', 'applications')
document.body.appendChild(applications) document.body.appendChild(applications)
@ -27,8 +27,8 @@ class WebDesktopEnvironment{
mobileDesktop.setAttribute('id', 'mobile-desktop') mobileDesktop.setAttribute('id', 'mobile-desktop')
document.body.appendChild(mobileDesktop) document.body.appendChild(mobileDesktop)
// let windowsLayer = document.createElement("div") // let windowsLayer = document.createElement("div")
// windowsLayer.setAttribute('id', 'windows-layer') // windowsLayer.setAttribute('id', 'windows-layer')
@ -46,20 +46,19 @@ class WebDesktopEnvironment{
WebDesktopEnvironment.Open("personal-properties", []) WebDesktopEnvironment.Open("personal-properties", [])
}) })
}) })
}).then(()=>{
}) })
.catch((error) => { .catch((error) => {
WebDesktopEnvironment.Alert(error); WebDesktopEnvironment.Alert(error);
}) })
} else{ } else{
document.body.style.setProperty('--zoom', 1) document.body.style.setProperty('--zoom', 1)
let windowsLayer = document.createElement("div") let windowsLayer = document.createElement("div")
windowsLayer.setAttribute('id', 'windows-layer') windowsLayer.setAttribute('id', 'windows-layer')
document.body.appendChild(windowsLayer) document.body.appendChild(windowsLayer)
} }
this.wc = new WindowsCompositor
} }
/** /**
@ -202,12 +201,15 @@ var getJSON = function(url, callback) {
}; };
class WindowsCompositor{ class WindowsCompositor{
windowLayer = undefined
movingElement = null movingElement = null
constructor(){ constructor(){
console.log("Windows Compositor is online :)"); this.windowLayer = document.body.querySelector('#windows-layer')
addEventListener("mousedown", (event) => { addEventListener("mousedown", (event) => {
this.bringWindowToFront(event.target.closest('.StandartApplicationWindow'))
this.catchClick(event) this.catchClick(event)
}) })
addEventListener("mouseup", (event) => { addEventListener("mouseup", (event) => {
this.movingElement = null this.movingElement = null
@ -220,12 +222,19 @@ class WindowsCompositor{
} }
}) })
} }
/**
* @param {HTMLElement} window
*/
bringWindowToFront(window){
console.log("kek")
this.windowLayer.insertBefore(this.windowLayer.lastChild, window)
}
/** /**
* @param {MouseEvent} event * @param {MouseEvent} event
*/ */
catchClick(event){ catchClick(event){
switch (true) { switch (true) {
case event.target.className == "WindowFrameTopBar": case event.target.className == "WindowFrameTopBar":
this.movingElement = event.target.parentElement this.movingElement = event.target.parentElement