From 35c494843bf610604f1a8c0aef17f5f2b6d8d66f Mon Sep 17 00:00:00 2001 From: Borys Levytskyi Date: Fri, 3 Apr 2015 19:47:37 +0300 Subject: [PATCH] small ui improvement --- app/bitwise/expression.js | 16 +++++++++------- app/controllers.js | 1 - app/models.js | 4 ++-- app/views.js | 8 ++++---- css/styles.css | 6 ++++-- index.html | 2 +- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/app/bitwise/expression.js b/app/bitwise/expression.js index c71546c..2339cc8 100644 --- a/app/bitwise/expression.js +++ b/app/bitwise/expression.js @@ -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 self.historyIndex) { // up diff --git a/app/models.js b/app/models.js index aaf1002..05c4789 100644 --- a/app/models.js +++ b/app/models.js @@ -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; diff --git a/app/views.js b/app/views.js index 3d07a5c..2a1ec01 100644 --- a/app/views.js +++ b/app/views.js @@ -82,12 +82,12 @@ renderView: function(model) { var resultView = this.$html.element( '
' + - '
{input}
' + - '
' + + '
>{input}
' + + '
' + '
', 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; } }); diff --git a/css/styles.css b/css/styles.css index ae007e7..4f8a587 100644 --- a/css/styles.css +++ b/css/styles.css @@ -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 } diff --git a/index.html b/index.html index d8af619..65053e9 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,7 @@

Bitwise Operations Visualised

- +