Index: lams_monitoring/web/includes/javascript/monitorLesson.js =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/web/includes/javascript/monitorLesson.js,v diff -u -r1.44.2.32 -r1.44.2.33 --- lams_monitoring/web/includes/javascript/monitorLesson.js 11 May 2016 10:47:26 -0000 1.44.2.32 +++ lams_monitoring/web/includes/javascript/monitorLesson.js 7 Jun 2016 07:44:52 -0000 1.44.2.33 @@ -756,7 +756,12 @@ sequenceCanvas.html(originalSequenceCanvas); } else { sequenceCanvasFirstFetch = true; - loadLearningDesignSVG(); + var exit = loadLearningDesignSVG(); + if (exit) { + // when SVG gets re-created, this update method will be run again + sequenceRefreshInProgress = false; + return; + } } // clear all completed learner icons except the door @@ -859,6 +864,7 @@ } function loadLearningDesignSVG() { + var exit = false; // fetch SVG just once, since it is immutable $.ajax({ dataType : 'text', @@ -882,6 +888,7 @@ resizeSequenceCanvas(width, height); }, error : function(error) { + exit = true; // the LD SVG is missing, try to re-generate it; if it is an another error, fail if (error.status != 404) { return; @@ -893,12 +900,15 @@ win = frame[0].contentWindow || frame[0].contentDocument; win.GeneralLib.saveLearningDesignImage(); frame.remove(); - // load the image again - loadLearningDesignSVG(); + + // run the whole fetch again + updateSequenceTab(); }).attr('src', LAMS_URL + 'authoring/author.do?method=generateSVG&selectable=false&learningDesignID=' + ldId); } }); + + return exit; } @@ -2099,11 +2109,11 @@ function dblTap(elem, dblClickFunction) { // double tap detection on mobile devices; it works also for mouse clicks elem.tap(function(event){ + var currentTime = new Date().getTime(); // is the second click on the same element as the first one? if (event.currentTarget == lastTapTarget) { // was the second click quick enough after the first one? - var currentTime = new Date().getTime(), - tapLength = currentTime - lastTapTime; + var tapLength = currentTime - lastTapTime; if (tapLength < tapTimeout && tapLength > 0) { event.preventDefault(); dblClickFunction(event);