PageSourceSearch

https://cofchrist.org/_assets/js/monk/layouts/mcms_ministry_1.js

js cofchrist.org collected 2026-10-02 04:27:15 UTC 22,655 bytes, 533 lines download raw bytes

1jQuery(function(r) {
2    if (
3    //sticky nav
4    r(".scroll-to-item").click(function() {
5        var e = r(this).attr("href"), 
6        //sepWidth = Math.max( $(window).width(), window.innerWidth),
7        t = r("#stickysub").height();
8        return r("html, body").stop().animate({
9            scrollTop: r(e).offset().top - (t - 5)
10        }, 550), !1;
11    }), r("body").hasClass("substicky")) {
12        var n = r(".stickysub-section"), a = r("#stickysub-nav"), s = a.outerHeight();
13        r(window).on("scroll", function() {
14            var o = r(this).scrollTop();
15            n.each(function() {
16                var e = r(this).offset().top - s, t = e + r(this).outerHeight();
17                e <= o && o <= t ? (a.find("a").removeClass("active"), n.removeClass("active"), 
18                r(this).addClass("active"), a.find('a[href="#' + r(this).attr("id") + '"]').addClass("active")) : (r(this).removeClass("active"), 
19                a.find('a[href="#' + r(this).attr("id") + '"]').removeClass("active"));
20            });
21        });
22    }
23    r("select.nav-dropdown").change(function(e) {
24        e.preventDefault(), e.stopPropagation();
25        // location.href = this.value;
26        // scroll to the selected section
27        var t = cumulativeOffset(document.getElementById(this.value.replace("#", "")));
28        setTimeout(function() {
29            // console.log("THIS.value", obj.top);
30            // window.scrollTo(0, obj.top);
31            r("html,body").animate({
32                scrollTop: t.top
33            }, 500);
34        }, 100);
35    }), 
36    //pagination for monklets
37    r("body").on("click", ".m1-monklet #pagination a", function(e) {
38        e.preventDefault();
39        var t = r(this).parents(".m1-monklet"), o = t.data();
40        if (null == r(this).attr("href") || "#" == r(this).attr("href")) return !1;
41        var n = getmUrlParameter("page", r(this).attr("href"));
42        if (null != n && (o.page = n), "groups1" === o.type || "groups2" === o.type) {
43            // different handling for groups1 monklet
44            var a = t.find(".list-view").outerHeight();
45            t.find(".list-view").css("min-height", a + "px"), t.find(".list-view").html("").addClass("loading");
46        } else {
47            a = t.height();
48            t.css("min-height", a + "px"), t.html("").addClass("loading");
49        }
50        r.ajax({
51            url: "/_components/ajax/ministry_1/ajax-ministry-1.php",
52            type: "GET",
53            data: o,
54            success: function(e) {
55                "groups1" === o.type || "groups2" === o.type ? // different handling for groups1/groups2
56                t.find(".items.list-view").removeClass("loading").html(e) : t.html(e).removeClass("loading");
57            },
58            error: function(e, t, o) {
59                //add error messages as needed console.log(jqXHR.responseText);
60            }
61        });
62    }), populateSmallGroupsImage(), r("#smallgroups2-map").length && initSmallGroups2();
63});
64
65var cumulativeOffset = function(e) {
66    for (var t = 0, o = 0; t += e.offsetTop || 0, o += e.offsetLeft || 0, e = e.offsetParent; ) ;
67    return {
68        top: t,
69        left: o
70    };
71};
72
73function getmUrlParameter(e, t) {
74    for (var o = t.split("?")[1].split("&"), n = 0; n < o.length; n++) {
75        var a = o[n].split("=");
76        if (a[0] == e) return a[1];
77    }
78}
79
80function populateSmallGroupsImage() {
81    $("#small-groups-image").length && $.get("/_components/ajax/ministry_1/ajax-small-groups-image.php", function(e) {
82        "blank" != e && $("#small-groups-image").css("background-image", e).removeClass("blank");
83    });
84}
85
86function initSmallGroups2() {
87    // Reference to Google Map
88    var n, a = [], r = [], o = 2, s = new InfoBox(), i = new google.maps.LatLng(17.6, 0);
89    // Array of map markers
90        /**
91   * Toggle marker and infobox visibility when user clicks map marker.
92   * @param {Object} group the group marker to toggle
93   * @param {Marker} marker Google Map marker
94   * @return {MapsEventListener}
95   */
96    function bindInfoBoxMarkerToggle(e, t) {
97        return google.maps.event.addListener(t, "click", function() {
98            s.getVisible() && s.getContent() === e.content ? 
99            /**
100   * Hide InfoBox and reset markerIcon
101   * @param {Marker} marker Google Map marker
102   * @return {null}
103   */
104            function(e) {
105                e.setIcon(defaultMarkerIcon()), s.setOptions(defaultInfoBox("")), s.setVisible(!1);
106            }
107            /**
108   * Hide InfoBox and reset grouped markerIcon
109   * @param {Marker} marker Google Map marker
110   * @return {null}
111   */ (t) : 
112            /**
113   * Display InfoBox and marker for a given group.
114   * @param {Object} group Group to display infobox for.
115   * @param {Marker} marker Groups marker.
116   * @return {Null}
117   */
118  
119            function(e, t) {
120                setAllMarkerIcons(defaultMarkerIcon()), t.setIcon({
121                    path: "M31.2,0c4.3,0,8.3,0.8,12.2,2.4c3.8,1.6,7.1,3.9,10,6.7s5.1,6.2,6.7,10c1.6,3.8,2.4,7.9,2.4,12.2c0,7.8-1.6,15.8-4.9,23.9 c-3.3,8.1-6.8,15.5-10.7,22.2S37.7,91.5,31.2,100c-6.5-8.5-11.7-16-15.6-22.6s-7.5-14-10.7-22.2C1.6,47,0,39,0,31.2 c0-4.3,0.8-8.3,2.4-12.2c1.6-3.8,3.9-7.1,6.7-10s6.2-5.1,10-6.7C22.9,0.8,26.9,0,31.2,0z M31.2,50c5.2,0,9.6-1.8,13.3-5.5 c3.6-3.6,5.5-8.1,5.5-13.3c0-5.2-1.8-9.6-5.5-13.3c-3.6-3.6-8.1-5.5-13.3-5.5c-5.2,0-9.6,1.8-13.3,5.5c-3.6,3.6-5.5,8.1-5.5,13.3 c0,5.2,1.8,9.6,5.5,13.3C21.6,48.2,26,50,31.2,50z",
122                    fillColor: "#0075c9",
123                    fillOpacity: 1,
124                    strokeWeight: 0,
125                    anchor: new google.maps.Point(31.25, 100),
126                    scale: .25
127                }), s.setOptions(defaultInfoBox(e.content)), s.setVisible(!0), s.open(n, t), disableInfoBoxScroll();
128            }
129            /**
130   * Display InfoBox and grouped marker for a given group.
131   * @param {String} content Content to display for the marker
132   * @param {Marker} marker Groups marker.
133   * @return {Null}
134   */ (e, t);
135        });
136    }
137    /**
138   * Toggle grouped marker and infobox visibility when user clicks map marker.
139   * @param {Object} grouped the grouped marker to toggle
140   * @param {Marker} marker Google Map marker
141   * @return {MapsEventListener}
142   */    function bindInfoBoxGroupedMarkerToggle(e, t) {
143        var o = 
144        /**
145   * build content for list view
146   * @param {Array} grouped Array of location grouping
147   * @return {String} html string
148   */
149        function(e) {
150            var t = "", o = e[0].address, n = '<div class="grouped title"><h5>' + e.length + " groups meet here.</h5></div>", a = '<div class="buttons grouped"><a href="http://maps.google.com/maps?q=' + o + '" target="_blank" class="map-directions">
150<span class="group-icon icon-pin_1"></span><span class="text">Get Directions</span></a></div>';
151            return e.forEach(function(e) {
152                t += "<li>" + e.listContent + "</li>";
153            }), n + a + "<ol>" + t + "</ol>";
154        }
155        /**
156   * Calculates furthest bounds for a set of objects
157   * @param  {Collection} objects Array of objects with geocode data
158   * @return {LatLngBounds}   google.maps.LatLngBounds class
159   */ (e);
160        return google.maps.event.addListener(t, "click", function() {
161            s.getVisible() && s.getContent() === o ? function(e) {
162                e.setIcon(groupedMarkerIcon()), s.setOptions(defaultInfoBox("")), s.setVisible(!1);
163            }
164            /**
165   * Gets and renders markers
166   * @param {String} data Serialized filter data.
167   * @param {Function} callback Function to perform after query
168   * @return {Null}
169   */ (t) : function(e, t) {
170                setAllGroupedMarkerIcons(groupedMarkerIcon()), t.setIcon({
171                    path: "M31.203,0.001c4.298,0,8.298,0.801,12.199,2.397c3.801,1.603,7.102,3.9,10,6.699c2.898,2.801,5.1,6.201,6.699,10 c1.602,3.801,2.398,7.9,2.398,12.199c0,7.801-1.6,15.801-4.898,23.899C54.3,63.299,50.8,70.694,46.902,77.396 c-3.9,6.699-9.199,14.104-15.699,22.603C24.703,91.5,19.502,84,15.602,77.396c-3.898-6.6-7.5-14-10.699-22.199 c-3.301-8.198-4.9-16.198-4.9-24c0-4.301,0.799-8.301,2.4-12.198C4.004,15.194,6.301,11.896,9.102,9c2.801-2.9,6.199-5.104,10-6.701 C22.9,0.802,26.902,0.001,31.203,0.001z M31.203,50.003c5.199,0,9.599-1.801,13.298-5.502c3.602-3.603,5.5-8.103,5.5-13.299 c0-5.201-1.799-9.604-5.5-13.304c-3.6-3.6-8.1-5.5-13.298-5.5c-5.201,0-9.602,1.804-13.301,5.5c-3.602,3.604-5.5,8.103-5.5,13.304 c0,5.196,1.801,9.6,5.5,13.299C21.604,48.202,26.002,50.003,31.203,50.003z M28.203,18.9h6.398V43.6h-6.398V18.9z M18.863,27.482 h24.701v6.4H18.863V27.482z",
172                    fillColor: "#0075c9",
173                    fillOpacity: 1,
174                    strokeWeight: 0,
175                    anchor: new google.maps.Point(31.25, 100),
176                    scale: .25
177                }), s.setOptions(defaultInfoBox(e)), s.setVisible(!0), s.open(n, t), setTimeout(disableInfoBoxScroll, 100);
178            }
179            /**
180   * Update map markers and positions
181   * @param  {String} data Serialized data
182   * @return {Null}
183   */ (o, t);
184        });
185    }
186    function calculateMaxBounds(e) {
187        if (e && e.length) {
188            var n, a = [];
189            // Build collection of LatLngBounds
190                        return e.forEach(function(e, t, o) {
191                e.latitude && e.longitude && a.push(new google.maps.LatLng(e.latitude, e.longitude));
192            }), 
193            // Compare each location and get the maximum bounds
194            a.forEach(function(e, t, o) {
195                0 === t ? n = new google.maps.LatLngBounds(e, e) : n.extend(e);
196            }), 
197            /**
198   * Extend LatLngBounds object to include a given range
199   * @param  {int}          degrees      Degrees to expand range by
200   * @param  {LatLngBounds} latLngBounds LatLngBounds to expand
201   * @return {LatLngBounds}
201 extended bounds
202   */
203            function(e, t) {
204                var o = new google.maps.LatLng(t.getNorthEast().lat() + e, t.getNorthEast().lng() + e);
205                return sw = new google.maps.LatLng(t.getSouthWest().lat() - e, t.getSouthWest().lng() - e), 
206                new google.maps.LatLngBounds(sw, o);
207            }(1 === a.length ? .1 : .03, n);
208        }
209        return !1;
210    }
211    // This function tries to keep the infobox a reasonable width/size on small mobile devices
212        /**
213   * Get a new infobox configuration
214   * @param {String} content Html string containing the infobox content
215   * @return {Object} Configuration object
216   */
217    function defaultInfoBox(e) {
218        return {
219            content: e,
220            disableAutoPan: !1,
221            maxWidth: 0,
222            pixelOffset: new google.maps.Size(-292, -31),
223            zIndex: null,
224            boxStyle: {
225                width: $("#smallgroups2-map").width() < 285 ? $("#smallgroups2-map").width() - 20 + "px" : "275px"
226            },
227            closeBoxMargin: "10px",
228            closeBoxURL: "/_assets/img/layouts/groupfinder_2/groupfinder_square_delete.svg",
229            infoBoxClearance: new google.maps.Size(20, 20),
230            isHidden: !1,
231            pane: "floatPane",
232            enableEventPropagation: !1
233        };
234    }
235    /**
236   * Get a new marker to draw on the map
237   * @param {Object} marker Marker object
238   * @param {Integer} index 0 based index of the map marker
239   * @return {Marker} New Google Map Marker
240   */    
241    /**
242   * Get a new default icon
243   * @return {String} icon url
244   */
245    function defaultMarkerIcon() {
246        //return '/_assets/img/layouts/groupfinder_2/groupfinder_marker.svg';
247        return {
248            path: "M31.2,0c4.3,0,8.3,0.8,12.2,2.4c3.8,1.6,7.1,3.9,10,6.7s5.1,6.2,6.7,10c1.6,3.8,2.4,7.9,2.4,12.2c0,7.8-1.6,15.8-4.9,23.9 c-3.3,8.1-6.8,15.5-10.7,22.2S37.7,91.5,31.2,100c-6.5-8.5-11.7-16-15.6-22.6s-7.5-14-10.7-22.2C1.6,47,0,39,0,31.2 c0-4.3,0.8-8.3,2.4-12.2c1.6-3.8,3.9-7.1,6.7-10s6.2-5.1,10-6.7C22.9,0.8,26.9,0,31.2,0z M31.2,50c5.2,0,9.6-1.8,13.3-5.5 c3.6-3.6,5.5-8.1,5.5-13.3c0-5.2-1.8-9.6-5.5-13.3c-3.6-3.6-8.1-5.5-13.3-5.5c-5.2,0-9.6,1.8-13.3,5.5c-3.6,3.6-5.5,8.1-5.5,13.3 c0,5.2,1.8,9.6,5.5,13.3C21.6,48.2,26,50,31.2,50z",
249            fillColor: "#0075c9",
250            fillOpacity: 1,
251            strokeWeight: 0,
252            anchor: new google.maps.Point(31.25, 100),
253            scale: .25
254        };
255    }
256    /**
257   * Get a new active icon
258   * @return {String} icon path
259   */    
260    /**
261   * Get a new grouped icon
262   * @return {String} icon url
263   */
264    function groupedMarkerIcon() {
265        //return '/_assets/img/layouts/groupfinder_2/groupfinder_marker_multiple.svg';
266        return {
267            path: "M31.203,0.001c4.298,0,8.298,0.801,12.199,2.397c3.801,1.603,7.102,3.9,10,6.699c2.898,2.801,5.1,6.201,6.699,10 c1.602,3.801,2.398,7.9,2.398,12.199c0,7.801-1.6,15.801-4.898,23.899C54.3,63.299,50.8,70.694,46.902,77.396 c-3.9,6.699-9.199,14.104-15.699,22.603C24.703,91.5,19.502,84,15.602,77.396c-3.898-6.6-7.5-14-10.699-22.199 c-3.301-8.198-4.9-16.198-4.9-24c0-4.301,0.799-8.301,2.4-12.198C4.004,15.194,6.301,11.896,9.102,9c2.801-2.9,6.199-5.104,10-6.701 C22.9,0.802,26.902,0.001,31.203,0.001z M31.203,50.003c5.199,0,9.599-1.801,13.298-5.502c3.602-3.603,5.5-8.103,5.5-13.299 c0-5.201-1.799-9.604-5.5-13.304c-3.6-3.6-8.1-5.5-13.298-5.5c-5.201,0-9.602,1.804-13.301,5.5c-3.602,3.604-5.5,8.103-5.5,13.304 c0,5.196,1.801,9.6,5.5,13.299C21.604,48.202,26.002,50.003,31.203,50.003z M28.203,18.9h6.398V43.6h-6.398V18.9z M18.863,27.482 h24.701v6.4H18.863V27.482z",
268            fillColor: "#0075c9",
269            fillOpacity: 1,
270            strokeWeight: 0,
271            anchor: new google.maps.Point(31.25, 100),
272            scale: .25
273        };
274    }
275    /**
276   * Get a new active grouped icon
277   * @return {String} icon url
278   */    
279    /**
280   * Remove all markers from map
281   * @return {Null}
282   */
283    function deleteMarkers() {
284        !
285        /**
286   * Set map target for all markers
287   * @param {Map} map Google Map
288   * @return {Null}
289   */
290        function(e) {
291            for (var t = 0; t < a.length; t++) a[t].setMap(e);
292        }
293        /**
294   * Set map target for all grouped markers
295   * @param {Map} map Google Map
296   * @return {Null}
297   */ (null), function(e) {
298            for (var t = 0; t < r.length; t++) r[t].setMap(e);
299        }
300        /**
301   * Set all marker icons for the map
302   * @param {Icon} Icon google.maps.icon
303   * @return {Null}
304   */ (null), s.setVisible(!1), a = [];
305    }
306    /**
307   * Disable map scrolling when mouse is inside infobox
308   * @return {null}
309   */    function disableInfoBoxScroll() {
310        // Disable map Dragging when cursor enters infoBox div
311        $(".infoBox").on("mouseenter", function() {
312            n.setOptions({
313                scrollwheel: !1
314            });
315        }), $(".infoBox").on("mouseleave", function() {
316            n.setOptions({
317                scrollwheel: !0
318            });
319        });
320    }
321    /**
322   * Get a new grouped marker to draw on the map
323   * @param {Object} group Group of locations
324   * @param {Integer} index 0 based index of the map marker
325   * @return {Marker} New Google Map Marker
326   */
327    function groupedMarker(e, t) {
328        return new google.maps.Marker({
329            position: new google.maps.LatLng(e[0].latitude, e[0].longitude),
330            map: n,
331            icon: groupedMarkerIcon(),
332            animation: google.maps.Animation.DROP,
333            zIndex: t
334        });
335    }
336    /**
337   * Initialize filterable map
338   * @param {DOM} canvas Dom element to bind map to.
339   * @return {Map} Google Map
340   */    
341    /**
342   * Add default map markers to the map.
343   * @param {Array} locations array of locations
344   * @return {Null}
345   */
346    function setDefaultMapMarkers(e) {
347        e.forEach(function(e, t) {
348            if (e.latitude && e.longitude) {
349                var o = function(e, t) {
350                    return new google.maps.Marker({
351                        position: new google.maps.LatLng(e.latitude, e.longitude),
352                        map: n,
353                        icon: defaultMarkerIcon(),
354                        animation: google.maps.Animation.DROP,
355                        title: e.name,
356                        zIndex: t
357                    });
358                }(e, t);
359                a.push(o), bindInfoBoxMarkerToggle(e, o);
360            }
361        });
362    }
363    /**
364   * Add grouped map markers to the map.
365   * @param {Array} grouped array of grouped locations
366   * @return {Null}
367   */    
368    /**
369   * Sets map markers
370   * @param {Array} groups  Group data
371   */
372    function setMapMarkers(e) {
373        var t = 
374        /**
375   * Returns an array that displays locations with valid
376   * coordinates.
377   * @param {Array} locations array of locations
378   * @return {Array} An array of valid locations
379   */
380        function(e) {
381            return e.filter(function(e) {
382                return e.latitude && e.longitude;
383            });
384        }(e), o = function(e) {
385            var a = {}, t = $.extend(!0, [], e);
386            // Create objects
387                        // Remove locations with one or fewer groups
388            for (var o in t.forEach(function(e, t) {
389                var o = e.latitude + "," + e.longitude;
390                a[o] ? a[o].push(e) : a[o] = [ e ];
391            }), a) a[o].length <= 1 && delete a[o];
392            // Remove initial colocational group from locations array
393                        /**
394   * Removes all elements from `array` that `predicate` returns truthy for
395   * and returns an array of the removed elements. Lodash's remove method.
396   * @param {Array} array The array to modify.
397   * @param {Function} predicate The function invoked per iteration
398   * @return {Array} Returns the new array of removed elements.
399   */
400            return function(e, t) {
401                for (var o = -1, n = e ? e.length : 0, a = []; ++o < n; ) {
402                    var r = e[o];
403                    t(r, o, e) && (a.push(r), e.splice(o--, 1), n--);
404                }
405            }
406            /**
407   * Reset all icon when the colorbox closes.
408   * @return {MapsEventListener}
409   */ (e, function(e, t, o) {
410                var n = e.latitude + "," + e.longitude;
411                return a[n];
412            }), a;
413        }(t);
414        // Remove markers that are present
415                (a.length || groupedMarker.length) && deleteMarkers(), function(e) {
416            var t = 0;
417            for (var o in e) {
418                var n = groupedMarker(e[o], t);
419                r.push(n), bindInfoBoxGroupedMarkerToggle(e[o], n), t++;
420            }
421        }(o), setDefaultMapMarkers(t);
422    }
423    function setAllMarkerIcons(e) {
424        for (var t = 0; t < a.length; t++) a[t].setIcon(e);
425    }
426    /**
427   * Set all grouped marker icons for the map
428   * @param {Icon} Icon google.maps.icon
429   * @return {Null}
430   */    function setAllGroupedMarkerIcons(e) {
431        for (var t = 0; t < r.length; t++) r[t].setIcon(e);
432    }
433    function updateMap(e) {
434        !function(e, t) {
435            $.getJSON("/_components/ajax/ministry_1/ajax-small-groups-map.php", e, function(e) {
436                $.isFunction(t) && t(e);
437            });
438        }(e, function(e) {
439            if (e.length) {
440                var t = calculateMaxBounds(e);
441                t.getCenter();
442                setMapMarkers(e), n.fitBounds(t);
443            } else deleteMarkers(), n.panTo(i), n.setZoom(o);
444        });
445    }
446    $(document).ready(function() {
447        var e = $("#smallgroups2-map")[0];
448        e && (google.maps.event.addListener(s, "closeclick", function() {
449            setAllMarkerIcons(defaultMarkerIcon()), setAllGroupedMarkerIcons(groupedMarkerIcon());
450        }), $("body").on("click", '.m1-monklet-section-groups[data-type="groups2"] #pagination a', function(e) {
451            if (void 0 === $(this).attr("href")) return !1;
452            // pagination handled elsewhere simultaneously, so allow a little time for data attr to be updated
453            setTimeout(function() {
454                // update the map
455                updateMap($("#smallgroups2-map").parents(".m1-monklet").data());
456            }, 100);
457        }), function(e) {
458            var t = {
459                minZoom: o,
460                // imageDefaultUI: true,
461                disableDefaultUI: !0,
462                mapTypeId: google.maps.MapTypeId.ROADMAP,
463                styles: [ {
464                    featureType: "water",
465                    stylers: [ {
466                        visibility: "on"
467                    }, {
468                        color: "#b5cbe4"
469                    } ]
470                }, {
471                    featureType: "landscape",
472                    stylers: [ {
473                        color: "#efefef"
474                    } ]
475                }, {
476                    featureType: "road.highway",
477                    elementType: "geometry",
478                    stylers: [ {
479                        color: "#83a5b0"
480                    } ]
481                }, {
482                    featureType: "road.arterial",
483                    elementType: "geometry",
484                    stylers: [ {
485                        color: "#bdcdd3"
486                    } ]
487                }, {
488                    featureType: "road.local",
489                    elementType: "geometry",
490                    stylers: [ {
491                        color: "#ffffff"
492                    } ]
493                }, {
494                    featureType: "poi.park",
495                    elementType: "geometry",
496                    stylers: [ {
497                        color: "#e3eed3"
498                    } ]
499                }, {
500                    featureType: "administrative",
501                    elementType: "all",
502                    stylers: [ {
503                        visibility: "off"
504                    }, {
505                        lightness: 33
506                    } ]
507                }, {
508                    featureType: "road"
509                }, {
510                    featureType: "poi.park",
511                    elementType: "labels",
512                    stylers: [ {
513                        visibility: "on"
514                    }, {
515                        lightness: 20
516                    } ]
517                }, {}, {
518                    featureType: "road",
519                    stylers: [ {
520                        lightness: 20
521                    } ]
522                } ]
523            };
524            n = new google.maps.Map(e, t), 
525            // Get initial map markers and then add them to the map
526            updateMap($(e).parents(".m1-monklet").data());
527        }
528        /**
529   * Update map markers when pagination is clicked on list of groups/items.
530   * @return {Null}
531   */ (e));
532    });
533}

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.