Skip to content
Snippets Groups Projects
Commit 29771618 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

write to console

parent c4b413f6
No related branches found
No related tags found
No related merge requests found
...@@ -581,12 +581,15 @@ label { ...@@ -581,12 +581,15 @@ label {
border-radius: 0; border-radius: 0;
} }
#consoleOutput{ #consoleOutput{
min-height:35px; min-height:42px;
background-color: #ddd; background-color: rgba(255,255,255,0.8);
opacity: 0.9;
border: 2px solid #bdc3c7; border: 2px solid #bdc3c7;
border-bottom-width: 0; border-bottom-width: 0;
border-top-width: 0; border-top-width: 0;
overflow: auto; overflow: auto;
resize: vertical; resize: vertical;
padding: 10px 20px;
font-family: Courier, monospace;
font-size: 13px;
line-height: 25px;
} }
\ No newline at end of file
...@@ -15,8 +15,14 @@ define(['jquery', 'underscore', 'backbone', 'appState'], function($, _, Backbone ...@@ -15,8 +15,14 @@ define(['jquery', 'underscore', 'backbone', 'appState'], function($, _, Backbone
initialize: function(){ initialize: function(){
_.bindAll(this, "_onKeyUp");
$(document).bind('keyup', {}, this._onKeyUp);
this.listenTo(appState, "change:consoleIsVisible", this._setVisibility); this.listenTo(appState, "change:consoleIsVisible", this._setVisibility);
this._setWidth(); this.listenTo(appState, "change:menuIsVisible", function(){
this._setWidth(false);
});
this._setWidth(false);
this._setVisibility(); this._setVisibility();
}, },
...@@ -28,16 +34,54 @@ define(['jquery', 'underscore', 'backbone', 'appState'], function($, _, Backbone ...@@ -28,16 +34,54 @@ define(['jquery', 'underscore', 'backbone', 'appState'], function($, _, Backbone
}, },
_setVisibility: function(){ _setVisibility: function(){
if (appState.get("consoleIsVisible")) this.show(); if (appState.get("consoleIsVisible")) this._show();
else this.hide(); else this._hide();
},
write: function(string){
this._writeOutput(string + "<br/>");
},
warn: function(string){
}, },
show: function(){ error: function(string){
},
_writeOutput: function(html){
var $output = $("#consoleOutput");
var height = $output.height();
$output.append(html);
$output.height(height);
$output.scrollTop($output.scrollTop()+$output.innerHeight());
},
_show: function(){
this.$el.fadeIn(); this.$el.fadeIn();
}, },
hide: function(){ _hide: function(){
this.$el.fadeOut(); this.$el.fadeOut();
},
_onKeyUp: function(e){
var $input = $("#consoleInput");
if ($input.is(":focus")){
// if (e.keyCode == 38) $output.val(this.model.getPrevHistElem());
// else if (e.keyCode == 40) $output.val(this.model.getNewerHistElem());
if (e.keyCode == 13) this._enterCommand($input);
} else {
}
},
_enterCommand: function($input){
// var command = $input.val();
var command = "nice try, this doesn't work yet :)";
$input.val("");
this.write(command);
$input.focus();
} }
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment