1 2$(document).ready(function () { 3 4var widthCheck = function(){ 5 return $('#width-check').css('z-index'); 6} 7var resized = function(){ 8 tableSize(); 9 setMobile(); 10} 11 12// MOBILE CHECK 13function detectmob() { 14 var $check = $('#width-check').css('z-index'); 15 16 if(!!navigator.userAgent.match(/iPad|iPhone|Android|BlackBerry|Windows Phone|webOS/i)) { 17 return true; 18 } else if($check != 0) { 19 return true; 20 } else { 21 return false; 22 } 23} 24function setMobile(){ 25 if(detectmob()){ 26 $('body').addClass('mobile'); 27 } else { 28 $('body').removeClass('mobile'); 29 } 30} 31setMobile(); 32 33// MOBILE TABLE FIX 34var tableFix = function(){ 35 $('#content table').each(function(){ 36 if(!$(this).hasClass('nofix')){ 37 $(this).wrap("<div class='overflow " + $(this).attr('class') + "'></div>"); 38 } 39 }); 40} 41tableFix(); 42var tableSize = function(){ 43 $('#content div.overflow').each(function(){ 44 $(this).next('p.instruction').remove(); 45 $(this).after('<p class="instruction">Scroll right to view more <i class="fas fa-arrow-right"></i></p>'); 46 var $width = $(this).width(); 47 var $scrollWidth = this.scrollWidth; 48 if ($scrollWidth > $width) { 49 $(this).next('p.instruction').addClass('show'); 50 } 51 }); 52} 53tableSize(); 54 55// NAV SCROLL 56var $scrollCheck = 0; 57var navScroll = function(){ 58 var $scrollTop = $(window).scrollTop(); 59 var $bottom = $(window).scrollTop() + $(window).height(); 60 // console.log('top: '+$scrollTop+' bottom: '+$bottom+' height: '+$(document).height()); 61 // if ($bottom <= ($(document).height() - 60)) { 62 if (($scrollTop >= 1)) { // if the site has scrolled hide the top, unless we scroll up 63 $('header.desktop').addClass('scrolled'); 64 $scrollCheck = $scrollTop; 65 } else { 66 $('header.desktop').removeClass('scrolled'); 67 $scrollCheck = $scrollTop; 68 } 69 // } 70} 71navScroll(); 72 73// ACCORDIONS 74var accordions = function(){ 75 $('.accordion:not(.nocollapse) > *:first-child').on('click touch',function(){ 76 $(this).next().toggle('slow'); 77 $(this).parent('.accordion').toggleClass('open'); 78 // tableSize(); 79 setTimeout(function(){tableSize();},500); 80 }); 81} 82accordions(); 83 84// ANCHOR SCROLL 85$('a.scroll').on('click touch',function(e){ 86 e.preventDefault(); 87 var $offset = 115; 88 if(widthCheck() > 0){ 89 $offset = 58; 90 } 91 var $target = $(this).attr('href'); 92 // var $section = $target.split("="); 93 // $section = $section[1]; 94 // var $id = $section; 95 var $id = $target; 96 console.log($id); 97 $('html, body').animate({ 98 'scrollTop': $($id).offset().top - $offset 99 }, 1250); 100}); 101 102 103 104//EMAIL SIGNUP 105function check_email_address(email) { 106 var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 107 return re.test(email); 108} 109 110 111var error_checking = function() { 112 $('.required input').focusout(function() { 113 if ($(this).val() == "") { 114 $(this).parent().addClass("error"); 115 } else { 116 if ($(this).parent().hasClass("signup-email")) { 117 if (!check_email_address($(this).val())) { 118 $(this).parent().addClass("error"); 119 } else { 120 $(this).parent().removeClass('error'); 121 $(this).parent().addClass('success'); 122 } 123 } else { 124 $(this).parent().removeClass('error'); 125 $(this).parent().addClass('success'); 126 } 127 } 128 }); 129 130 131 $('#signup-form input, #signup-form button').on('click touch', function(){ 132 $('.grecaptcha-badge').addClass('show'); 133 }); 134 $('#signup-form').submit ( function() { 135 136 var $message = $('.signup-message'); // Variable for selecting appropriate signup message 137 $message.empty().hide(); 138 139 var $this = $(this); 140 141 grecaptcha.ready(function() { // Call the V3 Recaptcha system 142 grecaptcha.execute($recaptcha_site_key, {action: 'submit'}).then(function(token) { 143 var recaptchaResponse1 = document.getElementById('recaptchaResponse1'); // Call this on hidden recpatcha element in the form 144 recaptchaResponse1.value = token; 145 // Add the below for each unique recaptcha element you have 146 // var recaptchaResponse2 = document.getElementById('recaptchaResponse2'); 147 // recaptchaResponse2.value = token; 148 149 // ORIGINAL AJAX CODE GOES HERE 150 151 var $form = $this, 152 formData = $form.serialize(), 153 formUrl = $form.attr('action'), 154 formMethod = $form.attr('method'), 155 //responseMsg = $('.signup-message'); 156 responseMsg = $message; 157 158 $.ajax({ 159 url: formUrl, 160 type: formMethod, 161 data: formData, 162 163 success:function(data){ 164 var responseData = jQuery.parseJSON(data); 165 switch(responseData.SUCCESS){ 166 case 'false': 167 $('#form-details').show(); 168 responseMsg.empty().hide().fadeIn('slow').append(responseData.CONFIRMATION); 169 break; 170 case 'true': 171 $('#form-details,.recaptcha').hide().removeClass('show'); 172 $('#about').removeClass('show'); 173 responseMsg.empty().hide().fadeIn('slow').append(responseData.CONFIRMATION); 174 break; 175 } 176 } 177 }); 178 }); 179 });
180 return false; 181 }); 182} 183error_checking(); 184 185 // MODAL 186 $('.popup-link').on('click', function(e) { 187 $('#'+$(this).data('popup')).stop().fadeIn(); 188 if ($(this).data('popup') == "search-popup") $('#s').focus(); 189 }); 190 $('.popup-container .close').on('click', function(e) { 191 $('.popup-container').stop().fadeOut(); 192 }); 193 194 195 //MOBILE MENU 196 $('.hamburger').on('click touch', function(e){ 197 e.stopPropagation(); 198 if($('header.mobile').hasClass("open")) { 199 $(this).parent().siblings('nav').slideUp(300); 200 $('header.mobile').removeClass('open'); 201 $(this).attr("aria-expanded","false"); 202 } else { 203 $(this).parent().siblings('nav').slideDown(300); 204 $('header.mobile').addClass('open'); 205 $(this).attr("aria-expanded","true"); 206 } 207 }); 208 $('.mobile-menu .has-children a.has-submenu').on('click touch', function(e) { 209 e.preventDefault(); 210 if($(this).parent('.has-children').hasClass("active")) { 211 $('.has-children').removeClass('active').children('ul').slideUp(300); 212 } else { 213 $('.has-children').removeClass('active').children('ul').slideUp(300); 214 $(this).parent('.has-children').addClass('active'); 215 $(this).siblings('ul').slideDown(300); 216 } 217 }); 218 219 $(window).scroll(function() { 220 navScroll(); 221 }); 222 223 $(window).resize(function() { 224 resized(); 225 }); 226 227}); 228
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.