1(function ($) { 2 const facetType = 'date-radio'; 3 const facetSelector = `.facetwp-${facetType}`; 4 window.FWP.hooks.addAction( 5 `facetwp/refresh/${facetType}`, 6 ($this, facetName) => { 7 const selectedValues = []; 8 $this.find(`${facetSelector}.checked`).each(function () { 9 selectedValues.push($(this).attr('data-value')); 10 }); 11 window.FWP.facets[facetName] = selectedValues; 12 }, 13 ); 14 15 window.FWP.hooks.addFilter( 16 `facetwp/selections/${facetType}`, 17 (output, params) => { 18 const choices = []; 19 $.each(params.selected_values, (idx, val) => { 20 const choice = params.el 21 .find(`${facetSelector}[data-value="${val}"]`) 22 .clone(); 23 choice.find('.facetwp-counter').remove(); 24 choices.push({ 25 value: val, 26 label: choice.text(), 27 }); 28 }); 29 return choices; 30 }, 31 ); 32 33 $(document).on( 34 'click', 35 `.facetwp-type-${facetType} ${facetSelector}:not(.disabled)`, 36 function () { 37 const $cb = $(this); 38 const isChecked = !$cb.hasClass('checked'); 39 $(this) 40 .parent(`.facetwp-type-${facetType}`) 41 .find(facetSelector) 42 .removeClass('checked'); 43 $(this).toggleClass('checked', isChecked); 44 window.FWP.autoload(); 45 }, 46 ); 47}(jQuery));
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.