mooc/www/index.html

195 lines
7.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Weblinux sans/without identification</title>
<meta name="keywords" content="opencore, emulation, or1000, javascript, linux">
<meta name="author" content="Sebastian Macke">
<link rel="stylesheet" href="css/default.css">
</head>
<body onload="Start()">
<canvas id="fbfullscreen" width="1024" height="768" style="width: 0px; height: 0px;">
Framebuffer uses canvas
</canvas>
<div class="windows">
<table>
<tbody>
<tr>
<td style="vertical-align: top">
<table>
<tbody>
<tr><td><table id="tty" class="terminal" cellpadding="0" cellspacing="0"></table></td></tr>
<tr><td>
<table width='100%'>
<tbody>
<tr>
<td style="width: 45px;"><img src="images/tar.png" width="40px" height="40px" onclick='jor1k.fs.TAR("home/alice/shared")' title="Sauvegarde le r&eacute;pertoire alice/shared" /></td>
<td style="width: 45px;"><label><img src="images/upload.png" width="40px" height="40px" title="Envoie des fichiers de votre ordinateur vers le r&eacute;pertoire d'alice" /><input type="file" id="files" style="visibility:hidden;width:0; height:0;" name="files[]" onchange='OnUploadFiles(this.files)' multiple /></label></td>
<td>&nbsp;<textarea style="height: 40px;" type=text cols="10" rows="1" id="clipboard">clipboard</textarea></td>
<td style="width: 30px;"><span id="shift"></span></td>
<td style="width: 25px;"><span id="alt"></span></td>
<td style="width: 30px;"><span id="ctrl"></span></td>
<!-- <td style="width: 50px;"><span id="key"></span></td> -->
<td style='text-align: center; display:none' id="warning">Le caractère | (pipe)<br>s'obtient avec<br>CTRL+SHIFT+L</td>
<td align=right style="width: 80px;"><span id="stats" style="text-align: right"></span><br><br>
<span id="versionWeblinux" style="text-align: right"><font size=1>Weblinux </font>v3.08</span></td>
</tr>
</tbody></table>
</td></tr>
</tbody>
</table>
</td>
<td style="vertical-align: top">
<!-- la console display:none pour la masquer -->
<canvas id="fb" class="screen" width="640" height="400" style='display:none'>
Framebuffer uses canvas
</canvas>
</td>
</tr>
</tbody>
</table>
</div><!-- windows -->
<script src="jor1k-master-min.js"></script>
<script>
var Jor1k = require("Jor1k");
var LinuxTerm = require("LinuxTerm");
var os = navigator.platform.indexOf('MacIntel');
var ua = navigator.userAgent;
if ( ( os != -1 ) && ( ua.indexOf("Firefox") == -1 ) )
document.getElementById('warning').style.display='block';
function Fullscreen()
{
document.body.style.margin = '0px';
window.onresize = function(event) {
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
var d = x/y;
if (d > 1.6) x = y*1.6; else y = x/1.6;
var fb = document.getElementById("fbfullscreen");
fb.style.width = "" + x + "px";
fb.style.height = "" + y + "px";
};
window.onresize();
jor1k.framebuffer.Init("fbfullscreen");
}
function OnUploadFiles(files)
{
for (var i = 0, f; f = files[i]; i++) {
jor1k.fs.UploadExternalFile(f);
}
}
function RandomString(length) {
var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var result = '';
for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
return result;
}
// from https://css-tricks.com/snippets/javascript/get-url-variables/
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return decodeURIComponent(pair[1]);}
}
return(false);
}
function Start() {
var pushState = false, loadUserData = false;
var userid = getQueryVariable("user");
if (userid == false) {
userid = RandomString(10);
pushState = true;
} else {
loadUserData = true;
}
// allow specifying relay URL via querystring
var relayURL = getQueryVariable("relayURL")
if (relayURL == false)
{
// relayURL = "wss://relay.widgetry.org/";
pushState = true;
}
jor1kparameters = {
system: {
kernelURL: "vmlinux.bin.bz2", // kernel image
memorysize: 32, // in MB, must be a power of two
cpu: "asm", // short name for the cpu to use
ncores: 1,
},
fs: {
basefsURL: "basefs.json", // json file with the basic filesystem configuration.
extendedfsURL: "../fs.json", // json file with extended filesystem informations. Loaded after the basic filesystem has been loaded.
earlyload: [], // list of files which should be loaded immediately after they appear in the filesystem
lazyloadimages: [
] // list of automatically loaded images after the basic filesystem has been loaded
},
term: new LinuxTerm("tty"), // canvas id for the terminal
fbid: "fb", // canvas id for the framebuffer
clipboardid: "clipboard", // input id for the clipboard
statsid: "stats", // object id for the statistics test
fps: 10, // update interval of framebuffer
// relayURL: relayURL, // relay url for the network
userid: userid, // unique user id string. Empty, choosen randomly, from a url, or from a cookie.
syncURL: "//jor1k.com/sync/upload.php", // url to sync a certain folder
path: "/sys/or1k/",
}
// --------------------------------------------------------
if (loadUserData)
jor1kparameters.fs.lazyloadimages.push("sync/tarballs/"+userid+".tar.bz2");
var nCores = getQueryVariable("n");
if (nCores != false) {
jor1kparameters.system.ncores = nCores;
} else {
pushState = true;
}
var cpu = getQueryVariable("cpu");
if (cpu != false) {
jor1kparameters.system.cpu = cpu;
if (jor1kparameters.system.cpu == "smp") {
console.log("Load smp kernel");
jor1kparameters.system.kernelURL = "vmlinuxsmp.bin.bz2";
}
} else {
pushState = true;
}
if (pushState) {
window.history.pushState([], "", "?cpu="+encodeURIComponent(jor1kparameters.system.cpu)+"&n="+encodeURIComponent(jor1kparameters.system.ncores));
// window.history.pushState([], "", "?user="+encodeURIComponent(jor1kparameters.userid)+"&cpu="+encodeURIComponent(jor1kparameters.system.cpu)+"&n="+encodeURIComponent(jor1kparameters.system.ncores)+"&relayURL="+encodeURIComponent(relayURL));
// window.history.pushState([], "", "?user="+encodeURIComponent(jor1kparameters.userid)+"&cpu="+encodeURIComponent(jor1kparameters.system.cpu)+"&n="+encodeURIComponent(jor1kparameters.system.ncores));
}
// --------------------------------------------------------
jor1k = new Jor1k(jor1kparameters);
}
</script>
<div id="console"></div>
</body>
</html>