-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
3,832 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<!doctype html> | ||
<html lang="en-us"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<title>fdtd3dbench online</title> | ||
<style> | ||
body { | ||
font-family: arial; | ||
margin: 0; | ||
padding: none; | ||
} | ||
|
||
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; } | ||
div.emscripten { text-align: center; } | ||
|
||
#status { | ||
display: inline-block; | ||
vertical-align: top; | ||
margin-top: 30px; | ||
margin-left: 20px; | ||
font-weight: bold; | ||
color: black; | ||
} | ||
|
||
#progress { | ||
height: 20px; | ||
width: 300px; | ||
} | ||
|
||
#output { | ||
width: 100%; | ||
height: 400px; | ||
margin: 0 auto; | ||
margin-top: 10px; | ||
border-left: 0px; | ||
border-right: 0px; | ||
padding-left: 0px; | ||
padding-right: 0px; | ||
display: block; | ||
background-color: black; | ||
color: white; | ||
font-family: 'Lucida Console', Monaco, monospace; | ||
outline: none; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div class="emscripten" id="status">Downloading...</div> | ||
|
||
<div class="emscripten"> | ||
<progress value="0" max="100" id="progress" hidden=1></progress> | ||
</div> | ||
|
||
<textarea id="output" rows="20"></textarea> | ||
|
||
<script type='text/javascript'> | ||
var statusElement = document.getElementById('status'); | ||
var progressElement = document.getElementById('progress'); | ||
|
||
var Module = { | ||
preRun: [], | ||
postRun: [], | ||
print: (function() { | ||
var element = document.getElementById('output'); | ||
if (element) element.value = ''; // clear browser cache | ||
return function(text) { | ||
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); | ||
// These replacements are necessary if you render to raw HTML | ||
//text = text.replace(/&/g, "&"); | ||
//text = text.replace(/</g, "<"); | ||
//text = text.replace(/>/g, ">"); | ||
//text = text.replace('\n', '<br>', 'g'); | ||
console.log(text); | ||
if (element) { | ||
element.value += text + "\n"; | ||
element.scrollTop = element.scrollHeight; // focus on bottom | ||
} | ||
}; | ||
})(), | ||
setStatus: function(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; | ||
} else { | ||
progressElement.value = null; | ||
progressElement.max = null; | ||
progressElement.hidden = true; | ||
} | ||
statusElement.innerHTML = text; | ||
}, | ||
totalDependencies: 0, | ||
monitorRunDependencies: function(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 = function(event) { | ||
// TODO: do not warn on ok events like simulating an infinite loop or exitStatus | ||
Module.setStatus('Exception thrown, see JavaScript console'); | ||
Module.setStatus = function(text) { | ||
if (text) Module.printErr('[post-exception status] ' + text); | ||
}; | ||
}; | ||
</script> | ||
<script async type="text/javascript" src="fdtd3dbench.js"></script> | ||
</body> | ||
</html> | ||
|
||
|
Oops, something went wrong.