X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=testing%2FMCTXWeb%2Fpublic_html%2Fstatic%2Fmctx.gui.js;h=1c3eb1fb77f37b97a03a31314d4c1a6ce3352f19;hb=7deca6b4e089e76e279ae84c0aa25728d91e8fd9;hp=13ca08e7ca0dc5a8dc94b54be72a18caa054376e;hpb=c93b3c1b0dc67d03e4f60d99785929b8c319ddb6;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 13ca08e..1c3eb1f 100644 --- a/testing/MCTXWeb/public_html/static/mctx.gui.js +++ b/testing/MCTXWeb/public_html/static/mctx.gui.js @@ -227,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 */