Index: lams_monitoring/web/includes/javascript/monitorLesson.js =================================================================== diff -u -r0b00c7fe6d231b631e9a717b87d8c833320b2f19 -r6f82bfabdb07cfa40b1c3840e688362fe11e7271 --- lams_monitoring/web/includes/javascript/monitorLesson.js (.../monitorLesson.js) (revision 0b00c7fe6d231b631e9a717b87d8c833320b2f19) +++ lams_monitoring/web/includes/javascript/monitorLesson.js (.../monitorLesson.js) (revision 6f82bfabdb07cfa40b1c3840e688362fe11e7271) @@ -904,17 +904,8 @@ openPopUp(LAMS_URL + activity.url, "MonitorActivity", 720, 900, true, true); }; - activityGroup.css('cursor', 'pointer') - // double tap detection on mobile devices; it works also for mouse clicks - .tap(function(event){ - var currentTime = new Date().getTime(), - tapLength = currentTime - lastTap; - if (tapLength < tapTimeout && tapLength > 0) { - event.preventDefault(); - dblClickFunction(); - } - lastTap = currentTime; - }); + activityGroup.css('cursor', 'pointer'); + dblTap(activityGroup, dblClickFunction); } }); @@ -1181,7 +1172,7 @@ }); if (usersViewable) { - learnerIcon.dblclick(function(event){ + dblTap(learnerIcon, function(event){ // double click on learner icon to see activity from his perspective event.stopPropagation(); var url = LAMS_URL + 'monitoring/monitoring.do?method=getLearnerActivityURL&userID=' @@ -1191,8 +1182,8 @@ } }); - - $('*[id^="act' + activity.id + 'learnerGroup"]', sequenceCanvas).dblclick(function(event){ + var learnerGroup = $('*[id^="act' + activity.id + 'learnerGroup"]', sequenceCanvas); + dblTap(learnerGroup, function(event){ // double click on learner group icon to see list of learners event.stopPropagation(); showLearnerGroupDialog(activity.id, activity.title, activity.learners, true, usersViewable); @@ -1257,13 +1248,14 @@ }); // show a group icon - $('').attr({ + var groupIcon = $('').attr({ 'src' : LAMS_URL + 'images/icons/group.png', 'title' : LABELS.LEARNER_GROUP_SHOW - }).css('cursor', 'pointer') - .dblclick(function(){ + }).css('cursor', 'pointer').appendTo(iconsContainer); + + dblTap(groupIcon, function(){ showLearnerGroupDialog(null, LABELS.LEARNER_FINISHED_DIALOG_TITLE, learners, true, false); - }).appendTo(iconsContainer); + }); } } @@ -1817,7 +1809,7 @@ .attr('disabled', null); }); if (allowView){ - learnerDiv.dblclick(function(){ + dblTap(learnerDiv, function(){ // same as clicking View Learner button openPopUp(viewUrl, "LearnActivity", 600, 800, true); }); @@ -1934,4 +1926,20 @@ target.appendChild(element); return element; +} + +/** + * Works as dblclick for mobile devices. + */ +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(), + tapLength = currentTime - lastTap; + if (tapLength < tapTimeout && tapLength > 0) { + event.preventDefault(); + dblClickFunction(event); + } + lastTap = currentTime; + }); } \ No newline at end of file