mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2025-12-10 06:52:05 +01:00
147 lines
4.6 KiB
HTML
147 lines
4.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head lang="en">
|
|
<meta charset="UTF-8">
|
|
|
|
<title></title>
|
|
|
|
<script type="text/javascript" src="components/is.js"></script>
|
|
<script type="text/javascript" src="components/should.js"></script>
|
|
<script type="text/javascript" src="components/htmlBuilder.js"></script>
|
|
<script type="text/javascript" src="components/di.js"></script>
|
|
|
|
<script type="text/javascript" src="app/app.js"></script>
|
|
<script type="text/javascript" src="components/controllersFeature.js"></script>
|
|
<script type="text/javascript" src="components/viewsFeature.js"></script>
|
|
<script type="text/javascript" src="app/bitwise/calc.js"></script>
|
|
<script type="text/javascript" src="app/bitwise/expression.js"></script>
|
|
<script type="text/javascript" src="app/bitwise/formatter.js"></script>
|
|
|
|
<script type="text/javascript" src="app/models.js"></script>
|
|
<script type="text/javascript" src="app/views.js"></script>
|
|
|
|
<script type="text/javascript" src="app/dispatcher.js"></script>
|
|
<script type="text/javascript" src="app/services.js"></script>
|
|
<script type="text/javascript" src="app/controllers.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="css/styles.css" />
|
|
</head>
|
|
<body id="rootView">
|
|
|
|
<h2>Bitwise Operations Visualised</h2>
|
|
|
|
<div class="links">
|
|
<a href="https://github.com/BorisLevitskiy/BitwiseCmd">App on GitHub</a>
|
|
</div>
|
|
|
|
<input id="in" type="text" class="expressionInput" data-controller="expressionInputCtrl" placeholder="type expression like '1>>2' or 'help' "/>
|
|
|
|
<div id="output" data-controller="resultView">
|
|
</div>
|
|
|
|
<script id="helpView" type="text/template">
|
|
<div class="help">
|
|
<p class="section">
|
|
<strong>Supported Commands</strong>
|
|
<ul>
|
|
<li><code>23 ^ 34</code> — type bitwise expression to see result in binary (only positive integers are supported now)</li>
|
|
<li><code>23 34</code> — type one or more numbers to see their binary representations</li>
|
|
<li><code>clear</code> — clear output pane</li>
|
|
<li><code>help</code> — display this help</li>
|
|
</ul>
|
|
</p>
|
|
|
|
|
|
<p class="section">
|
|
<strong>Supportd Bitwise Operations</strong>
|
|
<ul>
|
|
<li><code>&</code> — bitwise AND</li>
|
|
<li><code>|</code> — bitwise inclusive OR</li>
|
|
<li><code>^</code> — bitwise exclusive XOR</li>
|
|
<li><code><<</code> — left shift</li>
|
|
<li><code>>></code> — right shift</li>
|
|
<li><code>~</code> — bitwise NOT (one's complement) (unary)</li>
|
|
</ul>
|
|
</p>
|
|
|
|
<p style="font-style: italic">
|
|
<strong>Tip:</strong> Use Up and Down keys to navigate trough executed commands.
|
|
</p>
|
|
</div>
|
|
</script>
|
|
|
|
<script id="resultView" type="text/template">
|
|
<div class="result">
|
|
<div class="input"><span class="cur">></span>{input}</div>
|
|
<div class="content"></div>
|
|
</div>
|
|
</script>
|
|
|
|
<script id="shiftExpressionView" type="text/template">
|
|
<table class="expression">
|
|
<tr>
|
|
<td class="label">{operand1}</td>
|
|
<td class="bin">{operand1Binary}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="label">{operand1}{sign}{operand2}</td>
|
|
<td class="bin">{resultBinary}</td>
|
|
</tr>
|
|
</table>
|
|
</script>
|
|
|
|
<script id="binaryExpressionView" type="text/template">
|
|
<table class="expression">
|
|
<tr>
|
|
<td></td>
|
|
<td class="label">{operand1}</td>
|
|
<td class="bin">{operand1Binary}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>{sign}</td>
|
|
<td class="label">{operand2}</td>
|
|
<td class="bin">{operand2Binary}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>=</td>
|
|
<td class="label">{result}</td>
|
|
<td class="bin">{resultBinary}</td>
|
|
</tr>
|
|
</table>
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function(){
|
|
var app = window.app;
|
|
var dispatcher = app.get('dispatcher');
|
|
|
|
dispatcher.command('help', function() {
|
|
return new app.models.HelpResult();
|
|
});
|
|
|
|
dispatcher.command({
|
|
$expression:null,
|
|
canHandle: function(input) { return this.$expression.canParse(input); },
|
|
handle: function(input) {
|
|
return this.$expression.parse(input);
|
|
}
|
|
});
|
|
|
|
app.bootstrap(document.getElementById('rootView'));
|
|
|
|
app.debugMode = true;
|
|
|
|
dispatcher.dispatch('help');
|
|
dispatcher.dispatch('3 << 4');
|
|
dispatcher.dispatch('233 | 322');
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
</html> |