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) {
if (typeof exports === 'object') {
module.exports = factory(window, document)

View File

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