1jQuery(document).ready(function($) { 2 3 // Get Questions ID's of actual quiz 4 let cats_ids = []; 5 $('.wpProQuiz_quiz .wpProQuiz_list li.wpProQuiz_listItem').each(function() { 6 var $this = $(this); 7 var question_meta = $this.data('question-meta'); 8 var question_post_id = question_meta.question_post_id; 9 cats_ids += question_post_id += ','; 10 }); 11 12 var parms = { 13 'action': 'get_found_categories_data', 14 'question_ids': cats_ids 15 } 16 17 // Generate Frontend Custom Categories 18 $.ajax({ 19 type: "POST", 20 dataType: "json", 21 url: ld_mqc.ajax_url, 22 data: parms, 23 success: function(response) { 24 $.each(response, function(key, value) { 25 $('.wpProQuiz_catOverview ol').append('\ 26 <li data-category_id="' + value['id'] + '" data-posts_id="' + value['ids'] + '" data-posts_nr="' + value['count'] + '">\ 27 <span class="wpProQuiz_catName">' + value['name'] + ' ' + value['count'] + '</span>\ 28 <span class="wpProQuiz_catPercent">0%</span>\ 29 </li>\ 30 '); 31 }); 32 }, 33 error: function(response) {} 34 }); 35 36 // Display % of correct answer per category 37 $('.wpProQuiz_QuestionButton').on('click', function() { 38 $(document).ajaxStop(function() { 39 $('.wpProQuiz_catOverview li').each(function() { 40 var $this = $(this); 41 var posts_id = $this.data('posts_id'); 42 43 if (typeof posts_id === 'undefined') { 44 $this.hide(); 45 return true; 46 } 47 48 // String with posts ID's per catgory transfrom in array 49 var obj_split = []; 50 if (Object.prototype.toString.call(posts_id) == '[object String]') { 51 obj_split = posts_id.split(","); 52 } else { 53 obj_split = [posts_id]; 54 } 55 56 var nr_posts_per_cat = obj_split.length; 57 var corect_answers = 0; 58 59 $(obj_split).each(function(key, value) { 60 var quetion_id = parseInt(value); 61 62 $('.wpProQuiz_quiz .wpProQuiz_list li.wpProQuiz_listItem').each(function() { 63 var $this = $(this); 64 var question_meta = $this.data('question-meta'); 65 var question_post_id = question_meta.question_post_id; 66 67 if (quetion_id === question_post_id) { 68 if ( ( $this.find('.wpProQuiz_correct').length > 0 ) && ( $this.find('.wpProQuiz_correct').css('display') !== 'none' ) ) { 69 corect_answers += 1; 70 } 71 } 72 }); 73 }); 74 75 // Calculate percentage per question on category 76 var total_percent = (corect_answers * 100) / nr_posts_per_cat; 77 78 total_percent = (total_percent).toFixed(2) 79 $this.find('.wpProQuiz_catPercent').text(total_percent + '%'); 80 81 $this.show(); 82 corect_answers = 0; 83 }); 84 }); 85 }); 86 87 // var $e = $( element ); 88 // showTip: function() { 89 // var $this = $( this ); 90 // var id = $this.siblings( '.wpProQuiz_question' ).find( globalNames.questionList ).data( 'question_id' ); 91 92 // $this.siblings( '.wpProQuiz_tipp' ).toggle( 'fast' ); 93 94 // results[id].tip = 1; 95 // if ( config.quiz_resume_enabled === '1' ) { 96 // plugin.methode.saveMetaDataToCookie( 'tip' + id, {question_id: id} ); 97 // } 98 99 // $( document ).on( 'mouseup.tipEvent', function( e ) { 100 // var $tip = $e.find( '.wpProQuiz_tipp' ); 101 // var $btn = $e.find( 'input[name="tip"]' ); 102 103 // if ( ! $tip.is( e.target ) && $tip.has( e.target ).length == 0 && ! $btn.is( e.target ) ) { 104 // $tip.hide( 'fast' ); 105 // $( document ).unbind( '.tipEvent' ); 106 // } 107 // } ); 108 // },
109 // $e.find( 'input[name="tip"]' ).on( 'click', plugin.methode.showTip ); 110});
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.