rbac updated
This commit is contained in:
@@ -11,6 +11,7 @@ const restoreIcon = '🗗';
|
||||
|
||||
const startBtn = document.getElementById('start-btn');
|
||||
const startMenu = document.getElementById('start-menu');
|
||||
const taskbar = document.getElementById('taskbar');
|
||||
const windowsContainer = document.getElementById('windows');
|
||||
const taskbarWindows = document.getElementById('taskbar-windows');
|
||||
const ctx = new ContextMenu();
|
||||
@@ -21,9 +22,27 @@ const MAX_PADDING = { left: 4, top: 4, right: 4, bottom: (56 - 4) };
|
||||
|
||||
startBtn.addEventListener('click', (evt) => {
|
||||
evt.stopPropagation(); // verhindert sofortiges Schließen
|
||||
startBtn.classList.toggle('active');
|
||||
startMenu.classList.toggle('hidden');
|
||||
});
|
||||
|
||||
function updateStartMenuPosition() {
|
||||
const height = taskbar.offsetHeight;
|
||||
startMenu.style.bottom = (height + 5) + 'px';
|
||||
}
|
||||
|
||||
const observer = new ResizeObserver(entries => {
|
||||
for (let entry of entries) {
|
||||
const height = entry.contentRect.height;
|
||||
document.documentElement.style.setProperty('--auto-taskbar-height', height + 'px');
|
||||
}
|
||||
});
|
||||
|
||||
observer.observe(taskbar);
|
||||
|
||||
window.addEventListener('resize', updateStartMenuPosition);
|
||||
window.addEventListener('load', updateStartMenuPosition);
|
||||
|
||||
// Launch app when clicking start menu item
|
||||
document.addEventListener('click', async (e) => {
|
||||
const target = e.target.closest('.start-item');
|
||||
@@ -31,6 +50,7 @@ document.addEventListener('click', async (e) => {
|
||||
const clickedButton = startBtn.contains(e.target);
|
||||
|
||||
if(!clickedInsideMenu && !clickedButton) {
|
||||
startBtn.classList.remove('active');
|
||||
startMenu.classList.add('hidden');
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user