PageSourceSearch

https://moisesafracenter.org/wp-content/themes/jcc-moisesafra/js/custom.js?ver=20260930

js moisesafracenter.org collected 2026-10-08 21:16:21 UTC 15,331 bytes, 437 lines download raw bytes

1var subscribePopup = null;
2var doHeaderLoginClick = null;
3
4(function ($) {
5    $("#hebrew-events").on('click', '.change-month', function (e) {
6        e.preventDefault();
7        var _this = $(this);
8        var month = _this.data("month");
9        var year = _this.data("year");
10        var url = '/events-calendar/' + year + '-' + (month < 10 ? '0' : '') + month + '/';
11        $(".hebrew-calendar-loading").show();
12        window.history && window.history.pushState({ path: url }, '', url);
13        $.ajax({
14            url: $("#ajax-url").val(),
15            data: {
16                action: 'get_hebrew_events',
17                month: month,
18                year: year,
19            },
20            type: 'POST',
21            success: function (response) {
22                $(".hebrew-calendar-loading").hide();
23                var data = JSON.parse(response);
24                if (data.success) {
25                    $(".hebrew-events-container").html(data.html);
26                }
27            }
28        });
29    });
30
31    $("#hebrew-events").on('click', '.calendar-day', function () {
32        if ($(window).width() > 1008) {
33            return;
34        }
35        var _this = $(this);
36        var text = "";
37        _this.find(".desktop-events").each(function (i, item) {
38            text += '<p class="holiday">' + $(item).html() + '</p>';
39        });
40        if (text != "") {
41            var day = _this.data("day");
42            var month = _this.data("month");
43            var year = _this.data("year");
44
45            var html = '';
46            html += '<div class="shadow hebrew-calendar-popup">';
47            html += '<div class="success success-box">';
48            html += '<a class="close icon-icons-18" href="javascript:void(0);"></a>';
49            html += '<p class="holiday"><strong>' + month + ' ' + day + ', ' + year + '</strong></p>';
50            html += text;
51            html += '</div>';
52            html += '</div>';
53            $('body').append(html);
54        }
55    });
56
57    $(document).ready(function(){
58        if ($(".page-template-donate").length) {
59            $(this).scrollTop(0);
60        }
61
62        $(document).on('click', '#close-linked-popup', function() {
63            if ($('.linked-popup').length) {
64                $('.linked-popup').remove();
65            }
66        });
67
68        $(document).on('click', '#read-linked-popup', function() {
69            $.cookie("close_linked_popup_2", true);
70            var linkedPopupURL = $('#linked-popup-url').val();
71            if (linkedPopupURL !== "") {
72                window.location.href = linkedPopupURL;
73            }
74        });
75
76    });
77
78    /*$("body").on('click', '.login.open:not(.daxko_login)', function () {
79        var wWidth = $(window).width();
80        if (wWidth > 1024) {
81            if ($(".account-mobile-login").hasClass("open")) {
82                $(".account-mobile-login").removeClass("open");
83            }
84        }
85    });*/
86
87    $(function () {
88        initHeaderNavigation();
89        initEventFilters();
90        $('body').removeClass('alerted');
91    });
92
93    function initEventFilters () {
94        var isQuryTribe = false;
95        if (getUrlParameter('tribe_tags[]') || getUrlParameter('tribe_age_groups[]') || getUrlParameter('tribe_programs[]')) {
96            isQuryTribe = true;
97        }
98        var body = $('body');
99        var toggle = $('#tribe-bar-events-filters-toggle');
100        toggle.on('click', function () {
101            body.toggleClass('tribe-filters-closed').toggleClass('tribe-filters-open');
102        });
103        if (isQuryTribe) {
104            body.removeClass('tribe-filters-closed').addClass('tribe-filters-open');
105        } else {
106            body.removeClass('tribe-filters-open').addClass('tribe-filters-closed');
107        }
108        $('#tribe_events_filters_reset').on('click', function (e) {
109            e.preventDefault();
110            window.location = window.location.pathname;
111        });
112    }
113
114    function gtmTrackStuffPhoneClick (phone) {
115        if (typeof phone != "undefined" && phone) {
116            window.dataLayer = window.dataLayer || [];
117            window.dataLayer.push({
118                "event": "EventStuffPhoneClick",
119                "eventCategory": "Phone Call Tracking",
120                "eventAction": "Click to Call",
121                "eventLabel": phone
122            });
123        }
124    }
125
126    function initHeaderNavigation () {
127        var items = $('header nav .drop');
128        var drops = $('header nav .drop .dropdown');
129
130        items.find('>a').on('click', function (e) {
131            e.preventDefault();
132            var wWidth = $(window).width();
133            var item = $(this).parent();
134            var isOpened = item.hasClass('active');
135            if (!isOpened) isOpened = item.hasClass('open');
136
137            items.removeClass('active').removeClass('open');
138            drops.removeAttr('style');
139            if (!isOpened) {
140                if (wWidth > 991) {
141                    item.addClass('active');
142                } else {
143                    item.addClass('open');
144                    item.find('.dropdown').fadeIn();
145                }
146            }
147        });
148
149        $(window).on('click', function (event) {
150            if (!$(event.target).closest('header nav .drop').length) {
151                items.removeClass('active').removeClass('open');
152                drops.removeAttr('style');
153            }
154        });
155    }
156
157    subscribePopup = function (id) {
158        var value = "close_subscribe_popup_window";
159        if (!readCookie(value)) {
160            var popup = null;
161            var loading = showLoading();
162            $.post(themeData.url, 'action=show_popup_window&popup_id=' + id, function (response) {
163                loading.close();
164                if (response.html) {
165                    if (popup) popup.close();
166                    popup = openPopup(response.html);
167                    $('.gform_wrapper form', popup.content).attr('action', '');
168                    createCookie(value, 1, 30);
169                }
170            }, 'json');
171        }
172    }
173
174    doHeaderLoginClick = function () {
175        $('header .login:not(.daxko_login):visible').click();
176        return false;
177    }
178
179    $('[data-track-stuff-phone]').on('click touchstart', function () {
180        var phone = $(this).data('track-stuff-phone');
181        if (phone != '') gtmTrackStuffPhoneClick(phone);
182    });
183
184    function showLoading () {
185        var content = $('<div class="popup-loading"></div>');
186        var popup = openPopup(content);
187        $('.close', popup.container).remove();
188        $('.overlay', popup.container).off('click');
189        return popup;
190    }
191
192    function errorPopup (message, callback) {
193        if (!message) return false;
194        var html = '';
195        html += '<div class="shadow">';
196        html += '<div class="alert">';
197        html += '<div class="box">&nbsp;</div>';
198        html += '<a class="close icon-icons-18" href="javascript:void(0);"></a>';
199        html += '<p><span>Error: </span>' + message + '</p>';
200        html += '</div>';
201        html += '</div>';
202        $('body').append(html);
203        //alert(message);
204    }
205
206    function errorPopupCustom (message, callback) {
207        if (!message) return false;
208        var html = '';
209        html += '<div class="shadow">';
210        html += '<div class="alert alert-custom">';
211        html += '<div class="box">&nbsp;</div>';
212        html += '<a class="close icon-icons-18" href="javascript:void(0);"></a>';
213        html += '<p class="custom-alert-p">' + message + '</p>';
214        html += '</div>';
215        html += '</div>';
216        $('body').append(html);
217        //alert(message);
218    }
219
220    function customSuccessPopup (message, callback) {
221        if (!message) return false;
222        var html = '';
223        html += '<div class="shadow">';
224        html += '<div class="success success-box">';
225        html += '<div class="box">&nbsp;</div>';
226        html += '<a class="close icon-icons-18" href="javascript:void(0);"></a>' + message;
227        html += '</div>';
228        html += '</div>';
229        $('body').append(html);
230    }
231
232    function openPopup (content, callback) {
233        var popup = new simplePopup();
234        popup.append(content);
235        if (typeof callback == 'function') {
236            popup.callback = callback;
237        }
238        popup.open();
239        return popup;
240    }
241
242    function closePopup () {
243        $('.simple-popup .close').click();
244    }
245
246    function simplePopup () {
247        var This = this;
248        This.container = $(
249            '<div class="simple-popup">'
250            + '<div class="overlay"></div>'
251            + '<div class="wrapper">'
252            + '<div class="content"></div><div class="close"></div>'
253            + '</div>'
254            + '</div>'
255        ).hide();
256        This.container.find('.close').click(function () {
257            This.close();
258        });
259        This.container.find('.overlay').click(function () {
260            This.close();
261        });
262        $('body').append(This.container);
263        $(window).on('orientationchange resize scroll', function () {
264            This.center();
265        });
266    }
267
268    simplePopup.prototype.container = null;
269    simplePopup.prototype.addClass = function (val) {
270        this.container.addClass(val);
271    }
272    simplePopup.prototype.append = function (val) {
273        this.container.find('.content').append(val);
274    }
275    simplePopup.prototype.open = function () {
276        this.container.show();
277        this.center();
278    }
279    simplePopup.prototype.close = function () {
280        if (typeof this.callback == 'function') {
281            this.callback();
282        }
283        this.container.remove();
284    }
285    simplePopup.prototype.center = function () {
286        var c = this.container.find('.wrapper'), w = $(window), offset = 0;
287        var header = $('#wpadminbar');
288        if (header.length) offset = header.height();
289        c.css({
290            left: (w.width() - c.outerWidth()) / 2,
291            top: Math.max(0, (w.height() - offset - c.outerHeight()) / 2) + offset
292        });
293    }
294
295    function getUrlParameter (name) {
296        var value = null;
297        if (name = (new RegExp('[?&]' + encodeURIComponent(name) + '=([^&]*)')).exec(location.search)) {
298            value = decodeURIComponent(name[1]);
299        }
300        return value;
301    }
302
303    function createCookie (name, value, days) {
304        if (days) {
305            var date = new Date();
306            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
307            var expires = "; expires=" + date.toGMTString();
308        } else {
309            var expires = "";
310        }
311        document.cookie = name + "=" + value + expires + "; path=/";
312    }
313
314    function readCookie (name) {
315        var nameEQ = name + "=";
316        var ca = document.cookie.split(';');
317        for (var i = 0; i < ca.length; i++) {
318            var c = ca[i];
319            while (c.charAt(0) == ' ')
320                c = c.substring(1, c.length);
321            if (c.indexOf(nameEQ) == 0) {
322                return c.substring(nameEQ.length, c.length);
323            }
324        }
325        return null;
326    }
327
328    function eraseCookie (name) {
329        createCookie(name, "", -1);
330    }
331
332    $('.filter .datepicker').datepicker();
333
334    $("body").on("click", ".link-box.mobile-popup", function () {
335        var popupHTML = $(this).closest(".evnt").find(".shadow").html();
336        $('body').append('<div class="shadow active">' + popupHTML + "</div>");
337    });
338
339    $("body").on("click", ".pop-up .close", function () {
340        $('.shadow.active').remove();
341        return false;
342    });
343
344    $("header a.daxko_login").on("click", function (e) {
345        e.preventDefault();
346        showDaxkoLoginPopup();
347    });
348
349    function showDaxkoLoginPopup () {
350        let npgData = window.npgData || {}
351        var authURL = npgData.daxkoLoginUrl ?? ''; // "https://operations.daxko.com/online/auth?response_type=code&scope=client:5068+member:basic_info&state=axjfoa83alksdfj&client_id=prod_hebrew_bronx&redirect_uri=https://moisesafracenter.npgdev.com/successful_login";
352        if (!authURL) {
353            return false;
354        }
355
356        if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
357            window.location.href = authURL;
358        } else {
359            var pop = window.open(authURL, 'targetWindow', 'toolbar=no,location=yes,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=400');
360        }
361
362        return false;
363    }
364
365    // programs offerings search
366    if ($('body').hasClass('page-template-daxko_programs_offerings_search')) {
367        const offeringsSearchForm = $('#daxko-offerings-search-form');
368        const offeringsResults = $('#programs-offerings-results');
369        const offeringsKeywordInput = offeringsSearchForm.find('[name="keywords"]');
370        const offeringsTypesSelect = offeringsSearchForm.find('[name="offering_types"]');
371        const offeringsCategoriesSelect = offeringsSearchForm.find('[name="category_ids"]');
372        const offeringsLocationsSelect = offeringsSearchForm.find('[name="location_ids"]');
373        const offeringsLoading = $('.page-template-daxko_programs_offerings_search .page-list-load');
374        const offeringsDatePicker = offeringsSearchForm.find('.datepicker');
375        let selectedFromPicker = false;
376
377        offeringsKeywordInput.on('keydown', function (e) {
378            if (e.which == 13) {
379                e.preventDefault();
380                submitOfferingsSearchForm();
381            }
382        });
383
384        offeringsTypesSelect
385            .add(offeringsLocationsSelect)
386            .add(offeringsCategoriesSelect)
387            .on('change', function (e) {
388                e.preventDefault();
389                submitOfferingsSearchForm();
390            }
391        );
392
393        offeringsDatePicker.datepicker({
394            onSelect: function(dateText, inst) {
395                selectedFromPicker = true;
396                submitOfferingsSearchForm();
397            },
398            onClose: function(dateText, inst) {
399                if (!selectedFromPicker) {
400                    submitOfferingsSearchForm();
401                }
402                selectedFromPicker = false;
403            }
404        });
405
406        $(document).on('click', '#programs-offerings-load-more', function () {
407            submitOfferingsSearchForm (true);
408        });
409
410        function submitOfferingsSearchForm (loadMore = false) {
411            var formData = offeringsSearchForm.serialize();
412            if (!loadMore) {
413                offeringsResults.html('');
414            }
415            offeringsLoading.show();
416            $.ajax({
417                type: 'POST',
418                url: npgData.ajaxUrl,
419                data: formData + '&action=offerings_search_filter' + (loadMore ? '&load_more=yes' : ''),
420                success: function (response) {
421                    var data = JSON.parse(response);
422                    console.log(data.after);
423                    if (loadMore) {
424                        $('.page-list-load-more').remove();
425                        $('#programs-offerings-after').val(data.after);
426                        offeringsResults.append(data.html);
427                    } else {
428                        offeringsResults.html(data.html);
429                    }
430                    offeringsLoading.hide();
431                }
432            });
433        }
434
435        offeringsDatePicker.datepicker();
436    }
437})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.