-
Notifications
You must be signed in to change notification settings - Fork 17
/
index.html
565 lines (529 loc) · 19.9 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>OS GUI — Windows 98 CSS+JS Library Demo</title>
<link href="build/layout.css" rel="stylesheet" type="text/css">
<link href="build/windows-98.css" rel="stylesheet" type="text/css">
<link href="build/windows-default.css" rel="stylesheet" title="Windows Default" type="text/css">
<link href="build/peggys-pastels.css" rel="alternate stylesheet" title="Peggy's Pastels" type="text/css">
<link rel="icon" href="images/os-gui-favicon.png" type="image/png">
<meta property="og:title" content="OS-GUI.JS">
<meta property="og:type" content="website">
<meta property="og:description"
content="A JavaScript and CSS library for creating operating system-like user interfaces.">
<meta property="og:url" content="https://os-gui.js.org/">
<meta property="og:image" content="https://os-gui.js.org/images/os-gui-logo-wallpaper-dark.png">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1920">
<meta property="og:image:height" content="1080">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html,
body {
height: 100%;
margin: 0;
display: flex;
flex-direction: column;
}
body {
font-family: sans-serif;
/*background-color: var(--Background);*/
background-color: var(--InfoWindow);
color: var(--InfoText);
/* background-color: var(--ButtonFace);
color: var(--ButtonText); */
}
header {
color: white;
background-color: #4e004e;
background: radial-gradient(circle at 50% 120%, #ff43c0, #59025c, #040005);
margin: 0;
padding: 10vw;
}
header a {
color: white;
}
main,
footer {
padding: 1em;
}
main {
flex: 1;
}
nav {
text-align: center;
font-size: 2em;
margin-top: 1em;
margin-bottom: 1em;
}
footer {
flex: 0 0 auto;
text-align: center;
background: var(--ButtonFace);
color: var(--ButtonText);
}
button:not(.window-button) {
padding: 3px;
}
p>button {
vertical-align: bottom;
/* so text in a paragraph following the button flows with consistent line spacing (vertical rhythm) */
}
.window-content {
padding: 1em;
}
#buttons-demo td button {
width: 100%;
max-width: 200px;
}
#buttons-demo,
#insets-outsets-demo {
border-collapse: collapse;
}
#buttons-demo td,
#insets-outsets-demo td {
padding: 0.5em;
}
/* can't use <col> for this because I'm conditionally changing the display property with a media query */
#buttons-demo td:first-child,
#insets-outsets-demo td:first-child {
background: var(--ButtonFace);
color: var(--ButtonText);
}
#insets-outsets-demo td:first-of-type div {
padding: 10px;
}
td:nth-child(2) code {
display: block;
background: white;
color: black;
}
@media (max-width: 800px) {
.demo-table {
display: block;
}
.demo-table tr {
display: block;
}
.demo-table tr td {
display: block;
padding: 0.5em;
}
.demo-table colgroup,
.demo-table col {
display: none;
}
}
.scrollbar-demo {
display: inline-block;
padding: 0 15px;
}
.scrollbar-demo .scrollbar-track.vertical,
.scrollbar-demo .scrollbar.vertical {
width: var(--scrollbar-size);
}
.scrollbar-demo .scrollbar-track.vertical {
height: 50px;
}
.scrollbar-demo .scrollbar-thumb.vertical {
height: 20px;
}
body {
overflow: scroll;
/* show off the custom scrollbars :) */
}
#logo-heading {
margin: 0.1em 0;
line-height: 1;
font-size: min(100px, 12vw);
text-align: center;
white-space: nowrap;
/* picked for metric compatibility - with each other, mainly; it's not that good of a match though for Laser Corps, the font I used for the logo */
/* I could do selectable text in a bullet proof way if I wanted, by specifying the sizes of spans per letter. */
font-family: Arial, Helvetica, Liberation Sans, FreeSans, sans-serif;
letter-spacing: 0.25em;
}
#logo-heading>span {
background: url('images/os-gui-logo.svg');
background-repeat: no-repeat;
background-size: contain;
background-position: center;
color: transparent;
}
/* Why two elements? Well if you make part of the link fly away, it makes clicking the link unreliable,
given that the link is no longer under your mouse. So if you're animating a link or button,
it's useful to separate the click target from the visual element that is animating. */
#spaceship-graphic {
display: inline-block;
width: 8em;
height: calc(8em * (164 / 241));
vertical-align: middle;
position: relative;
}
#spaceship-graphic::after {
content: "";
display: inline-block;
position: absolute;
top: 50%;
left: 50%;
background: url("https://i.postimg.cc/pTCqBxL0/Spaceship-tut.png");
width: 164px;
height: 241px;
transform: translate(-50%, -50%) scale(0.5) rotate(.25turn);
transition: transform 1s;
}
#spaceship-link:active #spaceship-graphic::after,
#spaceship-link:focus #spaceship-graphic::after {
transform: translate(-50%, -50%) translateX(460px) scale(0.3) rotate(.25turn);
}
</style>
</head>
<body>
<script src="demo/lib/jquery-3.3.1.js"></script>
<script src="MenuBar.js"></script>
<script src="$Window.js"></script>
<script src="parse-theme.js"></script>
<script src="demo/demo.js"></script>
<header>
<h1 id="logo-heading"><span>OS-GUI.JS</span></h1>
<nav>
<a href="https://github.com/1j01/os-gui">GitHub</a>
·
<a href="https://npmjs.com/package/os-gui">npm</a>
·
<a href="https://github.com/1j01/os-gui/blob/master/CHANGELOG.md">Changelog</a>
·
<a href="#components">Components</a>
·
<a href="#demos">Demos</a>
<!-- · -->
<!-- <a href="#themes">Themes</a> -->
</nav>
</header>
<main>
<p>
<b>OS-GUI.js</b> is a JavaScript and CSS library for creating operating system-like user interfaces.
The default theme is an accurate recreation of Windows 98's appearance.
</p>
<p>
You can find the source code and docs on <a href="https://github.com/1j01/os-gui">GitHub</a>.
This page also acts as documentation. You may want to view <a href="demo.js">this page's source code.</a>
</p>
<br>
<br>
<h2><a id="components"></a>MenuBar</h2>
<p>
The MenuBar component is an application menu bar.
It supports command menu items, checkbox menu items, and submenus.
It works with screen readers, and is keyboard/mouse/touch accessible.
You can jump to menu items by pressing the first letter of the item's label, or if defined, an access key.
Access keys are defined in the item's label by putting an ampersand (<code>&</code>) before the letter.
</p>
<div>
<div id="menubar-example" style="height: 21px;"></div>
</div>
<h2>Application Window</h2>
<p>
Application windows are windows that can be dragged around, closed, minimized, and
are usually resizable and maximizable.
</p>
<p>
Windows 98's flying titlebar animation is implemented for maximizing, minimizing, and restoring.
</p>
<p>
Even without defining a taskbar, app windows can be minimized.
It works similarly to how it does in Windows 98 if you end the Explorer task.
</p>
<div>
<div id="app-window-example" style="height: 135px;"></div>
</div>
<h2>Tool Window</h2>
<p>
Tool windows have a smaller titlebar, and are generally not resizable, maximizable, or minimizable.
They share their focus with the application window they're in, at least visually.
</p>
<p>
Tool windows that have no parent window are shown as focused as long as the browser window is focused.
This is useful for web applications where the browser window takes the place of the application window.
</p>
<div>
<div id="tool-window-example" style="height: 90px;"></div>
</div>
<h2>Combined Application Example</h2>
<p>This example shows an app window with a tool window and a menu bar.</p>
<p>The tool window shares focus with the parent app window, and always stays on top of it's parent.</p>
<p><b>Tip:</b> Remember to listen for the <code>closed</code> event on the application window
to close any tool windows.</p>
<div style="position: relative;" id="combined-application-positioners">
<div id="app-window-2-positioner"></div>
<div id="tool-window-2-positioner" style="position: absolute;"></div>
</div>
<style>
#combined-application-positioners {
height: 220px;
}
#tool-window-2-positioner {
left: 400px;
top: 30px;
}
@media screen and (max-width: 800px) {
#combined-application-positioners {
height: 260px;
}
#tool-window-2-positioner {
left: 20px;
top: 100px;
}
}
</style>
<h2>Right-To-Left Support</h2>
<p>OS-GUI supports right-to-left languages with a flipped layout. Keyboard navigation is flipped appropriately
(for entering/exiting submenus).</p>
<p>You can specify the standard HTML attribute
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir"><code>dir="rtl"</code></a>
or CSS property
<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/direction"><code>direction: rtl</code></a>
to control the layout direction.
</p>
<div style="position: relative; height: 200px;">
<div id="app-window-3-positioner"></div>
</div>
<h2>Buttons</h2>
<p>You can go <em>bananas with buttons!</em></p>
<p>Come on down to Isaiah's Button Emporium, we've got all the buttons, we've got <em>gray buttons</em>...
and... <em>more-gray</em> buttons!</p>
<p><b>Tip</b>: You should use verbs for button labels when possible. For demo purposes, labels here describe the
button type.</p>
<table id="buttons-demo" class="demo-table">
<col style="/* background/color set elsewhere */ width: 150px;" />
<col style="background: var(--InfoWindow); color: var(--InfoText);" />
<col />
<tr>
<td><button>Basic button</button></td>
<td><code><button>Basic button</button></code></td>
<td>A normal command button.</td>
</tr>
<tr>
<td><button disabled>Disabled button</button></td>
<td><code><button disabled>Disabled button</button></code></td>
<td>Use the standard <code>disabled</code> attribute to mark buttons as disabled.</td>
</tr>
<tr>
<td><button class="default">Default button</button></td>
<td><code><button class="default">Default button</button></code></td>
<td>
The default action that will be triggered if you hit Enter.
The default should change to whatever button you tab to, or if you tab to another control in a form,
return to the original default button.
<!-- This style is also shown when a focused button becomes disabled... and you can even get it
<a href="https://i.imgur.com/WICAL98.png">where it shows two buttons with the so-called "default" style</a>
(neither disabled!).
<em>OK</em>, will apply, not <em>Apply</em> (when you hit Enter).
Well, actually OK <em>does</em> apply, so maybe it's an intentional choice...
-->
</td>
</tr>
<tr>
<td>
<button class="toggle selected" aria-pressed="true" id="demo-toggle-button">Toggle button</button>
</td>
<td>
<code><button class="toggle selected" aria-pressed="true">Toggle button</button></code>
</td>
<td>
Add the <code>selected</code> class to show the button as pressed.
Include the <code>toggle</code> class to make it a toggle button.
You should also provide <code>aria-pressed</code> or <code>aria-expanded</code> attributes
as appropriate.
Examples: Start button, taskbar buttons, List/Details buttons in file open/save dialogs.
Tool buttons in Paint look a bit different.
</td>
</tr>
<!-- TODO: <tr>
<td>
<label>
<input type="checkbox">
<span class="button">Toggle button</span>
</label>
</td>
<td>
A styled checkbox.
</td>
</tr> -->
<tr>
<td>
<button class="lightweight" tabindex="-1">Lightweight button</button>
</td>
<td>
<code><button class="lightweight" tabindex="-1">Lightweight button</button></code>
</td>
<td>
No border until hover. Used for menu and toolbar buttons. Generally not focusable.
</td>
</tr>
<tr>
<td>
<button class="lightweight" disabled tabindex="-1">Lightweight disabled</button>
</td>
<td>
<code><button class="lightweight" disabled tabindex="-1">Lightweight disabled</button></code>
</td>
<td>Use the standard <code>disabled</code> attribute to mark buttons as disabled.</td>
</tr>
</table>
<h2>Scrollbars</h2>
<p>
Scrollbars are automatically styled in webkit-based/blink-based browsers (Chrome/Chromium/Opera/Edge, etc.),
but for Firefox you could use
<a href="https://kingsora.github.io/OverlayScrollbars/#!overview">OverlayScrollbars</a>
or perhaps
<a href="https://grsmto.github.io/simplebar/">SimpleBar</a>.
</p>
<p>
The triangle graphics are rendered dynamically based on the theme colors and <code>--scrollbar-size</code>
CSS variable.
Graphics are prerendered at a default size in each theme's CSS file,
but you can update the graphics with:
</p>
<pre
style="overflow: auto;">applyCSSProperties(renderThemeGraphics(getComputedStyle(element)), {element, recurseIntoIframes: true});</pre>
<div id="scrollbar-demos" style="height: 270px; overflow: auto;">
<div class="scrollbar-demo">
<div class="scrollbar-button decrement horizontal" style="display: inline-block;"></div>
<div class="scrollbar-button increment horizontal" style="display: inline-block;"></div>
<div class="scrollbar-button decrement vertical"></div>
<div class="scrollbar-button increment vertical"></div>
<br>
<div class="scrollbar-button decrement horizontal disabled" style="display: inline-block;"></div>
<div class="scrollbar-button increment horizontal disabled" style="display: inline-block;"></div>
<!-- <div class="scrollbar-button decrement vertical disabled"></div>
<div class="scrollbar-button increment vertical disabled"></div> -->
<br>
<div class="scrollbar vertical">
<div class="scrollbar-button decrement vertical disabled"></div>
<div class="scrollbar-track vertical">
<div class="scrollbar-track-piece decrement vertical"></div>
<div class="scrollbar-thumb vertical"></div>
<div class="scrollbar-track-piece increment vertical"></div>
</div>
<div class="scrollbar-button increment vertical disabled"></div>
</div>
</div>
</div>
<h2>Insets & Outsets</h2>
<table id="insets-outsets-demo" class="demo-table">
<col style="background: var(--ButtonFace); color: var(--ButtonText); width: 150px;" />
<col style="background: var(--InfoWindow); color: var(--InfoText);" />
<col />
<tr>
<td>
<div class="inset-shallow"></div>
</td>
<td>
<code><div class="inset-shallow"></div></code>
</td>
<td>
Examples: tray in taskbar, status bar sections, tool options in Paint,
Length/Position boxes in Sound Recorder
</td>
</tr>
<tr>
<td>
<div class="outset-shallow"></div>
</td>
<td>
<code><div class="outset-shallow"></div></code>
</td>
<td>
Examples: lightweight action buttons on hover
</td>
</tr>
<tr>
<td>
<div class="inset-deep"></div>
</td>
<td>
<code><div class="inset-deep"></div></code>
</td>
<td>
Examples: text inputs, content panes for pages in Help Topics or Internet Explorer
</td>
</tr>
<tr>
<td>
<div class="outset-deep"></div>
</td>
<td>
<code><div class="outset-deep"></div></code>
</td>
<td>
Examples: slider handle in Sound Recorder, buttons
</td>
</tr>
</table>
<!-- <div style="padding: 2em" class="outset-deep">Here's perhaps a panel, styled with <code>class="outset-deep"</code></div> -->
<h2><a id="demos"></a>Crazy Animation Demo</h2>
<p>Check out the interactive
<a href="demo/animation.html" id="spaceship-link">
spaceship animation demo<span id="spaceship-graphic"></span>
</a>
</p>
<h2>The Kitchen Sink</h2>
<p>
<!-- <img alt="" src="https://win98icons.alexmeub.com/icons/png/registration-0.png" width="32" height="32" style="vertical-align: middle">
<img alt="" src="https://win98icons.alexmeub.com/icons/png/msconfig-0.png" width="32" height="32" style="vertical-align: middle"> -->
<img alt="" src="https://win98icons.alexmeub.com/icons/png/tools_gear-0.png" width="32" height="32"
style="vertical-align: middle">
<!-- <a href=".."><img alt="OS GUI" src="../images/os-gui-logo-simple-italic.svg" height="32" style="vertical-align: middle"></a> — Tests -->
<img alt="" src="https://win98icons.alexmeub.com/icons/png/doctor_watson.png" width="32" height="32"
style="vertical-align: middle">
<img alt="" src="https://win98icons.alexmeub.com/icons/png/accessibility_two_windows.png" width="32"
height="32" style="vertical-align: middle;" />
<img alt="" src="https://win98icons.alexmeub.com/icons/png/accessibility_big_keys.png" width="32"
height="32" style="vertical-align: middle;" />
<img alt="" src="https://win98icons.alexmeub.com/icons/png/html-3.png" width="32" height="32"
style="vertical-align: middle;" />
<img alt="" src="https://win98icons.alexmeub.com/icons/png/file_lines-0.png" width="32" height="32"
style="vertical-align: middle;" />
<img alt="" src="https://win98icons.alexmeub.com/icons/png/camera3_network-3.png" width="32" height="32"
style="vertical-align: middle;" />
<img alt="" src="https://win98icons.alexmeub.com/icons/png/themes-2.png" width="32" height="32"
style="vertical-align: middle;" />
<img alt=""
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAl1JREFUWEfVVltywyAMFBeLc7EacC+W5GClswIRWQY/Ejcz5SvBoF1pV7IdqRUiJfx1ehM72EhEyRG5ROTD/Ig+fvR3xQI4/nyNQiCjMqNCAjvT5Ch43p/xPAos5+dBnEuUcmhk+pMASOR9rgsecyVOAl9U28rhx5xxJsAFOn11g4ZAKRMg8pFl+DCBmAnESBQCJ/5ZAjG4NI6Jpm9IsGyOs7SYZRVjTPC342QDMQF4ICQKATrkJZe8929XpQYA+PV6rSDDMMySjNCirHEcyTm+eg4BC75W3svlQtM0kZfefFMLB3BktHcBHOtUArr0a0Rut1t9/G8IxDzIyXf8whL8VQUALuLCrWJjTaZJQEptiR2RQIPDNZjmXIpn6+Q2alUALYi2e5XAGriQER5dAvf7feFHW4HeGRgU2drMc//kJTIsCCD7VmBcEgIA6IGjapgVZVDVsvdkYAI6VQTXU8+WYQ/44/HgayDM8YwHtAzlY2vvGKJ25mVs82dDWToJkQSPBBwVHIYhD3S1Ei4eeclow4nD5TNSSFhPiHxNAorM5otGhgx6vWU4VESTQGwNrlqSYWubwhdbo9YOGSGu3Y89TcCCLwiU8nMs0ajljrXMbdkkZgt8QWANtJrLjNdW5lJKbTicg+Y2Ib0hBpQzTQ9I6Tt9zXfVzF9ovkZAfMCzYcMDdXZoMDPrN8GtBNqI+pl0VSXfM+CRzHtlZhkwToteWpbn9+OzY1pvuV2Zr+nMlSyGtLMF+0lGrDIm/0Tf99ze6qaWBPrcU+dSFQM8M7CQ7rn9FQJNMmd8iuvAv0XzaDC1qAqpAAAAAElFTkSuQmCC"
width="32" height="32" style="vertical-align: middle;" />
</p>
<p><a href="demo/test.html">The kitchen sink</a>
has lots of little applets for testing, like a theme applicator, recursive dialogs, nested iframes,
and lots of bits and bobs.</p>
<h2>A Physics Sandbox</h2>
<a href="https://1j01.github.io/pbj-sandbox/" style="display: block;">
<svg style="width: 100%; height: 150px;" id="physics-teaser"></svg>
</a>
<p>
<a href="https://1j01.github.io/pbj-sandbox/" style="font-size:1.4em">PBJ Sandbox</a>
is a point-based physics toy where you can build structures out of springy connections.
The interface uses os-gui.js, with two custom themes.
</p>
<h2>A Full Web Desktop</h2>
<a href="https://98.js.org/"><img src="images/98.js.svg" height="200"></a>
<p>
<a href="https://98.js.org/" style="font-size:1.4em">98.js.org</a>
is a web-based recreation of the Windows 98 desktop,
including Paint, Sound Recorder, Solitaire, and more.
</p>
<h2>The project that started it all</h2>
<a href="https://jspaint.app"><img src="images/jspaint.svg" height="200"></a>
<p>
<a href="https://jspaint.app" style="font-size:1.4em">JS Paint</a>
is a detailed clone of MS Paint from Windows 98,
with many <a href="https://github.com/1j01/jspaint#readme">extra features</a>.
</p>
</main>
<footer>
Open source <a href="https://github.com/1j01/os-gui">on GitHub</a>.
</footer>
<script async src="demo/physics-teaser.js"></script>
</body>
</html>