PageSourceSearch

https://www.visitcolumbiamo.com/wp-content/plugins/megamenu-pro/assets/public.js?ver=2.2.9

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