diff --git a/main/inc/lib/javascript/hotspot/js/hotspot.js b/main/inc/lib/javascript/hotspot/js/hotspot.js index 271b52280e..96f85972b2 100755 --- a/main/inc/lib/javascript/hotspot/js/hotspot.js +++ b/main/inc/lib/javascript/hotspot/js/hotspot.js @@ -1,7 +1,5 @@ window.HotspotQuestion = (function () { return function (settings) { - - var HotspotModel = function (attributes) { this.attributes = attributes; this.id = 0; @@ -56,8 +54,6 @@ window.HotspotQuestion = (function () { } }; - - SquareModel.decode = function (hotspotInfo) { var coords = hotspotInfo.coord.split('|'), position = coords[0].split(';'), @@ -185,7 +181,7 @@ window.HotspotQuestion = (function () { this.get('points').forEach(function (point) { pairedPoints.push( point.join(';') - ); + ); }); return pairedPoints.join('|'); @@ -300,7 +296,7 @@ window.HotspotQuestion = (function () { newEl.setAttribute( 'points', pointsPaired.join(' ') - ); + ); } newEl.setAttribute('class', 'hotspot-' + this.hotspotIndex); @@ -535,7 +531,7 @@ window.HotspotQuestion = (function () { $(config.selector).parent().find('.row').append( hotspotSelect.render().el - ); + ); }; AdminHotspotsSVG.prototype.setEvents = function () { var self = this, @@ -547,9 +543,10 @@ window.HotspotQuestion = (function () { y: 0 }; - $el.on('dragstart', function (e) { - e.preventDefault(); - }) + $el + .on('dragstart', function (e) { + e.preventDefault(); + }) .on('mousedown', function (e) { e.preventDefault(); @@ -765,7 +762,7 @@ window.HotspotQuestion = (function () { $(config.selector).append( contextMenu.render().el - ); + ); $.each(questionInfo.hotspots, function (index, hotspotInfo) { var hotspot = null; @@ -1038,7 +1035,7 @@ window.HotspotQuestion = (function () { this.el.appendChild( hotspotSVG.render().el - ); + ); return this; }; @@ -1748,61 +1745,61 @@ window.DelineationQuestion = (function () { }; return function (settings) { - config = $.extend({ - questionId: 0, - selector: '' - }, settings); + config = $.extend({ + questionId: 0, + selector: '' + }, settings); - if (!config.questionId || !config.selector) { - return; - } + if (!config.questionId || !config.selector) { + return; + } - $(config.selector).html('\n\ - \n\ - Loading\n\ - '); + $(config.selector).html('\n\ + \n\ + Loading\n\ + '); - var xhrQuestion = null; + var xhrQuestion = null; - switch (config.for) { + switch (config.for) { + case 'admin': + xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript_admin.as.php', { + modifyAnswers: parseInt(config.questionId) + }); + break; + + case 'user': + xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript.as.php', { + modifyAnswers: parseInt(config.questionId) + }); + break; + + case 'solution': + //no break + case 'preview': + xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_answers.as.php', { + modifyAnswers: parseInt(config.questionId), + exe_id: parseInt(config.exerciseId) + }); + break; + } + + $.when(xhrQuestion).done(function (questionInfo) { + switch (questionInfo.type) { case 'admin': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript_admin.as.php', { - modifyAnswers: parseInt(config.questionId) - }); + startAdminSvg(questionInfo); break; case 'user': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript.as.php', { - modifyAnswers: parseInt(config.questionId) - }); + startUserSvg(questionInfo); break; case 'solution': - //no break + //no break case 'preview': - xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_answers.as.php', { - modifyAnswers: parseInt(config.questionId), - exe_id: parseInt(config.exerciseId) - }); + startPreviewSvg(questionInfo); break; } - - $.when(xhrQuestion).done(function (questionInfo) { - switch (questionInfo.type) { - case 'admin': - startAdminSvg(questionInfo); - break; - - case 'user': - startUserSvg(questionInfo); - break; - - case 'solution': - //no break - case 'preview': - startPreviewSvg(questionInfo); - break; - } - }); + }); }; })();