<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">uniLiveSearch = {
	init:function() {
		var base = this; 
		
		base.inputs = '.header-search__input';
		base.minlength = 2;
		base.timer;
		base.delay = 750;
		
		$(document).on('click keyup', base.inputs, function(e) {
			if(e.type == 'click') {
				base.click(this);
			} else {
				base.keyUp(this);
			}
		});
		
		$('header, main, footer').on('click', () =&gt; {
			$('.live-search').hide();
		});
		
		$(base.inputs).attr('autocomplete', 'off');
	},
	click:function(el) {
		var base = this, $elem = $(el).parent().parent();
		
		if ($elem.find('.live-search ul li').length &gt; 1) {
			$elem.find('.live-search').show();
		}
	},
	keyUp:function(el) {
		var base = this, $this = $(el), $elem = $this.parent().parent(), search_phrase = $this.val().trim();
		
		if (search_phrase.length &gt;= base.minlength) {
			
			$elem.find('.live-search ul').html('&lt;li class="live-search__loading"&gt;&lt;/li&gt;');
			$elem.find('.live-search').show();
		
			clearTimeout(base.timer);
			
			base.timer = setTimeout(() =&gt; {
				$.ajax({
					url:'index.php?route=extension/module/uni_live_search',
					type:'post',
					data:{'filter_name': $this.val(), 'category_id': $elem.find('input[name=\'filter_category_id\']').val()},
					dataType:'html',
					success: function(html) {
						$('.live-search ul').html(html);
					}
				});
			}, base.delay);
		} else {
			$elem.find('.live-search').hide();
		}
	}
}

$(function() {
	uniLiveSearch.init();
});</pre></body></html>