1/** 2 * Campbell's FAQ Plugin default JavaScript Functions. 3 */ 4 5 jQuery(function (){ 6 var faqPage = jQuery( 'body.page-qa' ); 7 8 if ( faqPage ) { 9 toggleSubFaqs(); 10 toggleThumbsUp(); 11 toggleThumbsDown(); 12 } 13 14 function toggleSubFaqs() { 15 /* Open the section by default if there is only one section */ 16 if ( jQuery( '.legal-item .title' ).length === 1 ) { 17 jQuery( '.legal-item' ).addClass( 'expanded' ); 18 } 19 20 jQuery( '.legal-item .legal-content .legal-section h6, .legal-item .legal-content .legal-section h4' ).on( 'click', function () { 21 var el = jQuery( this ); 22 var elParent = jQuery( '.legal-item .legal-content .legal-section' ); 23 24 if ( el.parents( '.legal-section' ).hasClass( 'exposed' ) ) { 25 elParent.removeClass( 'exposed' ); 26 } else { 27 elParent.removeClass( 'exposed' ); 28 el.parents( '.legal-section' ).addClass( 'exposed' ); 29 } 30 }); 31 } 32 33 function toggleThumbsUp(){ 34 jQuery( '.thumbsUp' ).on( 'click', function(){ 35 jQuery( this ).toggleClass( 'highlight' ); 36 if( jQuery( this).siblings( '.thumbsDown' ).hasClass( 'highlight' )){ 37 jQuery( this).siblings( '.thumbsDown' ).removeClass( 'highlight' ); 38 var contact = jQuery( this ).parents(); 39 contact.siblings( '.contact-us').addClass( 'hide' ); 40 var parent = jQuery(this).parents().filter('.legal-section'); 41 var attr = parent[0].dataset.id; 42 var data = { 43 'action' : 'remove_unlike', 44 'id' : attr, 45 }; 46 jQuery.post(ajax_object.ajax_url, data, function(response){ 47 }); 48 } 49 50 if(jQuery(this).hasClass('highlight')){ 51 var parent = jQuery(this).parents().filter('.legal-section'); 52 var attr = parent[0].dataset.id; 53 var data = { 54 'action' : 'helpful_counter', 55 'id' : attr, 56 }; 57 jQuery.post(ajax_object.ajax_url, data, function(response){ 58 }); 59 } 60 61 if(jQuery(this).hasClass('highlight') === false){ 62 var parent = jQuery(this).parents().filter('.legal-section'); 63 var attr = parent[0].dataset.id; 64 var data = { 65 'action' : 'remove_like', 66 'id' : attr, 67 }; 68 jQuery.post(ajax_object.ajax_url, data, function(response){ 69 }); 70 } 71 72 }); 73 } 74 75 function toggleThumbsDown(){ 76 jQuery( '.thumbsDown' ).on( 'click', function(){ 77 jQuery( this ).toggleClass( "highlight" ); 78 if( jQuery( this).siblings( '.thumbsUp' ).hasClass( 'highlight' )){ 79 jQuery( this).siblings( '.thumbsUp' ).removeClass( 'highlight' ); 80 var parent = jQuery(this).parents().filter('.legal-section'); 81 var attr = parent[0].dataset.id; 82 var data = { 83 'action' : 'remove_like', 84 'id' : attr, 85 }; 86 jQuery.post(ajax_object.ajax_url, data, function(response){ 87 }); 88 } 89 var contact = jQuery( this ).parents(); 90 contact.siblings( '.contact-us').toggleClass( 'hide' ); 91 92 if(jQuery(this).hasClass('highlight')){ 93 var parent = jQuery(this).parents().filter('.legal-section'); 94 var attr = parent[0].dataset.id; 95 var data = { 96 'action' : 'unhelpful_counter', 97 'id' : attr, 98 }; 99 jQuery.post(ajax_object.ajax_url, data, function(response){ 100 }); 101 } 102 103 if(jQuery(this).hasClass('highlight') === false){ 104 var parent = jQuery(this).parents().filter('.legal-section'); 105 var attr = parent[0].dataset.id; 106 var data = { 107 'action' : 'remove_unlike', 108 'id' : attr, 109 }; 110 jQuery.post(ajax_object.ajax_url, data, function(response){ 111 }); 112 } 113 114 }); 115 } 116}); 117 118
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.