looper/web/shell.html

95 lines
4.1 KiB
HTML
Raw Permalink Normal View History

2024-04-24 09:59:51 -07:00
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
2024-05-02 14:52:11 -07:00
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="manifest" href="manifest.json" />
<link rel="apple-touch-icon" href="icon.svg" />
<meta name="apple-mobile-web-app-status-bar" content="#5200a5" />
<meta name="theme-color" content="#5200a5" />
2024-04-24 09:59:51 -07:00
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Looper</title>
2024-05-02 14:52:11 -07:00
<link rel="icon" type="image/svg" href="icon.svg">
<link rel="stylesheet" type="text/css" href="fork-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="style.css" />
2024-04-24 09:59:51 -07:00
</head>
<body>
<canvas class="fullpage emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1>
<div class="center">
<figure style="overflow:visible;" id="spinner"><div class="spinner"></div><center style="margin-top:0.5em"><strong>emscripten</strong></center></figure>
<div class="emscripten" id="status">Downloading...</div>
<div class="emscripten">
<progress value="0" max="100" id="progress" hidden=1></progress>
</div>
</div>
</canvas>
<input type="file" value="" hidden id="file-picker">
<script type="text/javascript" src="https://js.puter.com/v2/"></script>
2024-05-01 09:07:08 -07:00
<script type='text/javascript' src="shell.js"></script>
2024-04-24 09:59:51 -07:00
<script>
var Module = {
print: (function() {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return (...args) => {
var text = args.join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
//text = text.replace(/>/g, "&gt;");
//text = text.replace('\n', '<br>', 'g');
console.log(text);
};
})(),
canvas: (() => {
var canvas = document.getElementById('canvas');
// As a default initial behavior, pop up an alert when webgl context is lost. To make your
// application robust, you may want to override this behavior before shipping!
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
canvas.addEventListener("webglcontextlost", (e) => { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
return canvas;
})(),
setStatus: (text) => {
if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
if (text === Module.setStatus.last.text) return;
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
var now = Date.now();
if (m && now - Module.setStatus.last.time < 30) return; // if this is a progress update, skip it if too soon
Module.setStatus.last.time = now;
Module.setStatus.last.text = text;
if (m) {
text = m[1];
progressElement.value = parseInt(m[2])*100;
progressElement.max = parseInt(m[4])*100;
progressElement.hidden = false;
spinnerElement.hidden = false;
} else {
progressElement.value = null;
progressElement.max = null;
progressElement.hidden = true;
if (!text) spinnerElement.hidden = true;
}
statusElement.innerHTML = text;
},
totalDependencies: 0,
monitorRunDependencies: (left) => {
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
}
};
Module.setStatus('Downloading...');
window.onerror = () => {
Module.setStatus('Exception thrown, see JavaScript console');
spinnerElement.style.display = 'none';
Module.setStatus = (text) => {
if (text) console.error('[post-exception status] ' + text);
};
};
</script>
2024-05-02 14:52:11 -07:00
<div id="controls-margin"></div>
2024-04-24 09:59:51 -07:00
{{{ SCRIPT }}}
</body>
</html>