Minor - Format code - refs #8241

1.10.x
Angel Fernando Quiroz Campos 9 years ago
parent 18faa539b6
commit 2b98e4e01b
  1. 105
      main/inc/lib/javascript/hotspot/js/hotspot.js

@ -1,7 +1,5 @@
window.HotspotQuestion = (function () { window.HotspotQuestion = (function () {
return function (settings) { return function (settings) {
var HotspotModel = function (attributes) { var HotspotModel = function (attributes) {
this.attributes = attributes; this.attributes = attributes;
this.id = 0; this.id = 0;
@ -56,8 +54,6 @@ window.HotspotQuestion = (function () {
} }
}; };
SquareModel.decode = function (hotspotInfo) { SquareModel.decode = function (hotspotInfo) {
var coords = hotspotInfo.coord.split('|'), var coords = hotspotInfo.coord.split('|'),
position = coords[0].split(';'), position = coords[0].split(';'),
@ -185,7 +181,7 @@ window.HotspotQuestion = (function () {
this.get('points').forEach(function (point) { this.get('points').forEach(function (point) {
pairedPoints.push( pairedPoints.push(
point.join(';') point.join(';')
); );
}); });
return pairedPoints.join('|'); return pairedPoints.join('|');
@ -300,7 +296,7 @@ window.HotspotQuestion = (function () {
newEl.setAttribute( newEl.setAttribute(
'points', 'points',
pointsPaired.join(' ') pointsPaired.join(' ')
); );
} }
newEl.setAttribute('class', 'hotspot-' + this.hotspotIndex); newEl.setAttribute('class', 'hotspot-' + this.hotspotIndex);
@ -535,7 +531,7 @@ window.HotspotQuestion = (function () {
$(config.selector).parent().find('.row').append( $(config.selector).parent().find('.row').append(
hotspotSelect.render().el hotspotSelect.render().el
); );
}; };
AdminHotspotsSVG.prototype.setEvents = function () { AdminHotspotsSVG.prototype.setEvents = function () {
var self = this, var self = this,
@ -547,9 +543,10 @@ window.HotspotQuestion = (function () {
y: 0 y: 0
}; };
$el.on('dragstart', function (e) { $el
e.preventDefault(); .on('dragstart', function (e) {
}) e.preventDefault();
})
.on('mousedown', function (e) { .on('mousedown', function (e) {
e.preventDefault(); e.preventDefault();
@ -765,7 +762,7 @@ window.HotspotQuestion = (function () {
$(config.selector).append( $(config.selector).append(
contextMenu.render().el contextMenu.render().el
); );
$.each(questionInfo.hotspots, function (index, hotspotInfo) { $.each(questionInfo.hotspots, function (index, hotspotInfo) {
var hotspot = null; var hotspot = null;
@ -1038,7 +1035,7 @@ window.HotspotQuestion = (function () {
this.el.appendChild( this.el.appendChild(
hotspotSVG.render().el hotspotSVG.render().el
); );
return this; return this;
}; };
@ -1748,61 +1745,61 @@ window.DelineationQuestion = (function () {
}; };
return function (settings) { return function (settings) {
config = $.extend({ config = $.extend({
questionId: 0, questionId: 0,
selector: '' selector: ''
}, settings); }, settings);
if (!config.questionId || !config.selector) { if (!config.questionId || !config.selector) {
return; return;
} }
$(config.selector).html('\n\ $(config.selector).html('\n\
<span class="fa fa-spinner fa-spin fa-3x" aria-hidden="hidden"></span>\n\ <span class="fa fa-spinner fa-spin fa-3x" aria-hidden="hidden"></span>\n\
<span class="sr-only">Loading</span>\n\ <span class="sr-only">Loading</span>\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': case 'admin':
xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript_admin.as.php', { startAdminSvg(questionInfo);
modifyAnswers: parseInt(config.questionId)
});
break; break;
case 'user': case 'user':
xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_actionscript.as.php', { startUserSvg(questionInfo);
modifyAnswers: parseInt(config.questionId)
});
break; break;
case 'solution': case 'solution':
//no break //no break
case 'preview': case 'preview':
xhrQuestion = $.getJSON(config.relPath+'main/exercice/hotspot_answers.as.php', { startPreviewSvg(questionInfo);
modifyAnswers: parseInt(config.questionId),
exe_id: parseInt(config.exerciseId)
});
break; 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;
}
});
}; };
})(); })();

Loading…
Cancel
Save