PageSourceSearch

https://www.glasgowcomedyfestival.com/wp-content/themes/chuckle/assets/scripts/main.js?ver=1790286355

js glasgowcomedyfestival.com collected 2026-09-24 21:46:28 UTC 6,553 bytes, 227 lines download raw bytes

1///////////////////////////////////////////////
2//  Root URL
3///////////////////////////////////////////////
4
5let root = window.location.origin;
6let url = root;
7let dev = 'https://dev.infinite-eye.net';
8let local = 'https://gicf.local';
9
10let theme = 'chuckle';
11
12if ( root === dev ) {
13    url = root + '/gicf';
14} else if ( root === local ) {
15    url = root;
16}
17console.log(url);
18
19
20
21///////////////////////////////////////////////
22//  Brevo forms - auto-namespace ids
23//
24//  Every Brevo form export reuses the same hardcoded ids
25//  (#sib-form, #EMAIL, #sib-container, etc.), so if more than
26//  one ends up on the same page - the footer subscribe form
27//  plus one pasted into a page's content, say - the browser's
28//  own <button form="sib-form"> resolution (and Brevo's script)
29//  only ever bind to the FIRST form with a given id. This finds
30//  every Brevo form on the page and gives each one's ids a
31//  unique suffix before Brevo's own (deferred) main.js gets a
32//  chance to run.
33//
34//  Deliberately outside jQuery(document).ready() - that fires
35//  after deferred scripts, which is too late. This file loads
36//  un-deferred, in the footer, after all page content, so this
37//  block runs synchronously and always wins the race.
38///////////////////////////////////////////////
39
40document.querySelectorAll('.sib-form-container').forEach(function (wrapper, index) {
41    var uid = 'b' + index + '-' + Date.now().toString(36);
42    var idMap = {};
43
44    wrapper.querySelectorAll('[id]').forEach(function (el) {
45        var newId = el.id + '-' + uid;
46        idMap[el.id] = newId;
47        el.id = newId;
48    });
49    wrapper.querySelectorAll('[for]').forEach(function (el) {
50        var f = el.getAttribute('for');
51        if (idMap[f]) el.setAttribute('for', idMap[f]);
52    });
53    wrapper.querySelectorAll('[form]').forEach(function (el) {
54        var f = el.getAttribute('form');
55        if (idMap[f]) el.setAttribute('form', idMap[f]);
56    });
57});
58
59
60
61// jQuery - Start scripts
62jQuery(document).ready(function($) {
63
64    // Initial values
65    // var winH = $(window).outerHeight();
66    // var winW = $(window).outerWidth();
67    // var headerH = $('header').height();
68    // var mobileWidth = 768;
69
70
71    ////////////////////////////////////////////////////
72    //
73    //  REFRESH SIZING ON ORIENTATION
74    //
75    ////////////////////////////////////////////////////
76
77    $(window).resize(function() {
78      if(this.resizeTO) clearTimeout(this.resizeTO);
79      this.resizeTO = setTimeout(function() {
80          $(this).trigger('resizeEnd');
81      }, 0);
82    });
83
84    // $(window).bind('load resizeEnd', function() {
85    // });
86
87
88    //-- Scroll position
89    var scrollPosition = $(window).scrollTop();
90    function scrollCheck() {
91      scrollPosition = $(window).scrollTop();
92      if(scrollPosition > 3) {
93        if($('header').hasClass('fixed')){
94          $('header').addClass('sticky');
95        }
96      } else {
97        $('header').removeClass('sticky');
98      }
99    }
100
101    $(window).on('load scroll', function() {
102      scrollCheck();
103    });
104
105    $(document).ready(function(){
106      scrollCheck();
107    });
108
109
110
111
112    // Waypoints
113
114    //-- Lotties
115    $('div.lottie').each(function() {
116
117      var lottiePlayer = $(this).find('lottie-player');
118
119      $(this).waypoint(function(direction) {
120        if (direction === 'down') {
121          $(this).addClass('animated-lottie');
122          lottiePlayer.get(0).play();
123          // console.log('down');
124        }
125      }, {
126        offset: '100%'
127      });
128
129      $(this).waypoint(function(direction) {
130        if (direction === 'up') {
131          $(this).removeClass('animated-lottie');
132          lottiePlayer.get(0).pause();
133          // console.log('up');
134        }
135      }, {
136        offset: '100%'
137      });
138
139    });
140
141
142
143    // Mobile navigation
144    var headerH = '';
145    headerH = $('header').innerHeight();
146    // $('.mobile-menu > div').css({ marginTop : headerH });  
147
148    $('.nav-icon').on('click', function(){
149
150      $('.nav-icon').toggleClass('open');
151      $('#nav-icon').toggleClass('open');
152
153      headerH = $('header').innerHeight();
154      // $('.mobile-menu > div').css({ marginTop : headerH });  
155
156      if($('.nav-icon').hasClass('open')) {
157        // Add Classes
158        $('.nav-menu').html('Close');
159        $('body, .wrap, header, footer, .mobile-menu, .site-ad-container, .footer-wrap, footer').addClass('menu-opened');
160        // $('.site-ad-container').hide();
161
162        $('div.lottie').each(function() {
163          $(this).find('lottie-player').get(0).pause();
164        });
165
166      } else {
167        // Remove Classes
168        $('.nav-menu').html('Menu');
169        $('body, .wrap, header, footer, .mobile-menu, .site-ad-container, .footer-wrap, footer').removeClass('menu-opened');
170        // $('.site-ad-container').show();
171
172        $('li.download a .download-icon').remove();
173
174
175        $('div.lottie').each(function() {
176          $(this).find('lottie-player').get(0).play();
177        });
178
179      }
180    });
181
182    
183    // Selects
184    $('.event-filters select').niceSelect();
185
186
187
188    // Images
189
190    //-- Get all SVG's images, add an svg class to them,
191    //-- and process them to SVG code with the script below
192    $('img[src$=".svg"]').each(function(){
193      $(this).addClass('svg');
194    });
195
196    // -- Change images with svg class to svg
197    $('img.svg').each(function(){
198        var $img = jQuery(this);
199        var imgID = $img.attr('id');
200        var imgClass = $img.attr('class');
201        var imgURL = $img.attr('src');
202        jQuery.get(imgURL, function(data) {
203            // Get the SVG tag, ignore the rest
204            var $svg = jQuery(data).find('svg');
205            // Add replaced image's ID to the new SVG
206            if(typeof imgID !== 'undefined') {
207                $svg = $svg.attr('id', imgID);
208            }
209            // Add replaced image's classes to the new SVG
210            if(typeof imgClass !== 'undefined') {
211                $svg = $svg.attr('class', imgClass+' replaced-svg');
212            }
213            // Remove any invalid XML tags as per http://validator.w3.org
214            $svg = $svg.removeAttr('xmlns:a');
215            // Replace image with new SVG
216            $img.replaceWith($svg);
217        }, 'xml');
218    });
219
220
221    // AJAX Pagination
222    var infinite = new Waypoint.Infinite({
223      element: $('.infinite-container')[0]
224    });
225
226
227});

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.