mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2026-01-31 16:14:33 +01:00
small ui improvement
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
matches = numbersList.exec(string);
|
||||
if(matches != null) {
|
||||
return createListOfNumbersExpression(matches)
|
||||
return createListOfNumbersExpression(string)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,14 +37,16 @@
|
||||
return m;
|
||||
}
|
||||
|
||||
function createListOfNumbersExpression(matches) {
|
||||
var numbers = [], i=0;
|
||||
function createListOfNumbersExpression(input) {
|
||||
var numbers = [];
|
||||
input.split(' ').forEach(function(n){
|
||||
if(n.trim().length > 0) {
|
||||
numbers.push(parseInt(n));
|
||||
}
|
||||
|
||||
for(;i<matches.length; i++) {
|
||||
numbers.push(parseInt(matches[i], 10));
|
||||
}
|
||||
});
|
||||
|
||||
return app.models.BitwiseNumbers(numbers);
|
||||
return new app.models.BitwiseNumbers(numbers);
|
||||
}
|
||||
|
||||
})(window.app);
|
||||
@@ -26,7 +26,6 @@
|
||||
});
|
||||
|
||||
this.viewElement.addEventListener('keydown', function(args){
|
||||
console.log(args.keyCode);
|
||||
if(args.keyCode == 38) {
|
||||
|
||||
if (self.history.length > self.historyIndex) { // up
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
this.commands = commands;
|
||||
}
|
||||
|
||||
function DisplayResult (input, payload) {
|
||||
function DisplayResult (input, content) {
|
||||
this.input = input;
|
||||
this.payload = payload;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
app.models.BitwiseOperation = BitwiseOperation;
|
||||
|
||||
@@ -82,12 +82,12 @@
|
||||
renderView: function(model) {
|
||||
var resultView = this.$html.element(
|
||||
'<div class="result">' +
|
||||
'<div class="input">{input}</div>' +
|
||||
'<div class="payload"></div>' +
|
||||
'<div class="input"><span class="cur">></span>{input}</div>' +
|
||||
'<div class="content"></div>' +
|
||||
'</div>', model);
|
||||
|
||||
var payloadView = app.buildViewFor(model.payload);
|
||||
resultView.childNodes[1].appendChild(payloadView);
|
||||
var contentView = app.buildViewFor(model.content);
|
||||
resultView.childNodes[1].appendChild(contentView);
|
||||
return resultView;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,8 +3,10 @@ body { font-family: Verdana; font-size: 0.8em }
|
||||
.expressionInput { width: 500px; padding: 3px; border: solid 1px lightgray; }
|
||||
|
||||
.result { margin: 10px 10px 20px; }
|
||||
.result .input { font-style: italic; margin-bottom: 10px; }
|
||||
.result .payload { padding-left: 10px}
|
||||
.result .input { font-style: italic; margin-bottom: 10px;
|
||||
}
|
||||
.result .content { padding-left: 10px}
|
||||
.result .cur { color: lightgray; margin-right: 5px }
|
||||
|
||||
.expression .label { font-weight: bold; padding-right: 5px }
|
||||
.expression .one { color: #6d9ad3 }
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<body id="rootView">
|
||||
|
||||
<h2>Bitwise Operations Visualised</h2>
|
||||
<input id="in" type="text" class="expressionInput" data-controller="expressionInputCtrl" placeholder="type expression like '1>>2' or 'help' for the "/>
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user