Index: lams_central/web/includes/javascript/qb-option.js
===================================================================
diff -u -re11f383d97ca45f4fc0d1c8a283b306439dff946 -r8a54ffb3e9f49470ab01e2139a4b289931d06b81
--- lams_central/web/includes/javascript/qb-option.js (.../qb-option.js) (revision e11f383d97ca45f4fc0d1c8a283b306439dff946)
+++ lams_central/web/includes/javascript/qb-option.js (.../qb-option.js) (revision 8a54ffb3e9f49470ab01e2139a4b289931d06b81)
@@ -11,11 +11,11 @@
checkQuestionNewVersion();
}
}
-
+
function addOption(){
//store old InstanceIds before doing Ajax call. We need to keep record of old ones to prevent reinitializing new CKEditor two times.
var oldOptionIds = new Array();
- for (var instanceId in CKEDITOR.instances){
+ for (var instanceId in CKEDITOR.instances){
oldOptionIds[instanceId] = instanceId;
}
@@ -28,27 +28,27 @@
{
contentFolderID: contentFolderID,
questionType: QUESTION_TYPE,
- optionList: optionList
- },
+ optionList: optionList
+ },
function() {
initializeAnswers();
checkQuestionNewVersion();
}
);
}
-
+
//in order to be able to use option's value, copy it from CKEditor to textarea
function prepareOptionEditorsForAjaxSubmit(){
if ((QUESTION_TYPE == 1) || (QUESTION_TYPE == 7) || (QUESTION_TYPE == 8)) {
$("textarea[name^=optionName], textarea[name^=optionFeedback]").each(function() {
prepareOptionEditorForAjaxSubmit(this);
});
-
+
} else if (QUESTION_TYPE == 2) {
$("[name^=matchingPair]").each(function() {
prepareOptionEditorForAjaxSubmit(this);
});
-
+
} else if ((QUESTION_TYPE == 3) || (QUESTION_TYPE == 4)) {
$("[name^=optionFeedback]").each(function() {
prepareOptionEditorForAjaxSubmit(this);
@@ -66,63 +66,63 @@
//check if jquery-ui.slider.js library is loaded
if (typeof(jQuery.ui.slider) != 'undefined'){
//init grading slider
- $(".slider").slider({
- animate: true,
- min: -1,
- max: 1,
- step: 0.05,
- create: function(event, ui){
- //get initial value from the responsible form input
- var initialValue = $(this).next("input").val();
- $(this).slider('value', initialValue);
- }
- }).on('slide',function(event, ui){
- //ui is not available at the initial call
- var newValueInt = ui ? eval(ui.value) : eval($(this).slider('value'));
-
- //prepare string value
- var newValue;
- switch (newValueInt) {
- case 0:
- newValue = " " + SLIDER_NONE_LABEL + " ";
- break;
- case 1:
- case -1:
- newValue = parseInt(newValueInt*100) + " %";
- break;
- default:
- newValue = " " + parseInt(newValueInt*100) + " % ";
+ $(".slider").slider({
+ animate: false,
+ min: -1,
+ max: 1,
+ step: 0.05,
+ create: function(event, ui){
+ //get initial value from the responsible form input
+ var initialValue = $(this).next("input").val();
+ $(this).slider('value', initialValue);
}
-
+ }).on('slide',function(event, ui){
+ //ui is not available at the initial call
+ var newValueInt = ui ? eval(ui.value) : eval($(this).slider('value'));
+
+ //prepare string value
+ var newValue;
+ switch (newValueInt) {
+ case 0:
+ newValue = " " + SLIDER_NONE_LABEL + " ";
+ break;
+ case 1:
+ case -1:
+ newValue = parseInt(newValueInt*100) + " %";
+ break;
+ default:
+ newValue = " " + parseInt(newValueInt*100) + " % ";
+ }
+
//update slider's label
- $('span', $(this)).html('');
-
- //update input with the new value, it it's not initial call
- if (ui) {
- $(this).next("input").val(ui.value);
- }
-
- var optionDisplayOrderSpan = $(this).closest('.single-option-table').find('.optionDisplayOrderSpan');
- if (newValueInt > 0) {
- optionDisplayOrderSpan.addClass('correctOption').css('filter', 'brightness(' + (2 - newValueInt) + ')');
- } else {
- optionDisplayOrderSpan.removeClass('correctOption').css('filter', 'brightness(1)');
- }
+ $('span', $(this)).html('');
+ //update input with the new value, it it's not initial call
if (ui) {
+ $(this).next("input").val(ui.value);
+ }
+
+ var optionDisplayOrderSpan = $(this).closest('.single-option-table').find('.optionDisplayOrderSpan');
+ if (newValueInt > 0) {
+ optionDisplayOrderSpan.addClass('correctOption').css('filter', 'brightness(' + (2 - newValueInt) + ')');
+ } else {
+ optionDisplayOrderSpan.removeClass('correctOption').css('filter', 'brightness(1)');
+ }
+
+ if (ui) {
checkQuestionNewVersion();
}
- });
- //update slider's label with the initial value
- $('.slider').trigger('slide');
+ });
+ //update slider's label with the initial value
+ $('.slider').trigger('slide');
}
-
- //init options sorting feature
+
+ //init options sorting feature
if ($('#option-table.sortable-on').length) {
- new Sortable($('#option-table.sortable-on')[0], {
- animation: 150,
- ghostClass: 'sortable-placeholder',
- direction: 'vertical',
+ new Sortable($('#option-table.sortable-on')[0], {
+ animation: 150,
+ ghostClass: 'sortable-placeholder',
+ direction: 'vertical',
onStart: function (evt) {
//stop answers' hover effect, once element dragging started
//$("#option-table").removeClass("hover-active");
@@ -139,14 +139,14 @@
//update all displayOrders in order to later save it as options' order
var order = sortable.toArray();
for (var i = 0; i < order.length; i++) {
- var optionIndex = order[i];
- $('input[name="optionDisplayOrder' + optionIndex + '"]').val(i+1);
- $('span#optionDisplayOrderSpan' + optionIndex).text(alphabet[i]);
+ var optionIndex = order[i];
+ $('input[name="optionDisplayOrder' + optionIndex + '"]').val(i+1);
+ $('span#optionDisplayOrderSpan' + optionIndex).text(alphabet[i]);
}
checkQuestionNewVersion();
}
}
});
}
-}
+}
\ No newline at end of file