1jQuery(function () { 2 3 const $plugin = jQuery('.plugin__simplenavi_filter'); 4 if (!$plugin.length) return; 5 6 const $box = jQuery('<input>') 7 .addClass('edit') 8 .attr('placeholder', LANG.plugins.simplenavi.filter) 9 .val(window.sessionStorage.getItem('simplenavi-filter')); 10 11 $box.on('input', function (e) { 12 const value = e.target.value; 13 window.sessionStorage.setItem('simplenavi-filter', value); 14 const lookup = new RegExp(value, 'i'); 15 $plugin.find('li.hidden').removeClass('hidden'); 16 $plugin.find('> ul > li > .li').filter(function () { 17 return !this.textContent.match(lookup); 18 }).parents('li').addClass('hidden'); 19 }); 20 21 $plugin.prepend($box); 22 $box.trigger('input'); 23}); 24