1var flowCommons = (function ($){ 2 3 debug_log("[NEW FLOWS] flow commons init"); 4 var t = {}; 5 6 // declare your functions here! 7 t.animateSpeed = 250; 8 t.delaySpeed = 500; 9 t.defaultTicketMax = 14; 10 11 // Math function returning a scroll offset. 12 t.scrollingOffset = function(settings) { 13 if (window.innerWidth > 600) { 14 return settings.desktop; 15 } 16 else { 17 return settings.mobile; 18 } 19 } 20 21 t.makePrice = function(price) { 22 return '$' + price.toFixed(2); 23 } 24 25 t.collapseSection = function(id) { 26 debug_log("Collapsing",id); 27 // We remove skipped because we were just here. 28 $(id).removeClass('hidden expanded skipped').addClass('collapsed'); 29 } 30 31 t.expandSection = function(id) { 32 debug_log("Expanding",id); 33 // We remove skipped because clearly we are not skipping it. 34 $(id).removeClass('hidden collapsed skipped').addClass('expanded'); 35 } 36 37 t.hideSection = function(id) { 38 debug_log("Hiding",id); 39 // We don't remove skipped because hiding does not guarantee we're not coming 40 // back to it later - other steps will dictate. 41 $(id).removeClass('collapsed expanded').addClass('hidden'); 42 } 43 44 t.pluralize = function(qty,single,plural) { 45 return ((qty * 1) == 1 ? (qty + ' ' + single) : (qty + ' ' + plural)); 46 } 47 48 // Every "Times reflected are Eastern ___ Time (E_T)" notice (.timezone-est, 49 // shared across all the time-selection/combo-meal/experience-detail steps) 50 // needs to say Standard or Daylight depending on the VISIT DATE, not 51 // today's date â moment-timezone (loaded site-wide, see tessitura-gai.php) 52 // already has the real IANA rule table, so ask it rather than hand-rolling 53 // the 2nd-Sunday-March/1st-Sunday-November math ourselves. 54 t.timezoneEstText = function(date) { 55 var abbr = moment.tz(date, 'M/D/YYYY', 'America/New_York').format('z'); // 'EST' or 'EDT' 56 var word = (abbr === 'EDT') ? 'Daylight' : 'Standard'; 57 return 'Times reflected are Eastern ' + word + ' Time (' + abbr + ')'; 58 } 59 60 // Called by every flow's changedVisitDate â updates every .timezone-est 61 // notice on the page (time-selection, combo-meal, experience-detail all 62 // share the one visit date once it's picked, none of them have their own 63 // date picker) rather than each flow hunting down its own copy of this. 64 t.updateTimezoneNotice = function(date) { 65 $('.timezone-est').text(t.timezoneEstText(date)); 66 } 67 68 // Listener for increment/decrement routines 69 $('body').on('click','.number-adjusters.increment',function(){ 70 let myField = $(this).closest('.custom-number-input-field'); 71 let myCount = $('.number-count',myField).text() * 1; 72 let myLimiter = myField.data('capped') ? $('.custom-number-input-field.' + myField.data('capped')) : null; 73 debug_log("[NEW FLOWS] INCREMENT CLICK ",myField.attr('class')); 74 75 // Check for softlocking - if another field must have a positive value for this one to increment. 76 if (typeof myField.data('softlock') !== 'undefined') { 77 if (($('.number-count','.custom-number-input-field.' + myField.data('softlock')).text() * 1) <= 0) { return; } 78 } 79 80 81 if (myLimiter) { 82 debug_log("My Limiter: ",myLimiter); 83 debug_log("This spinner is capped by ",myField.data('capped'),"which has a value of",($('.number-count',myLimiter).text() * 1)); 84 } 85 if ( 86 (!myField.data('max') || (myCount < myField.data('max'))) && 87 (!myLimiter || (myCount < ($('.number-count',myLimiter).text() * 1))) && 88 !$(this).hasClass('disabled') && 89 !myField.hasClass('locked') 90 ) { 91 myCount++; 92 $('.number-count',myField).text(myCount); 93 $('.decrement',myField).removeClass('disabled'); 94 myField.trigger('change'); 95 96 // Re-enable increment on capped fields now below this counter's value 97 $('.custom-number-input-field[data-capped]').each(function(){ 98 if ( 99 myField.hasClass($(this).data('capped')) && 100 (myCount > ($('.number-count',this).text() * 1)) 101 ) { 102 debug_log("Capped field had increment enabled"); 103 $('.increment',this).removeClass('disabled'); 104 } 105 }); 106 107 // Re-enable increment on softlocked fields if we just incremented from 0 to 1. 108 $('.custom-number-input-field[data-softlock]').each(function(){ 109 if ( 110 myField.hasClass($(this).data('softlock')) && 111 (myCount == 1) 112 ) { 113 debug_log("Softlocked field had increment enabled"); 114 $('.increment',this).removeClass('disabled'); 115 } 116 }); 117 118 } 119 else { 120 return; 121 } 122 debug_log("[FLOW COMMONS] Increment ticket counter: myCount is now ",myCount,"max is ",myField.data('max'),"limiter is ",myLimiter); 123 if ( 124 (myField.data('max') && myCount == myField.data('max')) || 125 (myLimiter && (myCount == ($('.number-count',myLimiter).text() * 1))) 126 ) { 127 $(this).addClass('disabled'); 128 } 129 else { 130 $(this).removeClass('disabled'); 131 } 132 }); 133 134 $('body').on('click','.number-adjusters.decrement',function(){ 135 let myField = $(this).closest('.custom-number-input-field'); 136 let myCount = $('.number-count',myField).text() * 1; 137 138 debug_log("[NEW FLOWS] DECREMENT CLICK ",myField.attr('class')); 139 if (myCount > 0 && !$(this).hasClass('disabled') && !myField.hasClass('locked')) { 140 myCount--; 141 $('.number-count',myField).text(myCount); 142 $('.increment',myField).removeClass('disabled'); 143 myField.trigger('change'); 144 145 // Reduce any other fields whose values are limited by this one. 146 $('.custom-number-input-field[data-capped]').each(function(){ 147 if ( 148 myField.hasClass($(this).data('capped')) && 149 myCount <= ($('.number-count',this).text() * 1) 150 ) { 151 $('.number-count',this).text(myCount); 152 debug_log("Capped field had increment disabled"); 153 $('.number-adjusters.increment',this).addClass('disabled'); 154 $(this).trigger('change'); 155 } 156 }); 157 158 // If we are at zero, invalidate fields whose values are softlocked by this one. 159 $('.custom-number-input-field[data-softlock]').each(function(){ 160 if ( 161 myField.hasClass($(this).data('softlock')) && 162 myCount == 0 163 ) { 164 $('.number-count',this).text(myCount); 165 debug_log("Softlocked field got reset"); 166 $('.number-adjusters',this).addClass('disabled'); 167 $(this).trigger('change'); 168 } 169 }); 170 171 } 172 else { 173 return; 174 } 175 if (myCount == 0) { 176 $(this).addClass('disabled'); 177 } 178 else { 179 $(this).removeClass('disabled'); 180 } 181 }); 182 183 184 return t; 185})(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.