PageSourceSearch

https://flyakair.com/wp-content/plugins/megamenu-pro/assets/public.js?ver=2.0.1

js flyakair.com collected 2026-10-04 16:10:51 UTC 21,742 bytes, 622 lines download raw bytes

1/*jslint browser: true, white: true */
2/*global console,jQuery,megamenu,window,navigator*/
3
4/**
5 * EDD Ajax Cart
6 */
7(function($) {
8    "use strict";
9
10    $(function() {
11        $('body').on('edd_cart_item_added', function(event, data) {
12            $('.mega-menu-edd-cart-total').html(data.total);
13            $('.mega-menu-edd-cart-count').html(data.cart_quantity);
14        });
15    });
16
17})(jQuery);
18
19/**
20 * Searchbox jQuery plugin
21 */
22(function($) {
23    "use strict";
24
25    $.maxmegamenu_searchbox = function(form, options) {
26
27        var plugin = this;
28        var form = $(form);
29        var $menu = form.parents('.max-mega-menu');
30        var $wrap = $menu.parent();
31        var breakpoint = $menu.attr('data-breakpoint');
32        var input = $('input[type=text]', form);
33        var icon = $('.search-icon', form);
34
35        plugin.isDesktopView = function() {
36            return Math.max(window.outerWidth, $(window).width()) >= breakpoint; // account for scrollbars
37        };
38
39        plugin.monitorView = function() {
40            if (typeof $menu.data("view") === 'undefined') {
41                if (plugin.isDesktopView()) {
42                    $menu.data("view", "desktop");
43                } else {
44                    $menu.data("view", "mobile");
45                }
46            }
47
48            plugin.checkWidth();
49
50            $(window).resize(function() {
51                plugin.checkWidth();
52            });
53        };
54
55        plugin.checkWidth = function() {
56            var expanding_search = $("li.mega-menu-item .mega-search.expand-to-left input[type=text], li.mega-menu-item .mega-search.expand-to-right input[type=text]", $menu);
57
58            if ( $menu.data("view") === "mobile" ) {
59                var placeholder = expanding_search.attr('data-placeholder');
60                expanding_search.attr('placeholder', placeholder);
61            }
62
63            if ( $menu.data("view") === "desktop" ) {
64                expanding_search.attr('placeholder', '');
65            }
66        };
67
68        plugin.close_search = function() {
69            input.val("");
70            input.attr('placeholder', '');
71            form.removeClass('mega-search-open');
72            form.addClass('mega-search-closed');
73        }
74
75        plugin.open_search = function() {
76            input.attr('placeholder', input.attr('data-placeholder'));
77            form.removeClass('mega-search-closed');
78            form.addClass('mega-search-open');
79        }
80
81        plugin.detect_background_click = function() {
82            var dragging = false;
83
84            $(document).on({
85                "touchmove": function(e) { dragging = true; },
86                "touchstart": function(e) { dragging = false; }
87            });
88
89            $(document).on("click touchend", function(e) { // hide menu when clicked away from
90                if ( form.parent().hasClass('mega-static') ) {
91                    return;
92                }
93                if ( ! dragging && ! $(e.target).closest(".max-mega-menu li").length && ! $(e.target).closest(".mega-menu-toggle").length ) {
94                    plugin.close_search();
95                }
96                dragging = false;
97            });
98        }
99
100        plugin.init_replacements_search = function() {
101
102            input.val("");
103
104            if ( $menu.data("view") === "mobile" ) {
105                $(".mega-search.expand-to-left .search-icon, .mega-search.expand-to-right .search-icon", $menu).on('click', function(e) {
106                    $(this).parents(".mega-search").submit();
107                });
108            }
109
110            if ( $menu.data("view") === "desktop" ) {
111                input.on('focus', function(e) {
112                    if (! form.parent().hasClass('mega-static') && form.hasClass('mega-search-closed') && $wrap.hasClass('mega-keyboard-navigation') ) {
113                        plugin.open_search();
114                    }
115                });
116
117                input.on('blur', function(e) {
118                    if (! form.parent().hasClass('mega-static') && form.hasClass('mega-search-open') && $wrap.hasClass('mega-keyboard-navigation') ) {
119                        plugin.close_search();
120                    }
121                });
122
123                icon.on('click', function(e) {
124                    if (form.parent().hasClass('mega-static') ) {
125                        if (input.val() != '') {
126                            form.submit();
127                        }
128                        return;
129                    }
130                    
131                    if (form.hasClass('mega-search-closed')) {
132                        plugin.open_search();
133                        input.focus();
134                    } else if ( input.val() == '' ) {
135                        plugin.close_search();
136                    } else {
137                        form.submit();
138                    }
139                });
140            }
141        };
142
143        plugin.monitorView();
144        plugin.init_replacements_search();
145        plugin.detect_background_click();
146    };
147
148    $.fn.maxmegamenu_searchbox = function(options) {
149        return this.each(function() {
150            if (undefined === $(this).data('maxmegamenu_searchbox')) {
151                var plugin = new $.maxmegamenu_searchbox(this, options);
152                $(this).data('maxmegamenu_searchbox', plugin);
153            }
154        });
155    };
156
157    $(function() {
158        $(".max-mega-menu .mega-search").maxmegamenu_searchbox();
159    });
160})(jQuery);
161
162
163/**
164 * Searchbox jQuery plugin
165 */
166(function($) {
167    "use strict";
168
169    $.maxmegamenu_toggle_searchbox = function(form, options) {
170
171        var plugin = this;
172        var form = $(form);
173        var $wrap = form.parents('.mega-menu-wrap');
174        var input = $("input[type=text]", form);
175        var icon = $(".search-icon", form);
176        
177        plugin.open_search = function() {
178            input.attr('placeholder', input.attr('data-placeholder'));
179            form.removeClass('mega-search-closed');
180            form.addClass('mega-search-open');
181        }
182
183        plugin.close_search = function() {
184            input.attr('placeholder', '');
185            form.removeClass('mega-search-open');
186            form.addClass('mega-search-closed');
187        }
188
189        plugin.init_toggle_search = function() {
190
191            input.val("");
192
193            input.on('focus', function(e) {
194                if (! form.parent().hasClass('mega-static') && form.hasClass('mega-search-closed') && $wrap.hasClass('mega-keyboard-navigation') ) {
195                    plugin.open_search();
196                }
197            });
198
199            input.on('blur', function(e) {
200                if ( ! form.parent().hasClass('mega-static') && form.hasClass('mega-search-open') && $wrap.hasClass('mega-keyboard-navigation') ) {
201                    plugin.close_search();
202                }
203            });
204
205            icon.on('click', function(e) {
206                if (form.hasClass('static') ) {
207                    form.submit();
208                } else if (form.hasClass('mega-search-closed')) {
209                    input.focus();
210                    plugin.open_search();
211                } else if ( input.val() == '' ) {
212                    plugin.close_search();
213                } else {
214                    form.submit();
215                }
216            });
217
218        };
219
220        plugin.init_toggle_search();
221
222    };
223
224    $.fn.maxmegamenu_toggle_searchbox = function(options) {
225        return this.each(function() {
226            if (undefined === $(this).data('maxmegamenu_toggle_searchbox')) {
227                var plugin = new $.maxmegamenu_toggle_searchbox(this, options);
228                $(this).data('maxmegamenu_toggle_searchbox', plugin);
229            }
230        });
231    };
232
233    $(function() {
234        $(".mega-menu-toggle .mega-search").maxmegamenu_toggle_searchbox();
235    });
236})(jQuery);
237
238/**
239 * Sticky jQuery Plugin
240 */
241(function($) {
242
243    "use strict";
244
245    $.maxmegamenu_sticky = function(menu, options) {
246        var plugin = this;
247        var $menu = $(menu);
248        var $wrap = $menu.parent();
249        var breakpoint = $menu.attr('data-breakpoint');
250        var sticky_on_mobile = $menu.attr('data-sticky-mobile');
251        var sticky_on_desktop = $menu.attr('data-sticky-desktop');
252        var sticky_expand = $menu.attr('data-sticky-expand');
253        var sticky_expand_mobile = $menu.attr('data-sticky-expand-mobile');
254        var sticky_offset = isNaN(parseInt($menu.attr('data-sticky-offset'))) ? 0 : parseInt($menu.attr('data-sticky-offset'));
255        var sticky_hide_until_scroll_up = $menu.attr('data-sticky-hide');
256        var sticky_hide_until_scroll_up_tolerance = isNaN(parseInt($menu.attr('data-sticky-hide-tolerance'))) ? 0 : parseInt($menu.attr('data-sticky-hide-tolerance'));
257        var sticky_hide_until_scroll_up_offset = isNaN(parseInt($menu.attr('data-sticky-hide-offset'))) ? 0 : parseInt($menu.attr('data-sticky-hide-offset'));
258        var sticky_transition = $menu.attr('data-sticky-transition');
259        var sticky_menu_offset_top;
260        var sticky_menu_offset_left;
261        var sticky_menu_width;
262        var sticky_menu_width_round_up;
263        var sticky_menu_height;
264        var is_stuck = false;
265        var admin_bar_height = 0;
266        var last_scroll_top = 0;
267        var saved_scroll_top = 0;
268        var is_vertical = $menu.hasClass('mega-menu-vertical') || $menu.hasClass('mega-menu-accordion');
269
270        plugin.isDesktopView = function() {
271            return Math.max(window.outerWidth, $(window).width()) >= breakpoint; // account for scrollbars
272        };
273
274        var sticky_hide_until_scroll_up_enabled = function() {
275            return $menu.hasClass('mega-menu-horizontal') && sticky_hide_until_scroll_up == "true";
276        }
277
278        var sticky_enabled = function() {
279            if ( plugin.isDesktopView() ) {
280                return sticky_on_desktop === 'true';
281            } else {
282                return sticky_on_mobile === 'true';
283            }
284
285            return false;
286        };
287
288        plugin.calculate_menu_position = function() {
289            sticky_menu_offset_top = $wrap.offset().top;
290
291            if ($('body').hasClass('admin-bar') && $("#wpadminbar").is(":visible") && $("#wpadminbar").css('top') == '0px' && $("#wpadminbar").css('position') == 'fixed') {
292                admin_bar_height = $('#wpadminbar').height();
293                sticky_menu_offset_top = sticky_menu_offset_top - admin_bar_height;
294            }
295
296            if (sticky_offset < 0) {
297                sticky_menu_offset_top = sticky_menu_offset_top + sticky_offset;
298            } else {
299                sticky_menu_offset_top = sticky_menu_offset_top - sticky_offset;
300            }
301
302            sticky_menu_offset_left = $menu.parent().offset().left;
303            sticky_menu_width = window.getComputedStyle($wrap[0]).width;
304            sticky_menu_width_round_up = Math.ceil(parseFloat(sticky_menu_width));
305            sticky_menu_height = $wrap.height();
306        };
307
308        plugin.stick_menu = function() {
309            is_stuck = true;
310
311            var total_offset = parseInt(admin_bar_height, 10) + parseInt(sticky_offset, 10);
312
313            if (sticky_offset < 0) {
314                total_offset = parseInt(admin_bar_height, 10);
315            }
316
317            var placeholder = $("<div />").addClass("mega-sticky-wrapper").css({
318                'height' : sticky_menu_height + 'px',
319                'position' :'static'
320            });
321
322            $wrap.addClass('mega-sticky').wrap(placeholder).css({
323                'margin-top' : total_offset + 'px'
324            });
325
326            $menu.css({
327                'max-width' : sticky_menu_width_round_up + 'px'
328            });
329
330            if (sticky_menu_offset_left > 0) {
331                $menu.css({
332                    'margin-left' : sticky_menu_offset_left + 'px'
333                });
334            }
335
336            if (is_vertical || sticky_expand === 'false') {
337                $wrap.css({
338                    'margin-left' : '0',
339                    'margin-right' : '0',
340                    'width' : sticky_menu_width_round_up + 'px',
341                    'left' : sticky_menu_offset_left + 'px'
342                });
343
344                $menu.css({
345                    'margin-left' : '0'
346                });
347            }
348
349            if ( $(window).width() <= breakpoint ) {
350                $wrap.css({
351                    'width' : sticky_menu_width_round_up + 'px'
352                });
353
354                if (sticky_expand_mobile === 'true') {
355                   $wrap.css({
356                        'margin-left' : '',
357                        'margin-right' : '',
358                        'width' : '',
359                        'left' : ''
360                    });
361
362                    $menu.css({
363                        'max-width' : '',
364                        'margin-left' : '',
365                        'width' : '',
366                        'left' : ''
367                    });
368                }
369            }
370
371            $wrap.delay(0).queue(function(next){
372                $(this).addClass('mega-stuck');
373                next();
374            });
375        };
376
377        plugin.unstick_menu = function() {
378            is_stuck = false;
379            
380            $wrap.removeClass('mega-sticky').removeClass('mega-hide').removeClass('mega-reveal').css({
381                'margin' : '',
382                'width' : '',
383                'left': ''
384            });
385
386            $wrap.delay(0).queue(function(next){
387                $(this).removeClass('mega-stuck');
388                next();
389            });
390
391            $menu.css({
392                'margin-left' : '',
393                'max-width' : '',
394                'left' : '',
395                'width' : ''
396            });
397
398            if (sticky_transition == 'true') {
399                var delay = 250;
400            } else {
401                var delay = 0;
402            }
403
404            $wrap.delay(delay).queue(function(next){
405                $(this).unwrap();
406                next();
407            });
408        };
409
410        plugin.mega_sticky_on_scroll = function(){
411            if ( ! sticky_enabled() ) {
412                return;
413            }
414
415            var scroll_top = $(window).scrollTop();
416
417            if (scroll_top > sticky_menu_offset_top) {
418                if (!is_stuck) {
419                    plugin.stick_menu();
420                }
421            } else {
422                if (is_stuck) {
423                    plugin.unstick_menu();
424                }
425            }
426        };
427
428        var mega_hide_on_scroll_up = function() {
429            if (sticky_hide_until_scroll_up_enabled()) {
430
431                if ( $menu.data("view") === "mobile" && $('.mega-menu-toggle', $wrap).hasClass('mega-menu-open') ) {
432                    return;
433                }
434
435                var scroll_top = $(window).scrollTop();
436                
437                if ( scroll_top < sticky_hide_until_scroll_up_offset ) {
438                    $wrap.removeClass('mega-hide');
439                }
440                
441                saved_scroll_top = last_scroll_top;
442
443                if (scroll_top < last_scroll_top) {
444                    // scroll up
445                    if (saved_scroll_top - scroll_top > sticky_hide_until_scroll_up_tolerance) {
446                        $wrap.removeClass('mega-hide');
447                    }
448                } else {
449                    // scroll down
450                    if (scroll_top - saved_scroll_top > sticky_hide_until_scroll_up_tolerance) {
451                        $wrap.addClass('mega-hide');
452                    }
453                }
454
455                last_scroll_top = scroll_top;
456            }
457        }
458
459        plugin.mega_sticky_on_resize = function() {
460            if ($('input', $wrap).is(':focus')) {
461                return;
462            }
463
464            if ( sticky_enabled() ) {
465                if (is_stuck) {
466                    plugin.unstick_menu();
467                    plugin.calculate_menu_position();
468                    plugin.stick_menu();
469                } else {
470                    plugin.calculate_menu_position();
471                    plugin.mega_sticky_on_scroll();
472                }
473            } else {
474                if (is_stuck) {
475                    plugin.unstick_menu();
476                }
477            }
478        };
479
480        plugin.init = function() {
481            plugin.calculate_menu_position();
482            plugin.mega_sticky_on_scroll();
483
484            $('.mega-menu-accordion li.mega-menu-item').on('open_panel', function() {
485                plugin.calculate_menu_position();
486            });
487
488            var $window = $(window);
489
490            $window.scroll(function() {
491                 plugin.mega_sticky_on_scroll();
492                 mega_hide_on_scroll_up();
493            });
494
495            var windowWidth = $window.width();
496
497            $window.resize(function() {
498                if ($window.width() != windowWidth) {
499                    windowWidth = $window.width();
500                    plugin.mega_sticky_on_resize();
501                }
502            });
503        };
504
505        plugin.init();
506    };
507
508    $.fn.maxmegamenu_sticky = function(options) {
509
510        return this.each(function() {
511            if (undefined === $(this).data('maxmegamenu_sticky')) {
512                var plugin = new $.maxmegamenu_sticky(this, options);
513                $(this).data('maxmegamenu_sticky', plugin);
514            }
515        });
516
517    };
518
519    $(window).on('load', function (e) {
520        $(".mega-menu[data-sticky-enabled]").maxmegamenu_sticky();
521    });
522
523})(jQuery);
524
525/**
526 * Handle tabbed functionality
527 */
528(function($) {
529    $(function() {
530
531        var calculate_tabbed_sub_menu_widths = function( menu_item ) {
532            var menu = menu_item.parents('.mega-menu');
533
534            if( $(menu.attr('data-panel-inner-width')).length > 0 ) {
535                if ( menu.data("view") === "desktop" ) {
536                    $('> ul.mega-sub-menu', menu_item).each(function() {
537                        var tab_content = $(this);
538                        var parent_submenu_content_width = parseInt(tab_content.width());
539                        var parent_submenu_left_padding = parseInt(tab_content.css('paddingLeft'));
540                        var tabs_width = $(this).find('a.mega-menu-link').first().outerWidth();
541
542                        $('> li.mega-menu-item > ul.mega-sub-menu', $(this)).each(function() {
543                            $(this).css('width', parent_submenu_content_width - tabs_width + 'px');
544                            $(this).css('left', parent_submenu_left_padding + tabs_width + 'px'); 
545                        });
546                    });
547                } else {
548                    $('> ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu', menu_item).each(function() {
549                        $(this).css('width', '');
550                        $(this).css('left', ''); 
551                    });
552                }
553            }
554        }
555
556        var calculate_tabbed_sub_menu_heights = function( menu_item ) {
557            var menu = menu_item.parents('.mega-menu');
558            var max_height = 0;
559
560            if ( menu.data("view") === "desktop" ) {
561
562                $('> ul.mega-sub-menu', menu_item).css('minHeight', '');
563                
564                $('> ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu', menu_item).each(function() {
565                    var tab_content = $(this);
566                    var this_height = parseInt(tab_content.css('height'));
567
568                    if (this_height > max_height) {
569                        max_height = this_height;
570                    }
571                });
572
573                var border_top_width = parseInt($('> ul.mega-sub-menu', menu_item).css('borderTopWidth'),10);
574                var border_bottom_width = parseInt($('> ul.mega-sub-menu', menu_item).css('borderBottomWidth'),10);
575                
576                $('> ul.mega-sub-menu', menu_item).css('minHeight', max_height + border_bottom_width + border_top_width);
577            } else {
578                $('> ul.mega-sub-menu', menu_item).css('minHeight', '');
579            }
580        }
581
582        var $window = $(window);
583
584        var windowWidth = $window.width();
585
586        $window.resize(function() {
587            if ($window.width() != windowWidth) {
588                calculate_tabbed_sub_menu_widths($('li.mega-menu-tabbed'));
589                calculate_tabbed_sub_menu_heights($('li.mega-menu-tabbed'));
590            }            
591        });
592
593        $('li.mega-menu-tabbed, li.mega-menu-tabbed li.mega-collapse-children').on('open_panel', function() {
594            var menu = $(this).parents('.mega-menu');
595            var menu_item = $(this).closest(".mega-menu-tabbed");
596
597            $("> ul.mega-sub-menu", $(this)).promise().done(function(){
598                calculate_tabbed_sub_menu_widths( menu_item );
599                calculate_tabbed_sub_menu_heights( menu_item );
600            });
601
602            if ( menu.data('view') == 'desktop' ) {
603                if ($('> ul.mega-sub-menu > li.mega-menu-item-has-children.mega-toggle-on', menu_item).length == 0 ) {
604                    $('> ul.mega-sub-menu > li.mega-menu-item-has-children', menu_item).first().addClass('mega-toggle-on');
605                }
606
607                $('li.mega-menu-tabbed').on('close_panel', function() {
608                    $(".mega-toggle-on", menu).removeClass("mega-toggle-on");
609                });
610            }
611
612            $('li.mega-menu-tabbed li.mega-collapse-children').on('close_panel', function() {
613                var menu_item = $(this).closest(".mega-menu-tabbed");
614
615                $("> ul.mega-sub-menu", $(this)).promise().done(function(){
616                    calculate_tabbed_sub_menu_widths( menu_item );
617                    calculate_tabbed_sub_menu_heights( menu_item );
618                });
619            });
620        });
621    });
622})(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.