-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.html
113 lines (107 loc) · 3.17 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>StartOS</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="toolbar">
<div class="toolbar-section">
<div class="menu-button">
<button
class="toolbar-button bold"
onclick="toggleMenu('start-menu')"
>
StartOS
</button>
<div id="start-menu" class="menu">
<ul>
<li onclick="handleMenuClick('start-menu', createConfigWindow)">
Settings
</li>
</ul>
</div>
</div>
<div class="menu-button">
<button class="toolbar-button" onclick="toggleMenu('window-menu')">
New Window
</button>
<div id="window-menu" class="menu">
<ul>
<li
onclick="handleMenuClick('window-menu', createAddBookmarksWindow)"
>
Bookmarks
</li>
<li onclick="handleMenuClick('window-menu', createAddNoteWindow)">
Note
</li>
<li
onclick="handleMenuClick('window-menu', createAddPictureWindow)"
>
Image
</li>
<li
onclick="handleMenuClick('window-menu', createAddVideoWindow)"
>
Video
</li>
</ul>
</div>
</div>
</div>
<div class="toolbar-section">
<a class="toolbar-button" href="https://github.com/Jaredk3nt/startos">
GitHub
</a>
<p id="toolbar-time" class="toolbar-button"></p>
</div>
</div>
<div id="desktop"></div>
<script>
let currentWindow;
let windows = {};
let config = {};
let zIndex = 0;
// Constants
const LS_WINDOWS_KEY = "startwave-windows";
const LS_CONFIG_KEY = "startwave-config";
const DEFAULT_LOCATON = { x: 8, y: 32 };
const DAYS = ["Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat"];
function genId() {
return "window-" + Math.random().toString(16).slice(2);
}
function safeParse(item) {
try {
return JSON.parse(item);
} catch (err) {
return undefined;
}
}
setDateTime();
const s = new Date().getSeconds();
setTimeout(() => {
setDateTime();
setInterval(setDateTime, 1000 * 60);
}, (60 - s) * 1000);
function setDateTime() {
const timeEl = document.getElementById("toolbar-time");
const d = new Date();
const hours = ((d.getHours() + 11) % 12) + 1;
timeEl.innerText = `${
DAYS[d.getDay()]
} ${hours}:${d.getMinutes().toString().padStart(2, "0")}`;
}
</script>
<script src="src/utils/windows.js"></script>
<script src="src/windows.js"></script>
<script src="src/utils/config.js"></script>
<script src="src/utils/dragable.js"></script>
<script>
loadConfig();
loadWindows();
</script>
</body>
</html>