From: Jeremy Tan Date: Sat, 19 Oct 2013 06:49:42 +0000 (+0800) Subject: Fix two bugs in mctx.gui.js ++ X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=fc0dc3b827eeff91373db42a78a098200cbf8fa6;p=matches%2FMCTX3420.git Fix two bugs in mctx.gui.js ++ --- diff --git a/testing/MCTXWeb/public_html/control.html b/testing/MCTXWeb/public_html/control.html index 86a7f82..61157b6 100644 --- a/testing/MCTXWeb/public_html/control.html +++ b/testing/MCTXWeb/public_html/control.html @@ -9,19 +9,15 @@ + @@ -94,11 +90,6 @@ - - Software status - - -
Error and warning messages
@@ -111,7 +102,7 @@

- +

  diff --git a/testing/MCTXWeb/public_html/static/mctx.control.js b/testing/MCTXWeb/public_html/static/mctx.control.js new file mode 100644 index 0000000..cf67629 --- /dev/null +++ b/testing/MCTXWeb/public_html/static/mctx.control.js @@ -0,0 +1,17 @@ +/** + * Code for the controls page. + * @date 19-10-2013 + */ + +mctx.control = {}; +mctx.control.api = mctx.api + 'control' + +$(document).ready(function () { + $.ajax({ + url : mctx.control.api, + data : {'action' : 'identify'} + }).done(function () { + + }); +}); + diff --git a/testing/MCTXWeb/public_html/static/mctx.graph.js b/testing/MCTXWeb/public_html/static/mctx.graph.js index e79b6a8..4bb3e06 100644 --- a/testing/MCTXWeb/public_html/static/mctx.graph.js +++ b/testing/MCTXWeb/public_html/static/mctx.graph.js @@ -23,6 +23,15 @@ mctx.graph.chart = null; * Appends each value pair to the result * @returns result */ +/** + * Helper - Calculate pairs of (dependent, independent) values + * Given input as (time, value) pairs for dependent and independent + * Appends each value pair to the result + * @param {array[][]} dependent Dependent data to be correlated with independent + * @param {array[][]} independent Independent data + * @param {array[][]} result Storage location + * @returns {dataMerge.result} + */ function dataMerge(dependent, independent, result) { var j = 0; for (var i = 0; i < dependent.length-1; ++i) { diff --git a/testing/MCTXWeb/public_html/static/mctx.gui.js b/testing/MCTXWeb/public_html/static/mctx.gui.js index 48737b5..3198055 100644 --- a/testing/MCTXWeb/public_html/static/mctx.gui.js +++ b/testing/MCTXWeb/public_html/static/mctx.gui.js @@ -71,7 +71,14 @@ function debugLog () { alert(arguments[i]); } } else { - console.log.apply(this, arguments); + try { + console.log.apply(this, arguments); + } catch (e) { + //Chromie + for (var i = 0; i < arguments.length; i++) { + console.log(arguments[i]); + } + } } } } @@ -265,11 +272,16 @@ $.fn.setErrorLog = function () { var url = mctx.api + "errorlog"; var outdiv = this; + if ($(this).length <= 0) { + //No error log, so do nothing. + return; + } + var updater = function () { $.ajax({url : url}).done(function (data) { outdiv.text(data); outdiv.scrollTop( - outdiv[0].scrollHeight - outdiv.height() + outdiv[0].scrollHeight - outdiv.height() ); setTimeout(updater, 3000); }).fail(function (jqXHR) {