PageSourceSearch

https://curesarcoma.org/wp-content/themes/curesarcoma/assets/js/scripts.js?update=1790273618&ver=7.0.5

js curesarcoma.org collected 2026-09-24 18:26:09 UTC 15,747 bytes, 479 lines download raw bytes

1(function ($, w, d, h, b) {
2  var app = {
3    maxPageNumber: 1,
4    pageNumber: 1,
5
6    initNavigation: function () {
7      jQuery(window).scroll(function () {
8        var scroll = jQuery(window).scrollTop();
9        if (scroll >= 200 && jQuery(window).width() > 991) {
10          jQuery('.header').addClass('fixed');
11        } else {
12          jQuery('.header').removeClass('fixed');
13        }
14      });
15
16      function isMobileDevice() {
17        return window.innerWidth <= 400;
18      }
19
20      jQuery(document).ready(function ($) {
21        function setMenuHeight() {
22          var $menu = $('.header-nav');
23          var $search = $('.header-top-search');
24          var windowHeight = $(window).height();
25          var searchHeight = $search.outerHeight(true);
26          var availableHeight = windowHeight - searchHeight;
27
28          if ($(window).width() < 992) {
29            $menu.css({
30              'max-height': availableHeight + 'px',
31              'overflow-y': 'auto'
32            });
33          } else {
34            $menu.css({
35              'overflow-y': 'visible',
36              'max-height': 'none'
37            });
38          }
39        }
40
41        function handleMenuClick() {
42          setMenuHeight();
43        }
44
45        function setMegaMenuContent(element) {
46          var desc = element.find('a').data('desc');
47          var url = element.find('a').data('url') || element.find('a').attr('href');
48
49          $('.active-menu-item .menu-item-info-short-desc').text(desc);
50          $('.active-menu-item .menu-item-sub-panel-info a').attr('href', url);
51
52          element.find('a[data-feat]').parent().hide();
53
54          var feat1 = element.find('a[data-feat]').eq(0).data('feat');
55          if (feat1) {
56            var featImg1 = element.find('a[data-feat]').eq(0).data('feat-img');
57            var title1 = element.find('a[data-feat]').eq(0).text();
58            var letterCount = title1.length;
59            var desc1 = element.find('a[data-feat]').eq(0).data('desc');
60            var url1 = element.find('a[data-feat]').eq(0).attr('href');
61
62            $('.active-menu-item .menu-item-sub-panel-featured-item:nth-child(1) .menu-item-sub-panel-featured-img canvas')
63              .css('background-image', 'url(' + featImg1 + ')');
64            $('.active-menu-item .menu-item-sub-panel-featured-item:nth-child(1) .menu-item-sub-panel-featured-text-title')
65              .text(title1);
66
67            var lineClamp = letterCount <= 21 ? '3' : letterCount <= 44 ? '2' : '1';
68
69            $('.active-menu-item .menu-item-sub-panel-featured-item:nth-child(1) .menu-item-sub-panel-featured-text-desc')
70              .text(desc1)
71              .css('-webkit-line-clamp', lineClamp);
72
73            $('.active-menu-item .menu-item-sub-panel-featured-item:nth-child(1) a').attr('href', url1);
74          }
75
76          var feat2 = element.find('a[data-feat]').eq(1).data('feat');
77          if (feat2) {
78            var featImg2 = element.find('a[data-feat]').eq(1).data('feat-img');
79            var title2 = element.find('a[data-feat]').eq(1).text();
80            var letterCount2 = title2.length;
81            var desc2 = element.find('a[data-feat]').eq(1).data('desc');
82            var url2 = element.find('a[data-feat]').eq(1).attr('href');
83
84            $('.active-menu-item .menu-item-sub-panel-featured-item:nth-child(2) .menu-item-sub-panel-featured-img canvas')
85              .css('background-image', 'url(' + featImg2 + ')');
86            $('.active-menu-item .menu-item-sub-panel-featured-item:nth-child(2) .menu-item-sub-panel-featured-text-title')
87              .text(title2);
88
89            var lineClamp2 = letterCount2 <= 21 ? '3' : letterCount2 <= 44 ? '2' : '1';
90
91            $('.active-menu-item .menu-item-sub-panel-featured-item:nth-child(2) .menu-item-sub-panel-featured-text-desc')
92              .text(desc2)
93              .css('-webkit-line-clamp', lineClamp2);
94
95            $('.active-menu-item .menu-item-sub-panel-featured-item:nth-child(2) a').attr('href', url2);
96          }
97
98          if (!feat1 && !feat2) {
99            $('.active-menu-item .menu-item-sub-panel-featured').hide();
100          }
101        }
102
103        if (isMobileDevice()) {
104          $('.header-nav .hdrnav>li>a').each(function () {
105            var originalHref = $(this).attr('href');
106            $(this).data('url', originalHref).removeAttr('href');
107          });
108
109          $('.hdrnav>li').on('click', function () {
110            if ($(this).hasClass('active-menu-item')) {
111              $(this).removeClass('active-menu-item');
112            } else {
113              $('.hdrnav>li').removeClass('active-menu-item');
114              $(this).addClass('active-menu-item');
115              setMegaMenuContent($(this));
116            }
117            handleMenuClick();
118          });
119        } else {
120          $('.hdrnav>li').hover(
121            function () {
122              $(this).addClass('active-menu-item');
123              setMegaMenuContent($(this));
124            },
125            function () {
126              $(this).removeClass('active-menu-item');
127            }
128          );
129        }
130
131        setMenuHeight();
132
133        $(window).on('resize', function () {
134          setMenuHeight();
135        });
136      });
137
138      jQuery('.menu-item-sub-panel-menu a').hover(function () {
139        desc = jQuery(this).data('desc');
140        url = jQuery(this).attr('href')
141      });
142
143      jQuery('.header-mobile-menu-toggle').click(function () {
144        jQuery('body').toggleClass('mobile-menu-open');
145      });
146
147      jQuery(document).mouseup(function (e) {
148        var container = jQuery(".header-nav");
149        if (!container.is(e.target) && container.has(e.target).length === 0) {
150          jQuery('body').removeClass('mobile-menu-open');
151        }
152      });
153    },
154
155    initHelpers: function () {
156      jQuery('a[href^="mailto(coln)"], .asis-mailto-obfuscated-email').each((function () {
157        var t = jQuery(this).attr("data-value");
158        if (typeof t !== 'undefined') {
159          var r = t.replace(/\(at\)/g, "@").replace(/\(dotted\)/g, ".").trim(),
160              n = "mailto:" + r;
161
162          jQuery(this).attr("href", n);
163
164          var o = jQuery("<textarea>" + jQuery(this).html() + "</textarea>").text();
165          jQuery(this).html(o.replace(new RegExp(t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")), r));
166
167          jQuery(this).removeClass("asis-mailto-obfuscated-email-hidden");
168        }
169      }));
170
171      jQuery('.ip-content-popup-link').magnificPopup({ type: 'inline' });
172    },
173
174    initSlider: function () {
175      jQuery('.hp-slider').slick({
176        autoplaySpeed: 4000,
177        autoplay: true,
178        fade: true,
179        arrows: false,
180      });
181    },
182
183    initSliderAnnouncements: function () {
184      jQuery('.hp-slider-content-announcements').slick({
185        autoplaySpeed: 4000,
186        autoplay: true,
187        arrows: false,
188      });
189
190      jQuery('.hp-slider-content-announcement-text a').click(function () {
191        gtag('event', 'announcement_click', {
192          'announcement_url': jQuery(this).attr('href'),
193        });
194      });
195    },
196
197    initPatientStories: function () {
198      gsap.registerPlugin(ScrollTrigger);
199      const panels = gsap.utils.toArray(".hp-ps-wrap > div");
200
201      gsap.to(panels, {
202        xPercent: -70,
203        ease: "none",
204        scrollTrigger: {
205          trigger: ".hp-ps",
206          pin: true,
207          start: "top top",
208          scrub: 1,
209          end: '=+2000'
210        }
211      });
212    },
213
214    initGlobalDonateForm: function () {
215      jQuery(document).on('click', '.global-donate-btn', function (e) {
216        e.preventDefault();
217
218        const donationUrl = 'https://crm.bloomerang.co/HostedDonation?ApiKey=pub_6abaeed1-05f4-11e8-94a1-0a7fa948a058&WidgetId=7294531584';
219        const modal = document.getElementById("globalDonateModal");
220        const iframe = document.getElementById("globalDonateIframe");
221
222        if (modal && iframe) {
223          iframe.src = donationUrl;
224          modal.style.display = "block";
225          document.body.style.overflow = 'hidden';
226        }
227      });
228    },
229    
230    initFundraiseUpDonate: function () {
231      // Replace with your site-wide campaign ID
232      const SITE_CAMPAIGN_ID = 'FUNCJRUETRM';
233
234      // Wait until FU is ready
235      if (typeof window.FundraiseUp !== 'function' || !window.FundraiseUp.on) {
236        console.warn('[FU] Loader not ready yet; retrying...');
237        setTimeout(app.initFundraiseUpDonate, 300);
238        return;
239      }
240
241      // Unbind any Magnific handlers that might hijack clicks
242      try {
243        if (window.jQuery && jQuery.magnificPopup) {
244          jQuery('a[href="#popup-global-donate-form"], [data-mfp-src="#popup-global-donate-form"]').off('.magnificPopup');
245        }
246      } catch (_) { /* no-op */ }
247
248      // Register once FU is initialized
249      FundraiseUp.on('ready', () => {
250        // Unified click interceptor for all legacy/new donate selectors
251        const selectorList = [
252          'a[href="#popup-global-donate-form"]',
253          '[data-mfp-src="#popup-global-donate-form"]',
254          '.global-donate-btn',
255          '.open-gala-donation-popup',
256          '.global-donate-button'
257        ].join(',');
258
259        document.addEventListener('click', function (e) {
260          const el = e.target.closest(selectorList);
261          if (!el) return;
262
263          // Stop legacy handlers from firing
264          e.preventDefault();
265          e.stopImmediatePropagation();
266
267          // Optional per-CTA override
268          const campaignId = el.getAttribute('data-fu-campaign') || SITE_CAMPAIGN_ID;
269
270          // Optional custom field for your reporting
271          const slug = el.getAttribute('data-campaign-slug') || 'site-donation';
272
273          try {
274            FundraiseUp.openCheckout(campaignId, {
275              customFields: {
276                campaign_slug: slug,
277                utm_source: new URLSearchParams(location.search).get('utm_source') || 'website',
278                utm_campaign: new URLSearchParams(location.search).get('utm_campaign') || 'site'
279              }
280            });
281          } catch (err) {
282            console.error('[FU] openCheckout error:', err);
283          }
284        });
285
286        // Optional: auto-open if you pass a campaign ID via URL (?form=FUxxxx)
287        (function autoOpenFromURL () {
288          const params = new URLSearchParams(location.search);
289          const formId = params.get('form'); // e.g., ?form=FUABC123
290          if (formId) {
291            // small delay to ensure DOM quiets
292            setTimeout(() => FundraiseUp.openCheckout(formId), 300);
293          }
294        })();
295      });
296    },
297    
298initSarcomaMatchForms: function () {
299  jQuery(document).on('click', '.open-sarcoma-match-iframe', function (e) {
300    e.preventDefault();
301
302    var formUrl = jQuery(this).attr('href');
303    var iframe = jQuery('#sarcoma-match-iframe');
304
305    if (!formUrl || !iframe.length || !jQuery.magnificPopup) return;
306
307    iframe.attr('src', formUrl);
308
309    jQuery.magnificPopup.open({
310      items: {
311        src: '#popup-sarcoma-match-form'
312      },
313      type: 'inline',
314      closeOnBgClick: true,
315      enableEscapeKey: true,
316      callbacks: {
317        close: function () {
318          iframe.attr('src', '');
319        }
320      }
321    });
322  });
323
324  jQuery(document).on('click', '.sarcoma-match-modal-close', function () {
325    if (jQuery.magnificPopup) {
326      jQuery.magnificPopup.close();
327    }
328  });
329},
330
331    initSarcomaHelper: function () {
332      const hashValue = window.location.hash;
333      if (hashValue) switchTabs(hashValue);
334
335      $(document).on('click', '.sarcoma-post-button', function (e) {
336        e.preventDefault();
337        switchTabs(`#${$(this).data('id')}`);
338      });
339
340      function switchTabs(id) {
341        $('.tablist-item').removeClass('is-active');
342        $('.sarcoma-post-content').removeClass('active');
343
344        $(`[data-id="${id.replace('#', '')}"]`).parent().addClass('is-active');
345        $(`[data-content-id="${id.replace('#', '')}"]`).addClass('active');
346      }
347    }
348  };
349
350  jQuery(document).ready(function () {
351    app.initNavigation();
352    app.initHelpers();
353    app.initSlider();
354    app.initSliderAnnouncements();
355    app.initSarcomaMatchForms();
356
357    if (
358      jQuery('body').hasClass('home') ||
359      jQuery('body').hasClass('page-template-index-2') ||
360      jQuery('body').hasClass('page-template-index-3')
361    ) {
362      app.initPatientStories();
363    }
364
365    // app.initGlobalDonateForm(); // legacy iframe modal (disabled)
366    app.initFundraiseUpDonate();   // new FU modal
367    app.initSarcomaHelper();
368
369    var notifySelect = jQuery('#df-notify-person');
370    var notifyFields = jQuery('.notify-fields');
371
372    notifyFields.hide();
373
374    function toggleNotifyFields() {
375      if (notifySelect.val() === 'Yes') {
376        notifyFields.show();
377      } else {
378        notifyFields.hide();
379      }
380    }
381
382    toggleNotifyFields();
383    notifySelect.on('change', toggleNotifyFields);
384  });
385
386/*  jQuery(document).ready(function ($) {
387    $(document).on('click', '.open-gala-donation-popup', function () {
388      var donationUrl = $(this).data('donation-url');
389      if (donationUrl) {
390        $('#gala-donation-iframe').attr('src', donationUrl);
391        $.magnificPopup.open({
392          items: {
393            src: '#popup-gala-donation-form'
394          },
395          type: 'inline'
396        });
397      }
398    });
399  });
400*/
401jQuery(document).ready(function ($) {
402  function renderSelfHostedIntoMount(widgetId) {
403    var mountSel = '#gala-donation-mount';
404    $(mountSel).empty();
405
406    // Try your big self-hosted renderer (adjust if your signature differs)
407    if (typeof window.insertForm7294531584 === 'function') {
408      try {
409        // Common pattern used in your project
410        window.insertForm7294531584({ mountSelector: mountSel, widgetId: widgetId });
411        return true;
412      } catch (e) { /* fall through */ }
413    }
414
415    // Try your PHP-backed renderer hook if exposed
416    if (typeof window.render_bloomerang_default_form === 'function') {
417      try {
418        window.render_bloomerang_default_form(mountSel, { widgetId: widgetId });
419        return true;
420      } catch (e) { /* fall through */ }
421    }
422
423    return false; // no renderer available
424  }
425
426  $(document).on('click', '.open-gala-donation-popup', function (e) {
427    e.preventDefault();
428
429    // Read from your existing attribute and normalize &amp;
430    var url = (
431      $(this).data('donation-url') ||
432      $(this).data('popup-url') ||
433      $(this).attr('href') || ''
434    ).toString().replace(/&amp;/g, '&');
435
436    // Extract WidgetId=########
437    var widgetId = null;
438    var m = url.match(/(?:\?|&)WidgetId=(\d+)/i);
439    if (m) widgetId = m[1];
440
441    // Prefer full-screen modal with self-hosted form
442    if (widgetId && $.magnificPopup) {
443      $.magnificPopup.open({
444        items: { src: '#popup-gala-donation-form' },
445        type: 'inline',
446        closeOnBgClick: true,
447        enableEscapeKey: true,
448        callbacks: {
449          open: function () {
450            var ok = renderSelfHostedIntoMount(widgetId);
451            if (!ok) {
452              // No self-hosted renderer present → fallback to secure popup
453              $.magnificPopup.close();
454              if (url) window.open(url, 'bloomerangDonate', 'width=900,height=840,noopener');
455            }
456          },
457          close: function () {
458            $('#gala-donation-mount').empty();
459          }
460        }
461      });
462      return;
463    }
464
465    // Last resort: secure popup window (HostedDonation)
466    if (url) window.open(url, 'bloomerangDonate', 'width=900,height=840,noopener');
467  });
468
469  // Close button inside the modal
470  $(document).on('click', '.gala-close', function () {
471    if ($.magnificPopup) $.magnificPopup.close();
472  });
473});
474
475
476
477
478  jQuery(window).on('load', function () { });
479})(jQuery, window, document, 'html', 'body');

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.