Added Dino game to Browser
|
|
@ -95,6 +95,7 @@
|
||||||
- Favicon support
|
- Favicon support
|
||||||
- Back/Forward & Reload
|
- Back/Forward & Reload
|
||||||
- Google search via Address bar
|
- Google search via Address bar
|
||||||
|
- [chrome://dino](https://github.com/wayou/t-rex-runner) game
|
||||||
|
|
||||||
### [DevTools](https://eruda.liriliri.io/)
|
### [DevTools](https://eruda.liriliri.io/)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,17 @@ import { FAVICON_BASE_PATH } from "utils/constants";
|
||||||
type Bookmark = {
|
type Bookmark = {
|
||||||
icon: string;
|
icon: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
path?: string;
|
||||||
url: string;
|
url: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const DINO_GAME = {
|
||||||
|
icon: "/System/Icons/Favicons/dino.webp",
|
||||||
|
name: "T-Rex Chrome Dino Game",
|
||||||
|
path: "/Program Files/Browser/dino/index.html",
|
||||||
|
url: "chrome://dino",
|
||||||
|
};
|
||||||
|
|
||||||
export const bookmarks: Bookmark[] = [
|
export const bookmarks: Bookmark[] = [
|
||||||
{
|
{
|
||||||
icon: FAVICON_BASE_PATH,
|
icon: FAVICON_BASE_PATH,
|
||||||
|
|
@ -37,6 +45,7 @@ export const bookmarks: Bookmark[] = [
|
||||||
name: "AaronOS",
|
name: "AaronOS",
|
||||||
url: "https://aaronos.dev/",
|
url: "https://aaronos.dev/",
|
||||||
},
|
},
|
||||||
|
DINO_GAME,
|
||||||
];
|
];
|
||||||
|
|
||||||
export const HOME_PAGE = "https://www.google.com/webhp?igu=1";
|
export const HOME_PAGE = "https://www.google.com/webhp?igu=1";
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import { Arrow, Refresh, Stop } from "components/apps/Browser/NavigationIcons";
|
import { Arrow, Refresh, Stop } from "components/apps/Browser/NavigationIcons";
|
||||||
import StyledBrowser from "components/apps/Browser/StyledBrowser";
|
import StyledBrowser from "components/apps/Browser/StyledBrowser";
|
||||||
import { HOME_PAGE, bookmarks } from "components/apps/Browser/config";
|
import {
|
||||||
|
DINO_GAME,
|
||||||
|
HOME_PAGE,
|
||||||
|
bookmarks,
|
||||||
|
} from "components/apps/Browser/config";
|
||||||
import { type ComponentProcessProps } from "components/system/Apps/RenderComponent";
|
import { type ComponentProcessProps } from "components/system/Apps/RenderComponent";
|
||||||
import useTitle from "components/system/Window/useTitle";
|
import useTitle from "components/system/Window/useTitle";
|
||||||
import { useFileSystem } from "contexts/fileSystem";
|
import { useFileSystem } from "contexts/fileSystem";
|
||||||
|
|
@ -59,7 +63,13 @@ const Browser: FC<ComponentProcessProps> = ({ id }) => {
|
||||||
if (isHtml) setSrcDoc((await readFile(addressInput)).toString());
|
if (isHtml) setSrcDoc((await readFile(addressInput)).toString());
|
||||||
setIcon(id, processDirectory.Browser.icon);
|
setIcon(id, processDirectory.Browser.icon);
|
||||||
|
|
||||||
if (!isHtml) {
|
if (addressInput.startsWith(DINO_GAME.url)) {
|
||||||
|
contentWindow.location.replace(
|
||||||
|
`${window.location.origin}${DINO_GAME.path}`
|
||||||
|
);
|
||||||
|
|
||||||
|
prependFileToTitle(`${DINO_GAME.url}/`);
|
||||||
|
} else if (!isHtml) {
|
||||||
const addressUrl = await getUrlOrSearch(addressInput);
|
const addressUrl = await getUrlOrSearch(addressInput);
|
||||||
|
|
||||||
contentWindow.location.replace(addressUrl);
|
contentWindow.location.replace(addressUrl);
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ This project is greatly augmented by code from the open source community. Thank
|
||||||
- [opentype.js](https://github.com/opentypejs/opentype.js)
|
- [opentype.js](https://github.com/opentypejs/opentype.js)
|
||||||
- [nostr-tools](https://github.com/nbd-wtf/nostr-tools)
|
- [nostr-tools](https://github.com/nbd-wtf/nostr-tools)
|
||||||
- [DOMPurify](https://github.com/cure53/DOMPurify)
|
- [DOMPurify](https://github.com/cure53/DOMPurify)
|
||||||
|
- [t-rex-runner](https://github.com/wayou/t-rex-runner)
|
||||||
|
|
||||||
## Services
|
## Services
|
||||||
|
|
||||||
|
|
|
||||||
29
public/Program Files/Browser/dino/LICENSE
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
BSD 3-Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2022, 牛さん
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
After Width: | Height: | Size: 382 B |
|
After Width: | Height: | Size: 196 B |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 479 B |
|
After Width: | Height: | Size: 269 B |
|
After Width: | Height: | Size: 3.2 KiB |
BIN
public/Program Files/Browser/dino/assets/offline-sprite-1x.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
179
public/Program Files/Browser/dino/index.css
Normal file
|
|
@ -0,0 +1,179 @@
|
||||||
|
/* Copyright 2013 The Chromium Authors. All rights reserved.
|
||||||
|
* Use of this source code is governed by a BSD-style license that can be
|
||||||
|
* found in the LICENSE file. */
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
place-content: center;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
-webkit-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-offline {
|
||||||
|
content: -webkit-image-set( url(assets/default_100_percent/100-error-offline.png) 1x, url(assets/default_200_percent/200-error-offline.png) 2x);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-family: 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 500;
|
||||||
|
padding-top: 75px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.touch {
|
||||||
|
padding-top: 85px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Offline page */
|
||||||
|
|
||||||
|
.offline .interstitial-wrapper {
|
||||||
|
color: #2b2b2b;
|
||||||
|
font-size: 1em;
|
||||||
|
line-height: 1.55;
|
||||||
|
margin: 0 auto;
|
||||||
|
max-width: 600px;
|
||||||
|
padding-top: 100px;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.offline .runner-container {
|
||||||
|
height: 150px;
|
||||||
|
max-width: 600px;
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute;
|
||||||
|
top: 35px;
|
||||||
|
width: 44px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.offline .runner-canvas {
|
||||||
|
height: 150px;
|
||||||
|
max-width: 600px;
|
||||||
|
opacity: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.offline .controller {
|
||||||
|
background: rgba(247, 247, 247, .1);
|
||||||
|
height: 100vh;
|
||||||
|
left: 0;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
width: 100vw;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#offline-resources {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 420px) {
|
||||||
|
.suggested-left > #control-buttons, .suggested-right > #control-buttons {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
.snackbar {
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-height: 350px) {
|
||||||
|
h1 {
|
||||||
|
margin: 0 0 15px;
|
||||||
|
}
|
||||||
|
.icon-offline {
|
||||||
|
margin: 0 0 10px;
|
||||||
|
}
|
||||||
|
.interstitial-wrapper {
|
||||||
|
margin-top: 5%;
|
||||||
|
}
|
||||||
|
.nav-wrapper {
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 600px) and (max-width: 736px) and (orientation: landscape) {
|
||||||
|
.offline .interstitial-wrapper {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 420px) and (max-width: 736px) and (min-height: 240px) and (max-height: 420px) and (orientation:landscape) {
|
||||||
|
.interstitial-wrapper {
|
||||||
|
margin-bottom: 100px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-height: 240px) and (orientation: landscape) {
|
||||||
|
.offline .interstitial-wrapper {
|
||||||
|
margin-bottom: 90px;
|
||||||
|
}
|
||||||
|
.icon-offline {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-height: 320px) and (orientation: landscape) {
|
||||||
|
.icon-offline {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.offline .runner-container {
|
||||||
|
top: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 240px) {
|
||||||
|
.interstitial-wrapper {
|
||||||
|
overflow: inherit;
|
||||||
|
padding: 0 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.arcade-mode,
|
||||||
|
.arcade-mode .runner-container,
|
||||||
|
.arcade-mode .runner-canvas {
|
||||||
|
image-rendering: pixelated;
|
||||||
|
max-width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arcade-mode #buttons,
|
||||||
|
.arcade-mode #main-content {
|
||||||
|
opacity: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arcade-mode .interstitial-wrapper {
|
||||||
|
height: 100vh;
|
||||||
|
max-width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arcade-mode .runner-container {
|
||||||
|
left: 0;
|
||||||
|
margin: auto;
|
||||||
|
right: 0;
|
||||||
|
transform-origin: top center;
|
||||||
|
transition: transform 250ms cubic-bezier(0.4, 0, 1, 1) 400ms;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
48
public/Program Files/Browser/dino/index.html
Normal file
2752
public/Program Files/Browser/dino/index.js
Normal file
BIN
public/System/Icons/Favicons/16x16/dino.png
Normal file
|
After Width: | Height: | Size: 243 B |
BIN
public/System/Icons/Favicons/16x16/dino.webp
Normal file
|
After Width: | Height: | Size: 182 B |