Quiz And Survey Master (Formerly Quiz Master Next) - Version 7.1.4

Version Description

(October 06, 2020) = * Bug: Fixed point score issues when answer type is Rich Answer with HTML tags. * Enhancement: Added JS hook for quiz to enhance JS event. * Enhancement: Added .pot file to translate string into any language. * Enhancement: Added %POINT_SCORE% variable support in %QUESTIONS_ANSWERS% template variable. * Enhancement: Added option to display Correct Answer Info with inline result.

Download this release

Release Info

Developer expresstech
Plugin Icon 128x128 Quiz And Survey Master (Formerly Quiz Master Next)
Version 7.1.4
Comparing to
See all releases

Code changes from version 7.1.3 to 7.1.4

css/common.css CHANGED
@@ -244,6 +244,11 @@ footer.qsm-popup__footer button.qsm-popup-secondary-button:hover{
244
  color: red;
245
  margin-top: 5px;
246
  display: inline-block;
 
 
 
 
 
247
  }
248
  @media screen and (max-width: 767px){
249
  .question-type-polar-s .left-polar-title,
244
  color: red;
245
  margin-top: 5px;
246
  display: inline-block;
247
+ width: 100%;
248
+ }
249
+ .quiz_section .qsm-inline-correct-info{
250
+ margin-bottom: 0;
251
+ margin-top: 10px;
252
  }
253
  @media screen and (max-width: 767px){
254
  .question-type-polar-s .left-polar-title,
js/qsm-quiz.js CHANGED
@@ -39,7 +39,9 @@ var QSMPageTimer;
39
  * @param int quizID The ID of the quiz
40
  */
41
  initTimer: function( quizID ) {
42
-
 
 
43
  // Gets our form
44
  var $quizForm = QSM.getQuizForm(quizID);
45
 
@@ -95,6 +97,7 @@ var QSMPageTimer;
95
  $('#quizForm' + quizID).closest('.qmn_quiz_container').find('.stoptimer-p').show();
96
  }
97
  }
 
98
  },
99
  /**
100
  * Starts the timer for the quiz.
@@ -102,7 +105,8 @@ var QSMPageTimer;
102
  * @param int quizID The ID of the quiz.
103
  */
104
  activateTimer: function( quizID ) {
105
-
 
106
  // Gets our form.
107
  var $timer = QSM.getTimer( quizID );
108
 
@@ -129,6 +133,7 @@ var QSMPageTimer;
129
 
130
  // Sets up timer interval.
131
  qmn_quiz_data[ quizID ].timerInterval = setInterval( QSM.timer, 1000, quizID );
 
132
  },
133
  /**
134
  * Reduces the timer by one second and checks if timer is 0
@@ -207,6 +212,7 @@ var QSMPageTimer;
207
  if ( typeof qmn_quiz_data[ quizID ].timerInterval != 'undefined' ) {
208
  clearInterval( qmn_quiz_data[ quizID ].timerInterval );
209
  }
 
210
  },
211
  /**
212
  * Converts seconds to 00:00:00 format
@@ -261,7 +267,7 @@ var QSMPageTimer;
261
  *
262
  * @param int quizID The ID of the quiz.
263
  */
264
- initPagination: function( quizID ) {
265
  var $quizForm = QSM.getQuizForm( quizID );
266
  if ( 0 < $quizForm.children( '.qsm-page' ).length ) {
267
  $quizForm.children( '.qsm-page' ).hide();
@@ -271,6 +277,7 @@ var QSMPageTimer;
271
  $quizForm.find( '.qsm-pagination' ).append( '<input type="hidden" value="0" name="current_page" class="current_page_hidden" />');
272
  }
273
  if ( '1' == qmn_quiz_data[ quizID ].progress_bar ) {
 
274
  $('#quizForm' + quizID).find('.qsm-progress-bar').show();
275
  qmn_quiz_data[ quizID ].bar = new ProgressBar.Line('#quizForm' + quizID + ' .qsm-progress-bar', {
276
  strokeWidth: 2,
@@ -300,23 +307,28 @@ var QSMPageTimer;
300
  //bar.setText(Math.round(bar.value() * 100) + ' %');
301
  }
302
  });
 
303
  }
304
  QSM.goToPage( quizID, 1 );
305
  $quizForm.find( '.qsm-pagination .qsm-next' ).on( 'click', function( event ) {
 
306
  event.preventDefault();
307
  QSM.nextPage( quizID );
308
  var $container = jQuery( '#quizForm' + quizID ).closest( '.qmn_quiz_container' );
309
  if( qmn_quiz_data[ quizID ].disable_scroll_next_previous_click != 1 ){
310
  qsmScrollTo( $container );
311
- }
 
312
  });
313
  $quizForm.find( '.qsm-pagination .qsm-previous' ).on( 'click', function( event ) {
 
314
  event.preventDefault();
315
  QSM.prevPage( quizID );
316
  var $container = jQuery( '#quizForm' + quizID ).closest( '.qmn_quiz_container' );
317
  if( qmn_quiz_data[ quizID ].disable_scroll_next_previous_click != 1 ){
318
  qsmScrollTo( $container );
319
  }
 
320
  });
321
  }
322
  },
@@ -326,6 +338,7 @@ var QSMPageTimer;
326
  * @param int pageNumber The number of the page
327
  */
328
  goToPage: function( quizID, pageNumber ) {
 
329
  var $quizForm = QSM.getQuizForm( quizID );
330
  var $pages = $quizForm.children( '.qsm-page' );
331
  var $currentPage = $quizForm.children( '.qsm-page:nth-of-type(' + pageNumber + ')' );
@@ -383,6 +396,7 @@ var QSMPageTimer;
383
  }
384
  }
385
  QSM.savePage( quizID, pageNumber );
 
386
  },
387
  /**
388
  * Moves forward or backwards through the pages
@@ -438,6 +452,7 @@ var QSMPageTimer;
438
  * Init Page Timer
439
  */
440
  initPageTimer: function (quizID, $currentpage) {
 
441
  var $quizForm = QSM.getQuizForm(quizID);
442
  var pid = $currentpage.data('pid');
443
  if (undefined != pid) {
@@ -475,6 +490,7 @@ var QSMPageTimer;
475
  $this.get(0).play();
476
  });
477
  }
 
478
  },
479
  /**
480
  * Reduces the timer by one second and checks if timer is 0
@@ -651,7 +667,9 @@ function qmnClearField( field ) {
651
 
652
  function qsmScrollTo( $element ) {
653
  if($element.length > 0){
 
654
  jQuery( 'html, body' ).animate( { scrollTop: $element.offset().top - 150 }, 1000 );
 
655
  }
656
  }
657
 
@@ -667,7 +685,8 @@ function qmnResetError( quiz_form_id ) {
667
  jQuery( '#' + quiz_form_id + ' .quiz_section' ).removeClass( 'qmn_error' );
668
  }
669
 
670
- function qmnValidation( element, quiz_form_id ) {
 
671
  var result = true;
672
  var quiz_id = +jQuery( '#' + quiz_form_id ).find( '.qmn_quiz_id' ).val();
673
  var email_error = qmn_quiz_data[ quiz_id ].error_messages.email;
@@ -746,6 +765,7 @@ function qmnValidation( element, quiz_form_id ) {
746
  }
747
  }
748
  });
 
749
  return result;
750
  }
751
 
@@ -795,6 +815,7 @@ function qmnFormSubmit( quiz_form_id ) {
795
  if ( qmn_quiz_data[quiz_id].hasOwnProperty( 'timer_limit' ) ) {
796
  QSM.endTimer( quiz_id );
797
  }
 
798
  jQuery( '#' + quiz_form_id + ' input[type=submit]' ).attr( 'disabled', 'disabled' );
799
  qsmDisplayLoading( $container );
800
  // console.log( 'submitted data:' + unindexed_array );
@@ -808,7 +829,7 @@ function qmnFormSubmit( quiz_form_id ) {
808
  qmnDisplayResults( JSON.parse( response ), quiz_form_id, $container );
809
  }
810
  });
811
-
812
  return false;
813
  }
814
 
@@ -877,6 +898,7 @@ function qmnValidatePage( quiz_form_id ) {
877
 
878
  //Function to advance quiz to next page
879
  function qmnNextSlide( pagination, go_to_top, quiz_form_id ) {
 
880
  var quiz_id = +jQuery( quiz_form_id ).find( '.qmn_quiz_id' ).val();
881
  var $container = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' );
882
  var slide_number = +$container.find( '.slide_number_hidden' ).val();
@@ -955,9 +977,11 @@ function qmnNextSlide( pagination, go_to_top, quiz_form_id ) {
955
  jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
956
  }
957
  qmnInitProgressbarOnClick(quiz_id, page_number, total_page_number);
 
958
  }
959
 
960
  function qmnPrevSlide( pagination, go_to_top, quiz_form_id ) {
 
961
  var quiz_id = +jQuery( quiz_form_id ).find( '.qmn_quiz_id' ).val();
962
  var $container = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' );
963
  var slide_number = +$container.find( '.slide_number_hidden' ).val();
@@ -1027,6 +1051,7 @@ function qmnPrevSlide( pagination, go_to_top, quiz_form_id ) {
1027
  jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val( page_number );
1028
  jQuery( quiz_form_id ).parent().find('.qmn_pagination').css('width', '100%' );
1029
  qmnInitProgressbarOnClick(quiz_id, page_number, total_page_number);
 
1030
  }
1031
 
1032
  /**
@@ -1097,6 +1122,7 @@ function qmnInitPagination( quiz_id ) {
1097
  .append( '<a class="qmn_btn mlw_qmn_quiz_link mlw_next" href="#">' + qmn_quiz_data[quiz_id].pagination.next_text + '</a>' );
1098
 
1099
  if ( '1' == qmn_quiz_data[ quiz_id ].progress_bar ) {
 
1100
  jQuery('#quizForm' + quiz_id).closest( '.qmn_quiz_container' ).find('.qsm-progress-bar').show();
1101
  qmn_quiz_data[ quiz_id ].bar = new ProgressBar.Line('#qsm_progress_bar_' + quiz_id, {
1102
  strokeWidth: 2,
@@ -1125,6 +1151,7 @@ function qmnInitPagination( quiz_id ) {
1125
  step: function(state, bar) {
1126
  }
1127
  });
 
1128
  }
1129
 
1130
  jQuery(".mlw_next").click(function(event) {
@@ -1229,13 +1256,18 @@ jQuery(function() {
1229
  action: "qsm_get_question_quick_result",
1230
  question_id: question_id,
1231
  answer: value,
 
1232
  },
1233
  success: function (response) {
 
1234
  $this.find('.quick-question-res-p').remove();
1235
- if(response == 'correct'){
 
1236
  $this.append('<p style="color: green" class="quick-question-res-p">' + qmn_ajax_object.quick_result_correct_text + '</p>')
1237
- }else if(response == 'incorrect'){
 
1238
  $this.append('<p style="color: red" class="quick-question-res-p">' + qmn_ajax_object.quick_result_wrong_text + '</p>')
 
1239
  }
1240
  },
1241
  error: function (errorThrown) {
39
  * @param int quizID The ID of the quiz
40
  */
41
  initTimer: function( quizID ) {
42
+
43
+ jQuery(document).trigger('qsm_init_timer_before', [quizID]);
44
+
45
  // Gets our form
46
  var $quizForm = QSM.getQuizForm(quizID);
47
 
97
  $('#quizForm' + quizID).closest('.qmn_quiz_container').find('.stoptimer-p').show();
98
  }
99
  }
100
+ jQuery(document).trigger('qsm_init_timer_after', [quizID]);
101
  },
102
  /**
103
  * Starts the timer for the quiz.
105
  * @param int quizID The ID of the quiz.
106
  */
107
  activateTimer: function( quizID ) {
108
+
109
+ jQuery(document).trigger('qsm_activate_time_before', [quizID, qmn_quiz_data]);
110
  // Gets our form.
111
  var $timer = QSM.getTimer( quizID );
112
 
133
 
134
  // Sets up timer interval.
135
  qmn_quiz_data[ quizID ].timerInterval = setInterval( QSM.timer, 1000, quizID );
136
+ jQuery(document).trigger('qsm_activate_time_after', [quizID, qmn_quiz_data]);
137
  },
138
  /**
139
  * Reduces the timer by one second and checks if timer is 0
212
  if ( typeof qmn_quiz_data[ quizID ].timerInterval != 'undefined' ) {
213
  clearInterval( qmn_quiz_data[ quizID ].timerInterval );
214
  }
215
+ jQuery(document).trigger('qsm_end_timer', [quizID, qmn_quiz_data]);
216
  },
217
  /**
218
  * Converts seconds to 00:00:00 format
267
  *
268
  * @param int quizID The ID of the quiz.
269
  */
270
+ initPagination: function( quizID ) {
271
  var $quizForm = QSM.getQuizForm( quizID );
272
  if ( 0 < $quizForm.children( '.qsm-page' ).length ) {
273
  $quizForm.children( '.qsm-page' ).hide();
277
  $quizForm.find( '.qsm-pagination' ).append( '<input type="hidden" value="0" name="current_page" class="current_page_hidden" />');
278
  }
279
  if ( '1' == qmn_quiz_data[ quizID ].progress_bar ) {
280
+ jQuery(document).trigger('qsm_init_progressbar_before', [quizID, qmn_quiz_data]);
281
  $('#quizForm' + quizID).find('.qsm-progress-bar').show();
282
  qmn_quiz_data[ quizID ].bar = new ProgressBar.Line('#quizForm' + quizID + ' .qsm-progress-bar', {
283
  strokeWidth: 2,
307
  //bar.setText(Math.round(bar.value() * 100) + ' %');
308
  }
309
  });
310
+ jQuery(document).trigger('qsm_init_progressbar_after', [quizID, qmn_quiz_data]);
311
  }
312
  QSM.goToPage( quizID, 1 );
313
  $quizForm.find( '.qsm-pagination .qsm-next' ).on( 'click', function( event ) {
314
+ jQuery(document).trigger('qsm_next_button_click_before', [quizID]);
315
  event.preventDefault();
316
  QSM.nextPage( quizID );
317
  var $container = jQuery( '#quizForm' + quizID ).closest( '.qmn_quiz_container' );
318
  if( qmn_quiz_data[ quizID ].disable_scroll_next_previous_click != 1 ){
319
  qsmScrollTo( $container );
320
+ }
321
+ jQuery(document).trigger('qsm_next_button_click_after', [quizID]);
322
  });
323
  $quizForm.find( '.qsm-pagination .qsm-previous' ).on( 'click', function( event ) {
324
+ jQuery(document).trigger('qsm_previous_button_click_before', [quizID]);
325
  event.preventDefault();
326
  QSM.prevPage( quizID );
327
  var $container = jQuery( '#quizForm' + quizID ).closest( '.qmn_quiz_container' );
328
  if( qmn_quiz_data[ quizID ].disable_scroll_next_previous_click != 1 ){
329
  qsmScrollTo( $container );
330
  }
331
+ jQuery(document).trigger('qsm_previous_button_click_after', [quizID]);
332
  });
333
  }
334
  },
338
  * @param int pageNumber The number of the page
339
  */
340
  goToPage: function( quizID, pageNumber ) {
341
+ jQuery(document).trigger('qsm_go_to_page_before', [quizID, pageNumber]);
342
  var $quizForm = QSM.getQuizForm( quizID );
343
  var $pages = $quizForm.children( '.qsm-page' );
344
  var $currentPage = $quizForm.children( '.qsm-page:nth-of-type(' + pageNumber + ')' );
396
  }
397
  }
398
  QSM.savePage( quizID, pageNumber );
399
+ jQuery(document).trigger('qsm_go_to_page_after', [quizID, pageNumber]);
400
  },
401
  /**
402
  * Moves forward or backwards through the pages
452
  * Init Page Timer
453
  */
454
  initPageTimer: function (quizID, $currentpage) {
455
+ jQuery(document).trigger('qsm_init_page_timer_before', [quizID, $currentpage]);
456
  var $quizForm = QSM.getQuizForm(quizID);
457
  var pid = $currentpage.data('pid');
458
  if (undefined != pid) {
490
  $this.get(0).play();
491
  });
492
  }
493
+ jQuery(document).trigger('qsm_init_page_timer_after',[quizID, $currentpage]);
494
  },
495
  /**
496
  * Reduces the timer by one second and checks if timer is 0
667
 
668
  function qsmScrollTo( $element ) {
669
  if($element.length > 0){
670
+ jQuery(document).trigger('qsm_scroll_to_top_before', [$element]);
671
  jQuery( 'html, body' ).animate( { scrollTop: $element.offset().top - 150 }, 1000 );
672
+ jQuery(document).trigger('qsm_scroll_to_top_after', [$element]);
673
  }
674
  }
675
 
685
  jQuery( '#' + quiz_form_id + ' .quiz_section' ).removeClass( 'qmn_error' );
686
  }
687
 
688
+ function qmnValidation( element, quiz_form_id ) {
689
+ jQuery(document).trigger('qsm_before_validation', [element, quiz_form_id]);
690
  var result = true;
691
  var quiz_id = +jQuery( '#' + quiz_form_id ).find( '.qmn_quiz_id' ).val();
692
  var email_error = qmn_quiz_data[ quiz_id ].error_messages.email;
765
  }
766
  }
767
  });
768
+ jQuery(document).trigger('qsm_after_validation', [element, quiz_form_id]);
769
  return result;
770
  }
771
 
815
  if ( qmn_quiz_data[quiz_id].hasOwnProperty( 'timer_limit' ) ) {
816
  QSM.endTimer( quiz_id );
817
  }
818
+ jQuery(document).trigger('qsm_before_quiz_submit', [quiz_form_id]);
819
  jQuery( '#' + quiz_form_id + ' input[type=submit]' ).attr( 'disabled', 'disabled' );
820
  qsmDisplayLoading( $container );
821
  // console.log( 'submitted data:' + unindexed_array );
829
  qmnDisplayResults( JSON.parse( response ), quiz_form_id, $container );
830
  }
831
  });
832
+ jQuery(document).trigger('qsm_after_quiz_submit', [quiz_form_id]);
833
  return false;
834
  }
835
 
898
 
899
  //Function to advance quiz to next page
900
  function qmnNextSlide( pagination, go_to_top, quiz_form_id ) {
901
+ jQuery(document).trigger('qsm_next_button_click_before', [quiz_form_id]);
902
  var quiz_id = +jQuery( quiz_form_id ).find( '.qmn_quiz_id' ).val();
903
  var $container = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' );
904
  var slide_number = +$container.find( '.slide_number_hidden' ).val();
977
  jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.pages_count').hide();
978
  }
979
  qmnInitProgressbarOnClick(quiz_id, page_number, total_page_number);
980
+ jQuery(document).trigger('qsm_next_button_click_after', [quiz_form_id]);
981
  }
982
 
983
  function qmnPrevSlide( pagination, go_to_top, quiz_form_id ) {
984
+ jQuery(document).trigger('qsm_previous_button_click_before', [quiz_form_id]);
985
  var quiz_id = +jQuery( quiz_form_id ).find( '.qmn_quiz_id' ).val();
986
  var $container = jQuery( quiz_form_id ).closest( '.qmn_quiz_container' );
987
  var slide_number = +$container.find( '.slide_number_hidden' ).val();
1051
  jQuery( quiz_form_id ).closest( '.qmn_quiz_container' ).find('.current_page_hidden').val( page_number );
1052
  jQuery( quiz_form_id ).parent().find('.qmn_pagination').css('width', '100%' );
1053
  qmnInitProgressbarOnClick(quiz_id, page_number, total_page_number);
1054
+ jQuery(document).trigger('qsm_previous_button_click_after', [quiz_form_id]);
1055
  }
1056
 
1057
  /**
1122
  .append( '<a class="qmn_btn mlw_qmn_quiz_link mlw_next" href="#">' + qmn_quiz_data[quiz_id].pagination.next_text + '</a>' );
1123
 
1124
  if ( '1' == qmn_quiz_data[ quiz_id ].progress_bar ) {
1125
+ jQuery(document).trigger('qsm_init_progressbar_before', [quiz_id, qmn_quiz_data]);
1126
  jQuery('#quizForm' + quiz_id).closest( '.qmn_quiz_container' ).find('.qsm-progress-bar').show();
1127
  qmn_quiz_data[ quiz_id ].bar = new ProgressBar.Line('#qsm_progress_bar_' + quiz_id, {
1128
  strokeWidth: 2,
1151
  step: function(state, bar) {
1152
  }
1153
  });
1154
+ jQuery(document).trigger('qsm_init_progressbar_after', [quiz_id, qmn_quiz_data]);
1155
  }
1156
 
1157
  jQuery(".mlw_next").click(function(event) {
1256
  action: "qsm_get_question_quick_result",
1257
  question_id: question_id,
1258
  answer: value,
1259
+ show_correct_info: qmn_ajax_object.enable_quick_correct_answer_info
1260
  },
1261
  success: function (response) {
1262
+ var data = jQuery.parseJSON( response );
1263
  $this.find('.quick-question-res-p').remove();
1264
+ $this.find('.qsm-inline-correct-info').remove();
1265
+ if(data.success == 'correct'){
1266
  $this.append('<p style="color: green" class="quick-question-res-p">' + qmn_ajax_object.quick_result_correct_text + '</p>')
1267
+ $this.append('<p class="qsm-inline-correct-info">'+ data.message +'</p>');
1268
+ }else if(data.success == 'incorrect'){
1269
  $this.append('<p style="color: red" class="quick-question-res-p">' + qmn_ajax_object.quick_result_wrong_text + '</p>')
1270
+ $this.append('<p class="qsm-inline-correct-info">'+ data.message +'</p>');
1271
  }
1272
  },
1273
  error: function (errorThrown) {
lang/quiz-master-next.pot ADDED
@@ -0,0 +1,2748 @@