1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10/***************** 11 * 12 * Ajax search 13 * 14 *****************/ 15 16(function ($) { 17 18 'use strict'; 19 20 var selectors = { 21 'wrapper': 'div[role=search]', 22 'form': 'form.g1-searchform-ajax', 23 'input': 'form.g1-searchform-ajax input.search-field', 24 'results': '.g1-searches-ajax', 25 'seeAll': '.bimber-see-all-results' 26 }; 27 28 g1.ajaxSearch = function () { 29 if (!$.fn.autocomplete) { 30 return; 31 } 32 33 var minLength = 2; 34 35 $( selectors.input).each(function() { 36 var $input = $(this); 37 var $form = $input.parents(selectors.form); 38 var $wrapper = $input.parents(selectors.wrapper); 39 40 41 42 $input.autocomplete({ 43 'appendTo': $form, 44 'delay': 500, 45 'minLength': minLength, 46 'source': function(request) { 47 var xhr = $.ajax({ 48 'type': 'GET', 49 'url': g1.config.ajax_url, 50 'dataType': 'json', 51 'data': { 52 'action': 'bimber_search', 53 'bimber_term': request.term 54 } 55 }); 56 57 xhr.done(function (res) { 58 if (res.status === 'success') { 59 $wrapper.find(selectors.results).html(res.html); 60 } 61 }); 62 } 63 }); 64 65 // Empty results. 66 $input.on('keyup search', function() { 67 if ($(this).val().length < minLength) { 68 $wrapper.find(selectors.results).html(''); 69 } 70 }); 71 72 // See all results. 73 $wrapper.on('click', selectors.seeAll, function(e) { 74 e.preventDefault(); 75 76 $form.submit(); 77 }); 78 }); 79 }; 80 81 // Fire it up. 82 $(document).ready(function () { 83 g1.ajaxSearch(); 84 }); 85})(jQuery); 86 87}
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.