You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
|
|
<script src="webdice.js"></script>
|
|
|
|
<script>
|
|
|
|
var previous = "";
|
|
|
|
function send(){
|
|
|
|
var input = document.getElementById('inputBox').value;
|
|
|
|
var size = lengthBytesUTF8(input) + 1;
|
|
|
|
var pointer = _malloc(size);
|
|
|
|
stringToUTF8(input,pointer,size);
|
|
|
|
_webdice(pointer);
|
|
|
|
_free(pointer);
|
|
|
|
inputBox.value = '';
|
|
|
|
}
|
|
|
|
function keypress(code){
|
|
|
|
switch(code){
|
|
|
|
case 13:
|
|
|
|
previous = document.getElementById('inputBox').value;
|
|
|
|
send();
|
|
|
|
break;
|
|
|
|
case 38:
|
|
|
|
document.getElementById('inputBox').value = previous;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="container" style="position: absolute; bottom: 7em; left: 1em; top: 1em; right: 1em; font-family: sans-serif; overflow-y: scroll; ">
|
|
|
|
<div id="output"></div>
|
|
|
|
</div>
|
|
|
|
<form style="position: absolute; left: 1em; bottom: 1em; right: 1em; " action="javascript:void(0);">
|
|
|
|
<input style="width: 100%;" type="text" id="inputBox" onkeydown="keypress(event.keyCode)">
|
|
|
|
<input style="width: 100%;" type="button" onclick="keypress(13)" value="Submit">
|
|
|
|
</form>
|
|
|
|
</body>
|
|
|
|
</html>
|