1jQuery(document).ready(function($) { 2 // ã«ãã´ãªã¼1ã®ã©ã¸ãªãã¿ã³ã¨è¦ªè¦ç´ ã®ã¯ãªãã¯ã¤ãã³ã 3 $('.p-cat1_block').on('click', function() { 4 $(this).find('input[type="radio"]').prop('checked', true).trigger('change'); 5 }); 6 7 $('input[type="radio"]:checked').closest('.p-cat1_block').addClass('checked'); 8 $('input[type="radio"]').on('change', function() { 9 $('.p-cat1_block').removeClass('checked'); 10 $(this).closest('.p-cat1_block').addClass('checked'); 11 }); 12 13 // ã«ãã´ãªã¼2ã®ãã§ãã¯ããã¯ã¹ã¨è¦ªè¦ç´ ã®ã¯ãªãã¯ã¤ãã³ã 14 $('.p-cat2_block').on('click', function() { 15 var checkbox = $(this).find('input[type="checkbox"]'); 16 checkbox.prop('checked', !checkbox.prop('checked')).trigger('change'); 17 }); 18 19 // åæç¶æ ã§ãã§ãã¯ãããè¦ç´ ã«ã¯ã©ã¹ãä»ä¸ 20 $('input[type="checkbox"]:checked').closest('.p-cat2_block').addClass('checked'); 21 22 // "ãã¹ã¦" ãã§ãã¯ããã¯ã¹ãã¯ãªãã¯ãããã¨ã 23 $('#cat2_all').on('change', function() { 24 if ($(this).is(':checked')) { 25 $('input[type="checkbox"]').not(this).prop('checked', false).closest('.p-cat2_block').removeClass('checked'); 26 $(this).closest('.p-cat2_block').addClass('checked'); 27 } 28 }); 29 30 // ä»ã®ãã§ãã¯ããã¯ã¹ãã¯ãªãã¯ãããã¨ã 31 $('input[type="checkbox"]').not('#cat2_all').on('change', function() { 32 if ($('input[type="checkbox"]').not('#cat2_all').is(':checked')) { 33 $('#cat2_all').prop('checked', false).closest('.p-cat2_block').removeClass('checked'); 34 } 35 $(this).closest('.p-cat2_block').toggleClass('checked', $(this).is(':checked')); 36 }); 37 38 // ãã¼ã¸èªã¿è¾¼ã¿æã« "ãã¹ã¦" ããã§ãã¯ããã¦ããå ´åãä»ã®ãã§ãã¯ããã¯ã¹ãå¤ã 39 if ($('#cat2_all').is(':checked')) { 40 $('input[type="checkbox"]').not('#cat2_all').prop('checked', false).closest('.p-cat2_block').removeClass('checked'); 41 } 42 43 //æ¤ç´¢çµæããã¼ããã颿°ï¼ã¹ã¯ãã¼ã«ãªãï¼ 44 function initialLoadProducts(paged = 1) { 45 var cat1 = $('input[name="cat1"]:checked').val(); 46 var cat2 = []; 47 $('input[name="cat2[]"]:checked').each(function() { 48 cat2.push($(this).val()); 49 }); 50 51 $.ajax({ 52 url: ajax_object.ajaxurl, 53 type: 'POST', 54 data: { 55 action: 'ajax_product_filter', 56 cat1: cat1, 57 cat2: cat2, 58 paged: paged 59 }, 60 success: function(response) { 61 var data = JSON.parse(response); 62 $('.product-list').html(data.output); 63 $('.pagination-container').html(data.pagination); 64 65 // ãã¼ã¸ãã¼ã·ã§ã³ã®ã¯ãªãã¯ã¤ãã³ããå度è¨å® 66 $('.pagination a').on('click', function(e) { 67 e.preventDefault(); 68 var paged = $(this).attr('href').split('paged=')[1]; 69 loadProducts(paged); 70 }); 71 }, 72 error: function(xhr, status, error) { 73 console.log('AJAX Error: ' + error); 74 } 75 }); 76 } 77 78 // æ¤ç´¢çµæããã¼ããã颿°ï¼ã¹ã¯ãã¼ã«ããï¼ 79 function loadProducts(paged = 1) { 80 var cat1 = $('input[name="cat1"]:checked').val(); 81 var cat2 = []; 82 $('input[name="cat2[]"]:checked').each(function() { 83 cat2.push($(this).val()); 84 }); 85 86 $.ajax({ 87 url: ajax_object.ajaxurl, 88 type: 'POST', 89 data: { 90 action: 'ajax_product_filter', 91 cat1: cat1, 92 cat2: cat2, 93 paged: paged 94 }, 95 success: function(response) { 96 var data = JSON.parse(response); 97 $('.product-list').html(data.output); 98 $('.pagination-container').html(data.pagination); 99 100 // ãã¼ã¸ãã¼ã·ã§ã³ã®ã¯ãªãã¯ã¤ãã³ããå度è¨å® 101 $('.pagination a').on('click', function(e) { 102 e.preventDefault(); 103 var paged = $(this).attr('href').split('paged=')[1]; 104 loadProducts(paged); 105 }); 106 107 // ã¹ã¯ãã¼ã«æ©è½ã追å 108 $('html, body').animate({ 109 scrollTop: $('.l-product_form').offset().top 110 }, 500); 111 }, 112 error: function(xhr, status, error) { 113 console.log('AJAX Error: ' + error); 114 } 115 }); 116 } 117 118 // åæãã¼ã 119 initialLoadProducts(); 120 121 $('#filter-form').on('submit', function(e) { 122 e.preventDefault(); 123 loadProducts(); 124 }); 125 126 // ãã¼ã¸ãã¼ã·ã§ã³ã®ã¯ãªãã¯ã¤ãã³ãã®è¨å® 127 $(document).on('click', '.pagination a', function(e) { 128 e.preventDefault(); 129 var paged = $(this).attr('href').split('paged=')[1]; 130 loadProducts(paged); 131 }); 132});
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.