byte-launcher 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.html +89 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BYTE launcher for unpkg
|
|
2
2
|
|
|
3
|
-
One page (`index.html`)
|
|
3
|
+
One page (`index.html`): completely black until the first click, then a launcher with app tiles (BYTE, Games, Soundboard, Tools). The chosen app opens full-window in a frame; the browser Back button returns to the launcher. Published as an npm package,
|
|
4
4
|
it opens at `https://unpkg.com/<package-name>@<version>/index.html`.
|
|
5
5
|
|
|
6
6
|
BYTE itself still runs on its own server; this page is only a doorway to it. It needs the
|
package/index.html
CHANGED
|
@@ -4,32 +4,101 @@
|
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
6
|
<meta name="robots" content="noindex">
|
|
7
|
-
<title
|
|
8
|
-
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'
|
|
7
|
+
<title>‎</title>
|
|
8
|
+
<link rel="icon" id="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'/%3E">
|
|
9
9
|
<style>
|
|
10
|
-
html, body { margin: 0; height: 100%; background: #
|
|
11
|
-
|
|
12
|
-
#
|
|
10
|
+
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; color: #dbe4ff; font: 16px/1.5 system-ui, sans-serif; }
|
|
11
|
+
/* 1. Nothing but black until the first click or key press. */
|
|
12
|
+
#cover { position: fixed; inset: 0; z-index: 3; background: #000; border: 0; padding: 0; margin: 0; width: 100%; height: 100%; cursor: default; outline: 0; }
|
|
13
|
+
/* 2. The launcher. */
|
|
14
|
+
#launcher { position: fixed; inset: 0; z-index: 2; overflow: auto; background: radial-gradient(1200px 700px at 50% -10%, #12224a, #03060e 60%); }
|
|
15
|
+
#launcher .wrap { max-width: 880px; margin: 0 auto; padding: 9vh 16px 48px; }
|
|
16
|
+
#launcher h1 { margin: 0 0 4px; font-size: 34px; color: #fff; }
|
|
17
|
+
#launcher p.lead { margin: 0 0 28px; color: #9fb0d8; }
|
|
18
|
+
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
|
|
19
|
+
.tile { display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 18px; border-radius: 16px; border: 1px solid #ffffff22; background: #ffffff0d; color: inherit; font: inherit; cursor: pointer; }
|
|
20
|
+
.tile:hover, .tile:focus-visible { background: #ffffff1a; border-color: #7db0ff; outline: 0; }
|
|
21
|
+
.tile .kind { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #7db0ff; }
|
|
22
|
+
.tile .name { font-size: 20px; font-weight: 700; color: #fff; }
|
|
23
|
+
.tile .text { color: #b9c6e6; font-size: 14px; flex: 1; }
|
|
24
|
+
.tile .go { align-self: flex-start; margin-top: 6px; padding: 7px 14px; border-radius: 999px; background: #1d6cff; color: #fff; font-weight: 600; font-size: 14px; }
|
|
25
|
+
#launcher .tip { margin-top: 26px; color: #7f8db3; font-size: 13px; }
|
|
26
|
+
/* 3. The app, full window. */
|
|
27
|
+
iframe { position: fixed; inset: 0; z-index: 1; width: 100%; height: 100%; border: 0; background: #03060e; }
|
|
28
|
+
#msg { position: fixed; inset: 0; z-index: 4; display: none; place-items: center; padding: 24px; text-align: center; background: #03060e; }
|
|
13
29
|
#msg a { color: #7db0ff; }
|
|
30
|
+
[hidden] { display: none !important; }
|
|
14
31
|
</style>
|
|
15
32
|
</head>
|
|
16
33
|
<body>
|
|
17
|
-
<!-- BYTE launcher.
|
|
18
|
-
To point it at another BYTE address, change
|
|
19
|
-
<
|
|
34
|
+
<!-- BYTE launcher. Black until clicked, then a list of apps; each app runs on BYTE's own server and is shown in a frame.
|
|
35
|
+
To point it at another BYTE address, change BYTE_SITE below and publish a new version. -->
|
|
36
|
+
<button id="cover" type="button" aria-label="Open"></button>
|
|
37
|
+
<div id="launcher" hidden><div class="wrap">
|
|
38
|
+
<h1>BYTE launcher</h1>
|
|
39
|
+
<p class="lead">Pick what to open.</p>
|
|
40
|
+
<div class="grid" id="apps"></div>
|
|
41
|
+
<p class="tip">To open another app, use your browser's Back button, then click the black page.</p>
|
|
42
|
+
</div></div>
|
|
43
|
+
<div id="msg"><p>That did not load here.<br><a id="direct" rel="noopener">Open it directly</a></p></div>
|
|
20
44
|
<script>
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
document.getElementById(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
var BYTE_SITE = 'https://apps.handytechhelper.com';
|
|
46
|
+
var APPS = [
|
|
47
|
+
{ id: 'byte', kind: 'Web browser', name: 'BYTE', text: 'A browser inside this page, with tabs, bookmarks and themes.', go: 'Open BYTE', url: BYTE_SITE + '/browse' },
|
|
48
|
+
{ id: 'games', kind: 'Play', name: 'Games', text: 'Pick a game and play it right here. Nothing to install.', go: 'Open Games', url: BYTE_SITE + '/browse?url=' + encodeURIComponent('byte://games') },
|
|
49
|
+
{ id: 'sounds', kind: 'Fun', name: 'Soundboard', text: 'Thousands of sound buttons. Search and tap to play.', go: 'Open Soundboard', url: BYTE_SITE + '/browse?url=' + encodeURIComponent('byte://soundboard') },
|
|
50
|
+
{ id: 'tools', kind: 'Tools website', name: 'HandyTechHelper Tools', text: '80+ free tools for images, PDFs, text and code. Opens in a new tab.', go: 'Open', url: 'https://handytechhelper.com/', tab: true }
|
|
51
|
+
];
|
|
52
|
+
var $ = function (id) { return document.getElementById(id); };
|
|
53
|
+
var frame = null, timer = 0;
|
|
54
|
+
|
|
55
|
+
function closeApp() {
|
|
56
|
+
clearTimeout(timer);
|
|
57
|
+
if (frame) { frame.remove(); frame = null; }
|
|
58
|
+
$('msg').style.display = 'none';
|
|
59
|
+
$('launcher').hidden = false;
|
|
60
|
+
}
|
|
61
|
+
function openApp(app) {
|
|
62
|
+
if (app.tab) { window.open(app.url, '_blank', 'noopener'); return; }
|
|
63
|
+
closeApp();
|
|
64
|
+
var f = frame = document.createElement('iframe');
|
|
65
|
+
f.allow = 'fullscreen; autoplay; clipboard-read; clipboard-write; gamepad; encrypted-media; picture-in-picture';
|
|
66
|
+
f.allowFullscreen = true;
|
|
67
|
+
f.title = app.name;
|
|
68
|
+
f.src = app.url;
|
|
69
|
+
document.body.appendChild(f);
|
|
70
|
+
$('launcher').hidden = true;
|
|
71
|
+
$('direct').href = app.url;
|
|
72
|
+
// If nothing has arrived after a while (BYTE is down or blocked on this network), say so.
|
|
73
|
+
var loaded = false;
|
|
74
|
+
f.addEventListener('load', function () { loaded = true; });
|
|
75
|
+
timer = setTimeout(function () { if (!loaded && frame === f) $('msg').style.display = 'grid'; }, 15000);
|
|
76
|
+
try { history.pushState({ app: app.id }, ''); } catch (e) {}
|
|
77
|
+
}
|
|
78
|
+
// The browser's Back button leaves the app; the page goes black again until the next click.
|
|
79
|
+
addEventListener('popstate', function () { if (frame) { closeApp(); cover(); } });
|
|
80
|
+
|
|
81
|
+
APPS.forEach(function (app) {
|
|
82
|
+
var b = document.createElement('button');
|
|
83
|
+
b.type = 'button'; b.className = 'tile'; b.dataset.app = app.id;
|
|
84
|
+
[['kind', app.kind], ['name', app.name], ['text', app.text], ['go', app.go]].forEach(function (p) {
|
|
85
|
+
var s = document.createElement('span'); s.className = p[0]; s.textContent = p[1]; b.appendChild(s);
|
|
86
|
+
});
|
|
87
|
+
b.addEventListener('click', function () { openApp(app); });
|
|
88
|
+
$('apps').appendChild(b);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// While black, the tab has no name and no icon either.
|
|
92
|
+
var ICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='8' fill='%231d6cff'/%3E%3Ctext x='16' y='23' font-size='20' font-weight='700' text-anchor='middle' fill='%23fff' font-family='Georgia,serif'%3EB%3C/text%3E%3C/svg%3E", BLANK = $('icon').href;
|
|
93
|
+
function cover() { $('cover').hidden = false; $('launcher').hidden = true; document.title = '\u200e'; $('icon').href = BLANK; }
|
|
94
|
+
function uncover() {
|
|
95
|
+
if ($('cover').hidden) return;
|
|
96
|
+
$('cover').hidden = true;
|
|
97
|
+
$('launcher').hidden = false;
|
|
98
|
+
document.title = 'BYTE'; $('icon').href = ICON;
|
|
99
|
+
}
|
|
100
|
+
$('cover').addEventListener('click', uncover);
|
|
101
|
+
addEventListener('keydown', uncover);
|
|
33
102
|
</script>
|
|
34
103
|
</body>
|
|
35
104
|
</html>
|