From 2ebd108f43abb69ad6d3135525671fb02e56ecaa Mon Sep 17 00:00:00 2001 From: cTn Date: Mon, 3 Feb 2014 06:19:06 +0100 Subject: [PATCH] initial log window implementation --- background.js | 6 +++++- css/style.css | 19 +++++++++++++++++-- js/gui.js | 12 ++++++++++++ main.html | 4 ++++ 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/background.js b/background.js index 3c507372..81b087d8 100644 --- a/background.js +++ b/background.js @@ -2,7 +2,11 @@ function start_app() { chrome.app.window.create('main.html', { id: 'main-window', frame: 'none', - resizable: false + resizable: false, + minWidth: 962, + minHeight: 729, + maxWidth: 962, + maxHeight: 729 }, function(window_child) { window_child.onClosed.addListener(function() { // connectionId is passed from the script side through the chrome.runtime.getBackgroundPage refference diff --git a/css/style.css b/css/style.css index 21fbe7fa..8359a6ac 100644 --- a/css/style.css +++ b/css/style.css @@ -193,7 +193,22 @@ input[type="number"]::-webkit-inner-spin-button { } #sensor-status .on { background-color: #0d8b13; - } + } +#log { + margin-bottom: 10px; + + height: 90px; + + border: 1px solid silver; + background-color: white; + + overflow-y: scroll; +} + #log .wrapper { + padding: 5px; + + -webkit-user-select: text; + } #tabs { position: absolute; margin-top: 1px; @@ -236,7 +251,7 @@ input[type="number"]::-webkit-inner-spin-button { background-color: white; } #content { - margin-top: 27px; + margin-top: 37px; padding: 10px; diff --git a/js/gui.js b/js/gui.js index 5db35419..b02a2775 100644 --- a/js/gui.js +++ b/js/gui.js @@ -163,6 +163,18 @@ GUI_control.prototype.timeout_kill_all = function() { return timers_killed; }; +// message = string +GUI_control.prototype.log = function(message) { + var command_log = $('div#log'); + var d = new Date(); + var time = ((d.getHours() < 10) ? '0' + d.getHours(): d.getHours()) + + ':' + ((d.getMinutes() < 10) ? '0' + d.getMinutes(): d.getMinutes()) + + ':' + ((d.getSeconds() < 10) ? '0' + d.getSeconds(): d.getSeconds()); + + $('div.wrapper', command_log).append('

' + time + ' -- ' + message + '

'); + command_log.scrollTop($('div.wrapper', command_log).height()); +}; + // Method is called every time a valid tab change event is received // callback = code to run when cleanup is finished // default switch doesn't require callback to be set diff --git a/main.html b/main.html index 54e9c729..79e48359 100644 --- a/main.html +++ b/main.html @@ -92,6 +92,10 @@
+
+
+
+