mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-17 12:48:41 +00:00
Better rax2.html - See http://rada.re/js/rax2
This commit is contained in:
parent
0f2fd99986
commit
c1629360f9
@ -2,3 +2,6 @@ BIN=rax2
|
||||
BINDEPS=r_util
|
||||
|
||||
include ../rules.mk
|
||||
|
||||
pub:
|
||||
scp index.html main.js rax2.min.js radare.org:/srv/http/radareorg/js/rax2
|
||||
|
@ -6,102 +6,67 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>rax2</title>
|
||||
<style>
|
||||
html,body {
|
||||
height:100% !important;
|
||||
overflow: hidden;
|
||||
}
|
||||
table,body {
|
||||
background-color:#383a47;
|
||||
overflow: hidden;
|
||||
border:0px;
|
||||
padding:0px;
|
||||
margin:1px;
|
||||
}
|
||||
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
|
||||
textarea.emscripten { font-family: monospace; width: 90%; height:320px; background-color:black; color:white; }
|
||||
a { font-size:1.4em; font-family: monospace; color:white; text-decoration:none;
|
||||
color:#00ccff;
|
||||
}
|
||||
input {
|
||||
font-size:1.6em;
|
||||
font-family: monospace;
|
||||
background-color:black;
|
||||
color:white;
|
||||
border:1px solid #c0c0c0;
|
||||
background:black;
|
||||
}
|
||||
textarea.emscripten {
|
||||
height:100%;
|
||||
resize: none;
|
||||
font-size:1.2em; font-family: monospace; width: 100%;
|
||||
background-color:black; color:white; border:1px solid #ccc;
|
||||
background:black;
|
||||
}
|
||||
div.emscripten { text-align: center; }
|
||||
div.emscripten_border { border: 1px solid black; }
|
||||
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
|
||||
canvas.emscripten { border: 0px none; }
|
||||
</style>
|
||||
</head>
|
||||
<body onload="FocusOnInput()">
|
||||
<body >
|
||||
|
||||
<center>
|
||||
<script>
|
||||
var _(x) { return document.getElementById(x); }
|
||||
|
||||
function FocusOnInput() {
|
||||
_('input').focus();
|
||||
}
|
||||
|
||||
function doin () {
|
||||
var input=_('input');
|
||||
if (false) {
|
||||
window.location.href = "#"+input.value;
|
||||
location.reload();
|
||||
} else {
|
||||
Module.arguments = input.value.split (' ');
|
||||
Module.run();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<center style="height:100%">
|
||||
<table style="height:100%">
|
||||
<tr style="height:100%">
|
||||
<td colspan=3 style="padding:2px;vertical-align:bottom;background-color:black">
|
||||
<textarea readonly class="emscripten" id="output"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td>
|
||||
<a href="http://www.radare.org/" target="_blank">rax2</a>
|
||||
<input type=text id="input">
|
||||
<input type=submit onclick="doin()">
|
||||
</td><td width=100%">
|
||||
<input type=text style="width:100%" id="input">
|
||||
</td><td>
|
||||
<input type=submit onclick="clearOutput()" value="C">
|
||||
<!--
|
||||
</td><td>
|
||||
<input type=submit onclick="doin()" value=">">
|
||||
-->
|
||||
</td></tr>
|
||||
</table>
|
||||
</center>
|
||||
<hr>
|
||||
<textarea readonly class="emscripten" id="output" rows="8"></textarea>
|
||||
<hr>
|
||||
<div class="emscripten" id="status">Downloading...</div>
|
||||
<div class="emscripten">
|
||||
<progress value="0" max="100" id="progress" hidden=1></progress>
|
||||
</div>
|
||||
<script type='text/javascript'>
|
||||
// connect to canvas
|
||||
var Module = {
|
||||
arguments: document.location.hash.substring(1).split(' '),
|
||||
noExitRuntime: true,
|
||||
preRun: [],
|
||||
postRun: [],
|
||||
print: (function() {
|
||||
var element = document.getElementById('output');
|
||||
element.value = ''; // clear browser cache
|
||||
return function(text) {
|
||||
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');
|
||||
element.value += text + "\n";
|
||||
element.scrollTop = 99999; // focus on bottom
|
||||
};
|
||||
})(),
|
||||
printErr: function(text) {
|
||||
text = Array.prototype.slice.call(arguments).join(' ');
|
||||
if (0) { // XXX disabled for safety typeof dump == 'function') {
|
||||
dump(text + '\n'); // fast, straight to the real console
|
||||
} else {
|
||||
console.log(text);
|
||||
}
|
||||
},
|
||||
//canvas: document.getElementById('canvas'),
|
||||
setStatus: function(text) {
|
||||
if (Module.setStatus.interval) clearInterval(Module.setStatus.interval);
|
||||
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
|
||||
var statusElement = document.getElementById('status');
|
||||
var progressElement = document.getElementById('progress');
|
||||
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...');
|
||||
</script>
|
||||
<script type='text/javascript' src="rax2.js">
|
||||
<script type='text/javascript' src="main.js">
|
||||
</script>
|
||||
<script type='text/javascript' src="rax2.min.js">
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
78
binr/rax2/main.js
Normal file
78
binr/rax2/main.js
Normal file
@ -0,0 +1,78 @@
|
||||
// connect to canvas
|
||||
var Module = {
|
||||
arguments: document.location.hash.substring(1).split(' '),
|
||||
noExitRuntime: true,
|
||||
preRun: [],
|
||||
postRun: [],
|
||||
firstRun: true,
|
||||
print: (function() {
|
||||
var element = document.getElementById('output');
|
||||
element.value = ''; // clear browser cache
|
||||
return function(text) {
|
||||
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');
|
||||
element.value += text + "\n";
|
||||
element.scrollTop = 9999999; // focus on bottom
|
||||
};
|
||||
})(),
|
||||
printErr: function(text) {
|
||||
text = Array.prototype.slice.call(arguments).join(' ');
|
||||
if (0) { // XXX disabled for safety typeof dump == 'function') {
|
||||
dump(text + '\n'); // fast, straight to the real console
|
||||
} else {
|
||||
console.log(text);
|
||||
}
|
||||
},
|
||||
//canvas: document.getElementById('canvas'),
|
||||
setStatus: function(text) {
|
||||
if (this.firstRun) {
|
||||
var ta = _("output");
|
||||
_("output").value = "$ rax2\n";
|
||||
_('output').scrollTop = 99999999;
|
||||
}
|
||||
this.firstRun = false;
|
||||
}
|
||||
};
|
||||
|
||||
//Module.setStatus('Downloading...');
|
||||
log ("Downloading...");
|
||||
function log(x) {
|
||||
_("output").value += x;
|
||||
}
|
||||
|
||||
function _(x) { return document.getElementById(x); }
|
||||
|
||||
window.onload = function FocusOnInput() {
|
||||
var inp = _('input');
|
||||
inp.focus();
|
||||
inp.onkeyup = function(e){
|
||||
if(e.keyCode == 13)
|
||||
doin();
|
||||
}
|
||||
}
|
||||
|
||||
function keyPress() {
|
||||
if(e.which == 10 || e.which == 13) doin ();
|
||||
}
|
||||
|
||||
function doin () {
|
||||
var input=_('input');
|
||||
if (false) {
|
||||
window.location.href = "#"+input.value;
|
||||
location.reload();
|
||||
} else {
|
||||
_('output').value += "\n"+input.value+"\n";
|
||||
Module.arguments = input.value.split (' ');
|
||||
input.value = '';
|
||||
Module.run();
|
||||
}
|
||||
}
|
||||
|
||||
function clearOutput() {
|
||||
_("output").value = "";
|
||||
_("input").focus();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user