X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=testing%2FMCTXWeb%2Fpublic_html%2Fstatic%2Fmctx.gui.js;h=1c3eb1fb77f37b97a03a31314d4c1a6ce3352f19;hb=1a161f17021f8c954aa041f4bb19a5e01bf2e5b7;hp=10075102442dbb42bec3ae946cd1a8e9c52335e8;hpb=396dd52f485f5e89eb5fba80e68711af41eeebd4;p=matches%2FMCTX3420.git diff --git a/testing/MCTXWeb/public_html/static/mctx.gui.js b/testing/MCTXWeb/public_html/static/mctx.gui.js index 1007510..1c3eb1f 100644 --- a/testing/MCTXWeb/public_html/static/mctx.gui.js +++ b/testing/MCTXWeb/public_html/static/mctx.gui.js @@ -138,6 +138,10 @@ function runBeforeLoad(isLoginPage) { $("#logout").click(function () { $("#logout").logout(); + }); + + $("#change-password").click(function () { + window.open("users/user_change_details.php"); }); //Enable the error log, if present @@ -186,6 +190,7 @@ $.fn.login = function () { return $.ajax({ url : mctx.api + "bind", + type : "POST", data : {user: username, pass : password} }).done(function (data) { if (data.status < 0) { @@ -222,6 +227,40 @@ $.fn.logout = function () { }); }; +/** +* Sets the camera autoupdater +* Obsolete? +* @returns {$.fn} +*/ +$.fn.setCamera = function () { + var url = mctx.api + "image"; //http://beaglebone/api/image + var update = true; + + //Stop updating if we can't retrieve an image! + this.error(function() { + update = false; + }); + + var parent = this; + + var updater = function() { + if (!update) { + parent.parent().text("Cam fail"); + parent.attr("src", ""); + return; + } + + parent.attr("src", url + "#" + (new Date()).getTime()); + + setTimeout(updater, 2000); + }; + + updater(); + return this; +}; + + + /** * Sets the error log to continuously update. * @returns itself */