Fix two bugs in mctx.gui.js ++
[matches/MCTX3420.git] / testing / MCTXWeb / public_html / static / mctx.gui.js
index c609ef5..3198055 100644 (file)
@@ -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) {
@@ -284,6 +296,36 @@ $.fn.setErrorLog = function () {
     return this;
 };
 
+$(document).ready(function () {
+  //Show the content!
+  $("#content").css("display", "block");
+  
+  //Set the welcome bar
+  var name = " " + (mctx.friendlyName ? mctx.friendlyName : "");
+  $("#welcome-container").text("Welcome"+ name + "!");
+  $("#logout-container").css("display", "block");
+  //$("#menu-container").populateNavbar();
+
+  $("#logout").click(function () {
+    $("#logout").logout();
+  });
+  
+  //Enable the error log, if present
+  $("#errorlog").setErrorLog();
+  
+  //Enable the hide/show clicks
+  $("#sidebar-hide").click(function () {
+    $("#sidebar").css("display", "none");
+    $("#sidebar-show").css("display", "inherit");
+    return this;
+  });
+
+  $("#sidebar-show").click(function () {
+    $("#sidebar-show").css("display", "none");
+    $("#sidebar").css("display", "inherit");
+    return this;
+  });
+});
 $(document).ajaxError(function (event, jqXHR) {
     //console.log("AJAX query failed with: " + jqXHR.status + " (" + jqXHR.statusText + ")");
 });
\ No newline at end of file

UCC git Repository :: git.ucc.asn.au