1jQuery(document).ready(function($) { 2 3 $('.lms-next-question').on('click',function(e) { 4 e.preventDefault(); 5 6 if(this.form.force_all.value == 1 && !ValidateAnswer($(this).data('id'),this.form)) 7 return false;//answer not valid 8 9 var target = $(this).data('target'); 10 $('.lms-quiz-question').removeClass('active'); 11 12 $(target).addClass('active'); 13 }); 14 15 $('.lms-finish_quiz').on('click',function(e) { 16 e.preventDefault(); 17 18 var clicked = $(this); 19 var container = clicked.parent().parent(); 20 21 var data = $(this).parent().parent().serialize(); 22 23 console.log(data); 24 25 $.post(ajax_object.ajax_url, data, function(response) { 26 //console.log(response); 27 if(response.type == 1) { 28 location.assign(response.url); 29 } else { 30 $('.lms-quiz-question').removeClass('active'); 31 container.append(response.html); 32 if ( $('body').hasClass('admin-bar') ) { 33 var quizContainerTop = clicked.parents( '.lms_quiz_form' ).offset().top - 200+ 'px'; 34 } else { 35 var quizContainerTop = clicked.parents( '.lms_quiz_form' ).offset().top - 100+ 'px'; 36 } 37 38 jQuery( 'html,body' ).animate( { scrollTop: quizContainerTop }, 500 ); 39 } 40 41 42 }, 'json'); 43 44 }); 45 46 $( 'body' ).on( 'click', '.lms-next-question', function() { 47 jQuery( this ).parents( '.lms_quiz_form' ).addClass('xxxxxxxxxxxxxxxxx'); 48 var quizContainerTop = jQuery( this ).parents( '.lms_quiz_form' ).offset().top - 100+ 'px'; 49 //console.log( quizContainerTop ); 50 jQuery( 'html,body' ).animate( { scrollTop: quizContainerTop }, 500 ); 51 52 } ); 53 54}); 55 56/** 57* @brief: verify an answer has been provided 58* @return bool 59*/ 60function ValidateAnswer(intID,objForm){ 61 if(objForm['lms_quiz_answer[question]['+intID+']'].value == ''){ 62 alert('Please select an answer.'); 63 return false; 64 } 65 return true; 66}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.