PageSourceSearch

https://www.pasta-splat.cz/wp-content/plugins/advanced-woo-search//assets/js/common.js?ver=2.28

js pasta-splat.cz collected 2026-10-09 23:35:10 UTC 28,532 bytes, 703 lines download raw bytes

1// Hooks
2var AwsHooks = AwsHooks || {};
3AwsHooks.filters = AwsHooks.filters || {};
4
5(function($){
6    "use strict";
7
8    var selector = '.aws-container';
9    var instance = 0;
10    var pluginPfx = 'aws_opts';
11    var translate = {
12        sale      : aws_vars.sale,
13        sku       : aws_vars.sku,
14        showmore  : aws_vars.showmore,
15        noresults : aws_vars.noresults
16    };
17
18    AwsHooks.add_filter = function( tag, callback, priority ) {
19
20        if( typeof priority === "undefined" ) {
21            priority = 10;
22        }
23
24        AwsHooks.filters[ tag ] = AwsHooks.filters[ tag ] || [];
25        AwsHooks.filters[ tag ].push( { priority: priority, callback: callback } );
26
27    };
28
29    AwsHooks.apply_filters = function( tag, value, options ) {
30
31        var filters = [];
32
33        if( typeof AwsHooks.filters[ tag ] !== "undefined" && AwsHooks.filters[ tag ].length > 0 ) {
34
35            AwsHooks.filters[ tag ].forEach( function( hook ) {
36
37                filters[ hook.priority ] = filters[ hook.priority ] || [];
38                filters[ hook.priority ].push( hook.callback );
39            } );
40
41            filters.forEach( function( AwsHooks ) {
42
43                AwsHooks.forEach( function( callback ) {
44                    value = callback( value, options );
45                } );
46
47            } );
48        }
49
50        return value;
51
52    };
53
54    $.fn.aws_search = function( options ) {
55
56        var methods = {
57
58            init: function() {
59
60                // @since 2.16
61                var appendResultsTo = AwsHooks.apply_filters( 'aws_results_append_to', 'body', { instance: instance, form: self, data: d } );
62
63                $(appendResultsTo).append('<div id="aws-search-result-' + instance + '" class="aws-search-result" style="display: none;"></div>');
64
65                methods.addClasses();
66
67                setTimeout(function() { methods.resultLayout(); }, 500);
68
69            },
70
71            onKeyup: function(e) {
72
73                searchFor = $searchField.val();
74                searchFor = searchFor.trim();
75                searchFor = searchFor.replace( /<>\{\}\[\]\\\/]/gi, '' );
76                searchFor = searchFor.replace( /\s\s+/g, ' ' );
77
78                for ( var i = 0; i < requests.length; i++ ) {
79                    requests[i].abort();
80                }
81
82                if ( d.showPage == 'ajax_off' ) {
83                    return;
84                }
85
86                if ( searchFor === '' ) {
87                    $(d.resultBlock).html('').hide();
88                    methods.hideLoader();
89                    methods.resultsHide();
90                    return;
91                }
92
93                if ( cachedResponse.hasOwnProperty( searchFor ) ) {
94                    methods.showResults( cachedResponse[searchFor] );
95                    return;
96                }
97
98                if ( searchFor.length < d.minChars ) {
99                    $(d.resultBlock).html('');
100                    methods.hideLoader();
101                    return;
102                }
103
104                if ( d.showLoader ) {
105                    methods.showLoader();
106                }
107
108                var searchTimeout = d.searchTimeout > 100 ? d.searchTimeout : 300;
109
110                clearTimeout( keyupTimeout );
111                keyupTimeout = setTimeout( function() {
112                    methods.ajaxRequest();
113                }, searchTimeout );
114
115            },
116
117            ajaxRequest: function() {
118
119                var data = {
120                    action: 'aws_action',
121                    keyword : searchFor,
122                    aws_page: d.pageId,
123                    aws_tax: d.tax,
124                    lang: d.lang,
125                    pageurl: window.location.href,
126                    typedata: 'json'
127                };
128
129                requests.push(
130
131                    $.ajax({
132                        type: 'POST',
133                        url: ajaxUrl,
134                        data: data,
135                        dataType: 'json',
136                        success: function( response ) {
137
138                            cachedResponse[searchFor] = response;
139
140                            methods.showResults( response );
141
142                            methods.showResultsBlock();
143
144                            methods.analytics( searchFor );
145
146                        },
147                        error: function (jqXHR, textStatus, errorThrown) {
148                            console.log( "Request failed: " + textStatus );
149                            methods.hideLoader();
150                        }
151                    })
152
153                );
154
155            },
156
157            showResults: function( response ) {
158
159                var resultNum = 0;
160                var html = '<ul>';
161
162                if ( typeof response.tax !== 'undefined' ) {
163
164                    $.each(response.tax, function (i, taxes) {
165
166                        if ( ( typeof taxes !== 'undefined' ) && taxes.length > 0 ) {
167                            $.each(taxes, function (i, taxitem) {
168
169                                resultNum++;
170
171                                html += '<li class="aws_result_item aws_result_tag">';
172                                    html += '<a class="aws_result_link" href="' + taxitem.link + '" >';
173                                        html += '<span class="aws_result_content">';
174                                            html += '<span class="aws_result_title">';
175                                                html += taxitem.name;
176                                                if ( taxitem.count ) {
177                                                    html += '<span class="aws_result_count">&nbsp;(' + taxitem.count + ')</span>';
178                                                }
179                                            html += '</span>';
180                                            if ( ( typeof taxitem.excerpt !== 'undefined' ) && taxitem.excerpt ) {
181                                                html += '<span class="aws_result_excerpt">' + taxitem.excerpt + '</span>';
182                                            }
183                                        html += '</span>';
184                                    html += '</a>';
185                                html += '</li>';
186
187                            });
188                        }
189
190                    });
191
192                }
193
194                if ( ( typeof response.products !== 'undefined' ) && response.products.length > 0 ) {
195
196                    $.each(response.products, function (i, result) {
197
198                        resultNum++;
199
200                        html += '<li class="aws_result_item">';
201                        html += '<a class="aws_result_link" href="' + result.link + '" >';
202
203                        if ( result.image ) {
204                            html += '<span class="aws_result_image">';
205                            html += '<img src="' + result.image 
205+ '">';
206                            html += '</span>';
207                        }
208
209                        html += '<span class="aws_result_content">';
210
211                        html += '<span class="aws_result_title">';
212                            if ( result.featured ) {
213                                html += '<span class="aws_result_featured" title="Featured"><svg version="1.1" viewBox="0 0 20 21" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink"><g fill-rule="evenodd" stroke="none" stroke-width="1"><g transform="translate(-296.000000, -422.000000)"><g transform="translate(296.000000, 422.500000)"><path d="M10,15.273 L16.18,19 L14.545,11.971 L20,7.244 L12.809,6.627 L10,0 L7.191,6.627 L0,7.244 L5.455,11.971 L3.82,19 L10,15.273 Z"/></g></g></g></svg></span>';
214                            }
215                            html += result.title;
216                        html += '</span>';
217
218                        if ( result.stock_status ) {
219                            var statusClass = result.stock_status.status ? 'in' : 'out';
220                            html += '<span class="aws_result_stock ' + statusClass + '">';
221                                html += result.stock_status.text;
222                            html += '</span>';
223                        }
224
225                        if ( result.sku ) {
226                            html += '<span class="aws_result_sku">' + translate.sku +  result.sku + '</span>';
227                        }
228
229                        if ( result.excerpt ) {
230                            html += '<span class="aws_result_excerpt">' + result.excerpt + '</span>';
231                        }
232
233                        if ( result.price ) {
234                            html += '<span class="aws_result_price">' + result.price + '</span>';
235                        }
236
237                        html += '</span>';
238
239                        if ( result.on_sale ) {
240                            html += '<span class="aws_result_sale">';
241                            html += '<span class="aws_onsale">' + translate.sale + '</span>';
242                            html += '</span>';
243                        }
244
245                        html += '</a>';
246                        html += '</li>';
247
248                    });
249
250                    if ( d.showMore && d.showPage ) {
251                        html += '<li class="aws_result_item aws_search_more"><a href="#">' + translate.showmore + '</a></li>';
252                    }
253
254                    //html += '<li class="aws_result_item"><a href="#">Next Page</a></li>';
255
256                }
257
258                if ( ! resultNum ) {
259                    html += '<li class="aws_result_item aws_no_result">' + translate.noresults + '</li>';
260                }
261
262
263                html += '</ul>';
264
265                // @since 2.05
266                html = AwsHooks.apply_filters( 'aws_results_html', html, { response: response, data: d } );
267
268
269                methods.hideLoader();
270
271                $(d.resultBlock).html( html );
272
273                methods.showResultsBlock();
274
275                if ( eShowResults ) {
276                    self[0].dispatchEvent( eShowResults );
277                }
278
279            },
280
281            showResultsBlock: function() {
282                methods.resultLayout();
283                methods.resultsShow();
284            },
285
286            showLoader: function() {
287                $searchForm.addClass('aws-processing');
288            },
289
290            hideLoader: function() {
291                $searchForm.removeClass('aws-processing');
292            },
293
294            resultsShow: function() {
295                $(d.resultBlock).show();
296                $searchForm.addClass('aws-form-active');
297            },
298
299            resultsHide: function() {
300                $(d.resultBlock).hide();
301                $searchForm.removeClass('aws-form-active');
302            },
303
304            onFocus: function( event ) {
305
306                var show = AwsHooks.apply_filters( 'aws_show_modal_layout', false, { instance: instance, form: self, data: d } );
307
308                if ( ! $('body').hasClass('aws-overlay') && ( ( methods.isMobile() && d.mobileScreen && ! methods.isFixed() ) || show ) ) {
309                    methods.showMobileLayout();
310                }
311
312                if ( searchFor !== '' ) {
313                    methods.showResultsBlock();
314                }
315
316            },
317
318            hideResults: function( event ) {
319                if ( ! $(event.target).closest( ".aws-container" ).length ) {
320                    methods.resultsHide();
321                }
322            },
323
324            isResultsVisible:function() {
325                return $(d.resultBlock).is(":visible");
326            },
327
328            removeHovered: function() {
329                $( d.resultBlock ).find('.aws_result_item').removeClass('hovered');
330            },
331
332            resultLayout: function () {
333
334                var $resultsBlock = $( d.resultBlock );
335                var offset = self.offset();
336                var bodyOffset = $('body').offset();
337                var bodyPosition = $('body').css('position');
338                var bodyHeight = $(document).height();
339                var resultsHeight = $resultsBlock.height();
340
341                if ( offset && bodyOffset  ) {
342
343                    var styles = {
344                        width: self.outerWidth(),
345                        top : 0,
346                        left: 0
347                    };
348
349                    if ( bodyPosition === 'relative' || bodyPosition === 'absolute' || bodyPosition === 'fixed' ) {
350                        styles.top = offset.top + $(self).innerHeight() - bodyOffset.top;
351                        styles.left = offset.left - bodyOffset.left;
352                    } else {
353                        styles.top = offset.top + $(self).innerHeight();
354                        styles.left = offset.left;
355                    }
356
357                    if ( bodyHeight - offset.top < 500 ) {
358                        resultsHeight = methods.getResultsBlockHeight();
359                        if ( ( bodyHeight - offset.top < resultsHeight ) && ( offset.top >= resultsHeight ) ) {
360                            styles.top = styles.top - resultsHeight - $(self).innerHeight();
361                        }
362                    }
363
364                    // @since 2.10
365                    styles = AwsHooks.apply_filters( 'aws_results_layout', styles, { resultsBlock: $resultsBlock, form: self } );
366
367                    $resultsBlock.css( styles );
368
369                }
370
371            },
372
373            getResultsBlockHeight: function() {
374
375                var $resultsBlock = $( d.resultBlock );
376                var resultsHeight = $resultsBlock.height();
377
378                if ( resultsHeight === 0 ) {
379                    var copied_elem = $resultsBlock.clone()
380                        .attr("id", false)
381                        .css({visibility:"hidden", display:"block",
382                            position:"absolute"});
383                    $("body").append(copied_elem);
384                    //copied_elem.find('.mCSB_outside').attr('style', '');
385                    resultsHeight = copied_elem.height();
386                    copied_elem.remove();
387                }
388
389                return resultsHeight;
390
391            },
392
393            showMobileLayout: function() {
394                self.after('<div class="aws-placement-container"></div>');
395                self.addClass('aws-mobile-fixed').prepend('<div class="aws-mobile-fixed-close"><svg width="17" height="17" viewBox="1.5 1.5 21 21"><path d="M22.182 3.856c.522-.554.306-1.394-.234-1.938-.54-.543-1.433-.523-1.826-.135C19.73 2.17 11.955 10 11.955 10S4.225 2.154 3.79 1.783c-.438-.371-1.277-.4-1.81.135-.533.537-.628 1.513-.25 1.938.377.424 8.166 8.218 8.166 8.218s-7.85 7.864-8.166 8.219c-.317.354-.34 1.335.25 1.805.59.47 1.24.455 1.81 0 .568-.456 8.166-7.951 8.166-7.951l8.167 7.86c.747.72 1.504.563 1.96.09.456-.471.609-1.268.1-1.804-.508-.537-8.167-8.219-8.167-8.219s7.645-7.665 8.167-8.218z"></path></svg></div>');
396                $('body').addClass('aws-overlay').append('<div class="aws-overlay-mask"></div>').append( self );
397                $searchField.focus();
398            },
399
400            hideMobileLayout: function() {
401                $('.aws-placement-container').after( self ).remove();
402                self.removeClass('aws-mobile-fixed');
403                $('body').removeClass('aws-overlay');
404                $('.aws-mobile-fixed-close').remove();
405                $('.aws-overlay-mask').remove();
406            },
407
408            isFixed: function() {
409                var $checkElements = self.add(self.parents());
410                var isFixed = false;
411                $checkElements.each(function(){
412                    if ($(this).css("position") === "fixed") {
413                        isFixed = true;
414                        return false;
415                    }
416                });
417                return isFixed;
418            },
419
420            analytics: function( label ) {
421                if ( d.useAnalytics ) {
422                    try {
423                        var sPage = '/?s=' + encodeURIComponent( 'ajax-search:' + label );
424                        if ( typeof gtag !== 'undefined' && gtag !== null ) {
425                            gtag('event', 'AWS search', {
426                                'event_label': label,
427                                'event_category': 'AWS Search Term',
428                                'transport_type' : 'beacon'
429                            });
430                            gtag('event', 'page_view', {
431                                'page_path': sPage,
432                                'page_title' : 'AWS search'
433                            });
434                        }
435                        if ( typeof ga !== 'undefined' && ga !== null ) {
436                            ga('send', 'event', 'AWS search', 'AWS Search Term', label);
437                            ga( 'send', 'pageview', sPage );
438                        }
439                        if ( typeof pageTracker !== "undefined" && pageTracker !== null ) {
440                            pageTracker._trackPageview( sPage );
441                            pageTracker._trackEvent( 'AWS search', 'AWS search', 'AWS Search Term', label )
442                        }
443                        if ( typeof _gaq !== 'undefined' && _gaq !== null ) {
444                            _gaq.push(['_trackEvent', 'AWS search', 'AWS Search Term', label ]);
445                            _gaq.push(['_trackPageview', sPage]);
446                        }
447                        // This uses Monster Insights method of tracking Google Analytics.
448                        if ( typeof __gaTracker !== 'undefined' && __gaTracker !== null ) {
449                            __gaTracker( 'send', 'event', 'AWS search', 'AWS Search Term', label );
450                            __gaTracker( 'send', 'pageview', sPage );
451                        }
452                    }
453                    catch (error) {
454                    }
455                }
456            },
457
458            addClasses: function() {
459                if ( methods.isMobile() || d.showClear ) {
460                    $searchForm.addClass('aws-show-clear');
461                }
462            },
463
464            isMobile: function() {
465                var check = false;
466                (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
467                return check;
468            },
469
470        };
471
472
473        var self            = $(this),
474            $searchForm     = self.find('.aws-search-form'),
475            $searchField    = self.find('.aws-search-field'),
476            $searchButton   = self.find('.aws-search-btn'),
477            haveResults     = false,
478            eShowResults    = false,
479            requests        = Array(),
480            searchFor       = '',
481            keyupTimeout,
482            cachedResponse = new Array();
483
484        var ajaxUrl = ( self.data('url') !== undefined ) ? self.data('url') : false;
485
486        if ( document.createEvent ){
487            eShowResults = document.createEvent("Event");
488            eShowResults.initEvent('awsShowingResults', true, true);
489            eShowResults.eventName = 'awsShowingResults';
490        }
491
492        if ( options === 'relayout' ) {
493            var d = self.data(pluginPfx);
494            methods.resultLayout();
495            return;
496        }
497
498
499        instance++;
500
501        self.data( pluginPfx, {
502            minChars  : ( self.data('min-chars') !== undefined ) ? self.data('min-chars') : 1,
503            lang : ( self.data('lang') !== undefined ) ? self.data('lang') : false,
504            showLoader: ( self.data('show-loader') !== undefined ) ? self.data('show-loader') : true,
505            showMore: ( self.data('show-more') !== undefined ) ? self.data('show-more') : true,
506            showPage: ( self.data('show-page') !== undefined ) ? self.data('show-page') : true,
507            showClear: ( self.data('show-clear') !== undefined ) ? self.data('show-clear') : false,
508            mobileScreen: ( self.data('mobile-screen') !== undefined ) ? self.data('mobile-screen') : false,
509            useAnalytics: ( self.data('use-analytics') !== undefined ) ? self.data('use-analytics') : false,
510            searchTimeout: ( self.data('timeout') !== undefined ) ? parseInt( self.data('timeout') ) : 300,
511            instance: instance,
512            resultBlock: '#aws-search-result-' + instance,
513            pageId: ( self.data('page-id') !== undefined ) ? self.data('page-id') : 0,
514            tax: ( self.data('tax') !== undefined ) ? self.data('tax') : 0
515        });
516
517
518        var d = self.data(pluginPfx);
519
520
521
522        if ( $searchForm.length > 0 ) {
523            methods.init.call(this);
524        }
525
526
527        $searchField.on( 'keyup input', function(e) {
528            if ( e.keyCode != 40 && e.keyCode != 38 ) {
529                methods.onKeyup(e);
530            }
531        });
532
533
534        $searchField.on( 'focus', function (e) {
535            $searchForm.addClass('aws-focus');
536            methods.onFocus(e);
537        });
538
539        $searchField.on( 'focusout', function (e) {
540            $searchForm.removeClass('aws-focus');
541        });
542
543        $searchForm.on( 'keypress', function(e) {
544            if ( e.keyCode == 13 && ( ! d.showPage || $searchField.val() === '' ) ) {
545                e.preventDefault();
546            }
547        });
548
549
550        $searchButton.on( 'click', function (e) {
551            if ( d.showPage && $searchField.val() !== '' ) {
552                $searchForm.submit();
553            }
554        });
555
556
557        $searchForm.find('.aws-search-clear').on( 'click', function (e) {
558            $searchField.val('');
559            $searchField.focus();
560            methods.resultsHide();
561            $(d.resultBlock).html('');
562            searchFor = '';
563        });
564
565
566        $(document).on( 'click', function (e) {
567            methods.hideResults(e);
568        });
569
570
571        $(window).on( 'resize', function(e) {
572            methods.resultLayout();
573        });
574
575
576        $(window).on( 'scroll', function(e) {
577            if ( $( d.resultBlock ).css('display') == 'block' ) {
578                methods.resultLayout();
579            }
580        });
581
582
583        $( d.resultBlock ).on( 'mouseenter', '.aws_result_item', function() {
584            methods.removeHovered();
585            $(this).addClass('hovered');
586            $searchField.trigger('mouseenter');
587        });
588
589
590        $( d.resultBlock ).on( 'mouseleave', '.aws_result_item', function() {
591            methods.removeHovered();
592        });
593
594
595        $( d.resultBlock ).on( 'click', '.aws_search_more', function(e) {
596            e.preventDefault();
597            $searchForm.submit();
598        });
599
600        $( d.resultBlock ).on( 'click', 'span[href], [data-link]', function(e) {
601            e.preventDefault();
602            var link = $(this).data('link') ? $(this).data('link') : $(this).attr('href');
603            if ( link === '' || link === '#' ) {
604                return;
605            }
606            e.stopPropagation();
607            if ( link ) {
608                window.location = link;
609            }
610        });
611
612        $( self ).on( 'click', '.aws-mobile-fixed-close', function(e) {
613            methods.hideMobileLayout();
614        });
615
616
617        $(window).on( 'keydown', function(e) {
618
619            if ( e.keyCode == 40 || e.keyCode == 38 ) {
620                if ( methods.isResultsVisible() ) {
621
622                    e.stopPropagation();
623                    e.preventDefault();
624
625                    var $item = $( d.resultBlock ).find('.aws_result_item');
626                    var $hoveredItem = $( d.resultBlock ).find('.aws_result_item.hovered');
627                    var $itemsList = $( d.resultBlock ).find('ul');
628
629                    if ( e.keyCode == 40 ) {
630
631                        if ( $hoveredItem.length > 0 ) {
632                            methods.removeHovered();
633                            $hoveredItem.next().addClass('hovered');
634                        } else {
635                            $item.first().addClass('hovered');
636                        }
637
638                    }
639
640                    if ( e.keyCode == 38 ) {
641
642                        if ( $hoveredItem.length > 0 ) {
643                            methods.removeHovered();
644                            $hoveredItem.prev().addClass('hovered');
645                        } else {
646                            $item.last().addClass('hovered');
647                        }
648
649                    }
650
651                    var activeItemOffset = $(".aws_result_item.hovered").position();
652                    if ( activeItemOffset ) {
653                        $itemsList.animate({
654                            scrollTop: activeItemOffset.top + $itemsList.scrollTop()
655                        }, 400);
656                    }
657
658                }
659            }
660
661        });
662
663
664    };
665
666
667    // Call plugin method
668    $(document).ready( function() {
669
670        $(selector).each( function() {
671            $(this).aws_search();
672        });
673
674        // Enfold header
675        $('[data-avia-search-tooltip]').on( 'click', function() {
676            window.setTimeout(function(){
677                $(selector).aws_search();
678            }, 1000);
679        } );
680
681        // Search results filters fix
682        var $filters_widget = $('.woocommerce.widget_layered_nav_filters');
683        var searchQuery = window.location.search;
684
685        if ( $filters_widget.length > 0 && searchQuery ) {
686            if ( searchQuery.indexOf('type_aws=true') !== -1 ) {
687                var $filterLinks = $filters_widget.find('ul li.chosen a');
688                if ( $filterLinks.length > 0 ) {
689                    var addQuery = '&type_aws=true';
690                    $filterLinks.each( function() {
691                        var filterLink = $(this).attr("href");
692                        if ( filterLink && filterLink.indexOf('post_type=product') !== -1 ) {
693                            $(this).attr( "href", filterLink + addQuery );
694                        }
695                    });
696                }
697            }
698        }
699
700    });
701
702
703})( 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.