PageSourceSearch

https://sturgeonhospitalfoundation.org/wp-content/themes/peak/js/main.js?ver=1.0

js sturgeonhospitalfoundation.org collected 2026-10-06 11:04:23 UTC 32,847 bytes, 902 lines download raw bytes

1/*jshint undef: true, unused: false, plusplus: true, loopfunc: true */
2/*global jQuery:false, window: false, Modernizr: false, clearTimeout: false, setTimeout: false, mo_options:false, peak:false, template_dir:false, document:false  */
3
4jQuery.noConflict();
5
6var MO_THEME = {}; // theme namespace
7
8/*================================== Theme Function init =======================================*/
9
10(function ($) {
11
12    "use strict";
13
14    var touchDevice = (Modernizr.touch) ? true : false;
15    var css3 = (Modernizr.csstransforms3d) ? true : false;
16
17    MO_THEME = {
18
19        touchDevice: (Modernizr.touch) ? true : false,
20
21        css3: (Modernizr.csstransforms3d) ? true : false,
22
23        timers: {},
24
25        vendor_prefix: function () {
26
27            var prefix;
28
29            if (css3 === true) {
30                var styles = window.getComputedStyle(document.documentElement, '');
31                prefix = (Array.prototype.slice.call(styles).join('').match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o']))[1];
32
33                return prefix;
34            }
35        },
36
37        is_IE: function () {
38
39
40            var myNav = navigator.userAgent.toLowerCase();
41            return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
42        },
43
44        is_mobile: function () {
45
46
47            if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
48                return true;
49            }
50            return false;
51        },
52
53        // Helps to avoid continuous method execution as can happen in the case of scroll or window resize. Useful specially
54        // when DOM access/manipulation is involved
55        wait_for_final_event: function (callback, ms, uniqueId) {
56
57            if (!uniqueId) {
58                uniqueId = "Don't call this twice without a uniqueId";
59            }
60            if (MO_THEME.timers[uniqueId]) {
61                clearTimeout(MO_THEME.timers[uniqueId]);
62            }
63            MO_THEME.timers[uniqueId] = setTimeout(callback, ms);
64        },
65
66        toggle_html5_video_volume: function (video) {
67
68
69            if (video.muted) {
70                video.muted = false;
71            }
72            else {
73                video.muted = true;
74            }
75        },
76
77        // Enter negative percentage to darken; assumes presence of # - Credit: http://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color //
78        shade_color: function (color, percent) {
79
80            var num = parseInt(color.slice(1), 16), amt = Math.round(2.55 * percent), R = (num >> 16) + amt, G = (num >> 8 & 0x00FF) + amt, B = (num & 0x0000FF) + amt;
81            return "#" + (0x1000000 + (R < 255 ? R < 1 ? 0 : R : 255) * 0x10000 + (G < 255 ? G < 1 ? 0 : G : 255) * 0x100 + (B < 255 ? B < 1 ? 0 : B : 255)).toString(16).slice(1);
82        },
83
84        setup_parallax: function () {
85
86            var scroll = window.requestAnimationFrame ||
87                window.webkitRequestAnimationFrame ||
88                window.mozRequestAnimationFrame ||
89                window.msRequestAnimationFrame ||
90                window.oRequestAnimationFrame ||
91                function (callback) {
92                    window.setTimeout(callback, 1000 / 600);
93                };
94
95            function init_parallax() {
96
97                if (MO_THEME.touchDevice === false && MO_THEME.css3 === true) {
98                    var windowHeight = $(window).height();
99                    $('.parallax-banner').each(function () {
100                        var segment = $(this);
101                        var elementHeight = segment.outerHeight(true);
102
103                        /* Apply transform only when the element is in the viewport */
104                        var boundingRect = segment[0].getBoundingClientRect();
105                        if (boundingRect.bottom >= 0 && boundingRect.top <= windowHeight) {
106                            var distanceToCover = windowHeight + elementHeight;
107                            var pixelsMoved = windowHeight - boundingRect.top;
108                            var toTransform = 50; // only 50% of the image height is available for transforming
109                            var transformPercent = toTransform * Math.abs(pixelsMoved / distanceToCover);
110                            transformPercent = -transformPercent.toFixed(2); // not more than 2 decimal places for performance reasons
111
112                            segment.find('.parallax-bg').css('-' + MO_THEME.vendor_prefix() + '-transform', 'translate3d(0px, ' + transformPercent + '%, 0px)');
113                        }
114                    });
115                }
116
117            }
118
119            if (MO_THEME.touchDevice === false) {
120
121                // Call once to initialize parallax and then call on each scroll
122                scroll(init_parallax);
123                $(window).on('scroll', function () {
124                    scroll(init_parallax);
125                });
126            }
127
128        },
129
130        add_body_classes: function () {
131            if (MO_THEME.is_mobile()) {
132                $('body').addClass('mobile-device');
133            }
134            if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
135                $('body').addClass('ios-device');
136            }
137            if (navigator.userAgent.match(/Android/i) !== null) {
138                $('body').addClass('android-device');
139            }
140        },
141
142        toggle_mobile_menu: function () {
143            $('#mobile-menu-toggle').toggleClass('menu-open');
144            $('body').toggleClass('push-right');
145            $('#mobile-menu').toggleClass('slide-open');
146        },
147
148        init_side_nav: function () {
149            var menuTrigger = $('.side-nav-toggle');
150
151            menuTrigger.on('click', function (e) {
152                e.preventDefault();
153
154                var nav = $('#sidenav');
155                $(this).toggleClass('close-menu');
156
157                nav.fadeToggle(400);
158                nav.toggleClass('open closed');
159
160                if ($(this).hasClass('close-menu')) {
161                    $('body').addClass('hide');
162                }
163                else {
164                    $('body').removeClass('hide');
165                }
166            });
167
168        },
169
170        display_numbers: function (duration) {
171            $('.odometer').each(function () {
172                var data_stop = $(this).attr('data-stop');
173                $(this).text(data_stop);
174            });
175        },
176
177        display_barcharts: function () {
178            /* ------- Skill Bar --------- */
179            $('.stats-bar-content').each(function () {
180                var dataperc = $(this).attr('data-perc');
181                $(this).animate({ "width": dataperc + "%"}, dataperc * 20);
182            });
183        },
184
185        display_piecharts: function () {
186
187            /* -------- Charts like Pie Chart -------- */
188            var bar_color = mo_options.theme_skin,
189                track_color = MO_THEME.shade_color(bar_color, 26);
190            /* Lighten */
191
192            $('.piechart .percentage').not('.dark-bg .piechart .percentage').easyPieChart({
193                animate: 2000,
194                lineWidth: 10,
195                barColor: function (percent) {
196                    var color = $(this.el).attr('data-bar-color');
197                    if (color == null)
198                        color = bar_color;
199                    return color;
200                },
201                trackColor: 'rgba(0,0,0,0.1)',
202                scaleColor: false,
203                lineCap: 'square',
204                size: 220
205
206            });
207
208
209            $('.dark-bg .piechart .percentage').easyPieChart({
210                animate: 2000,
211                lineWidth: 20,
212                barColor: function (percent) {
213                    var color = $(this.el).attr('data-bar-color');
214                    if (color === null)
215                        color = bar_color;
216                    return color;
217                },
218                trackColor: 'rgba(255,255,255,0.1)',
219                scaleColor: false,
220                lineCap: 'square',
221                size: 250
222
223            });
224        },
225
226        get_internal_link: function (urlString) {
227            var internal_link = null;
228            if (urlString.indexOf("#") !== -1) {
229                var arr = urlString.split('#');
230                if (arr.length === 2) {
231                    var url = arr[0];
232                    internal_link = '#' + arr[1];
233                    // check if this internal link belongs to current URL
234                    if (url === (document.URL + '/') || url === document.URL) {
235                        return internal_link;
236                    }
237                } else if (arr.length === 1) {
238                    internal_link = '#' + arr[0];
239                    return internal_link;
240                }
241            }
242            return internal_link;
243
244        },
245
246        set_header_spacing_height: function () {
247
248            $('#header-spacer').css('height', $('#header').outerHeight());
249
250        },
251
252        highlight_menu: function () {
253
254            var $active_menu_item;
255
256            /* Do not highlight internal links */
257            // make the current page active for highlight - top list cannot have both a parent and current page item
258            $active_menu_item = $('#primary-menu > ul > li.current_page_item > a').not('a[href*="#"]').first();
259
260            if ($active_menu_item.length === 0)
261                $active_menu_item = $('#primary-menu > ul > li.current-menu-item > a').not('a[href*="#"]').first();
262
263            if ($active_menu_item.length === 1)
264                $active_menu_item.parent().addClass('active');
265
266        },
267
268        init_page_navigation: function () {
269
270            MO_THEME.set_header_spacing_height();
271
272            MO_THEME.highlight_menu();
273
274            var delay = (function () {
275                var timer = 0;
276                return function (callback, ms) {
277                    clearTimeout(timer);
278                    timer = setTimeout(callback, ms);
279                };
280            })();
281
282            /*--- Sticky Menu -------*/
283
284            if (mo_options.sticky_menu) {
285                var $offset = -40;
286                $('#container').waypoint({
287                    offset: $offset,
288                    handler: function (direction) {
289                        if (direction === "up") {
290                            $('#header').removeClass('sticky');
291                            /* Reached the top and hence highlight current page link */
292                            $('#primary-menu > ul > li').each(function () {
293                                $(this).removeClass('active');
294                            });
295                            MO_THEME.highlight_menu();
296                        } else {
297                            $('#header').addClass('sticky');
298                        }
299                    }
300                });
301
302            }
303
304            /* ----- Smooth Scroll --------*/
305
306            if ($().smoothScroll !== undefined) {
307                $('.composite-page #primary-menu > ul > li > a[href*="#"], .page-template-template-1c #primary-menu > ul > li > a[href*="#"], .page-template-template-1c #primary-menu > ul > li > a[href*="#"]').smoothScroll(
308                    { preventDefault: true, easing: 'swing', speed: 700, offset: -60, exclude: ['.external a']});
309                $('.composite-page #mobile-menu a[href*="#"], .page-template-template-1c #mobile-menu a[href*="#"]').smoothScroll(
310                    {easing: 'swing', speed: 700, offset: 0, exclude: ['.external a']});
311
312                $('.composite-page a[href*="#"].pointer-down, .page-template-template-1c a[href*="#"].pointer-down').smoothScroll(
313                    {easing: 'swing', speed: 700, offset: -60 });
314            }
315
316
317            /* --------- One Page Menu --------- */
318            $('.composite-page #primary-menu > ul > li > a[href*="#"], .page-template-template-1c #primary-menu > ul > li > a[href*="#"]').on('click', function () {
319                $(this).closest('ul').children('li').each(function () {
320                    $(this).removeClass('active');
321                });
322                $(this).parent('li').addClass('active');
323            });
324            $('.composite-page #primary-menu > ul > li > a[href*="#"], .page-template-template-1c #primary-menu > ul > li > a[href*="#"]').each(function () {
325                var current_div_selector = MO_THEME.get_internal_link($(this).attr('href')); // Give ids of div's with ids like #work,#service, #portfolio etc.
326
327                $(current_div_selector).waypoint(function (direction) {
328                        if (direction === "up") {
329                            $('#primary-menu > ul > li').each(function () {
330                                $(this).removeClass('active');
331                                if ($(this).find('a').attr('href').indexOf(current_div_selector) !== -1) {
332                                    $(this).addClass('active');
333                                }
334                            });
335                        }
336                    }, {
337                        offset: function () {
338                            var half_browser_height = $.waypoints('viewportHe
338ight') / 2;
339                            var element_height = $(this).height();
340                            var result = 0;
341                            if (element_height > half_browser_height) {
342                                result = -( element_height - (half_browser_height)); // enable when top of the div is half exposed on the screen
343                            }
344                            else {
345                                result = -(element_height / 2); // enable the menu when everything is visible
346                            }
347                            return result;
348                        }
349                    }
350                );
351                $(current_div_selector).waypoint(function (direction) {
352                    if (direction === "down") {
353                        $('#primary-menu > ul > li').each(function () {
354                            $(this).removeClass('active');
355                            if ($(this).find('a').attr('href').indexOf(current_div_selector) !== -1) {
356                                $(this).addClass('active');
357                            }
358                        });
359                    }
360                }, { offset: '50%' });
361            });
362
363        },
364
365        init_menus: function () {
366            /* For sticky and primary menu navigation */
367            $('.dropdown-menu-wrap > ul').superfish({
368                delay: 100, // one second delay on mouseout
369                animation: {height: 'show'}, // fade-in and slide-down animation
370                speed: 'fast', // faster animation speed
371                autoArrows: false // disable generation of arrow mark-up
372            });
373
374
375            /* Take care of internal links too - close the menu when scrolling from internal links */
376            $('#mobile-menu-toggle, #mobile-menu a[href*="#"]').on('click', function () {
377                MO_THEME.toggle_mobile_menu();
378                return true;
379                /* must return true to record click event for smooth scroll of internal links */
380            });
381
382            /* Close the mobile menu if the user touches the right document when mobile menu is open */
383            $('#container').on('click touchstart', function () {
384                if ($('body').hasClass('push-right')) {
385                    MO_THEME.toggle_mobile_menu();
386                    return false;
387                    /* no need to do anything else for now until menu closes */
388                }
389                return true;
390                /* continue with normal click activity */
391            });
392
393            $("#mobile-menu ul li").each(function () {
394                var sub_menu = $(this).find("> ul");
395                if (sub_menu.length > 0 && $(this).addClass("has-ul")) {
396                    $(this).append('<div class="sf-sub-indicator"><i class="icon-chevron-right"></i></div>');
397                }
398            });
399
400            $('#mobile-menu ul li:has(">ul") > div').on('click', function () {
401                $(this).siblings("ul.sub-menu").stop(true, true).slideToggle();
402                $(this).parent().toggleClass("open");
403                return false;
404            });
405
406            MO_THEME.init_page_navigation();
407        },
408
409        scroll_effects: function () {
410            if ($().waypoint === undefined) {
411                return;
412            }
413
414            $(".mockups-container .mockup img, #client-list .fourcol img, #marketing-policy .symmetric-text h3").css('opacity', 0);
415
416            $("#app-screenshot .arrow-wrap").waypoint(function (direction) {
417                $(this).css('opacity', 1);
418                $(this).children('.arrow').addClass('visible');
419            }, { offset: $.waypoints('viewportHeight') - 150,
420                triggerOnce: true});
421
422            $(".mockups-container .mockup img").waypoint(function (direction) {
423                $(this).addClass("animated fadeInUp");
424            }, { offset: $.waypoints('viewportHeight') - 50,
425                triggerOnce: true});
426
427            $("#client-list .fourcol img").waypoint(function (direction) {
428                $(this).addClass("animated fadeIn");
429            }, { offset: $.waypoints('viewportHeight') - 250,
430                triggerOnce: true});
431
432            $('#marketing-policy').waypoint(function (direction) {
433                setTimeout(function () {
434                    $('#marketing-policy .symmetric-left h3').addClass("animated fadeInLeft");
435                }, 0);
436                setTimeout(function () {
437                    $('#marketing-policy .symmetric-right h3').addClass("animated fadeInRight");
438                }, 400); // delay the second effect
439            }, { offset: $.waypoints('viewportHeight') - 280,
440                triggerOnce: true});
441
442            /* ------------------- Stats -----------------------------*/
443
444            $(".stats-bar").waypoint(function (direction) {
445
446                MO_THEME.display_barcharts();
447
448            }, { offset: $.waypoints('viewportHeight') - 150,
449                triggerOnce: true});
450
451            $(".piechart").waypoint(function (direction) {
452
453                MO_THEME.display_piecharts();
454
455            }, { offset: $.waypoints('viewportHeight') - 250,
456                triggerOnce: true});
457
458            $(".animate-numbers").waypoint(function (direction) {
459                setTimeout(function () {
460                    MO_THEME.display_numbers(2400);
461                }, 100);
462
463            }, { offset: $.waypoints('viewportHeight') - 100,
464                triggerOnce: true});
465
466        },
467
468        toggle_state: function (toggle_element) {
469            var active_class;
470            var current_content;
471
472            active_class = 'active-toggle';
473
474            // close all others first
475            toggle_element.siblings().removeClass(active_class);
476            toggle_element.siblings().find('.toggle-content').slideUp("fast");
477
478            current_content = toggle_element.find('.toggle-content');
479
480            if (toggle_element.hasClass(active_class)) {
481                toggle_element.removeClass(active_class);
482                current_content.slideUp("fast");
483            }
484            else {
485                toggle_element.addClass(active_class);
486                current_content.slideDown("fast");
487            }
488        },
489
490        magnific_popup: function () {
491
492            if ($().magnificPopup === undefined) {
493                return;
494            }
495
496            $('.image-grid, .hfeed').each(function () {
497                $(this).find('.lightbox-link').magnificPopup({
498
499                    gallery: {
500                        enabled: true
501                    },
502                    type: 'image'
503                });
504            });
505
506            $('.video-popup').magnificPopup({
507                type: 'iframe'
508            });
509        },
510
511        init_photo_grid: function () {
512
513            $('.photo-grid').photosetGrid({
514                width: '100%',
515                gutter: '5px',
516                // Wrap the images in links
517                highresLinks: true,
518                onInit: function () {
519                },
520                onComplete: function () {
521
522                    $('.photo-grid').css({
523                        'visibility': 'visible'
524                    });
525
526                    $('.photo-grid').each(function () {
527                        $(this).find('a').magnificPopup({
528
529                            gallery: {
530                                enabled: true
531                            },
532                            type: 'image'
533                        });
534                    });
535
536                }
537            });
538
539        },
540
541        validate_contact_form: function () {
542
543            if ($().validate === undefined) {
544                return;
545            }
546            /* ------------------- Contact Form Validation ------------------------ */
547            var rules = {
548                contact_name: {
549                    required: true,
550                    minlength: 5
551                },
552                contact_email: {
553                    required: true,
554                    email: true
555                },
556                contact_phone: {
557                    required: false,
558                    minlength: 5
559                },
560                contact_url: {
561                    required: false,
562                    url: false
563                },
564                message: {
565                    required: true,
566                    minlength: 15
567                }
568            };
569            var messages = {
570                contact_name: {
571                    required: peak.name_required,
572                    minlength: peak.name_format
573                },
574                contact_email: peak.email_required,
575                contact_url: peak.url_required,
576                contact_phone: {
577                    minlength: peak.phone_required
578                },
579                message: {
580                    required: peak.message_required,
581                    minlength: peak.message_format
582                }
583            };
584            $("#content .contact-form").validate({
585                rules: rules,
586                messages: messages,
587                errorClass: 'form-error',
588                submitHandler: function (theForm) {
589                    $.post(
590                        theForm.action,
591                        $(theForm).serialize(),
592                        function (response) {
593                            $("#content .feedback").html('<div class="success-msg">' + peak.success_message + '</div>');
594                            theForm.reset();
595                        });
596                }
597
598            });
599            $(".widget .contact-form").validate({
600                rules: rules,
601                messages: messages,
602                errorClass: 'form-error',
603                submitHandler: function (theForm) {
604                    $.post(
605                        theForm.action,
606                        $(theForm).serialize(),
607                        function (response) {
608                            $(".widget .feedback").html('<div class="success-msg">' + peak.success_message + '</div>');
609                            theForm.reset();
610                        });
611                }
612
613            });
614        },
615
616        init_isotope: function () {
617            if ($().isotope === undefined) {
618                return;
619            }
620
621            var html_content = $('.js-isotope');
622            // layout Isotope again after all images have loaded
623            html_content.imagesLoaded(function () {
624                html_content.isotope('layout');
625            });
626
627            var container = $('#showcase-items');
628            if (container.length === 0) {
629                return;
630            }
631
632            $('#showcase-filter a').on('click', function (e) {
633                e.preventDefault();
634
635                var selector = $(this).attr('data-value');
636                container.isotope({ filter: selector });
637                return false;
638            });
639
640            if (mo_options.ajax_showcase) {
641                if ($().infinitescroll !== undefined && $('.pagination').length) {
642
643                    container.infinitescroll({
644                            navSelector: '.pagination', // selector for the paged navigation
645                            nextSelector: '.pagination .next', // selector for the NEXT link (to page 2)
646                            itemSelector: '.showcase-item', // selector for all items you'll retrieve
647                            loading: {
648                                msgText: peak.loading_portfolio,
649                                finishedMsg: peak.finished_loading,
650                                img: template_dir + '/images/loader.gif',
651                                selector: '#main'
652                            }
653                        },
654                        // call Isotope as a callback
655                        function (newElements) {
656                            var $newElems = $(newElements);
657                            $newElems.imagesLoaded(function () {
658                                container.isotope('appended', $newElems);
659                            });
660                            MO_THEME.magnific_popup();
661                        });
662                }
663            }
664        }
665
666
667    };
668
669})
670    (jQuery);
671
672/*======================== Document event handling ======================*/
673
674jQuery(document).ready(function ($) {
675
676    "use strict";
677
678
679    /*--------------------- Parallax Init -------------------- */
680
681
682    MO_THEME.setup_parallax();
683
684    /* -------------------------- Initialize document based on platform type -------------------- */
685
686    MO_THEME.add_body_classes();
687
688    /* ---------------------------------- Drop-down Menu.-------------------------- */
689
690    MO_THEME.init_menus();
691
692    /* ---------------------------------- Full Screen Toggle Side Menu -------------------------- */
693
694    MO_THEME.init_side_nav();
695
696    /* --------- Back to top function ------------ */
697    $(window).scroll(function () {
698        MO_THEME.wait_for_final_event(function () {
699            var yPos = $(window).scrollTop();
700            /* show back to top after screen has scrolled down 200px from the top in desktop and big size tablets only */
701            if (yPos > 200) {
702                if (!mo_options.disable_back_to_top) {
703                    $("#go-to-top").fadeIn();
704                }
705            } else {
706                $("#go-to-top").fadeOut();
707            }
708        }, 200, 'go-to-top');
709    });
710
711
712    // Animate the scroll to top
713    $('#go-to-top').on('click', function (event) {
714        event.preventDefault();
715        $('html, body').animate({scrollTop: 0}, 600);
716    });
717
718
719    /* ------------------- Scroll Effects ----------------------------- */
720
721
722    var width = $(window).width();
723    if (width > 1100 && !mo_options.disable_animations_on_page && !(MO_THEME.is_IE() && MO_THEME.is_IE() < 10) && !MO_THEME.is_mobile()) {
724        MO_THEME.scroll_effects();
725    }
726    else {
727
728        //Show stats without waiting for user to scroll to the element
729        MO_THEME.display_barcharts();
730        MO_THEME.display_piecharts();
731        setTimeout(function () {
732            MO_THEME.display_numbers(2400);
733        }, 200);
734
735        // Show elements rightaway without animation
736        $('#feature-pointers img').css({ opacity: 1});
737    }
738
739    /* ------------------- Header Icons --------------------*/
740
741    $('#campaign-header i').on('click', function (e) {
742
743        var content = $('#header-campaign');
744        if (content.is(":hidden")) {
745            $(this).addClass('open');
746            content.slideDown(300);
747        } else {
748            Cookies.set('mo_campaign_header', 'true', { expires: 7 });  // expires in 7 days
749            $(this).removeClass('open');
750            content.slideUp(300);
751        }
752    });
753
754    if (Cookies.get('mo_campaign_header') !== undefined) {
755        $('#campaign-header i').removeClass('open');
756        $('#header-campaign').slideUp(300);
757    }
758    else {
759        $('#campaign-header i').addClass('open');
760        $('#header-campaign').slideDown(300);
761    }
762
763    /* ------------------- Donation Form --------------------*/
764
765    $('.single-campaign .button.donate-now').on('click', function (e) {
766
767        var donation_form = $('.single-campaign .donation-form');
768
769        if (donation_form.is(":hidden")) {
770            $(this).text(peak.close_form);
771            donation_form.slideDown(300);
772        } else {
773            $(this).text(peak.donate_now);
774            donation_form.slideUp(300);
775        }
776
777        return false;
778
779    });
780
781
782    /* -------------- Countdown timer for campaigns ------------------- */
783
784    var campaigns = mo_options.campaigns;
785    if (campaigns !== undefined) {
786        var arrayLength = campaigns.length;
787        for (var i = 0; i < arrayLength; i += 1) {
788            var campaign = campaigns[i];
789            var selector = campaign.selector;
790            var end_date = campaign.end_date;
791            if (end_date) {
792                $(selector).countdown(end_date, function (event) {
793                    $(this).html(event.strftime('<ul><li><span>%D</span>Days</li><li><span>%H</span>Hour</li><li><span>%M</span>Min</li><li><span>%S</span>Sec</li></ul>'));
794                });
795            }
796
797        }
798    }
799
800    /* ------------------- Tabs plus Tooltips ------------------------ */
801
802    $("ul.tab-titles").tabs(".tab-pane");
803
804    $(".social-list li a[title]").not('#sidebar-header .social-list li a').tooltip();
805
806    $(".composite-page .page_section a.edit-button[title]").tooltip();
807
808
809    /* ------------------- Back to Top and Close ------------------------ */
810
811    $(".back-to-top").on('click', function (e) {
812        $('html,body').animate({
813            scrollTop: 0
814        }, 600);
815        e.preventDefault();
816    });
817
818    $('a.close').on('click', function (e) {
819        e.preventDefault();
820        $(this).closest('.message-box').fadeOut();
821    });
822
823
824    /* -------------------------------- Toggle  --------------------------*/
825    $(".toggle-label").toggle(
826        function () {
827            MO_THEME.toggle_state($(this).parent());
828        },
829        function () {
830            MO_THEME.toggle_state($(this).parent());
831        }
832    );
833
834    /* -------------------------------- Contact Form --------------------------*/
835
836    // Hide the honeypot trap field
837    $("p.trap-field").hide();
838
839    MO_THEME.validate_contact_form();
840
841    /* --------------------------- YouTube Video display ------------------------- */
842
843    if (!MO_THEME.is_mobile()) {
844
845        if ($().mb_YTPlayer !== undefined) {
846            /* Video Backgrounds */
847            $('.ytp-bg').mb_YTPlayer({
848                startAt: 0,
849                showYTLogo: false,
850                showControls: false,
851                autoPlay: true,
852                mute: true,
853                containment: 'self'});
854        }
855
856    }
857
858    /* ------------------------ Vimeo Video display ------------------------------ */
859
860    $('.vimeo-wrap img, .vimeo-wrap i').on('click', function () {
861        var parent = $(this).closest('.vimeo-wrap');
862        parent.html('<iframe src="https://player.vimeo.com/video/' + parent.data('vimeoid') + '?portrait=0&title=0&color=bf1f48&badge=0&byline=0&autoplay=1" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>');
863    });
864
865    /*-----------------------------------------------------------------------------------*/
866    /*	jQuery isotope functions and Infinite Scroll
867     /*-----------------------------------------------------------------------------------*/
868
869    MO_THEME.init_isotope();
870
871    /*-----------------------------------------------------------------------------------*/
872    /*	Handle videos in responsive layout - Credit - http://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php
873     /*-----------------------------------------------------------------------------------*/
874
875    $("#content, #sidebar-primary, #footer").fitVids();
876
877    // Take care of maps too - https://github.com/davatron5000/FitVids.js - customSelector option
878    $("#content").fitVids({ customSelector: "iframe[src^='http://mapbuildr.com/'], iframe[src^='http://maps.google.com/'], iframe[src^='https://maps.google.com/'], iframe[src^='https://www.google.com/maps/'], iframe[src^='http://www.google.com/maps/']"});
879
880
881    /*----------------- Magnific Popup --------------------*/
882
883    MO_THEME.magnific_popup();
884
885    /* ----------------- Photo grid --------------------------- */
886
887    MO_THEME.init_photo_grid();
888
889
890});
891
892jQuery(window).load(function () {
893
894    /*------------ Show the page now that all have been loaded ---------*/
895
896
897    if (!mo_options.disable_smooth_page_load) {
898        jQuery("#page-loading").delay(500).fadeOut("slow");
899    }
900
901
902});

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.