PageSourceSearch

https://endfistula.org/modules/custom/unfpa_endfistula/js/fundraiseup.js?tm65w4

js endfistula.org collected 2026-10-02 06:19:20 UTC 4,688 bytes, 136 lines download raw bytes

1(function (w, d, s, n, a) {
2  if (!w[n]) {
3    var l = 'call,catch,on,once,set,then,track'
4      .split(','), i, o = function (n) {
5        return 'function' == typeof n ? o.l.push([arguments]) && o
6          : function () { return o.l.push([n, arguments]) && o }
7      }, t = d.getElementsByTagName(s)[0],
8    j = d.createElement(s); j.async = !0; j.src = 'https://cdn.fundraiseup.com/widget/' + a;
9    t.parentNode.insertBefore(j, t); o.s = Date.now(); o.v = 4; o.h = w.location.href; o.l = [];
10    for (i = 0; i < 7; i++)o[l[i]] = o(l[i]); w[n] = o
11  }
12})(window, document, 'script', 'FundraiseUp', 'ACSRWCJP');
13
14/**
15 * Take-action donation cards: Fundraise Up injects/reorders its element and
16 * pushes the visible DONATE label to the right. Force every non-label child
17 * to cover the label button so position + click match the original design.
18 */
19(function (document) {
20  function styleOverlay(el) {
21    if (!el || !el.style) {
22      return;
23    }
24    el.style.setProperty('position', 'absolute', 'important');
25    el.style.setProperty('left', '0', 'important');
26    el.style.setProperty('top', '0', 'important');
27    el.style.setProperty('right', '0', 'important');
28    el.style.setProperty('bottom', '0', 'important');
29    el.style.setProperty('width', '100%', 'important');
30    el.style.setProperty('height', '100%', 'important');
31    el.style.setProperty('min-width', '100%', 'important');
32    el.style.setProperty('min-height', '100%', 'important');
33    el.style.setProperty('max-width', 'none', 'important');
34    el.style.setProperty('max-height', 'none', 'important');
35    el.style.setProperty('margin', '0', 'important');
36    el.style.setProperty('padding', '0', 'important');
37    el.style.setProperty('opacity', '0', 'important');
38    el.style.setProperty('z-index', '2', 'important');
39    el.style.setProperty('pointer-events', 'auto', 'important');
40    el.style.setProperty('cursor', 'pointer', 'important');
41    el.style.setProperty('background', 'transparent', 'important');
42    el.style.setProperty('border', '0', 'important');
43    el.style.setProperty('overflow', 'hidden', 'important');
44    el.style.setProperty('display', 'block', 'important');
45    el.setAttribute('aria-label', 'Donate');
46  }
47
48  function findLabeledButton(container) {
49    var kids = container.children;
50    var i;
51    var el;
52    for (i = 0; i < kids.length; i++) {
53      el = kids[i];
54      if (el.textContent && el.textContent.replace(/\s+/g, ' ').trim().length > 0) {
55        // Prefer the beige DONATE label (has nested spans with text).
56        if (el.classList && el.classList.contains('btn')) {
57          return el;
58        }
59      }
60    }
61    for (i = 0; i < kids.length; i++) {
62      el = kids[i];
63      if (el.textContent && /donate/i.test(el.textContent)) {
64        return el;
65      }
66    }
67    return null;
68  }
69
70  function fixContainer(container) {
71    var labeled = findLabeledButton(container);
72    var kids;
73    var i;
74    var kid;
75
76    if (!labeled) {
77      return;
78    }
79
80    container.style.setProperty('position', 'relative', 'important');
81    container.style.setProperty('display', 'inline-flex', 'important');
82    container.style.setProperty('width', 'auto', 'important');
83    container.style.setProperty('overflow', 'hidden', 'important');
84
85    labeled.style.setProperty('position', 'relative', 'important');
86    labeled.style.setProperty('z-index', '1', 'important');
87    labeled.style.setProperty('pointer-events', 'none', 'important');
88    labeled.style.setProperty('opacity', '1', 'important');
89    labeled.style.setProperty('visibility', 'visible', 'important');
90
91    kids = Array.prototype.slice.call(container.children);
92    for (i = 0; i < kids.length; i++) {
93      kid = kids[i];
94      if (kid === labeled) {
95        continue;
96      }
97      styleOverlay(kid);
98    }
99
100    container.querySelectorAll('iframe').forEach(styleOverlay);
101  }
102
103  function fixAll() {
104    document.querySelectorAll('#makedonation .btn-container').forEach(fixContainer);
105  }
106
107  var scheduled = false;
108  function scheduleFix() {
109    if (scheduled) {
110      return;
111    }
112    scheduled = true;
113    window.requestAnimationFrame(function () {
114      scheduled = false;
115      fixAll();
116    });
117  }
118
119  fixAll();
120  if (document.readyState === 'loading') {
121    document.addEventListener('DOMContentLoaded', fixAll);
122  }
123  window.addEventListener('load', fixAll);
124  [300, 800, 1500, 3000, 5000].forEach(function (ms) {
125    window.setTimeout(fixAll, ms);
126  });
127
128  var root = document.getElementById('makedonation');
129  if (root && window.MutationObserver) {
130    new MutationObserver(scheduleFix).observe(root, {
131      childList: true,
132      subtree: true,
133      attributes: true
134    });
135  }
136})(document);

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.