1(function($){ 2 3 /* Prevent scroll when drawer open */ 4 $(".navbar-toggler").click(function () { 5 $("body").toggleClass("no-scroll"); 6 }) 7 8 /* Add scroll if window is resized and menu is open */ 9 window.addEventListener('resize', () => { 10 if (window.innerHeight > 767) { 11 $("body").removeClass("no-scroll"); 12 } 13 }); 14 15 /* Smooth Scroll */ 16 // Select all links with hashes that are actual links 17 $('a[href*="#"]') 18 .not('[href="#"]') 19 .not('[href="#0"]') 20 .click(function(event) { 21 // On-page links 22 if ( location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname ) { 23 // Figure out element to scroll to 24 var target = $(this.hash); 25 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 26 if (target.length) { 27 event.preventDefault(); 28 if ($(window).width() > 768) { 29 var offsetJumplink = 90; 30 } else { 31 var offsetJumplink = 157; 32 } 33 try { 34 $('html, body').animate({ 35 scrollTop: target.offset().top - offsetJumplink 36 }, 500); 37 } catch (error) { 38 // do nothing 39 } 40 41 42 } 43 } 44 }); 45 46 var allJumplinks = $('a[href*="#"]').not('[href="#"]').not('[href="#0"]'); 47 48 $(window).scroll(() => { 49 50 var canBeActive = true; 51 52 for (var i = 0; i < allJumplinks.length; i++) { 53 var el = $(allJumplinks[i].hash); 54 var ePosTop = el.offset().top - $(window).scrollTop(); // Height w.r.t window 55 var ePosBot = el.offset().top + el.height() - $(window).scrollTop(); 56 57 58 if ( (ePosTop >= 90 || ePosBot >= 200) && canBeActive == true) { 59 allJumplinks[i].classList.add('active'); 60 canBeActive = false; 61 62 } else { 63 allJumplinks[i].classList.remove ('active'); 64 } 65 } 66 }); 67 68 /* Utility Function */ 69 const executeWhenExists = function (el, callback, turn) { 70 71 if (typeof turn == 'undefined') { 72 turn = 0; 73 } 74 75 const theTarget = $(el); 76 turn++; 77 78 if (turn == 10) { // prevent from executing too many times. 79 callback('', 'Failed'); 80 return false; 81 } 82 83 if (theTarget.length > 0) { 84 callback(theTarget); 85 } else { 86 setTimeout( 87 function () { 88 executeWhenExists(el, callback, turn); 89 }, 500 90 ) 91 } 92 } 93 94 /* Add AN form to hustle modal */ 95 executeWhenExists($('.hustle-modal'), function () { 96 $('.hustle-modal-content').append('<div class="newsletter-cta__section"><div class="union-newsletter-cta__cta-form">' + matches +'</div></div>'); 97 }); 98 99 $('#newsPageShowMore').on('click', (e) => { 100 e.preventDefault(); 101 102 // Select all hidden cards 103 const hiddenCards = $('.clc-tile.d-none'); 104 105 let cardCount = 0; 106 107 hiddenCards.each( function() { 108 if (cardCount < 18) { 109 cardCount++; 110 $(this).removeClass('d-none'); 111 } else { 112 return false; 113 } 114 }); 115 116 $remainingHiddenCards = $('.clc-tile.d-none'); 117 118 if (!$remainingHiddenCards.length) { 119 $('#newsPageShowMore').addClass('d-none'); 120 } 121 122 }); 123 124 // Ticket event 125 setTimeout( 126 function () { 127 $('#can_embed_iframe').addClass('layout-1'); 128 }, 1500 129 ); 130 131 $(document).bind('DOMNodeInserted DOMNodeRemoved', function(element){ 132 if($(this).hasClass('pac-container')){ 133 console.log(element.target); 134 } 135 136 }); 137 138 // Iframe must be loaded first 139 140 function checkDOMChange() { 141 // check for any new element being inserted here, 142 if ($('#can_embed_iframe')) { 143 144 setTimeout( 145 function () { 146 $('.single__event--ticketed').css('max-height','2500px').css('opacity', '1'); 147 }, 2500 148 ); 149 } 150 151 else { 152 setTimeout( checkDOMChange, 50 ); 153 } 154 } 155 156 checkDOMChange(); 157 158})(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.