mirror of
https://github.com/ghndrx/webos.git
synced 2026-02-10 06:45:00 +00:00
Add working Start menu with app launcher
This commit is contained in:
30
js/app.js
30
js/app.js
@@ -12,6 +12,7 @@ class GregOS {
|
||||
this.bindIconClicks();
|
||||
this.startClock();
|
||||
this.setupTerminal();
|
||||
this.setupStartMenu();
|
||||
}
|
||||
|
||||
bindIconClicks() {
|
||||
@@ -211,6 +212,35 @@ class GregOS {
|
||||
setInterval(updateClock, 1000);
|
||||
}
|
||||
|
||||
setupStartMenu() {
|
||||
const startButton = document.querySelector('.start-button');
|
||||
const startMenu = document.getElementById('start-menu');
|
||||
|
||||
startButton.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
startMenu.classList.toggle('open');
|
||||
startButton.classList.toggle('active');
|
||||
});
|
||||
|
||||
// Close menu when clicking elsewhere
|
||||
document.addEventListener('click', (e) => {
|
||||
if (!startMenu.contains(e.target) && !startButton.contains(e.target)) {
|
||||
startMenu.classList.remove('open');
|
||||
startButton.classList.remove('active');
|
||||
}
|
||||
});
|
||||
|
||||
// Start menu item clicks
|
||||
document.querySelectorAll('.start-menu-item').forEach(item => {
|
||||
item.addEventListener('click', () => {
|
||||
const windowId = item.dataset.window;
|
||||
this.openWindow(windowId);
|
||||
startMenu.classList.remove('open');
|
||||
startButton.classList.remove('active');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
setupTerminal() {
|
||||
document.addEventListener('keydown', (e) => {
|
||||
const input = document.getElementById('terminal-input');
|
||||
|
||||
Reference in New Issue
Block a user