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 () { 12 window.sessionStorage.setItem('simplenavi-filter', $box.val()); 13 const lookup = new RegExp($box.val(), 'i'); 14 $plugin.find('li.hidden').removeClass('hidden'); 15 $plugin.find('> ul > li > .li > a').filter(function () { 16 return !this.text.match(lookup); 17 }).parents('li').addClass('hidden'); 18 }); 19 20 $plugin.prepend($box); 21 $box.trigger('input'); 22}); 23