1/* ======================================================================== 2 * DOM-based Routing 3 * Based on http://goo.gl/EUTi53 by Paul Irish 4 * 5 * Only fires on body classes that match. If a body class contains a dash, 6 * replace the dash with an underscore when adding it to the object below. 7 * 8 * .noConflict() 9 * The routing is enclosed within an anonymous function so that you can 10 * always reference jQuery with $, even when in .noConflict() mode. 11 * ======================================================================== */ 12 13(function($) { 14 // Use this variable to set up the common and page specific functions. If you 15 // rename this variable, you will also need to rename the namespace below. 16 var srReload = false; 17 var srReloadType = 'page'; 18 var BigTickets = { 19 // All pages 20 'common': { 21 init: function() { 22 // Sticky Top Nav 23 if (!$('#nav-rotate').hasClass('stuck') && typeof Bound == 'function') { 24 var $el = ($('.header-stepper').length>0?$('.header-stepper'):$('.main-content-wrapper').eq(0)); 25 var sticky = new Bound({ 26 element: $el, 27 offsetTop: 80, /* +36 now that we have top-bar? */ 28 handler: function(event) { 29 if (event.section === 'top') { 30 if (event.status === 'hold') { 31 $('#nav-rotate').addClass('stuck'); 32 // extend properties 33 $('#nav-rotate').addClass('extend-content'); 34 //$('#nav-main').addClass('col-md-10 col-md-offset-1'); 35 } else if (event.status === 'release') { 36 $('#nav-rotate').removeClass('stuck'); 37 // extend properties 38 $('#nav-rotate').removeClass('extend-content'); 39 //$('#nav-main').removeClass('col-md-10 col-md-offset-1'); 40 } 41 } 42 } 43 }); 44 } 45 46 // GDRP Cookie Compliance 47 /*var cv = document.cookie.replace(/(?:(?:^|.*;\s*)acceptCookies\s*\=\s*([^;]*).*$)|^.*$/, "$1"); 48 if (cv != true && cv != 'true') $('details').attr('open', true); 49 $(window).scroll(function() { 50 acceptCookies(); 51 }); 52 $(document).on('click', 'details summary .icon-close', function() {acceptCookies()}); 53 54 $(document).on('click', 'a:not([href="#"])', function() { 55 if (cv != true && cv != 'true') { 56 if ($(this).closest('details').length == 0) { 57 acceptCookies(); 58 } 59 } 60 }); 61 function acceptCookies() { 62 if (cv != true && cv != 'true') { 63 document.cookie = "acceptCookies=true"; 64 cv = true; 65 } 66 $('details[open]').removeAttr('open'); 67 }*/ 68 69 function acceptRebrand() { 70 if (rbc != true && rbc != 'true') { 71 var today = new Date(); 72 var expire = new Date(); 73 expire.setTime(today.getTime() + 3600000*24*7); 74 document.cookie = "acceptRebrand=true;expires="+expire.toGMTString()+";path=/"; 75 rbc = true; 76 } 77 $('details[open]').removeAttr('open'); 78 } 79 var rbc = document.cookie.replace(/(?:(?:^|.*;\s*)acceptRebrand\s*\=\s*([^;]*).*$)|^.*$/, "$1"); 80 if (rbc != true && rbc != 'true') $('details').attr('open', true); 81 $(document).on('click', 'details .btn', function() {acceptRebrand()}); 82 83 // Prevents main page scrolling when closing stacked modals 84 $('.modal').on('hidden.bs.modal', function (e) { 85 if($('.modal').hasClass('in')) { 86 $('body').addClass('modal-open'); 87 } 88 }); 89 90 $(document).on('shown.bs.modal hidden.bs.modal', '.modal', function (e) { 91 if ($('body').hasClass('widget-body')) {sendHeight();sendScrollTop();} 92 }); 93 94 if (typeof $.fn.catcomplete === 'function') { 95 $("#search").catcomplete({ 96 delay: 500, 97 minLength: 1, 98 source: function (request, response) { 99 var cacheKey = $("#search").val() + $("#searchDate").val() + $("#region-text").text(); 100 if (cacheKey != '' && dataCache.exist(cacheKey)) { 101 response(dataCache.get(cacheKey)); 102 } else { 103 $.ajax({
104 url: '/lookup/autocomplete.cfm', 105 data: {q : $("#search").val(), d : $("#searchDate").val() || "all-dates", r : $("#region-text").text()}, 106 dataType: "json", 107 type: "POST", 108 success: function (data) { 109 var responseData = $.map(data, function (item) { 110 var thisLabel = item.label, thisVenue = item.venue, thisCity = item.city, thisState = item.state, 111 thisSearch = $("#search").val(), aWords = thisSearch.match(/\b\w+/gi); 112 aWords.forEach(function(val) { 113 thisLabel = thisLabel.replace(new RegExp(val+'{1}', 'gi'), '<strong>$&</strong>' ); 114 thisVenue = thisVenue.replace(new RegExp(val+'{1}', 'gi'), '<strong>$&</strong>' ); 115 thisCity = thisCity.replace(new RegExp(val+'{1}', 'gi'), '<strong>$&</strong>' ); 116 thisState = thisState.replace(new RegExp(val+'{1}', 'gi'), '<strong>$&</strong>' ); 117 }); 118 return { 119 label: '<div>'+thisLabel + '<small><br>'+(thisVenue != ''?thisVenue+(item.type != 'group' && (thisCity != '' || thisState != '')?', ':''):'')+ 120 (item.type != 'group' ? thisCity+(thisCity != '' && thisState != '' ? ', ': '') : '' ) + thisState + '</small>'+'</div>', 121 value: item.label, 122 category: item.category, 123 link: item.link, 124 venue: item.venue, 125 city: item.city, 126 state: item.state 127 } 128 }); 129 /*console.log( responseData );*/ 130 dataCache.set(cacheKey, responseData); 131 response(responseData); 132 }, 133 error: function (XMLHttpRequest, textStatus, error) { 134 document.write( XMLHttpRequest.responseText ); 135 } 136 });
137 } 138 }, 139 select: function (event, ui) { 140 location.href = ui.item.link; 141 } 142 }); 143 $(window).resize(function() { 144 if ($('ul.ui-autocomplete').eq(0).css('display') == 'block') { 145 $("#search").catcomplete("search"); 146 } 147 }); 148 $(window).scroll(function() { 149 if ($('ul.ui-autocomplete').eq(0).css('display') == 'block') { 150 $('ul.ui-autocomplete').eq(0).css('display', 'none'); 151 } 152 if ($('.pac-container').eq(0).css('display') == 'block') { 153 $('.pac-container').eq(0).css('display', 'none'); 154 } 155 }); 156 } 157 158 // Datepicker Invocations 159 // $('.datepicker').datepicker(); // Calendar Style Datepicker 160 if (typeof $.datepicker == 'object') { 161 $('.datepicker-inline').datepicker({ // Input Style Datepicker 162 inline: true 163 }); 164 $('.datepicker').each(function() { 165 var $this = $(this); 166 var opts = {}; 167 if ($this.data('defaultDate')) { 168 opts.defaultDate = $this.data('defaultDate'); 169 } 170 $this.datepicker(opts); 171 }); 172 } 173 174 $(document).ready(function() { 175 // Extending collapse status to parent container for tickets (used to trigger icon flipping, etc.) 176 $(document).on('hide.bs.collapse', '.ticket-type-details', function () { 177 $(this).parents('.ticket-type-row').removeClass('row-open'); 178 }).on('show.bs.collapse', '.ticket-type-details', function () { 179 $(this).parents('.ticket-type-row').addClass('row-open'); 180 }); 181 182 // Add Responsive Cheatsheet Helper (to view responsive breakpoints) 183 if (window.location.hostname.indexOf('local.') != -1 || window.location.hostname.indexOf('.') == -1) 184 $('body').append('<div class="responsive-cheatsheet"></div>'); 185 }); 186 187 window.sr = function(id) { 188 var reset = (arguments[1] || 0); 189 // set active 190 $('#region-menu li').removeClass('active'); 191 $.each($('#region-menu li'), function(i,o) { 192 if ($(this).data('id') == id) { 193 $(this).addClass('active'); 194 if(typeof $(this).data('region') != 'undefined') { 195 $('#region-text').text($(this).data('region')); 196 } else { 197 $('#region-text').text($(this).text()); 198 } 199 return false; 200 } 201 }); 202 203 /*<!--- Has to be a jsonp request to maintain cookies --->*/ 204 205 if (reset && navigator.geolocation) { 206 navigator.geolocation.getCurrentPosition(forcePosition); 207 } else { 208 $.getJSON('/regions/change/?callback=?', {r:id}, 209 function(json) { 210 if (json.SUCCESS && srReload && srReloadType == 'page' && ud.SR != id) { 211 location.reload(); 212 } else if (json.SUCCESS && srReload && srReloadType == 'form' && ud.SR != id) { 213 if ($('#location-filter #filterLocation').length == 1) {
214 $('#location-filter #filterLocation').val( $('#region-menu li:not(:first-of-type)[data-id="'+id+'"] a').text() ); 215 $('#location-filter').submit(); 216 } 217 } 218 ud.SR=id; 219 } 220 ).fail(function(o, s, r) {/*<!---jQuery('body').before("<div>"+xhr.responseText+"</div>");--->*/}); 221 } 222 }; 223 if (typeof ud.L == 'undefined') { 224 ud.L = 1; 225 } 226 /*if (ud.L == 0) {//sets position on page load 227 if (navigator.geolocation) { 228 // do not set the position on checkout... 229 if (!$('body').hasClass('section-checkout')) { 230 navigator.geolocation.getCurrentPosition(setPosition); 231 } 232 } 233 }*/ 234 235 window.logout = function() { 236 if (typeof $('body').data('step') !== 'undefined') { 237 var f = document.EventForm; 238 f.action = $('body').data('page') + '?' + $('body').data('step') + '&action=logout'; 239 f.submit(); 240 } else if (typeof goLogout === 'function') { 241 goLogout(); 242 } else { 243 document.location = '/home/logout/'; 244 } 245 }; 246 247 function forcePosition(position) { 248 setPosition(position, 1); 249 } 250 function setPosition(position) { 251 var userSet = (arguments[1] || 0); 252 ud.L = 1; 253 // only set the position if it has actually changed 254 if ((typeof ud.LT != 'undefined' && ud.LT != position.coords.latitude) || (typeof ud.LN != 'undefined' && ud.LN != position.coords.longitude)) { 255 ud.LT = position.coords.latitude; 256 ud.LN = position.coords.longitude; 257 jQuery.getJSON( 258 '/regions/update/?callback=?', 259 {lt:ud.LT,ln:ud.LN}, 260 function(json) { 261 if (json.SUCCESS && srReload) { 262 ud.SR=json.SR; 263 ud.P=json.P; 264 if (userSet) location.reload(); 265 } else if (json.SUCCESS) { 266 ud.SR=json.SR; 267 ud.P=json.P 268 $('#region-text').text(json.P); 269 } else { 270 $('#region-text').text('Region'); 271 } 272 } 273 ).fail(function(o, s, r) {/*<!--- jQuery('body').before("<div>"+o.responseText+"</div>"); --->*/}); 274 } else if (typeof ud.R != 'undefined' && ud.SR != ud.R) { 275 window.sr(ud.R); 276 } 277 } 278 279 // Handles multiple stacked modals 280 $(document).on('show.bs.modal', '.modal', function () { 281 var zIndex = 1040 + (10 * $('.modal:visible').length); 282 $(this).css('z-index', zIndex); 283 setTimeout(function() { 284 $('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack'); 285 }, 0); 286 }); 287 288 // Restores +/- active or disabled when back button is pressed 289 $(window).on('pageshow', function(event) { 290 $('.btn-decrement').each(function() { 291 var $select = $(this).next('select'); 292 $(this).prop('disabled', $select.prop('selectedIndex') === 0); 293 }); 294 $('.btn-increment').each(function() { 295 var $select = $(this).prev('select'); 296 $(this).prop('disabled', $select.prop('selectedIndex') === $select.find('option').length - 1); 297 }); 298 }); 299 300 // Ticket Count Quantity Controls 301 var updateQtyControlButtons = function($select) { 302 $select.parent() 303 .find('.btn-decrement') 304 .prop('disabled', $select.prop('selectedIndex') === 0) 305 .end() 306 .find('.btn-increment') 307 .prop('disabled', $select.prop('selectedIndex') === $select.find('option').length - 1) 308 .end(); 309 }; 310 311 $('.select-qty-control .select-qty').each(function() { 312 updateQtyControlButtons($(this)); 313 }) 314 $(document).on('click', '.select-qty-control .btn-decrement', function() { 315 var $select = $(this).siblings('.select-qty'); 316 $select.find('option:selected') 317 .prev() 318 .prop('selected', true); 319 $select.trigger('change'); 320 updateQtyControlButtons($select); 321 }); 322 $(document).on('click', '.select-qty-control .btn-increment', function() { 323 var $select = $(this).siblings('.select-qty'); 324 $select.find('option:selected') 325 .next() 326 .prop('selected', true); 327 $select.trigger('change'); 328 updateQtyControlButtons($select); 329 }); 330 $(document).on('change', '.select-qty-control .select-qty', function() { 331 updateQtyControlButtons($(this)); 332 }); 333 334 $('.alert[data-auto-dismiss]').each(function() { 335 var $alert = $(this); 336 let timeout = $alert.data('autoDismiss') || 10000; 337 setTimeout(function() { 338 $alert.slideUp('slow', function() { $alert.alert('close') }); 339 }, timeout); 340 }); 341 }, 342 finalize: function() { 343 // JavaScript to be fired on all pages, after page specific JS is fired 344 if (typeof Bound === 'function') Bound.refreshAll(); 345 } 346 }, 347 // Home page 348 'home': { 349 init: function() { 350 //$('#nav-rotate').addClass('stuck').addClass('extend'); 351 srReload = true; 352 353 $('#banner-events-carousel').carousel({ 354 interval: 1000*7 355 }).emulateTransitionEnd(10000); 356 357 (function(){ 358 $('.multi-slide-carousel .item').each(function(){ 359 var itemToClone = $(this); 360 for (var i=1;i<4;i++) { 361 itemToClone = itemToClone.next(); 362 363 // wrap around if at end of item collection 364 if (!itemToClone.length) { 365 itemToClone = $(this).siblings(':first'); 366 } 367 368 // grab item, clone, add marker class, add to collection 369 itemToClone.children(':first-child').clone() 370 .addClass("cloneditem-"+(i)) 371 .appendTo($(this)); 372 } 373 });
374 }()); 375 376 // Carousels - Swipe Functionality (Hammer.js) 377 var similarEventsCarousel = carouselSwipe( $('#banner-events-carousel')[0] ); 378 379 function carouselSwipe(currentCarousel) { 380 if (typeof currentCarousel !== 'undefined') { 381 var hammerTime = new Hammer(currentCarousel); 382 383 hammerTime.on("swiperight", function() { 384 $(currentCarousel).carousel('prev'); 385 }).on("swipeleft", function() { 386 $(currentCarousel).carousel('next'); 387 }); 388 } 389 } 390 }, 391 finalize: function() { 392 // JavaScript to be fired on HOME page, after page specific JS is fired 393 } 394 }, 395 // Detail Page (detail.html) 396 'page_detail': { 397 init: function() { 398 var $head = $( '#nav-rotate' ); 399 400 $( '.detail-in-header' ).each( function(i) { 401 var $el = $( this ), 402 animClassDown = $el.data( 'animateDown' ), 403 animClassUp = $el.data( 'animateUp' ); 404 405 new Bound({ 406 element: $(this), 407 offsetTop: 80, 408 handler: function(event) { 409 if (event.section === 'top') { 410 if (event.status === 'hold') { 411 $('#nav-rotate').removeClass(animClassUp).addClass(animClassDown); 412 //$head.attr('class', 'navbar navbar-default navbar-fixed-top stuck ' + animClassDown); 413 } else if (event.status === 'release') { 414 $('#nav-rotate').removeClass(animClassDown).addClass(animClassUp); 415 //$head.attr('class', 'navbar navbar-default navbar-fixed-top stuck ' + animClassUp); 416 } 417 } 418 } 419 }); 420 }); 421 422 $('#similar-events-carousel').carousel({ 423 interval: false 424 }); 425 426 (function(){ 427 $('.multi-slide-carousel .item').each(function(){ 428 var itemToClone = $(this); 429 for (var i=1;i<4;i++) { 430 itemToClone = itemToClone.next(); 431 432 // wrap around if at end of item collection 433 if (!itemToClone.length) { 434 itemToClone = $(this).siblings(':first'); 435 } 436 437 // grab item, clone, add marker class, add to collection 438 itemToClone.children(':first-child').clone() 439 .addClass("cloneditem-"+(i)) 440 .appendTo($(this)); 441 } 442 }); 443 }()); 444 445 // Carousels - Swipe Functionality (Hammer.js) 446 if ($('#event-photo-gallery').length != 0) { 447 var eventPhotoCarousel = carouselSwipe( $('#event-photo-gallery')[0] ); 448 } 449 if ($('#similar-events-carousel').length != 0) { 450 var similarEventsCarousel = carouselSwipe( $('#similar-events-carousel')[0] ); 451 } 452 453 function carouselSwipe(currentCarousel) { 454 var hammerTime = new Hammer(currentCarousel); 455 456 hammerTime.on("swiperight", function() { 457 $(currentCarousel).carousel('prev'); 458 }).on("swipeleft", function() { 459 $(currentCarousel).carousel('next'); 460 }); 461 } 462 463 // Ticketing Modal 464 $('#modal-ticket-purchase,#modal-instagram').modal({ 465 show: false, 466 backdrop: 'static' 467 }) 468 469 window.createTicketModal = function() { 470 var isSeated = arguments[0] ? true : false; 471 var url = '/e/' + $('body').data('list-dir') + '/' + $('body').data('event-dir') + '/'; 472 var $target = $('#modal-ticket-purchase'); 473 474 if ($('body').hasClass('widget-body')) { 475 url += '?v=m&t=i'; 476 } else { 477 url += '?v=m'; 478 } 479 url += '&promoCode='+(typeof $('body').data('promo') == 'undefined'?'':$('body').data('promo')); 480 481 // Pass referral if it is available 482 var referral = window.location.search.match(/[?&]referral=([^&#]*)/) 483 if (referral && referral[1]) { 484 url += '&referral='+referral[1]; 485 } 486 487 // Pass eventref if it is available (facebook events) 488 var eventref = window.location.search.match(/[?&]eventref=([^&#]*)/) 489 if (eventref && eventref[1]) { 490 url += '&eventref='+eventref[1]; 491 } 492 493 // Add loading image ... 494 if (isSeated) { 495 window.location.href = url; 496 } else { 497 $target.find('.modal-body').addClass('text-center').html('<img src="/ui/fe/images/loading.gif" style="width:240px;">'); 498 $target.modal('show', this); 499 $target.addClass('initialized'); 500 $.get(url, function(html) {
501 $target.find('.modal-content').html(html); 502 503 if ($('body').hasClass('widget-body')) { 504 $target.find('.btn-submit').data('step', 'step2'); 505 } 506 507 showTitles(); 508 }); 509 } 510 }; 511 512 $('.btn-primary').on('click', function() { 513 if ($(this).closest('.modal').length == 0) { 514 if ($('body').hasClass('has-seating')) { 515 var url = '/e/' + $('body').data('list-dir') + '/' + $('body').data('event-dir') + '/'; 516 document.location = url; 517 } else { 518 var $target = $('#modal-ticket-purchase'); 519 if (!$target.hasClass('initialized')) { 520 createTicketModal(); 521 } else { 522 $target.modal('toggle', this); 523 } 524 } 525 } 526 }); 527 } 528 }, 529 // About Page TODO: add "page-about" body class to About Us page when created. 530 'page_about': { 531 init: function() { 532 533 } 534 }, 535 // About Page TODO: add "page-about" body class to About Us page when created. 536 'page_login': { 537 init: function() { 538 $('#formCarousel').carousel({ 539 interval: false 540 }); 541 $('#formCarousel').off('keydown.bs.carousel'); 542 } 543 }, 544 // Ticketing Page 545 'page_ticketing': { 546 init: function() { 547 548 } 549 }, 550 // Calendar Page 551 'page_calendar': { 552 init: function() { 553 $('.datepicker-inline').datepicker('option', { 554 onSelect: function(date, dp) { 555 $('.collapsible-details.in').collapse('hide'); 556 557 var activeDate = new Date(dp.currentYear, dp.currentMonth, dp.currentDay); 558 showEventsForDate(activeDate); 559 $('.event-by-organizer').removeClass('closed').addClass('open'); 560 561 if ($(window).width() <= 768) { 562 $('html,body').animate({ scrollTop: 0 }, 'slow'); 563 } 564 }, 565 beforeShowDay: function(date) { 566 var hasEvent = $('.event-by-organizer .event-card').toArray().some(function(e) { 567 var $this = $(e); 568 var fromDate = new Date($this.data('from-date')); 569 var toDate = $this.data('to-date') ? new Date($this.data('to-date')) : null; 570 if ((!toDate && fromDate.toDateString() === date.toDateString()) || (toDate && fromDate <= date && date < toDate)) { 571 return true; 572 } 573 return false; 574 }); 575 if (window.groupCalDates) { // Calendar Legend 576 for (var i = 0; i < window.groupCalDates.length; i++) { 577 var startDate = window.groupCalDates[i].startdate ? new Date(window.groupCalDates[i].startdate) : null; 578 var endDate = window.groupCalDates[i].enddate ? new Date(window.groupCalDates[i].enddate) : null; 579 var color = window.groupCalDates[i].color.replace('#', ''); 580 var contrast = ColorHelper.contrast(window.groupCalDates[i].color).replace('#', ''); 581 582 if (startDate && endDate && color) { 583 if (startDate && ((!endDate && date.toDateString() === startDate.toDateString()) || (endDate && startDate <= date && date <= endDate))) { 584 return [true, 'highlighted highlight-'+color+' text-'+contrast+' '+(hasEvent ? 'has-event' : '')]; 585 } 586 } 587 } 588 } 589 return [true, hasEvent ? 'has-event' : '']; 590 }, 591 }); 592 $('.event-by-organizer .btn-close').on('click', function() { 593 $('.event-by-organizer').removeClass('open').addClass('closed'); 594 }) 595 596 function showEventsForDate(activeDate) { 597 $('.day-of-week').text(activeDate.toLocaleString('default', {weekday: 'long'})); /*{weekday: 'short'}*/ 598 $('.month-day').text(activeDate.toLocaleString('default', {month: 'long', day: 'numeric', year: 'numeric'})); 599 600 $('.event-by-organizer .event-card').addClass('hidden').each(function() { 601 var $this = $(this); 602 var fromDate = new Date($this.data('from-date')); 603 var toDate = $this.data('to-date') ? new Date($this.data('to-date')) : null; 604 if ((!toDate && fromDate.toDateString() === activeDate.toDateString()) || (toDate && fromDate <= activeDate && activeDate < toDate)) { 605 $this.removeClass('hidden'); 606 } 607 }); 608 609 $('.event-by-organizer .event-card').removeClass('entering'); 610 setTimeout(function() { 611 $('.event-by-organizer .event-card:not(.hidden)').addClass('entering'); 612 }, 0); 613 614 var isEmpty = $('.event-by-organizer .event-card:not(.hidden)').length == 0; 615 $('.event-by-organizer .empty').toggleClass('hidden', !isEmpty); 616 617 setTimeout(function () { 618 if ($('body').hasClass('widget-body')) sendHeight(); 619 }, 400); 620 } 621 showEventsForDate(new Date()); 622 623 // TODO test timeslots calendar 624 625 window.selectEvent = function(e, ev) { 626 ev && ev.preventDefault(); 627 628 $event = $(e).closest('.event-card'); 629 $('body').data('list-dir', $event.data('list-dir')); 630 $('body').data('event-dir', $event.data('event-dir')); 631 632 // Load liability waiver. 633 $.ajax({
634 url: '/lookup/waiver.cfm', 635 data: {id : $event.data('id')}, 636 dataType: "json", 637 type: "POST", 638 success: function (json) { 639 if (json.WAIVER != '') { 640 $('.waiver-link').removeClass('hidden'); 641 $('#modal-liability-waiver #myModalLabel').text(json.WAIVERLABEL); 642 $('#modal-liability-waiver .modal-body').html(json.WAIVER); 643 } else { 644 $('.waiver-link').addClass('hidden'); 645 } 646 if ($('body').hasClass('widget-body')) {sendHeight();sendScrollTop();} 647 }, 648 error: function (XMLHttpRequest, textStatus, error) { 649 document.write( XMLHttpRequest.responseText ); 650 } 651 }); 652 653 createTicketModal(); 654 }; 655 } 656 }, 657 // Listing Page 658 'page_listing': { 659 init: function() { 660 srReload = true; 661 srReloadType = 'form'; 662 663 // Sticky Filter Panel 664 $(document).ready(function() { 665 new Bound({ 666 boundBy: $('.row.row-sticky-boundary'), 667 element: $('.sticky-filters'), 668 offsetTop: 110, 669 offsetBottom: 0, 670 handler: function(event) { 671 if (event.section === 'bottom') { 672 if (event.status === 'hold' && this.boundBy.height() > this.element.height()) { 673 this.boundBy.addClass('at-bottom'); 674 } else if (event.status === 'release' || this.boundBy.height() <= this.element.height()) { 675 this.boundBy.removeClass('at-bottom'); 676 } 677 } else if (event.section === 'top') { 678 if (event.status === 'hold') { 679 //$('.row-sticky-boundary').addClass('at-bottom'); 680 this.element.addClass('stuck'); 681 } else if (event.status === 'release') { 682 this.element.removeClass('stuck'); 683 } 684 } 685 } 686 }); 687 688 // Extending collapse status to parent container for filters (used to trigger icon flipping, etc.) 689 $('.panel-collapse').on('hide.bs.collapse', function () { 690 $(this).parents('.panel').removeClass('row-open'); 691 }).on('show.bs.collapse', function () { 692 $(this).parents('.panel').addClass('row-open'); 693 }); 694 695 }); 696 } 697 }, 698 // Checkout Steps Pages 699 'section_checkout': { 700 init: function() { 701 $(document).ready(function() { 702 if (typeof Bound == 'function') { 703 new Bound({ 704 element: $('.header-stepper'), 705 offsetTop: 40, 706 offsetBottom: 0, 707 handler: function(event) { 708 if (typeof $('body').data('timer') !== 'undefined') { 709 if (event.section === 'top') { 710 if (event.status === 'hold') { 711 $('.top-bar-content .countdown-timer-clock-wrapper').removeClass('visible-xs'); 712 } else if (event.status === 'release') { 713 $('.top-bar-content .countdown-timer-clock-wrapper').addClass('visible-xs'); 714 } 715 } 716 } 717 } 718 }); 719 new Bound({ 720 element: $('.header-stepper'), 721 offsetTop: 70, 722 offsetBottom: 0, 723 handler: function(event) { 724 if (typeof $('body').data('timer') !== 'undefined') { 725 if (event.section === 'top') { 726 if (event.status === 'hold') { 727 $('.fixed-clock').addClass('show-clock'); 728 } else if (event.status === 'release') { 729 $('.fixed-clock').removeClass('show-clock'); 730 } 731 } 732 } 733 } 734 }); 735 } 736 }); 737 738 $('#loginPassword').keypress(function(event) { 739 if (event.which == 13) { 740 event.preventDefault(); 741 $('a[data-step="login"]')[0].click(); 742 } 743 }); 744 745 $('#formCarousel').carousel({ 746 interval: false 747 }); 748 $('#formCarousel').off('keydown.bs.carousel'); 749 750 $("#formCarousel").on('slid.bs.carousel', function () { 751 if ($('body').hasClass('widget-body')) sendHeight(); 752 }); 753 754 $(document.body).on('keyup', '#promo-code', function() { 755 // if apply promo button exists, disable the submit button when a value is entered 756 if ($('.btn-promo').length != 0 && !$('.btn-promo').hasClass('disabled')) { 757 if ($(this).val() == '') { 758 $('.btn-submit').removeClass('disabled'); 759 } else { 760 $('.btn-submit').addClass('disabled'); 761 } 762 } 763 }); 764 765 // Basic jQuery Timer (Vanilla JS Timer by robbmj) 766 function startTimer(duration, display) { 767 var timer, minutes, seconds; 768 var stopTime = new Date().getTime() + (duration * 1000); 769 var ivl = setInterval(function () { 770 timer = parseInt((stopTime - new Date().getTime()) / 1000, 10); 771 minutes = Math.max(0, parseInt(timer / 60, 10)); 772 seconds = Math.max(0, parseInt(timer % 60, 10)); 773 774 minutes = minutes < 10 ? "0" + minutes : minutes; 775 seconds = seconds < 10 ? "0" + seconds : seconds; 776 777 display.text(minutes + ":" + seconds); 778 779 if (timer <= 0) {
780 $('#modal-timeout').modal('toggle', this); 781 clearInterval(ivl); 782 } 783 }, 1000); 784 } 785 786 $(function () { 787 var timeToComplete = $('body').data('timer'), 788 display = $('.countdown-timer-clock'); 789 if (timeToComplete) 790 startTimer(timeToComplete, display); 791 }); 792 793 function fieldObj(field) { 794 return $('input').filter(function() {return (typeof $(this).attr('name') !== 'undefined' && $(this).attr('name').toLowerCase().indexOf(field.toLowerCase()) > -1);}); 795 } 796 $('#modal-liability-waiver .form-footer a').on('click', function() { 797 var f = document.EventForm; 798 // get input fields ignoring case... 799 var $waivAgree = fieldObj('waiverAgree'); 800 801 $waivAgree.val($(this).data('agree')); 802 if (parseInt($(this).data('agree')) == 1) { 803 $('.waiver-agree').removeClass('hidden'); 804 if ($('#modal-liability-waiver').hasClass('modal-submit')) { 805 $('.btn').addClass('disabled'); 806 f.submit(); 807 } 808 } else { 809 $(this).data('submit', 0); 810 $('.waiver-agree').addClass('hidden'); 811 if ($('#modal-liability-waiver').hasClass('modal-submit')) { 812 $('.waiver-link').addClass('has-error'); 813 $('.waiver-link .help-block').removeClass('hidden'); 814 } 815 } 816 $('#modal-liability-waiver').removeClass('modal-submit'); 817 }); 818 819 $(document.body).on('click', '.btn-submit, .lnk-submit', function() { 820 var f = document.EventForm; 821 // get input fields ignoring case... 822 var $waivAgree = fieldObj('waiverAgree'); 823 var $tabs = $('ul.ticket-type-tabs'); 824 var step = $(this).data('step'); 825 var action = (step ? $('body').data('page')+'?'+step+($('body').data('token')?'&'+$('body').data('token'):'') : f.action ); 826 var isModal = ($(this).data('modal') ? true : false); 827 var isLogin = $(this).hasClass('btn-login') || $(this).hasClass('btn-register'); 828 var that = this; 829 var submitPage = function() { 830 if (typeof passEdits == 'undefined' || passEdits()) { 831 if (parseInt($waivAgree.val()) == 1 || isLogin) { 832 $('.btn').addClass('disabled'); 833 if (step == 'processOrder') { 834 var processingMessage = $(that).data('processingMessage') || 'Hold tight while we create your order.'; 835 setTimeout(function() { 836 $.dialog({ 837 title: 'Please wait, processing...', 838 content: processingMessage, 839 icon: 'c-icon icon-refresh animate', 840 closeIcon: false, 841 theme: 'supervan', 842 animation: 'scale', 843 closeAnimation: 'scale', 844 opacity: 0.5 845 }); 846 }, 3000); 847 if (typeof f.elements['BZ'] == 'undefined') $('form[name="EventForm"]').append('<input type="hidden" id="BZ" name="BZ" value="">'); 848 $('#BZ').val(btoa(Intl.DateTimeFormat().resolvedOptions().timeZone)); 849 } 850 f.action = action; 851 f.submit(); 852 } else { 853 var $target = $('#modal-liability-waiver'); 854 $target.modal('toggle', this).addClass('modal-submit'); 855 } 856 } 857 }; 858 859 if (isModal) { 860 var $target = $('#'+$(this).data('modal')); 861 862 if ($(this).data('backdrop')) { 863 $target.modal({backdrop:$(this).data('backdrop'), keboard:false}); 864 } else { 865 $target.modal('toggle', this); 866 } 867 } 868 869 var shouldSubmit$ = $.Deferred().resolve(true); 870 871 if ($tabs.length > 0 && $tabs.find('li.active a').attr('href') == '#FindForMe' && typeof findSeats === 'function') { 872 shouldSubmit$ = shouldSubmit$.then(function(shouldSubmit) { return shouldSubmit && findSeats(); }); 873 } 874 875 if (($(this).is('.btn-place-order') || $(this).is('.btn-review')) && typeof processPayment === 'function') { 876 shouldSubmit$ = shouldSubmit$.then(function(shouldSubmit) { return shouldSubmit && $.Deferred(function(dfd) { processPayment().then(dfd.resolve); }).promise(); }); 877 } 878 879 shouldSubmit$.then(function(shouldSubmit) { 880 if (shouldSubmit) { 881 submitPage(); 882 } 883 });
884 885 }); 886 887 $(document.body).on('click', '.btn-promo', function() { 888 var f = document.EventForm; 889 $('.btn').addClass('disabled'); 890 f.action = f.action.split('?')[0] + '?applyPromo'; 891 f.submit(); 892 }); 893 894 $('.stepper-progress .step.completed a').on('click', function() { 895 if (typeof clearOrder === 'function' || $(this).data('step') != 'step1') { 896 goTo($(this).data('step')); 897 } else { 898 var $target = $('#modal-start-over'); 899 $target.modal('toggle', this); 900 } 901 }); 902 903 $('.btn-cancel').on('click', function() { 904 var $target = $('#modal-start-over'); 905 $target.modal('toggle', this); 906 }); 907 $('#modal-start-over .modal-footer .btn-primary, #modal-timeout .modal-footer .btn-primary').on('click', function() { 908 goTo('step1'); 909 }); 910 911 var goTo = function(step) { 912 var f = document.EventForm; 913 var action = (step ? $('body').data('page')+'?'+step+($('body').data('token')?'&'+$('body').data('token'):'') : f.action ); 914 f.action = action; 915 f.submit(); 916 }; 917 } 918 }, 919 // Checkout Steps Pages 920 'activate_time_slots': { 921 init: function() { 922 $(document.body).on('change', 'select[name="eventsGrouped"]', function() { 923 var eDir = $('body').data('event-dir'); 924 var lDir = $('body').data('list-dir'); 925 926 if (typeof eDir !== 'undefined' && eDir !== false && typeof lDir !== 'undefined' && lDir !== false) { 927 928 929 // Details Page 930 if ($(this).val() != 0) { 931 $('body').data('list-dir', $(this).find('option:selected').data('list-dir')); 932 $('body').data('event-dir', $(this).find('option:selected').data('event-dir')); 933 $.ajax({
934 url: '/lookup/waiver.cfm', 935 data: {id : $(this).find('option:selected').val()}, 936 dataType: "json", 937 type: "POST", 938 success: function (json) { 939 if (json.WAIVER != '') { 940 $('.waiver-link').removeClass('hidden'); 941 $('#modal-liability-waiver #myModalLabel').text(json.WAIVERLABEL); 942 $('#modal-liability-waiver .modal-body').html(json.WAIVER); 943 } else { 944 $('.waiver-link').addClass('hidden'); 945 } 946 }, 947 error: function (XMLHttpRequest, textStatus, error) { 948 document.write( XMLHttpRequest.responseText ); 949 } 950 }); 951 952 // we'll need to support seated events. 953 var isSeated = $(this).find('option:selected').data('seated') ? true : false; 954 createTicketModal(isSeated); 955 } 956 } else { 957 // Step 1 958 var $option = $('select[name="eventsGrouped"] option:selected'); 959 var url, params = []; 960 if ($('body').hasClass('widget-body')) { 961 url = '/event/widget_render.cfm'; 962 params[params.length] = 'id='+encodeURIComponent($option.data('event-id')); 963 params[params.length] = 'type='+encodeURIComponent('purchase'); 964 params[params.length] = 'color='+encodeURIComponent($('input[name="color"]').val()) 965 } else { 966 eDir = $option.data('event-dir'); 967 lDir = $option.data('list-dir'); 968 url = '/e/' + lDir + '/' + eDir + '/'; 969 } 970 971 if ($('#promo-code').length != 0 && $('#promo-code').val() != '') params[params.length] = 'promoCode='+encodeURIComponent($('#promo-code').val()); 972 if ($('input[name="referral"]').val() != '') params[params.length] = 'referral='+encodeURIComponent($('input[name="referral"]').val()); 973 if ($('input[name="eventref"]').val() != '') params[params.length] = 'eventref='+encodeURIComponent($('input[name="eventref"]').val()); 974 975 for(i=0;i<params.length;i++) { 976 url += (i == 0 ? '?' : '&') + params[i]; 977 } 978 979 if ($('body').hasClass('widget-body')) { 980 if (typeof $option.data('event-id') !== 'undefined' && typeof $option.data('event-id') !== false) document.location = url; 981 } else if (typeof eDir !== 'undefined' && eDir !== false && typeof lDir !== 'undefined' && lDir !== false) { 982 document.location = url; 983 } 984 } 985 }); 986 987 window.showTitles = function showTitles() { 988 $.each($('.ticket-type-header-wrapper'), function() { 989 var hasItems = false; 990 var items = $(this).next('.ticket-options-wrappers-group').find('.ticket-options-wrapper'); 991 if (items.find('.ticket-type-row:not(.hidden)').length == 0) { 992 $(this).addClass('hidden'); 993 } else { 994 $(this).removeClass('hidden'); 995 } 996 }); 997 }; 998 999 $(document.body).on('change', 'input[name="timeSlots"],select[name="timeSlots"]', function() { 1000 var tsSelected = false, tsVal = '', tsNumSelected = 0; 1001 1002 if ($(this).prop("tagName") == 'INPUT') { 1003 tsSelected = $(this).is(':checked'); 1004 tsVal = $(this).val(); 1005 tsNumSelected = $('input[name="timeSlots"]:checked').length; 1006 } else if ($(this).prop("tagName") == 'SELECT') { 1007 if ($(this)[0].selectedIndex != 0) { 1008 tsSelected = true; 1009 tsVal = $(this).val(); 1010 } 1011 tsNumSelected = tsSelected ? 1 : 0; 1012 } 1013 1014 // this is needed if we decide not to start with them all hidden until time-slot selected 1015 if (tsNumSelected > 0) { 1016 var tagName = $(this).prop("tagName"); 1017 $('.ticket-type-row').each(function() { 1018 if ($(this).data('time-slot') != '') { 1019 if (tagName == 'INPUT' && !$('input[name="timeSlots"][value="'+$(this).data('time-slot')+'"]').is(':checked') ) { 1020 $(this).addClass('hidden'); 1021 } else if (tagName == 'SELECT') { 1022 $(this).addClass('hidden'); 1023 } 1024 } 1025 }); 1026 } else { 1027 $('.ticket-type-row').each(function() { 1028 if ($(this).data('time-slot') != '') { 1029 $(this).removeClass('hidden'); 1030 } 1031 }); 1032 } 1033 1034 $('.ticket-type-row').each(function() { 1035 if ($(this).data('time-slot') != '') { 1036 if (tsVal == $(this).data('time-slot')) { 1037 if (tsSelected) { 1038 $(this).removeClass('hidden'); 1039 } 1040 } else if ($('.time-slots-wrapper').data('multi-select') == 0) { 1041 $(this).addClass('hidden'); 1042 } 1043 } 1044 if ($('body').hasClass('widget-body')) sendHeight(); 1045 });
1046 1047 showTitles(); 1048 1049 if (tsSelected) { 1050 $('.for-spacing').addClass('hidden'); 1051 } else { 1052 $('.for-spacing').removeClass('hidden'); 1053 } 1054 1055 const $firstItem = $('.ticket-options-wrapper:not(.hidden-for-calendar) .ticket-type-row[data-time-slot="'+tsVal+'"]:first'); 1056 if (tsSelected && $firstItem.length) { 1057 const $scrollItem = $firstItem.closest('.ticket-options').length 1058 ? $firstItem.closest('.ticket-options') 1059 : $firstItem; 1060 1061 let scrollMarginTop = 0; 1062 const isTopLevelScroll = !$scrollItem.parents().toArray().some(el =>/(auto|scroll)/.test($(el).css('overflow-y'))); 1063 if (isTopLevelScroll && $('.top-bar-content').css('position') === 'fixed') { 1064 scrollMarginTop = $('.top-bar-content').outerHeight(); 1065 } 1066 1067 $scrollItem.css('scroll-margin-top', scrollMarginTop + 10); 1068 $scrollItem[0].scrollIntoView({behavior: 'smooth', container: 'nearest'}); 1069 $scrollItem.css('scroll-margin-top', ''); 1070 1071 $('.ticket-options').has('.ticket-options-wrapper:not(.hidden-for-calendar) .ticket-type-row[data-time-slot="'+tsVal+'"]') 1072 .find('.ticket-group-toggle.collapsed').click(); 1073 } 1074 }); 1075 $('input[name="timeSlots"]:checked').trigger('change'); 1076 $('select[name="timeSlots"] option:not(:eq(0)):selected').trigger('change'); 1077 1078 showTitles(); 1079 } 1080 } 1081 }; 1082 1083 if (typeof $.fn.autocomplete === 'function') { 1084 $.widget( "custom.catcomplete", $.ui.autocomplete, { 1085 _create: function() { 1086 this._super(); 1087 this.widget().menu( "option", "items", "> :not(.ui-autocomplete-category)" ); 1088 }, 1089 _renderMenu: function( ul, items ) { 1090 var that = this, 1091 currentCategory = ""; 1092 $.each( items, function( index, item ) { 1093 var li; 1094 if ( item.category != currentCategory ) { 1095 ul.append( "<li class='ui-autocomplete-category' style=''>" + item.category + "</li>" ); 1096 currentCategory = item.category; 1097 } 1098 li = that._renderItemData( ul, item ); 1099 if ( item.category ) { 1100 li.attr( "aria-label", item.category + " : " + item.label ); 1101 } 1102 }); 1103 }, 1104 _renderItem: function( ul, item ) { 1105 return $( "<li>" ) 1106 .attr( "data-value", item.value ) 1107 .append( item.label ) 1108 .appendTo( ul ); 1109 } 1110 }); 1111 } 1112 1113 var dataCache = { 1114 data: {}, 1115 remove: function (cacheKey) { 1116 delete dataCache.data[cacheKey]; 1117 }, 1118 exist: function (cacheKey) { 1119 return dataCache.data.hasOwnProperty(cacheKey) && dataCache.data[cacheKey] !== null; 1120 }, 1121 get: function (cacheKey) { 1122 console.log('Getting in cache for cacheKey' + cacheKey); 1123 return dataCache.data[cacheKey]; 1124 }, 1125 set: function (cacheKey, cachedData) { 1126 dataCache.remove(cacheKey); 1127 dataCache.data[cacheKey] = cachedData; 1128 } 1129 }; 1130 1131 // The routing fires all common scripts, followed by the page specific scripts. 1132 // Add additional events for more control over timing e.g. a finalize event 1133 var UTIL = { 1134 fire: function(func, funcname, args) { 1135 var fire; 1136 var namespace = BigTickets; 1137 funcname = (funcname === undefined) ? 'init' : funcname; 1138 fire = func !== ''; 1139 fire = fire && namespace[func]; 1140 fire = fire && typeof namespace[func][funcname] === 'function'; 1141 1142 if (fire) { 1143 namespace[func][funcname](args); 1144 } 1145 }, 1146 loadEvents: function() { 1147 // Fire common init JS 1148 UTIL.fire('common'); 1149 1150 // Fire page-specific init JS, and then finalize JS 1151 $.each(document.body.className.replace(/-/g, '_').split(/\s+/), function(i, classnm) { 1152 UTIL.fire(classnm); 1153 UTIL.fire(classnm, 'finalize'); 1154 }); 1155 1156 // Fire common finalize JS 1157 UTIL.fire('common', 'finalize'); 1158 } 1159 }; 1160 1161 // Load Events 1162 $(document).ready(UTIL.loadEvents); 1163 1164})(jQuery); // Fully reference jQuery after this point.
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.