fullscreen button (kinda)
This commit is contained in:
parent
740abc9f2c
commit
0f49cbeabd
|
|
@ -10,6 +10,10 @@ iframe.browser {
|
||||||
margin-top: var(--browser-bar-height);
|
margin-top: var(--browser-bar-height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iframe.browser.fullscren {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
[data-mode="tall"] iframe.browser {
|
[data-mode="tall"] iframe.browser {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
@ -48,6 +52,12 @@ iframe:focus {
|
||||||
transform: scaleX(-1);
|
transform: scaleX(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#fullscreen-button {
|
||||||
|
position: absolute;
|
||||||
|
right: 15;
|
||||||
|
top: -1;
|
||||||
|
}
|
||||||
|
|
||||||
#close-button {
|
#close-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: -10;
|
right: -10;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ export const Layout: FC = async ({ children, title }) => (
|
||||||
<link href="/css/reset.css" rel="stylesheet" />
|
<link href="/css/reset.css" rel="stylesheet" />
|
||||||
<link href="/css/main.css" rel="stylesheet" />
|
<link href="/css/main.css" rel="stylesheet" />
|
||||||
<link href="/css/game.css" rel="stylesheet" />
|
<link href="/css/game.css" rel="stylesheet" />
|
||||||
<link href="/css/browser.css" rel="stylesheet" />
|
|
||||||
|
|
||||||
<script type="importmap" dangerouslySetInnerHTML={{ __html: `{ "imports": { "@/": "/" } }` }} />
|
<script type="importmap" dangerouslySetInnerHTML={{ __html: `{ "imports": { "@/": "/" } }` }} />
|
||||||
<script src={process.env.NODE_ENV === "production" ? `/bundle.js?${GIT_SHA}` : "/js/main.js"} type="module" async></script>
|
<script src={process.env.NODE_ENV === "production" ? `/bundle.js?${GIT_SHA}` : "/js/main.js"} type="module" async></script>
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,14 @@ export const Terminal: FC = async () => (
|
||||||
<>
|
<>
|
||||||
<link rel="stylesheet" href="/css/terminal.css" />
|
<link rel="stylesheet" href="/css/terminal.css" />
|
||||||
<link rel="stylesheet" href="/css/editor.css" />
|
<link rel="stylesheet" href="/css/editor.css" />
|
||||||
|
<link rel="stylesheet" href="/css/browser.css" />
|
||||||
|
|
||||||
<div id="browser-controls" style="display:none">
|
<div id="browser-controls" style="display:none">
|
||||||
<a id="back-button" href="#"></a>
|
<a id="back-button" href="#"></a>
|
||||||
<a id="forward-button" href="#"></a>
|
<a id="forward-button" href="#"></a>
|
||||||
<a id="stop-button" href="#"></a>
|
<a id="stop-button" href="#"></a>
|
||||||
<a id="reload-button" href="#">@</a>
|
<a id="reload-button" href="#">@</a>
|
||||||
|
<a id="fullscreen-button" href="#"></a>
|
||||||
<a id="close-button" href="#">╳</a>
|
<a id="close-button" href="#">╳</a>
|
||||||
<span id="browser-address">chris.nose-pluto.local</span>
|
<span id="browser-address">chris.nose-pluto.local</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,8 @@ function handleClick(e: MouseEvent) {
|
||||||
stopLoading(); break
|
stopLoading(); break
|
||||||
case "reload-button":
|
case "reload-button":
|
||||||
reloadBrowser(); break
|
reloadBrowser(); break
|
||||||
|
case "fullscreen-button":
|
||||||
|
fullscreenBrowser(); break
|
||||||
case "close-button":
|
case "close-button":
|
||||||
closeBrowser(); break
|
closeBrowser(); break
|
||||||
default:
|
default:
|
||||||
|
|
@ -136,6 +138,11 @@ function stopLoading() {
|
||||||
sendNavCommand('stop')
|
sendNavCommand('stop')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fullscreenBrowser() {
|
||||||
|
controls.style.display = 'none'
|
||||||
|
iframe.classList.add('fullscren')
|
||||||
|
}
|
||||||
|
|
||||||
function sendNavCommand(action: 'back' | 'forward' | 'reload' | 'stop') {
|
function sendNavCommand(action: 'back' | 'forward' | 'reload' | 'stop') {
|
||||||
if (!iframe.contentWindow) return
|
if (!iframe.contentWindow) return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ async function handleClick(e: MouseEvent) {
|
||||||
const href = a.getAttribute("href")
|
const href = a.getAttribute("href")
|
||||||
if (!href) return
|
if (!href) return
|
||||||
|
|
||||||
if (href.startsWith("#")) {
|
if (href.startsWith("#") && href.length > 1) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
await runCommand(href.slice(1))
|
await runCommand(href.slice(1))
|
||||||
focusInput()
|
focusInput()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user