PageSourceSearch

https://theatrelab.org/wp-content/themes/hello-theme-child-master-temp/js/custom.js?ver=1790241879

js theatrelab.org collected 2026-09-24 09:38:14 UTC 14,306 bytes, 361 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3  // SVG must be a string (template literal). If it's not quoted, the whole script dies.
4  var svg = `
5    <svg class="arrow-up" xmlns="http://www.w3.org/2000/svg" width="21" height="14" viewBox="0 0 21 14">
6      <g transform="translate(21 14) rotate(180)" fill="none">
7        <path d="M10.5,0,21,14H0Z" stroke="none"></path>
8        <path d="M 10.5 2.5 L 3 12.5 L 18 12.5 L 10.5 2.5 M 10.5 0 L 21 14 L 0 14 L 10.5 0 Z" stroke="none" fill="currentColor"></path>
9      </g>
10    </svg>
11  `;
12
13  /*
14  $('.elementor-nav-menu .sub-arrow').each(function() {
15    $(this).append(svg); // Add the SVG
16    $(this).find('.e-font-icon-svg').hide(); // Hide existing icon
17  });
18  */
19
20  /**
21   * MOBILE MENU BUTTON FIX
22   * Use delegated handler (works even if header is re-rendered / sticky header duplicates)
23   * Click the menu toggle inside the same header first, then fallback.
24   */
25  $(document).on('click', '.wc-mobile-menu-btn', function (e) {
26    e.preventDefault();
27    e.stopPropagation();
28
29    var $header = $(this).closest('.elementor-location-header');
30    var $toggle = $header.find('.elementor-menu-toggle').first();
31
32    if (!$toggle.length) $toggle = $('.elementor-location-header .elementor-menu-toggle').first();
33    if (!$toggle.length) $toggle = $('.elementor-menu-toggle').first();
34
35    if ($toggle.length) {
36      $toggle.get(0).click(); // native click works best with Elementor
37    } else {
38      console.warn('Elementor menu toggle not found: .elementor-menu-toggle');
39    }
40  });
41
42  jQuery(document).on('click', '.comman-filter-btn', function () {
43    jQuery.magnificPopup.open({
44      items: { src: '#filter-wrapper' },
45      type: 'inline'
46    });
47  });
48
49  jQuery(document).on('click', '.close-popup-btn', function () {
50    jQuery('.mfp-close').click();
51    return false;
52  });
53
54  setTimeout(function () {
55
56    if (jQuery('.comman-accodian-list .e-n-accordion-item').length > 0) {
57      jQuery('.comman-accodian-list .e-n-accordion-item').each(function () {
58        jQuery(this).attr('open', true);
59      });
60    }
61
62    if (jQuery(window).width() < 1025 && jQuery('.elementor-location-header .sub-arrow').length > 0) {
63      jQuery('.elementor-location-header .sub-arrow').html(svg);
64    }
65
66    if (jQuery('.elementor-widget-n-tabs .e-n-tabs .e-n-tabs-content div[role="tabpanel"]').length > 0) {
67      jQuery('.elementor-widget-n-tabs').each(function () {
68
69        var tab_html = '';
70        var t_this = jQuery(this);
71
72        if (jQuery(t_this).find('.e-n-tabs .e-n-tabs-content div[role="tabpanel"]').length > 0) {
73          jQuery(t_this).find('.e-n-tabs .e-n-tabs-content div[role="tabpanel"]').each(function (kt, kv) {
74
75            var active_str = '';
76            if (kt == 0) { active_str = 'active'; }
77
78            if (jQuery(this).find('.tab-content-box').length > 0) {
79              tab_html += '<div class="wc-tab-li ' + active_str + '" data-id="' + jQuery(this).attr('id') + '">' + jQuery(this).find('.tab-content-box').html() + '</div>';
80            }
81
82          });
83        }
84
85        jQuery(t_this).find('.e-n-tabs .e-n-tabs-heading').wrapInner("<div class='tab-inner-items'></div>");
86        jQuery(t_this).find('.e-n-tabs .e-n-tabs-heading').prepend('<div class="tab-inner-html">' + tab_html + '</div>');
87
88      });
89    }
90
91    /*
92    if( jQuery('.facetwp-facet .facetwp-checkbox').length > 0 ){
93      jQuery('.facetwp-facet .facetwp-checkbox').append('<svg ...>...</svg>');
94      jQuery('.facetwp-type-search .facetwp-input-wrap .facetwp-icon').append('<svg ...>...</svg>');
95    }
96    */
97
98    if (jQuery('.comman-paginations .page-numbers.prev').length > 0) {
99      jQuery('.comman-paginations .page-numbers.prev').prepend('<svg xmlns="http://www.w3.org/2000/svg" width="19.208" height="15" viewBox="0 0 19.208 15" aria-hidden="true" class="ico ico--arrow-full"><path class="ico__path" d="M673.369,383.877l10-7.5v6.542a.983.983,0,0,1,.208-.042h8a1,1,0,0,1,0,2h-8a.983.983,0,0,1-.208-.042v6.542Zm8-3.5-4.666,3.5,4.666,3.5Z" transform="translate(-673.369 -376.377)"></path></svg>');
100    }
101
102    if (jQuery('.comman-paginations .page-numbers.next').length > 0) {
103      jQuery('.comman-paginations .page-numbers.next').append('<svg xmlns="http://www.w3.org/2000/svg" width="19.208" height="15" viewBox="0 0 19.208 15" aria-hidden="true" class="ico ico--arrow-full"><path class="ico__path" d="M692.577,383.877l-10-7.5v6.542a.983.983,0,0,0-.208-.042h-8a1,1,0,0,0,0,2h8a.983.983,0,0,0,.208-.042v6.542Zm-8-3.5,4.666,3.5-4.666,3.5Z" transform="translate(-673.369 -376.377)"></path></svg>');
104    }
105
106    if (jQuery('.main-top-bar .post-navigation__arrow-prev').length > 0) {
107      jQuery('.main-top-bar .post-navigation__arrow-prev').append('<svg xmlns="http://www.w3.org/2000/svg" width="19.208" height="15" viewBox="0 0 19.208 15" aria-hidden="true" class="ico ico--arrow-full"><path class="ico__path" d="M673.369,383.877l10-7.5v6.542a.983.983,0,0,1,.208-.042h8a1,1,0,0,1,0,2h-8a.983.983,0,0,1-.208-.042v6.542Zm8-3.5-4.666,3.5,4.666,3.5Z" transform="translate(-673.369 -376.377)"></path></svg>');
108    }
109
110    if (jQuery('.main-top-bar .post-navigation__arrow-next').length > 0) {
111      jQuery('.main-top-bar .post-navigation__arrow-next').append('<svg xmlns="http://www.w3.org/2000/svg" width="19.208" height="15" viewBox="0 0 19.208 15" aria-hidden="true" class="ico ico--arrow-full"><path class="ico__path" d="M692.577,383.877l-10-7.5v6.542a.983.983,0,0,0-.208-.042h-8a1,1,0,0,0,0,2h8a.983.983,0,0,0,.208-.042v6.542Zm-8-3.5,4.666,3.5-4.666,3.5Z" transform="translate(-673.369 -376.377)"></path></svg>');
112    }
113
114    // (Left as-is, but made selector a bit more forgiving)
115    jQuery('widget_wc-donation-widget .wc-donation-in-action .price-wrapper input.grab-donation, .widget_wc-donation-widget .wc-donation-in-action .price-wrapper input.grab-donation, .woocommerce-cart-form .wc_donation_on_cart .wc-donation-in-action .price-wrapper input.grab-donation')
116      .each(function () {
117        $(this).attr('placeholder', 'Enter Your Donation Amount');
118      });
119
120    if (jQuery('.elementor-widget-loop-grid').length > 0) {
121      jQuery('.elementor-widget-loop-grid').each(function () {
122
123        if (jQuery(this).find('.elementor-pagination .page-numbers').length > 0) {
124
125          var num_option = '';
126          var num_i = 1;
127          var active_page = 0;
128
129          if (jQuery('.facetwp-pager').length > 0) {
130            active_page = jQuery('.facetwp-page.active').text();
131          }
132
133          jQuery(this).find('.elementor-pagination .page-numbers').each(function () {
134            if (!jQuery(this).hasClass('prev') && !jQuery(this).hasClass('next')) {
135
136              var selected_str = '';
137
138              if (jQuery(this).hasClass('current')) {
139                selected_str = 'selected="selected"';
140              }
141
142              if (active_page > 0 && active_page == num_i) {
143                selected_str = 'selected="selected"';
144              }
145
146              num_option += '<option value="' + num_i + '" ' + selected_str + ' >' + num_i + '</option>';
147              num_i++;
148            }
149          });
150
151          if (num_option != '') {
152            jQuery(this).find('.elementor-pagination .page-numbers.prev').after('<select class="wc-form__input custom-page-select">' + num_option + '</select>');
153          }
154        }
155      });
156    }
157
158  }, 1000);
159
160  /*
161  jQuery(document).on('click', '.comman-paginations .page-numbers', function() {
162    var selectedPage = $('.custom-page-select').val();
163    if( jQuery(this).hasClass('next') ){
164      selectedPage++;
165      window.location.href = window.location.origin+window.location.pathname+'?_paged='+selectedPage;
166    }
167    if( jQuery(this).hasClass('prev') ){
168      selectedPage--;
169      window.location.href = window.location.origin+window.location.pathname+'?_paged='+selectedPage;
170    }
171    return false;
172  });
173  */
174
175  jQuery(document).on('change', '.custom-page-select', function () {
176
177    var selectedPage = $(this).val();
178
179    if (jQuery('.facetwp-pager').length > 0) {
180      window.location.href = window.location.origin + window.location.pathname + '?_paged=' + selectedPage;
181      return false;
182    }
183
184    jQuery(this).closest('.elementor-pagination').find('.page-numbers').each(function () {
185      if (!jQuery(this).hasClass('prev') && !jQuery(this).hasClass('next')) {
186
187        var screen_label = jQuery(this).find('.elementor-screen-only').text();
188        var main_page_text = jQuery(this).text();
189        main_page_text = main_page_text.replace(screen_label, '');
190
191        if (main_page_text == selectedPage) {
192          window.location.href = jQuery(this).attr('href');
193        }
194      }
195    });
196  });
197
198  jQuery(document).on('click', '.reset-filter-btn a', function () {
199    FWP.reset();
200    return false;
201  });
202
203  jQuery(document).on('click', '.e-n-tabs-heading .e-n-tab-title', function () {
204    var tab_name = jQuery(this).attr('aria-controls');
205    jQuery(this).closest('.e-n-tabs-heading').find('.wc-tab-li').removeClass('active');
206    jQuery(this).closest('.e-n-tabs-heading').find('.wc-tab-li[data-id="' + tab_name + '"]').addClass('active');
207  });
208
209  $('.search--toggle-button').click(function () {
210    if ($(this).closest('.search--wrapper').hasClass('open')) {
211      $(this).closest('.search--wrapper').removeClass('open');
212      $(this).attr('aria-expanded', 'false');
213      $(this).find('.scrn-rdr-txt').first().text('show search');
214    } else {
215      $(this).closest('.search--wrapper').addClass('open');
216      $(this).attr('aria-expanded', 'true');
217      $(this).find('.scrn-rdr-txt').first().text('hide search');
218    }
219  });
220
221  $('button.search--toggle').click(function () {
222
223    if ($(this).closest('.header-search--wrapper').hasClass('open')) {
224
225      $(this).closest('.header-search--wrapper').removeClass('open');
226      $(this).attr('aria-expanded', 'false');
227      $(this).html('<svg xmlns="http://www.w3.org/2000/svg" width="17.832" height="17.825" viewBox="0 0 17.832 17.825" aria-hidden="true" class="ico"><title>Search</title><g transform="translate(0.771 0.771)"><g transform="translate(0 0)"><path class="ico__path" d="M507.3,3454.71a6.444,6.444,0,1,0-8.451-3.41A6.444,6.444,0,0,0,507.3,3454.71Z" transform="translate(-498.336 -3442.334)"></path><path class="ico__path" d="M512.09,3456.079l5,5" transform="translate(-501.088 -3445.084)"></path></g></g></svg><span class="btn__txt scrn-rdr-txt">show search</span>');
228
229    } else {
230
231      $(this).closest('.header-search--wrapper').addClass('open');
232      $(this).attr('aria-expanded', 'true');
233      $(this).html('<svg xmlns="http://www.w3.org/2000/svg" width="17.121" height="17.121" viewBox="0 0 17.121 17.121" class="ico ico--close" aria-hidden="true"><title>Close</title><g transform="translate(-1389.439 -18.439)"><line x2="15" y2="15" transform="translate(1405.5 19.5) rotate(90)" fill="none" stroke="#fdfbf5" stroke-linecap="round" stroke-width="1.5"/><line x1="15" y2="15" transform="translate(1405.5 19.5) rotate(90)" fill="none" stroke="#fdfbf5" stroke-linecap="round" stroke-width="1.5"/></g></svg><span class="btn__txt scrn-rdr-txt">hide search</span>');
234
235    }
236  });
237
238  if (localStorage.getItem('acceptsCookies') != "yes") {
239    $(".gdpr-container").addClass("active");
240  }
241
242  $(".gdpr-accept").click(function (e) {
243    e.preventDefault();
244    localStorage.setItem('acceptsCookies', "yes");
245    $(".gdpr-container").removeClass("active");
246    if ($("html").attr("data-whatinput") == "keyboard") {
247      $("a.skip-link").get(0).focus();
248    }
249  });
250
251  $(".gdpr__close--button").click(function () {
252    $(".gdpr-container").removeClass('active');
253  });
254
255  /*
256  if( jQuery('.clip-container').length > 0 ){
257    var controller = new ScrollMagic.Controller();
258    var slideOut = gsap.to(".clip-container", { y: "-100vh", opacity: 0, ease: "power2.out" });
259    new ScrollMagic.Scene({ triggerElement: ".clip-spacer", triggerHook: 0, duration: "100%", reverse: true })
260      .setTween(slideOut)
261      .addTo(controller);
262  }
263  */
264
265  $(document).on('click', '.clip-container .link__content a', function () {
266    init = false;
267    var $header = $('.elementor-location-header');
268    var $contentWrapper = $('.site-main');
269    initAnimation($header, $contentWrapper);
270    return false;
271  });
272
273  var init = false;
274  var lastScroll = 0;
275
276  function initAppropriateAnimation() {
277
278    var $header = $('.elementor-location-header');
279    var $contentWrapper = $('.site-main');
280    var $homepageOverlay = $('.clip-container');
281
282    if ($homepageOverlay.length > 0) {
283
284      $(window).on('scroll', function (e) {
285
286        var st = $(window).scrollTop();
287
288        if (st > 99 && lastScroll <= st && !init) {
289          initAnimation($header, $contentWrapper);
290          lastScroll = st;
291        }
292
293        if (st == 0 && init) {
294          setTimeout(function () {
295            if ($('.homepage__first-section').hasClass('active')) {
296              // do nothing
297            } else {
298              if (st == 0) {
299                reverseAnimation($header, $contentWrapper);
300                lastScroll = st;
301              }
302            }
303          }, 500);
304        }
305      });
306
307      return;
308    }
309
310    initAnimation($header, $contentWrapper);
311  }
312
313  function initAnimation($header, $contentWrapper) {
314
315    if (init == false) {
316
317      $header.addClass('active');
318      $contentWrapper.addClass('active');
319      $('body').addClass('lightbox-open');
320
321      $('.clip-container').css({
322        transform: 'translateY(-100vh)',
323        transition: '1s all ease',
324      });
325
326      var h_height = jQuery('.elementor-location-header').outerHeight();
327
328      if (jQuery(window).width() > 1025) {
329        $('#homepage__first-section').css('margin-top', (h_height + 100) + 'px');
330      } else {
331        $('#homepage__first-section').css('margin-top', (h_height + 30) + 'px');
332      }
333
334      setTimeout(function () {
335        init = true;
336      }, 500);
337    }
338  }
339
340  function reverseAnimation($header, $contentWrapper) {
341
342    if (init == true) {
343
344      $header.removeClass('active');
345      $contentWrapper.removeClass('active');
346      $('body').removeClass('lightbox-open');
347
348      $('.clip-container').css({
349        transform: 'translateY(0)',
350        transition: '1s all ease',
351      });
352
353      setTimeout(function () {
354        init = false;
355      }, 500);
356    }
357  }
358
359  $(window).on('load', initAppropriateAnimation);
360
361});

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.