1/** 2 * Site behaviors 3 */ 4 5( function( $ ) { 6 7 $(window).on('load', function() { 8 9 cardResize(); 10 11 // Primary Menu Behaviors 12 $('#primary-menu .sub-menu').each(function(){ 13 $item_count = $(this).find('.menu-item').size(); 14 if($item_count>4) { 15 $(this).addClass('column-count-2'); 16 } 17 }); 18 19 /* 20 $('#primary-menu .menu-level-0').mouseenter(function(){ 21 $(this).addClass('focus'); 22 }); 23 $('#primary-menu .menu-level-0').mouseleave(function(){ 24 $(this).removeClass('focus'); 25 }); 26 */ 27 $('#primary-menu .menu-item .menu-top-level').focus(function(){ 28 $(this).parent('.menu-item').addClass('focus'); 29 }); 30 $('#primary-menu .sub-menu li a').focus(function () { 31 $(this).parent().parent('.sub-menu').parent('.menu-item').addClass('focus'); 32 }); 33 34 $('#primary-menu .menu-item .menu-top-level').focusout(function(){ 35 $(this).parent('.menu-item').removeClass('focus'); 36 }); 37 $('#primary-menu .sub-menu li a').focusout(function () { 38 $(this).parent().parent('.sub-menu').parent('.menu-item').removeClass('focus'); 39 }); 40 41 $('#member-bar a.member-login-btn').on('click', function(e) { 42 e.preventDefault; 43 }); 44 45 if (!$('body').hasClass('mobile-device')) { 46 $('a[href^="tel:"]').addClass('nonclick').removeAttr('href').on('click', function (e) { 47 e.preventDefault(); 48 }); 49 } 50 51 // Clicked Card Component Behaviors 52 $('.card').on('click', function(){ 53 $('.card.focus').toggleClass('focus'); 54 $(this).addClass('focus'); 55 }); 56 57 // Show/hide Scroll to Top button 58 var btn = $('#move-top'); 59 $(window).scroll(function() { 60 if ($(window).scrollTop() > 300) { 61 btn.addClass('active'); 62 } else { 63 btn.removeClass('active'); 64 } 65 }); 66 67 // Clicked Scroll to Top function 68 btn.on('click', function(e) { 69 e.preventDefault(); 70 $('html, body').animate({scrollTop:0}, '300'); 71 }); 72 73 // Course sessions register disclaimer popup 74 $(document).on('submit', '.course form.course-sessions-form', function (e) { 75 e.preventDefault(); 76 var form = $(this); 77 var action = $(this).attr('action'); 78 var data = form.serialize(); 79 var method = form.attr('method') || 'POST'; 80 var submitBtn = $(this).find('button[type=submit]'); 81 var oldText = '', oldWidth = ''; 82 $.ajax({ 83 url: '/member/register-for-class', 84 method: method, 85 data: data, 86 beforeSend: function () { 87 oldText = submitBtn.text(); 88 oldWidth = submitBtn.width(); 89 submitBtn.width(oldWidth).attr({ 'disabled': true}).html('<i class="fas fa-spinner fa-spin"></i>'); 90 }, 91 success: function (success) { 92 console.log(success); 93 try { 94 decoded = JSON.parse(success); 95 if ( decoded.success ) { 96 if ( decoded.message == 'submembers' ) { 97 location.href = `/member/add-family-members/?scheduleGuid=${decoded.scheduleGuid}`; 98 } else { 99 location.href = '/member/cart'; 100 } 101 }else { 102 disclaimerBox = $('<div />', { 103 class: 'disclaimer-box-outer' 104 }); 105 submitBtn.text(oldText).removeAttr('disabled style'); 106 openGenericPopup(decoded.message); 107 } 108 } catch ( e ) { 109 submitBtn.text(oldText).removeAttr('disabled style'); 110 openDisclaimerPopup(success); 111 } 112 } 113 }) 114 115 }); 116 117 $(document).on('submit', 'form.course-sessions-form-test', function(e) { 118 e.preventDefault(); 119 var form = $(this); 120 var action = $(this).attr('action'); 121 var data = form.serialize(); 122 var method = form.attr('method') || 'POST'; 123 var submitBtn = $(this).find('button[type=submit]'); 124 var oldText = '', oldWidth = ''; 125 $.ajax({ 126 url: '/member/register-for-group-class', 127 method: method, 128 data: data, 129 beforeSend: function () { 130 oldText = submitBtn.text(); 131 oldWidth = submitBtn.width(); 132 submitBtn.width(oldWidth).attr({ 'disabled': true }).html('<i class="fas fa-spinner fa-spin"></i>'); 133 }, 134 success: function (success) { 135 console.log(success); 136 try { 137 decoded = JSON.parse(success); 138 if ( decoded.success ) { 139 if ( decoded.message == 'submember' ) { 140 var prev_url = (decoded.prev_url != null && decoded.prev_url !== '') ? '&prev_url=' + decoded.prev_url : ''; 141 location.href = '/member/register-for-group-ex-review?scheduleGuid=' + decoded.scheduleGuid + '&scheduleId=' + decoded.scheduleId + prev_url; 142 } 143 } else { 144 disclaimerBox = $('<div />', { 145 class: 'disclaimer-box-outer' 146 }); 147 submitBtn.text(oldText).removeAttr('disabled style'); 148 openGenericPopup(decoded.message); 149 } 150 } catch ( e ) { 151 submitBtn.text(oldText).removeAttr('disabled style'); 152 openDisclaimerPopup(success); 153 } 154 } 155 }); 156 }); 157 158 function openDisclaimerPopup(data) { 159 160 if ($('.disclaimer-popup-box').length == 0) { 161 $('body').append('<div class="disclaimer-popup-box popup-box">'); 162 }
163 $('body').addClass('popup-enabled'); 164 $('.disclaimer-popup-box').empty().html(data).addClass('active').find('.close-popup').on('click', function (e) { 165 e.preventDefault(); 166 closePopUp(); 167 }); 168 } 169 170 function openGenericPopup(message) { 171 if ( $('.generic-popup-box.popup-box').length == 0) { 172 $('body').append('<div class="generic-popup-box popup-box transition250">'); 173 } 174 $('bod').addClass('popup-enabled'); 175 disclaimerBox = $('<div />', { 176 class: 'disclaimer-box-outer' 177 }); 178 closeBtn = $('<div />', { 179 class: 'close-popup transition250', 180 html: '<i class="fas fa-times" aria-hidden="true"></i>' 181 }); 182 disclaimerBoxInner = $('<div />', { 183 class: 'disclaimer-box-inner white-bg overflow-hidden padding-med', 184 html: message 185 }); 186 disclaimerBox.append(closeBtn); 187 disclaimerBox.append(disclaimerBoxInner); 188 $('.generic-popup-box').empty().html(disclaimerBox).addClass('active').find('.close-popup').on('click', function (e) { 189 e.preventDefault(); 190 closePopUp(); 191 }) 192 } 193 194 $('.menu-toggle').on('click', function (e) { 195 $('#site-navigation').toggleClass('active'); 196 $('.header-wrapper').toggleClass('open'); 197 }); 198 199 $('#search-toggle').on('click', function (e) { 200 e.preventDefault(); 201 $('#contact-search').toggleClass('active'); 202 if ($('#contact-search').hasClass('active')) { 203 $('.search-field').focus(); 204 } else { 205 $('.search-field').focusout(); 206 } 207 }) 208 209 // Toggle filter on schedule pages (tablet and mobile) 210 $('#filter-toggle').on('click', function (e) { 211 $(this).toggleClass('active'); 212 $('#schedule-nav').toggleClass('active'); 213 }); 214 215 var headerHeight = $('#masthead').height() + (($('#site-alert').length > 0) ? $('#site-alert').innerHeight() : 0); 216 var stickyTop, fullWeekBottom; 217 if ($('#date-tabs').length >= 1) { 218 stickyTop = $('#date-tabs').offset().top - (headerHeight + 20); 219 if ($('#full-week').length >= 1) { 220 fullWeekBottom = $('#full-week').offset().top + $('#full-week').height() - $('#date-tabs').height() - (headerHeight + 20); 221 } 222 } 223 224 stickyDateBar(); 225 sizeInstagram(); 226 227 $(window).on( 'scroll', function(){ 228 stickyDateBar(); 229 }); 230 231 $(window).on( 'resize', function(){ 232 stickyDateBar(); 233 sizeInstagram(); 234 cardResize(); 235 236 if ( $('body').hasClass('page-id-379') && $(window).width() < 1025 ) { 237 if ( $('.class-column.active').length == 0 ) { 238 $('.date-tab.active').trigger('click'); 239 } 240 } 241 }); 242 243 function stickyDateBar() { 244 if ($(window).scrollTop() >= fullWeekBottom) { 245 $('#date-tabs').css({position: "absolute", top: fullWeekBottom + "px"}); 246 $('#date-tabs').width($('#date-tabs').parent().width()); 247 } else if ($(window).scrollTop() >= stickyTop) { 248 $('#date-tabs').css({position: "fixed", top: headerHeight + "px", zIndex: 22}); 249 $('#date-tabs').width($('#date-tabs').parent().width()); 250 } else { 251 $('#date-tabs').css({position: "relative", top: "0px"}); 252 $('#date-tabs').width($('#date-tabs').parent().width()); 253 } 254 } 255 256 function sizeInstagram() { 257 setTimeout(function() { 258 $image_width = $('.instagram-image').outerWidth(); 259 260 $('.instagram-image').each(function(i) { 261 (function(self) { 262 $(self).css({'height': $image_width}); 263 setTimeout(function(){ 264 $(self).addClass('show'); 265 },(i*500)); 266 })(this); 267 }); 268 269 }, 250) 270 }; 271 272 /* Match Height */ 273 function cardResize() { 274 // Get an array of all element heights 275 jQuery('.new-card-wrapper .new-card').removeAttr('style'); 276 var elementHeights = jQuery('.new-card-wrapper .new-card').map(function() { 277 return jQuery(this).height(); 278 }).get(); 279 280 // Math.max takes a variable number of arguments 281 // `apply` is equivalent to passing each height as an argument 282 var maxHeight = Math.max.apply(null, elementHeights); 283 284 // Set each height to the max height 285 jQuery('.new-card-wrapper .new-card').height(maxHeight); 286 } 287 288 289 /* Page Builder - Cards Popup */ 290 $('button.popup-btn').on('click', function () { 291 console.log('clicked'); 292 clicked = $(this); 293 clicked.addClass('active');
294 $('body').addClass('popup-enabled'); 295 296 var target = $(this).attr('data-area'); 297 $('.popup-box').removeClass('active'); 298 $('.popup-box[data-popup="'+target+'"]').addClass('active'); 299 300 }); 301 302 /* Page Builder - Cards Popup Tabs */ 303 $('#popup-tabs > .popup-tab').on('click', function (e) { 304 305 // determine what was clicked 306 clicked = $(this); 307 var target = clicked.attr('data-tab'); 308 309 // disable current active in popup 310 $('.popup-box.active #popup-tabs .popup-tab').removeClass('tab-active'); 311 $('.popup-box.active .popup-tab-content').removeClass('tab-active'); 312 313 // enable tab and content based on what was clicked 314 clicked.addClass('tab-active'); 315 $('.popup-box.active .popup-tab-content[data-tab-content="'+target+'"]').addClass('tab-active'); 316 317 }); 318 319 $('.page-id-52 .popup-tab').on('click', function (e) { 320 clicked = $(this); 321 var target = clicked.attr('data-tab'); 322 323 //disable current active in page 324 $('.page-id-52 .popup-tab').removeClass('tab-active'); 325 $('.page-id-52 .popup-tab-content').removeClass('tab-active'); 326 327 //enable tab and content based on what was clicked 328 clicked.addClass('tab-active'); 329 $('.page-id-52 .popup-tab-content[data-tab-content="'+target+'"]').addClass('tab-active'); 330 }) 331 332 /* Page Builder - WYSIWYG Popup */ 333 // $count = 0; 334 // $('.page-builder .wysiwyg .popup-btn, footer .popup-btn').each(function() { 335 // $popup_url = $(this).attr('href'); 336 // console.log('popup_url length: ' + $popup_url.length); 337 // $count++; 338 // $(this).attr('data-area', $count); 339 340 // // Build popup window 341 // $popup_box = '<div class="card-pop popup-box display-flex transition250" data-popup="' + $count + '">'; 342 // $popup_box += '<div class="popup-box-outer two-third-width mobile-full">'; 343 // $popup_box += '<div class="close-popup black-color transition250"><i class="fas fa-times"></i></div>'; 344 // $popup_box += '<div class="popup-box-inner white-bg overflow-hidden display-flex ios-scroll">'; 345 // if ( $popup_url.length > 2 ) { 346 // $popup_box += '<iframe class="full-width full-height ios-scroll" src="' + $popup_url + '"></iframe>'; 347 // } else { 348 // $popup_box += '<div class="full-width text-center lt-gray-bg display-flex flex-align-center flex-justify-center"><div class="two-third-width tablet-full"><p><i class="fas fa-exclamation-triangle" style="font-size: 5em;"></i></p><div class="font-lrg purple-color padding-med">We do not have any sessions scheduled at this time.</div></div></div>'; 349 // } 350 351 // $popup_box += '</div></div></div>'; 352 353 // $(this).after($popup_box); 354 // }); 355 356 $('.page-builder .wysiwyg a.popup-btn, footer a.popup-btn').on('click', function (e) { 357 e.preventDefault(); 358 // console.log('clicked'); 359 clicked = $(this); 360 clicked.addClass('active'); 361 $('body').addClass('popup-enabled'); 362 var target = $(this).attr('data-area'); 363 $('.popup-box').removeClass('active'); 364 $('.popup-box[data-popup="'+target+'"]').addClass('active'); 365 }); 366 367 $(document).on('click', '.close-popup', function() { 368 closePopUp(); 369 }); 370 371 $('.show-password').on('click', function () { 372 var showFor = $(this).data('show-for'); 373 if ($('input[name="' + showFor + '"]').attr('type') == 'text') { 374 $('input[name="' + showFor + '"]').attr('type', 'password'); 375 } else { 376 $('input[name="' + showFor + '"]').attr('type', 'text'); 377 } 378 }); 379 380 $('.popup-window').click(function (event) { 381 event.preventDefault(); 382 window.open($(this).attr("href"), "popupWindow", "width=1100,height=900,scrollbars=yes"); 383 }); 384 385 }); 386 387} )( 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.