PageSourceSearch

https://webstergardens.org/_assets/js/monk/main.js

js webstergardens.org collected 2026-10-09 04:20:40 UTC 39,170 bytes, 1,038 lines download raw bytes

1/*******************
2HELPER FUNCTIONS
3********************
4/*
5check for valid email
6*/
7function isValidEmail(emailAddress) {
8    atPos = emailAddress.indexOf("@");
9    dotPos = emailAddress.indexOf(".", atPos);
10    spacePos = emailAddress.indexOf(" ");
11    if (emailAddress.length > 0 && atPos > 0 && dotPos > atPos && spacePos == -1) {
12        return true;
13    }
14    return false;
15}
16
17/*
18windowsize should match css for hiding at lg @992px
19*/ function isSiteSmall() {
20    if (window.matchMedia("(max-width: 992px)").matches) {
21        return true;
22    }
23    return false;
24}
25
26function isSiteLarge() {
27    if (window.matchMedia("(max-width: 1200px)").matches) {
28        return true;
29    }
30    return false;
31}
32
33/*
34mobile detect
35*/ function mobileDetect() {
36    var check = false;
37    (function(a) {
38        if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|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|phone)|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;
39    })(navigator.userAgent || navigator.vendor || window.opera);
40    return check;
41}
42
43/*
44debounce for perfomance (function, wait, immediate)
45*/ function debounce(func, wait, immediate) {
46    var timeout;
47    return function() {
48        var context = this, args = arguments;
49        var later = function() {
50            timeout = null;
51            if (!immediate) func.apply(context, args);
52        };
53        var callNow = immediate && !timeout;
54        clearTimeout(timeout);
55        timeout = setTimeout(later, wait);
56        if (callNow) func.apply(context, args);
57    };
58}
59
60/*
61throttle for perfomance (function, wait, options)
62*/
63function throttle(func, wait, options) {
64    var context, args, result;
65    var timeout = null;
66    var previous = 0;
67    if (!options) options = {};
68    var later = function() {
69        previous = options.leading === false ? 0 : Date.now();
70        timeout = null;
71        result = func.apply(context, args);
72        if (!timeout) context = args = null;
73    };
74    return function() {
75        var now = Date.now();
76        if (!previous && options.leading === false) previous = now;
77        var remaining = wait - (now - previous);
78        context = this;
79        args = arguments;
80        if (remaining <= 0 || remaining > wait) {
81            if (timeout) {
82                clearTimeout(timeout);
83                timeout = null;
84            }
85            previous = now;
86            result = func.apply(context, args);
87            if (!timeout) context = args = null;
88        } else if (!timeout && options.trailing !== false) {
89            timeout = setTimeout(later, remaining);
90        }
91        return result;
92    };
93}
94
95/*
96touch detect
97*/
98function touchDetect() {
99    var prefixes = " -webkit- -moz- -o- -ms- ".split(" ");
100    var mq = function(query) {
101        return window.matchMedia(query).matches;
102    };
103    if ("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch) {
104        return true;
105    }
106    var query = [ "(", prefixes.join("touch-enabled),("), "heartz", ")" ].join("");
107    return mq(query);
108}
109
110/*
111test if element is in viewport
112*/ $.fn.isInViewport = function() {
113    var elementTop = $(this).offset().top;
114    var elementBottom = elementTop + $(this).outerHeight();
115    var viewportTop = $(window).scrollTop();
116    var viewportBottom = viewportTop + $(window).height();
117    return elementBottom > viewportTop && elementTop < viewportBottom;
118};
119
120/*******************
121INIT FUNCTIONS
122********************/
123/*
124responsive third party vids - uses fitvids from plugins.js
125*/ function responsiveVideo() {
126    $("#content, .content-section").fitVids({
127        ignore: "#video-player, .div-embed, .vimeoWrapper, .embed-responsive, .plyr__player, #plyr__player_event",
128        customSelector: "iframe[src*='/Clients/player/videoembed.php']"
129    });
130}
131
132/*
133Plyr video
134*/ function plyrVideo() {
135    var plyr_options = {
136        hideControls: true,
137        ratio: "16:9",
138        controls: [ "play-large", "play", "progress", "settings", "fullscreen", "volume" ]
139    };
140    var players = Plyr.setup(".plyr__player", plyr_options);
141    window.players = players;
142    $(document).ajaxComplete((function() {
143        var plyr_options = {
144            hideControls: true,
145            ratio: "16:9",
146            controls: [ "play-large", "play", "progress", "settings", "fullscreen", "volume" ]
147        };
148        var players = Plyr.setup(".plyr__player", plyr_options);
149        window.players = players;
150    }));
151}
152
153/*
154lightbox defaults - uses lightgallery from plugins.js
155*/ function lightgallery() {
156    //default thickbox
157    var $thickbox = $(".thickbox").lightGallery({
158        iframe: true,
159        selector: "this",
160        width: "1024px",
161        height: "800px",
162        counter: false,
163        download: false,
164        share: false,
165        rotate: false,
166        hash: false,
167        zoom: false,
168        pager: false,
169        fullScreen: false,
170        addClass: "lightGallery-thickbox"
171    });
172    //photo gallery
173        $(".insert-gallery").each((function() {
174        var galleryID = $(this).attr("id");
175        $("#" + galleryID).lightGallery({
176            thumbnail: false,
177            counter: false,
178            download: false,
179            share: false,
180            rotate: false,
181            hash: false,
182            zoom: false,
183            pager: false,
184            fullScreen: false
185        });
186    }));
187    //play sermon video
188        $("body").on("click", ".play-video-thickbox-close", (function(event) {
189        $(".play-video-thickbox-wrap").remove();
190    }));
191    $("body").on("click", ".play-video-thickbox", (function(event) {
192        event.preventDefault();
193        var data = $(this).data();
194        $.ajax({
195            url: "/_components/ajax/ajax-video-src-thickbox.php",
196            type: "GET",
197            data: data,
198            success: function(results) {
199                $("body").append(results);
200            },
201            error: function(results, textStatus, jqXHR) {
202                //add error messages as needed console.log(jqXHR.responseText);
203            }
204        });
205    }));
206}
207
208/*
209pretty selectmenus - uses jqueryui from plugins.js
210*/ function sorters($sorter) {
211    var changeSelectMenu = function(event, item) {
212        $(this).trigger("change", item);
213    };
214    //ui-front moves menu from appending to body to parent element
215        if ($sorter.parents(".monkForm").length) {
216        $sorter.parent().addClass("ui-front position-relative");
217    }
218    $sorter.selectmenu({
219        width: false,
220        style: "dropdown",
221        icons: {
222            button: "icon"
223        },
224        change: changeSelectMenu
225    });
226}
227
228/*
229add sticky
230*/ function addSticky() {
231    var stickyToggle = function(sticky, stickyWrapper, scrollElement) {
232        var stickyHeight = sticky.outerHeight();
233        if (sticky.attr("id") === "header") {
234            var stickyTop = stickyWrapper.offset().top + 1;
235        } else {
236            var stickyTop = stickyWrapper.offset().top;
237        }
238        if (scrollElement.scrollTop() >= stickyTop) {
239            stickyWrapper.height(stickyHeight);
240            sticky.addClass("is-sticky");
241            if ($("#alert-top").length) {
242                $("#alert-top").slideUp("fast", (function() {
243                    var hHeight = $("#header .header").outerHeight();
244                    $("nav#mobile .navigation-inner .navigation, #site-search .search-inner .search").css({
245                        "padding-top": hHeight + 16 + "px"
246                    });
247                }));
248            }
249        } else {
250            sticky.removeClass("is-sticky");
251            if ($("#alert-top").length) {
252                $("#alert-top").slideDown("fast", (function() {
253                    var hHeight = $("#header .header").outerHeight();
254                    var aHeight = $("#alert-top").outerHeight();
255                    hHeight += aHeight;
256                    $("nav#mobile .navigation-inner .navigation, #site-search .search-inner .search").css({
257                        "padding-top": hHeight + "px"
258                    });
259                }));
260            }
261            stickyWrapper.height("");
262        }
263    };
264    $('[data-toggle="sticky-onscroll"]').each((function() {
265        var sticky = $(this);
266        var stickyWrapper = $("<div>").addClass("sticky-wrapper");
267 // insert hidden element to maintain actual top offset on page
268                if (sticky.attr("id") === "header") {
269            stickyWrapper.addClass("is-stickyheader");
270        } else if (sticky.attr("id") === "stickysub") {
271            stickyWrapper.addClass("is-stickysub");
272        }
273        sticky.before(stickyWrapper);
274        sticky.addClass("sticky");
275        // Scroll & resize events
276                $(window).on("scroll.sticky-onscroll resize.sticky-onscroll", (function() {
277            stickyToggle(sticky, stickyWrapper, $(this));
278        }));
279        // On page load
280                stickyToggle(sticky, stickyWrapper, $(window));
281    }));
282    $("body").on("click", ".scrollto", (function(event) {
283        var pageLoc = $(this).attr("href");
284        $("html, body").stop().animate({
285            scrollTop: $(pageLoc).offset().top
286        }, 550);
287        return false;
288    }));
289}
290
291/*
292jarallax plugin - uses jarallax from plugins.js
293*/ function jarallax() {
294    objectFitImages();
295 //ofi extension
296        $(".jarallax").jarallax({
297        coverImage: true,
298        clipContainer: true
299    });
300}
301
302/*
303header
304*/ function header() {
305    //adjustments
306    headerAdj();
307    window.addEventListener("resize", debounce((function() {
308        headerAdj();
309    }), 250));
310    //billboard
311    //update billboard bg for curve.  does not help with images.
312        if (!$("body.substicky").length) {
313        if ($("#billboard").length && $("#content").length) {
314            var bgColor = $("#content").css("backgroundColor");
315            $("#billboard-wrap").css({
316                "background-color": bgColor
317            });
318        } else if ($("#billboard").length && $(".content-section").first().length) {
319            var bgColor = $(".content-section").first().find(".content-section-inner").css("backgroundColor");
320            $("#billboard-wrap").css({
321                "background-color": bgColor
322            });
323        }
324    }
325    //down arrow for large billboard
326        if ($("#billboardDown").length) {
327        var hHeight = $("#header").outerHeight();
328        if (isSiteSmall()) {
329            var offsetDiff = 60;
330        } else {
331            var offsetDiff = 80;
332        }
333        if ($("#content").length) {
334            var firstSec = "content";
335        } else {
336            var firstSec = $(".content-section").first().attr("id");
337        }
338        $("#billboardDown").click((function(event) {
339            event.preventDefault();
340            $("html, body").stop().animate({
341                scrollTop: $("#" + firstSec).offset().top - offsetDiff
342            }, 550);
343        }));
344    }
345    //search 
346        $("#header .toggle-search").on("click", (function(event) {
347        event.preventDefault();
348        $("body").removeClass("show-mobilenav");
349        $("body").toggleClass("show-search");
350    }));
351    //mobile
352        $("#header .toggle-mobile").on("click", (function(event) {
353        event.preventDefault();
354        $("body").removeClass("show-search");
355        $("body").toggleClass("show-mobilenav");
356    }));
357    $("#mobilenav li a").each((function() {
358        if ($(this).parent().children("ul").length) {
359            $(this).parent().addClass("dropdown");
360            var mnhref = $(this).attr("href");
361            $(this).append("<span><i></i></span>");
362            if (mnhref == "" || mnhref == "#") {
363                $(this).addClass("open");
364            } else {
365                $(this).find("span").addClass("open");
366            }
367        }
368    }));
369    $("#mobilenav li.dropdown .open").on("click", (function(event) {
370        var current = $(this).closest("li").first();
371        current.siblings(".active").find("ul").first().slideUp();
372        current.siblings(".active").removeClass("active");
373        current.toggleClass("active");
374        current.find("ul").first().slideToggle();
375        event.preventDefault();
376    }));
377}
378
379function headerAdj() {
380    var hHeight = $("#header .header").outerHeight();
381    if ($("#alert-top").length) {
382        var aHeight = $("#alert-top").outerHeight();
383        hHeight += aHeight;
384    }
385    $("nav#mobile .navigation-inner .navigation, #site-search .search-inner .search").css({
386        "padding-top": hHeight + "px"
387    });
388    //if moving screen around close out menu
389        if (!$("html").hasClass("mobilenav_only") && !isSiteSmall()) {
390        $("body").removeClass("show-mobilenav");
391    }
392    if ($("body").hasClass("fixed-header")) {
393        var bPadding = hHeight;
394        $("#billboard .inner").css({
395            "padding-top": bPadding + "px"
396        });
397    }
398}
399
400/*
401subnav for sidebar navigation
402*/ function subnav($subnav) {
403    $("#subnav > li > ul  li  a").each((function() {
404        if ($(this).parent().children("ul").length) {
405            $(this).parent().addClass("dropdown");
406            var mnhref = $(this).attr("href");
407            $(this).prepend("<span><i></i></span>");
408            if (mnhref == "" || mnhref == "#") {
409                $(this).addClass("open");
410            } else {
411                $(this).find("span").addClass("open");
412            }
413        }
414    }));
415    $("#subnav li.dropdown .open").on("click", (function(event) {
416        var current = $(this).closest("li").first();
417        current.siblings(".active").find("ul").first().slideUp();
418        current.siblings(".active").removeClass("active");
419        current.toggleClass("active");
420        current.find("ul").first().slideToggle();
421        event.preventDefault();
422    }));
423    //for second level pages open up
424        $("#subnav > li > ul > li.current").find(".open").first().trigger("click");
425}
426
427/*
428marco polo
429*/ function predictiveSearch() {
430    $(".search-predictive").each((function() {
431        $searchInput = $(".search-predictive");
432        $searchInput.marcoPolo({
433            url: "/_components/ajax/ajax-search-predictive.php",
434            formatItem: function(data, $item) {
435                var title = data.title, type = data.type;
436                $item.attr("title", title);
437                return "<div class='title'>" + title + "</div><div class='type'>" + type + "</div>";
438            },
439            onRequestBefore: function(data) {
440                $(".mp_list").removeClass("hasMore").show().html('<li class="searching"><span style="font-style:italic;">Searching...</span></li>');
441            },
442            onResults: function(data) {
443                if (data.length >= 7) {
444                    $(".mp_list").addClass("hasMore");
445                    $(".mp_list li:last-child").addClass("mp_show_more");
446                }
447            },
448            onSelect: function(data, $item) {
449                var title = data.title;
450                $searchInput.val(title);
451                window.location = data.url;
452            }
453        });
454    }));
455}
456
457/*
458slick plugin - uses jqueryui from plugins.js
459*/ function slick() {
460    //load slick video via ajax
461    $("body").on("click", ".slick-video", (function(event) {
462        event.preventDefault();
463        var $this = $(this), mediaTitle = $this.data("title"), mediaType = $this.data("type"), mediaSRC = $this.data("src"), mediaImg = encodeURIComponent($this.data("image")), mediaExt = "";
464        if (mediaType == "file") {
465            var mediaExt = mediaSRC.substr(mediaSRC.lastIndexOf(".") + 1).toLowerCase();
466        }
467        $this.parents(".slick-widget").slick("slickPause");
468        $.ajax({
469            url: "/_components/ajax/ajax-rotator-media.php",
470            type: "GET",
471            data: {
472                title: mediaTitle,
473                type: mediaType,
474                src: mediaSRC,
475                image: mediaImg,
476                ext: mediaExt
477            },
478            success: function(results) {
479                $this.parents(".slick-slide").addClass("playing").prepend(results);
480                if ($this.parents("#billboard").length) {
481                    $("#billboard").addClass("playing");
482                }
483                //$this.parents('.slick-slider').find('.slick-dots').hide();
484                        },
485            error: function(results, textStatus, jqXHR) {
486                //add error messages as needed console.log(jqXHR.responseText);
487            }
488        });
489    }));
490    //after slide change remove any playing video
491        $(".slick-widget").on("afterChange", (function(event, slick, currentSlide) {
492        var $thisSlick = $(this);
493        $thisSlick.find(".slide").removeClass("first last");
494        $thisSlick.find(".slick-active").first().addClass("first");
495        $thisSlick.find(".slick-active").last().addClass("last");
496        if ($thisSlick.find(".slick-slide.playing").length) {
497            $thisSlick.find(".video").remove();
498            $thisSlick.find(".slick-slide").removeClass("playing");
499            $thisSlick.find(".slick-dots").show();
500            $thisSlick.slick("slickPlay");
501            if ($("#billboard.playing").length) {
502                $("#billboard").removeClass("playing");
503            }
504        }
505    }));
506    $(".slick-widget").each((function() {
507        $slick = $(this);
508        //slick settings via data tags
509                var slickData = $slick.data();
510        var howmany = slickData.howmany ? parseInt(slickData.howmany) : 1;
511        var dots = slickData.dots ? true : false;
512        var arrows = slickData.arrows;
513        var autoplay = slickData.timeout ? true : false;
514        var autoplaySpeed = slickData.timeout ? parseInt(slickData.timeout) : false;
515        var fade = slickData.fade ? true : false;
516        var eqheight = slickData.eqheight ? true : false;
517        var infinite = slickData.infinite ? true : false;
518        var adaptiveHeight = slickData.adaptiveheight ? true : false;
519        var howmanyMobile = 1;
520        if (fade) {
521            howmany = 1;
522        }
523        //keep slides the same height = largest slide
524                $slick.on("setPosition", (function(slick) {
525            if (eqheight) {
526                if ($(this).hasClass("slick-billboard") && !$("#billboard.large").length) {
527                    $(this).find(".slide").css({
528                        "min-height": "0px"
529                    });
530                    var slickTrack = $(this).find(".slick-track");
531                    var slickTrackHeight = $(slickTrack).height();
532                    $(this).find(".slide").css("min-height", slickTrackHeight + "px");
533                } else {
534                    $(this).find(".slick-slide, .slide").height("auto");
535                    var slickTrack = $(this).find(".slick-track");
536                    var slickTrackHeight = $(slickTrack).height();
537                    $(this).find(".slick-slide, .slide").css("height", slickTrackHeight + "px");
538                }
539            }
540            if ($("#billboard .rotator").length) {
541                //update from css to align with slide content
542                if (isSiteSmall()) {
543                    $("#billboard .rotator .slick-dots").css({
544                        bottom: "2rem",
545                        top: "auto"
546                    });
547                } else {
548                    var $el = $("#billboard .rotator .inner").first();
549                    var bottom = $el.position().top + $el.offset().top + $el.outerHeight(true) - 64;
550 /*4rem=64*/                    $("#billboard .rotator .slick-dots").css({
551                        bottom: "auto",
552                        top: bottom + "px"
553                    });
554                }
555            }
556        }));
557        //slick init and settings
558                $slick.slick({
559            vertical: false,
560            initialSlide: 0,
561            slidesToShow: howmany,
562            slidesToScroll: 1,
563            infinite: infinite,
564            speed: 500,
565            arrows: arrows,
566            dots: dots,
567            fade: fade,
568            autoplay: autoplay,
569            autoplaySpeed: autoplaySpeed,
570            adaptiveHeight: adaptiveHeight,
571            pauseOnHover: false,
572            swipeToSlide: true,
573            touchThreshold: 20,
574            prevArrow: '<button type="button" class="slick-prev"><span></span></button>',
575            nextArrow: '<button type="button" class="slick-next"><span></span></button>',
576            responsive: [ {
577                //match css break for lg
578                breakpoint: 1024,
579                settings: {
580                    vertical: false,
581                    initialSlide: 0,
582                    slidesToShow: howmanyMobile,
583                    adaptiveHeight: adaptiveHeight,
584                    slidesToScroll: 1,
585                    infinite: infinite
586                }
587            } ]
588        });
589    }));
590}
591
592/*
593html tabs - uses jqueryui from plugins.js
594*/ function tabs($tab) {
595    $tab.tabs({
596        create: function(event, ui) {
597            $tab.find(".tab-content").each((function() {
598                var thisTab = $(this);
599                var thisTabID = thisTab.attr("id");
600                var thisAnchor = $tab.find('.ui-tabs-tab[aria-controls="' + thisTabID + '"]');
601                var thisAnchorPos = thisAnchor.index();
602                var thisAnchorText = thisAnchor.find("a").html();
603                thisTab.wrapAll('<div class="ui-tab-wrap" />');
604                thisTab.parent(".ui-tab-wrap").prepend('<a href="#' + thisTabID + '" data-tab="' + thisAnchorPos + '" class="ui-tabs-anchor-mobile">' + thisAnchorText + "</a>");
605            }));
606            $tab.find(".ui-tabs-anchor-mobile").first().addClass("active");
607            $(".ui-tabs-anchor-mobile").click((function(event) {
608                event.preventDefault();
609                var thisTabPos = parseInt($(this).data("tab"));
610                $tab.find(".ui-tabs-anchor-mobile").removeClass("active");
611                $(this).addClass("active");
612                $tab.tabs("option", "active", thisTabPos);
613            }));
614        },
615        beforeActivate: function(event, ui) {},
616        activate: function(event, ui) {
617            $tab.find(".ui-tabs-anchor-mobile").removeClass("active");
618            $tab.find('.ui-tabs-anchor-mobile[data-tab="' + ui.newTab.index() + '"]').addClass("active");
619        }
620    });
621}
622
623/*
624ajax tabs from link list - uses jqueryui from plugins.js
625*/ function tabsAjax($tab) {
626    var tabsC = $tab.attr("id");
627    var tabsID = tabsC.split("-")[1];
628    $.ajax({
629        url: "/_components/ajax/ajax-tabs.php",
630        type: "GET",
631        data: {
632            id: tabsID
633        },
634        success: function(results) {
635            $("#" + tabsC).html(results);
636            $("#" + tabsC).tabs({
637                create: function(event, ui) {
638                    $("#" + tabsC).find(".tab-content").each((function() {
639                        var thisTab = $(this);
640                        var thisTabID = thisTab.attr("id");
641                        var thisAnchor = $("#" + tabsC).find('.ui-tabs-tab[aria-controls="' + thisTabID + '"]');
642                        var thisAnchorPos = thisAnchor.index();
643                        var thisAnchorText = thisAnchor.find("a").html();
644                        thisTab.wrapAll('<div class="ui-tab-wrap" />');
645                        thisTab.parent(".ui-tab-wrap").prepend('<a href="#' + thisTabID + '" data-tab="' + thisAnchorPos + '" class="ui-tabs-anchor-mobile">' + thisAnchorText + "</a>");
646                    }));
647                    $("#" + tabsC).find(".ui-tabs-anchor-mobile").first().addClass("active");
648                    $(".ui-tabs-anchor-mobile").click((function(event) {
649                        event.preventDefault();
650                        var thisTabPos = parseInt($(this).data("tab"));
651                        $("#" + tabsC).find(".ui-tabs-anchor-mobile").removeClass("active");
652                        $(this).addClass("active");
653                        $("#" + tabsC).tabs("option", "active", thisTabPos);
654                    }));
655                },
656                beforeActivate: function(event, ui) {
657                    //console.log(ui);
658                    if ($(ui.newTab).find("a").attr("href").indexOf("#") != 0) {
659                        window.open($(ui.newTab).find("a").attr("href"), "_self");
660                    } else {}
661                },
662                activate: function(event, ui) {
663                    $("#" + tabsC).find(".ui-tabs-anchor-mobile").removeClass("active");
664                    $("#" + tabsC).find('.ui-tabs-anchor-mobile[data-tab="' + ui.newTab.index() + '"]').addClass("active");
665                }
666            });
667        },
668        error: function(results, textStatus, jqXHR) {
669            //add error messages as needed console.log(jqXHR.responseText);
670        }
671    });
672}
673
674/*
675accordions from snippets and link list - uses jqueryui from plugins.js
676*/ function accordions($accordion) {
677    $accordion.accordion({
678        header: "> h6",
679        heightStyle: "content",
680        active: false,
681        collapsible: true,
682        create: function(event, ui) {},
683        activate: function(event, ui) {}
684    });
685    //open forms for error or thanks
686        if (window.location.href.indexOf("ferr") >= 0 || window.location.href.indexOf("thanks") >= 0) {
687        if ($(".accordion .monkForm .errorSummary").length) {
688            var panelID = $(".accordion .monkForm .errorSummary").parents(".ui-accordion-content").attr("id");
689            $(".accordion").accordion("option", "active", $("#" + panelID).index(".accordion div"));
690        }
691        if ($(".accordion .mcms_form_thank_you").length) {
692            var panelID = $(".accordion .mcms_form_thank_you").parents(".ui-accordion-content").attr("id");
693            $(".accordion").accordion("option", "active", $("#" + panelID).index(".accordion div"));
694        }
695    }
696}
697
698/*
699tooltip uses jqueryui from plugins.js
700*/ function tooltips() {
701    //tooltip
702    $(".tooltip").tooltip({
703        position: {
704            my: "center bottom-9",
705            at: "center top",
706            collision: "flipfit"
707        }
708    });
709    $(document).ajaxComplete((function() {
710        if ($(".tooltip").length) {
711            $(".tooltip").tooltip({
712                position: {
713                    my: "center bottom-9",
714                    at: "center top",
715                    collision: "flipfit"
716                }
717            });
718        }
719    }));
720}
721
722/*
723zurb tables for responsive tables approach - re pinned tables in css
724*/ function zurbTables() {
725    function n(n) {
726        n.wrap("<div class='table-wrapper' />");
727        var i = n.clone();
728        i.find("td:not(:first-child), th:not(:first-child)").css("display", "none"), i.removeClass("responsive-table"), 
729        n.closest(".table-wrapper").append(i), i.wrap("<div class='pinned' />"), n.wrap("<div class='scrollable' />"), 
730        e(n, i);
731    }
732    function i(n) {
733        n.closest(".table-wrapper").find(".pinned").remove(), n.unwrap(), n.unwrap();
734    }
735    function e(n, i) {
736        var e = n.find("tr"), t = i.find("tr"), a = [];
737        e.each((function(n) {
738            var i = $(this), e = i.find("th, td");
739            e.each((function() {
740                var i = $(this).outerHeight(!0);
741                a[n] = a[n] || 0, i > a[n] && (a[n] = i);
742            }));
743        })), t.each((function(n) {
744            $(this).height(a[n]);
745        }));
746    }
747    var t = !1, a = function() {
748        return $(window).width() < 767 && !t ? (t = !0, $("table.responsive-table").each((function(i, e) {
749            n($(e));
750        })), !0) : void (t && $(window).width() > 767 && (t = !1, $("table.responsive-table").each((function(n, e) {
751            i($(e));
752        }))));
753    };
754    a(), $(window).on("redraw", (function() {
755        t = !1, a();
756    })), $(window).on("resize", a);
757}
758
759/*
760replace url with outside url custom field
761*/ function outsideURL() {
762    //articles with outside url
763    $(".outsideurl").each((function() {
764        var outsideURL = $(this).data("url");
765        $(this).find("a").attr("href", outsideURL);
766    }));
767    $(document).ajaxComplete((function() {
768        $(".outsideurl").each((function() {
769            var outsideURL = $(this).data("url");
770            $(this).find("a").attr("href", outsideURL);
771        }));
772    }));
773}
774
775/*
776add new window to anchors
777*/ function blankTarget() {
778    $("[data-blanktarget=true]").each((function() {
779        $(this).find("a").attr("target", "_blank");
780    }));
781    $(document).ajaxComplete((function() {
782        $("[data-blanktarget=true]").each((function() {
783            $(this).find("a").attr("target", "_blank");
784        }));
785    }));
786}
787
788/*
789Remove the Monk-generated onsubmit function and handle the form submit here
790*/ function newsletter($newsletter) {
791    //$newsletter.find('#newsletter_text').val = '';
792    //$newsletter.find('#newsletter_text').attr('placeholder', 'Email');
793    $newsletter.removeAttr("onsubmit").submit((function(event) {
794        event.preventDefault();
795        var eml_addr = $newsletter.find("#newsletter_text").val();
796        if (isValidEmail(eml_addr)) {
797            var formData = $newsletter.serialize();
798            $.ajax({
799                type: "POST",
800                url: $newsletter.attr("action"),
801                data: formData
802            });
803            // var successMsg = $(this).find('#success').val().split("||").pop();
804                        var successMsg = "Thanks! Check your email and click the confirmation link to complete the&nbsp;sign&#8209;up.";
805            $newsletter.replaceWith("<p class='success-msg mb-6'>" + successMsg + "</p>");
806        } else {
807            //$newsletter.find('#newsletter_text').val = '';
808            //$newsletter.find('#newsletter_text').attr('placeholder', 'Email');
809            alert("Please enter a valid email address and try again.");
810        }
811    }));
812}
813
814/*
815Church map
816*/ function churchMap() {
817    var gMapKey = $("div.googlemapsAPI").data("key");
818    if (!gMapKey) {
819        return;
820    }
821    $(".widget-church-map").each((function() {
822        if ($(this).parents(".widget.visit").length) {
823            $(this).parents(".info").css({
824                padding: "0px"
825            });
826        }
827        var $map = $(this);
828        var id = $map.find(".map").attr("id");
829        var data = $map.data();
830        var myLatLng = {
831            lat: data.latitude,
832            lng: data.longitude
833        };
834        icon = {
835            path: "M16.1,31C16.1,31,16.1,31,16.1,31c0,0,10.9-14.5,10.9-19.3c0-7-5.5-10.1-10.9-10.1c-5.4,0-10.9,3.1-10.9,10.1,C5.2,16.5,16.1,31,16.1,31L16.1,31z M12.4,11.3C12.4,9.5,14,8,16.1,8s3.8,1.5,3.8,3.3s-1.7,3.3-3.8,3.3C14,14.6,12.4,13.1,12.4,11.3z",
836            fillColor: "#000000",
837            fillOpacity: 1,
838            anchor: new google.maps.Point(0, 0),
839            strokeWeight: 0,
840            scale: 1
841        };
842        if (data.latitude && data.longitude) {
843            if ($map.parents(".widget.visit").length) {
844                $map.parents(".info").addClass("no-padding");
845            }
846            var mapOptions = {
847                center: myLatLng,
848                zoom: 14,
849                mapTypeId: google.maps.MapTypeId.ROADMAP,
850                disableDefaultUI: true,
851                styles: [ {
852                    featureType: "administrative",
853                    elementType: "all",
854                    stylers: [ {
855                        visibility: "on"
856                    }, {
857                        saturation: -100
858                    }, {
859                        lightness: 20
860                    } ]
861                }, {
862                    featureType: "road",
863                    elementType: "all",
864                    stylers: [ {
865                        visibility: "on"
866                    }, {
867                        saturation: -100
868                    }, {
869                        lightness: 40
870                    } ]
871                }, {
872                    featureType: "water",
873                    elementType: "all",
874                    stylers: [ {
875                        visibility: "on"
876                    }, {
877                        saturation: -10
878                    }, {
879                        lightness: 30
880                    } ]
881                }, {
882                    featureType: "landscape.man_made",
883                    elementType: "all",
884                    stylers: [ {
885                        visibility: "simplified"
886                    }, {
887                        saturation: -60
888                    }, {
889                        lightness: 10
890                    } ]
891                }, {
892                    featureType: "landscape.natural",
893                    elementType: "all",
894                    stylers: [ {
895                        visibility: "simplified"
896                    }, {
897                        saturation: -60
898                    }, {
899                        lightness: 60
900                    } ]
901                }, {
902                    featureType: "poi",
903                    elementType: "all",
904                    stylers: [ {
905                        visibility: "off"
906                    }, {
907                        saturation: -100
908                    }, {
909                        lightness: 60
910                    } ]
911                }, {
912                    featureType: "transit",
913                    elementType: "all",
914                    stylers: [ {
915                        visibility: "off"
916                    }, {
917                        saturation: -100
918                    }, {
919                        lightness: 60
920                    } ]
921                } ]
922            };
923            var churchmap = new google.maps.Map(document.getElementById(id), mapOptions);
924            var churchmarker = new google.maps.Marker({
925                position: myLatLng,
926                icon: icon,
927                map: churchmap
928            });
929            google.maps.event.addListener(churchmarker, "click", (function() {
930                window.open("http://maps.google.com/maps?q=" + data.address + "", "_blank");
931            }));
932        }
933    }));
934}
935
936/*
937Section Animation
938*/ function sectionAnimation() {
939    $("body.section-animation .content-section").each((function() {
940        if ($(this).isInViewport()) {
941            $(this).addClass("inview");
942        }
943    }));
944    window.addEventListener("scroll", throttle((function() {
945        $("body.section-animation .content-section").each((function() {
946            if ($(this).isInViewport()) {
947                $(this).addClass("inview");
948            }
949        }));
950    }), 250));
951}
952
953function initialize(callback) {
954    responsiveVideo();
955    plyrVideo();
956    lightgallery();
957    $(".monkForm select, .filters select, .event-right .sorter, #select-nav-dropdown").exists((function() {
958        sorters(this);
959    }));
960    addSticky();
961    $(".jarallax").exists((function() {
962        jarallax();
963    }));
964    header();
965    $("nav.subnav").exists((function() {
966        subnav(this);
967    }));
968    $(".search-predictive").exists((function() {
969        predictiveSearch();
970    }));
971    $(".slick-widget").exists((function() {
972        slick();
973    }));
974    // Modifications to 'Tabs' handling, in order to allow for multiple instances on single page (snippet code also should be updated with new html)
975        $(".tabs").exists((function() {
976        // Skip the special handling for tabs on the search page
977        if ($(this).hasClass("search")) {
978            tabs($(this));
979        } else {
980            // On each set of tabs, assign new href to the nav items and matching ids to the content divs
981            $(".tabs").each((function(i) {
982                // Generate a random, 3-digit number to differentiate this set of tabs
983                var random_id = Math.floor(Math.random() * (999 - 100 + 1) + 100);
984                // Assign a unique href to each nav item
985                                $(this).find("> ul > li a").each((function(index) {
986                    // #tab-xxx-1
987                    $(this).attr("href", "#tab-" + random_id + "-" + index);
988                }));
989                // Assign a matching id to each tab-content div
990                                $(this).find(".tab-content").each((function(index) {
991                    // #tab-xxx-1
992                    $(this).attr("id", "tab-" + random_id + "-" + index);
993                }));
994                // After updating the hrefs and ids, run the normal tabs function on each set of tabs
995                                tabs($(this));
996            }));
997        }
998    }));
999    $(".tabs-linklist").exists((function() {
1000        tabsAjax(this);
1001    }));
1002    $(".accordion").exists((function() {
1003        accordions(this);
1004    }));
1005    $(".tooltip").exists((function() {
1006        tooltips();
1007    }));
1008    zurbTables();
1009    outsideURL();
1010    blankTarget();
1011    $("#newsletter").exists((function() {
1012        newsletter(this);
1013    }));
1014    $(".widget-church-map").exists((function() {
1015        churchMap();
1016    }));
1017    $("body.section-animation").exists((function() {
1018        sectionAnimation();
1019    }));
1020    callback();
1021}
1022
1023function initialLoaded() {
1024    $("html").addClass("loaded");
1025}
1026
1027$.fn.exists = function(callback) {
1028    if (this.length) {
1029        var args = [].slice.call(arguments, 1);
1030        callback.call(this, args);
1031    }
1032    return this;
1033};
1034
1035jQuery((function($) {
1036    //setup in bulk (DOCUMENT READY)
1037    initialize(initialLoaded);
1038}));

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.