PageSourceSearch

https://bbriverboats.com/assets/js/vendor/hornblower/cruise-finder.js

js bbriverboats.com collected 2026-09-25 23:47:31 UTC 30,337 bytes, 723 lines download raw bytes

1function getUrlVars() {
2    var vars = {};
3    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
4        vars[key] = value;
5    });
6    return vars;
7}
8
9function getUrlParam(parameter, defaultvalue){
10    var urlparameter = defaultvalue;
11    if(window.location.href.indexOf(parameter) > -1){
12        urlparameter = getUrlVars()[parameter] || defaultvalue;
13    }
14    return urlparameter;
15}
16
17function getTodayDateOrUrlParam(urlParam,format) {
18    var selUrlParam = decodeURIComponent(getUrlParam(urlParam,''));
19    var today = new Date();
20    var dd = String(today.getDate()).padStart(2, '0');
21    var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
22    var yyyy = today.getFullYear();
23    //console.log('format',format);
24    var thisDateStr = mm + '/' + dd + '/' + yyyy;
25    if(format !== undefined && format === 'YYYYMMDD') {
26        thisDateStr = yyyy + '' + mm + dd;
27    }
28
29
30    return selUrlParam.length ? selUrlParam : thisDateStr;
31}
32
33function getDateByNumDays(theDate, num) {
34    var newDate = new Date(theDate);
35    newDate.setDate(newDate.getDate() + num);
36    var dd = String(newDate.getDate()).padStart(2, '0');
37    var mm = String(newDate.getMonth() + 1).padStart(2, '0'); //January is 0!
38    var yyyy = newDate.getFullYear();
39    var newDateStr = mm + '/' + dd + '/' + yyyy;
40    return newDateStr;
41}
42
43function constructColorPalette() {
44    return {
45        palette: {
46            primary: {
47                main: "#e1292f",
48                contrastText: "#ffffff"
49            },
50            secondary: {
51                main: "#042e45",
52            },
53            background: {
54                default: "#ffffff"
55            }
56        }
57    };
58}
59
60function constructInlineStyle() {
61    return {
62           ".calendar-custom-wrapper":{
63              "width":"100% !important",
64              "maxWidth":"550px !important",
65              "margin":"0 !important"
66           },
67           ".DayPicker__withBorder":{
68              "boxShadow":"0 2px 6px rgba(0,0,0,.05),0 0 0 1px #172b4d !important",
69              "borderRadius":"16px !important"
70           },
71           ".DayPicker_transitionContainer":{
72              "borderRadius":"16px !important",
73              "height":"540px !important",
74              "@media (min-width:0px) and (max-width:600px)": {
75                "height": "380px !important"
76              },
77              "@media (min-width:430px) and (max-width:485px)": {
78                "height": "440px !important"
79              },
80              "@media (min-width:486px) and (max-width:530px)": {
81                "height": "470px !important"
82              },
83              "@media (min-width:531px) and (max-width:599px)": {
84                "height": "440px !important"
85              }
86           },
87           ".DayPickerNavigation_button__default":{
88              "border":"1px solid #172b4d !important",
89              "borderRadius":"50% !important"
90           },
91           ".CalendarMonth_caption":{
92              "color":"#172b4d !important",
93              "fontSize":"24px !important",
94              "padding-bottom":"48px !important"
95           },
96           ".DayPicker_weekHeader":{
97              "color":"#172b4d !important",
98              "top":"72px !important"
99           },
100           ".DayPicker_weekHeader_li":{
101              "fontSize":"18px !important"
102           },
103           ".CalendarDay":{
104              "fontSize":"18px !important"
105           },
106           ".CalendarDay__default":{
107              "backgroundColor":"#FFFFFF !important",
108              "border":"none !important",
109              "color":"#172b4d !important",
110              "fontWeight":"bold !important"
111           },
112           ".CalendarMonth_table":{
113              "borderCollapse":"separate !important",
114              "borderSpacing":"0px !important"
115           },
116           ".CalendarDay__blocked_calendar":{
117              "backgroundColor":"transparent !important",
118              "border":"none !important",
119              "color":"#808b96 !important"
120           },
121           ".CalendarDay__selected":{
122              "borderRadius":"50% !important",
123              "border":"none !important",
124              "backgroundColor":"#e1292f !important",
125              "color":"#FFFFFF !important",
126              "padding":"6px !important"
127           },
128           ".CalendarDay__highlighted_calendar":{
129              "backgroundColor":"transparent !important",
130              "border":"none !important"
131           },
132           ".ticket-item-price":{
133              "fontFamily":"Futura-Book, Helvetica, Arial, sans-serif !important"
134           },
135           ".ticketLabel_wrapper": {
136            "& > span:first-child": {
137                "fontFamily":"Futura-Heavy, Helvetica, Arial, sans-serif !important",
138                "fontSize": "1.1rem !important"
139            }
140           },
141           ".step-icon-container":{
142              "fontSize":"2.4rem !important",
143              "marginRight":"8px !important"
144           },
145           ".shoppingCart_wrapper": {
146             "@media (min-width:0px) and (max-width:600px)": {
147                "paddingLeft": "8px !important",
148                "paddingRight": "8px !important"
149              }
150           },
151           ".checkout-summary-selected-tour":{
152              "padding":"4px 32px !important",
153              "backgroundColor":"#eaeded !important",
154              "borderRadius":"12px !important",
155              "marginTop": "78px !important"
156           },
157           ".checkout-summary-billing-summary":{
158              "backgroundColor":"inherit !important",
159              "boxShadow":"none !important",
160              "& > ul > li": {
161                "paddingLeft":"0px !important",
162                "paddingRight":"0px !important",
163                "alignItems": "end !important",
164                "& > div:nth-child(2)": {
165                    "paddingRight":"0px !important",
166                    "& > span": {
167                        "fontFamily":"Futura-Book, Helvetica, Arial, sans-serif !important"
168                    }
169                },
170                "&:last-child": {
171                    "borderTop": "5px solid #e1292f !important",
172                    "& > div:nth-child(2)": {
173                        "paddingRight":"0px !important",
174                        "& > span": {
175                            "fontFamily":"Futura-Book, Helvetica, Arial, sans-serif !important"
176                        }
177                    }
178                }
179              }
180           },
181           ".shopping-cart-summary":{
182              "fontSize":"0.8rem !important",
183              "fontFamily":"Futura-Book, Helvetica, Arial, sans-serif !important"
184           },
185           ".tourInfoSummary_wrapper":{
186              "& > span":{
187                 "fontSize":"1.4rem !important",
188                 "color":"#e1292f !important"
189              }
190           },
191           ".tourInfoSummary_divider": {
192               "height": "3px !important",
193                "background-color": "#172b4d !important",
194                "margin": "8px 0 0 0 !important"
195           },
196           ".cta-buttons-container": {
197                "display": "flex !important",
198                "width": "100% !important",
199                "justifyContent": "space-between !important",
200                "margin": "8px 0 !important",
201                "& > div": {
202                    "width": "50% !important"
203                },
204                "& .backButton_wrapper": {
205                    "width": "100% !important"
206                },
207                "& .continueButton_wrapper": {
208                    "width": "100% !important",
209                    "borderRadius": "16px !important"
210                },
211                "& .payInButton_wrapper": {
212                    "width": "100% !important",
213                    "borderRadius": "16px !important"
214                }
215           },
216           ".reserveTimer_wrapper": {
217            "backgroundColor": "#e1292f !important",
218            "width": "100% !important",
219            "fontSize": "1rem !important",
220            "height": "40px !important"
221           }
222    };
223}
224
225function reloadSearchSDK(date) {
226    jQuery('#hb-commerce-sdk-root').html('');
227    console.log('selectedDate', date);
228    HBCommerce.launch({
229        locale: thisLang,
230        theme: thisTheme,
231        customStyles: thisStyle,
232        searchParams: {
233            searchTerm: thisSearchTerm,
234            city : thisCity,
235            date: date.start,
236            endDate: date.end,
237        },
238        flags: {
239            showSearchForm: false
240        },
241    }, "hb-commerce-sdk-root").then(function (instance) {
242        _HBCOMMERCEINSTANCE_ = instance;
243    }).catch(function (err) {
244        console.log("Error launching commerce sdk", err);
245    });
246}
247
248function loadToursByDateTagSdk(thisDate, thisEDate, thisTag) {
249    var gqlProp = {
250        propertyId: thisPropId,
251        searchTerm: thisTag,
252        crossSellCities: [],
253        siteId: '',
254        includeAvailability: true,
255        includeMenu: false,
256        date: thisDate,
257        filterNoVacancyEvents: false,
258        endDate: thisEDate,
259    };
260    console.log('gqlProp', {thisDate, thisEDate, thisTag, gqlProp});
261    jQuery('#hb-commerce-sdk-root').html('');
262    jQuery( '.hb-tours-wrapper .loading-event' ).attr('style', '');
263    jQuery('.hb-empty-tour').addClass('hide');
264    HBCommerce
265      .graphql({ sdkSrc: 'https://my.hornblower.com/sdk' })
266      .then(function(gql) {
267        gql.searchTours(gqlProp)
268          .then(function(tours) {
269            jQuery( '.hb-tours-wrapper .loading-event' ).fadeOut( 'slow', function() {
270                if(! (tours.available || []).length) {
271                    jQuery('.hb-empty-tour').removeClass('hide');
272                }
273                var toursHtml = render_tours(tours, thisTag);
274                jQuery('#hb-commerce-sdk-root').html(toursHtml);
275            });
276        })
277        .catch(console.log);
278    })
279    .catch(function(error) {
280      //Handle error
281      console.log(error);
282    });
283}
284
285
286var thisMode = typeof hb_mode !== 'undefined' ? hb_mode : 'account';
287var singleFormCheckout = typeof singleFormCheckoutFlag !== 'undefined' ? singleFormCheckoutFlag : false;
288var thisTag = typeof hb_tag !== 'undefined' ? hb_tag : 'hb-commerce-sdk-root';
289var thisLang = typeof hb_lang !== 'undefined' ? hb_lang : 'en';
290var thisStyle = typeof hb_style !== 'undefined' ? hb_style : constructColorPalette();
291var thisPropId = typeof hb_prop_id !== 'undefined' ? hb_prop_id : getUrlParam('propertyID', 'hbbrvrbt');
292var thisBookId = typeof hb_booking_id !== 'undefined' ? hb_booking_id : getUrlParam('cruise', 0);
293var hasUrlParam = getUrlParam('propertyID', '').length > 0 && getUrlParam('bookingTypeId', 0) !== 0;
294var thisCartMode = hasUrlParam ? false : (typeof hb_cart_mode !== 'undefined' ? hb_cart_mode : false);
295var thisCheckoutUrl = typeof hb_checkout_url !== 'undefined' ? hb_checkout_url : (thisCartMode ? '/cart-checkout/' : '/booking/');
296var thisContinueUrl = typeof hb_continue_url !== 'undefined' ? hb_checkout_url : '/cruises/';
297var thisTheme = typeof hb_theme_name !== 'undefined' ? hb_theme_name : 'hbbrvrbt';
298var thisCity = typeof hb_city_name !== 'undefined' ? hb_city_name : 'bb riverboats - newport';
299var thisSearchTerm = typeof hb_search_term !== 'undefined' ? hb_search_term : 'Searchable Tours';
300
301(function ($) {
302    $(document).ready(function () {
303      console.log(thisMode);
304
305        function customDateFormat(dObj, offsetD) {
306			var fObj = [];
307			dObj.setDate(dObj.getDate() + offsetD);
308			fObj.dateVal = dObj.getDate();
309			//console.log('dObj',dObj);
310			//console.log('dObj.getDate()',dObj.getDate());
311			//console.log('fObj',fObj);
312			fObj.monthVal = dObj.getMonth() + 1;
313			fObj.yearVal = dObj.getFullYear();
314			fObj.dateStr = '0' + fObj.dateVal;
315			fObj.dateStr = fObj.dateStr.substring(fObj.dateStr.length - 2);
316			fObj.monthStr = '0' + fObj.monthVal;
317			fObj.monthStr = fObj.monthStr.substring(fObj.monthStr.length - 2);
318			fObj.yearStr = fObj.yearVal + '';
319			fObj.fullStr = fObj.monthStr + '/' + fObj.dateStr + '/' + fObj.yearStr;
320			fObj.fullStr2 = fObj.yearStr + '-' + fObj.monthStr + '-' + fObj.dateStr;
321			return fObj;
322		}
323
324        function render_calendar(tagId) {
325			var calendarEl = document.getElementById(tagId);
326			var todaysDate = new Date();
327			var startDate = todaysDate.getFullYear() + '-' + ((todaysDate.getMonth()+1)+'').padStart(2,'0') + '-' + (todaysDate.getDate()+'').padStart(2,'0');
328			console.log('startDate', startDate);
329			calendar = new FullCalendar.Calendar(calendarEl, {
330				initialView: (myObj.settings.calendar_mode_weekly || false) ? 'timeGridWeek' : 'dayGridMonth',
331				//initialView: 'timeline',
332				duration: { days: 7 },
333				fixedWeekCount: false,
334				defaultTimedEventDuration: '00:01',
335				validRange: {
336					start: startDate //'2023-05-25'
337				},
338				footerToolbar: {
339					left: 'title',
340					center: '',
341					right: 'today,prev,next'
342				},
343				contentHeight: "auto",
344				datesSet: function(dateInfo) {
345					console.log('isFirstLoad', isFirstLoad);
346					$('.fc-header-toolbar .fc-toolbar-chunk:nth-child(2) .loading-event').removeClass('hide');
347					var startDateObj = customDateFormat(dateInfo.start, 0);
348					var endDateObj = customDateFormat(dateInfo.end, -1);
349                    //console.log('loading-date', {startDateObj, endDateObj});
350					if(isFirstLoad) {
351						//calendar.validRange( { start: startDateObj.fullStr2 })
352						isFirstLoad = false;
353					}
354					if(loadedBatch[startDateObj.fullStr+'-'+endDateObj.fullStr] === undefined) {
355						//console.log('not loaded yet');
356						loadShows(startDateObj, endDateObj);
357						loadedBatch[startDateObj.fullStr+'-'+endDateObj.fullStr] = '';
358					} else {
359						//console.log('loaded already');
360						$('.fc-header-toolbar .fc-toolbar-chunk:nth-child(2) .loading-event').addClass('hide');
361					}
362				},
363				eventContent: function(arg) {
364					var showInfo = arg.event._def;
365					var thisHtml = '';
366					if(!myObj.settings.hide_image || false) {
367						thisHtml += '<div class="show-img">' + '<img src="' + showInfo.extendedProps.media + '" />' + '</div>';
368					}
369					thisHtml += '<div class="show-title">' + showInfo.title + '</div>';
370					var thisTimeSlot = showInfo.extendedProps.timeSlot;
371					thisHtml += '<div class="show-times">';
372					for(var tIdx=0; tIdx < thisTimeSlot.length; tIdx++) {
373						if(myObj.settings.show_sold_out_before_showtime && thisTimeSlot[tIdx].isSoldOut) {
374							thisHtml += '<div class="show-sold-out before-showtime">' + myObj.settings.sold_out_text + '</div>';
375						}
376						if(myObj.settings.showtime_as_text) {
377							thisHtml += '<div class="show-time-text">' + thisTimeSlot[tIdx].sTime + '</div>';
378						} else {
379							thisHtml += '<a class="btn-primary" href="'+thisTimeSlot[tIdx].showUrl+'">' + thisTimeSlot[tIdx].sTime + '</a>';
380						}
381						if(myObj.settings.show_sold_out_after_showtime && thisTimeSlot[tIdx].isSoldOut) {
382							thisHtml += '<div class="show-sold-out after-showtime">' + myObj.settings.sold_out_text + '</div>';
383						}
384						if(myObj.settings.show_availability && !thisTimeSlot[tIdx].isSoldOut) {
385							thisHtml += '<div class="availability-text">' + thisTimeSlot[tIdx].vacancy + ' ' + (myObj.availableTextBookIds['bookId-'+thisTimeSlot[tIdx].bookingTypeId] || '') + ' ' +  (thisTimeSlot[tIdx].vacancy === 1 ? myObj.settings.available_single_text : myObj.settings.available_plural_text ) +  '</div>';
386						}
387						if(myObj.settings.show_sold_out_as_btn && thisTimeSlot[tIdx].isSoldOut) {
388							thisHtml += '<a class="btn-primary sold-out-showtime" href="'+thisTimeSlot[tIdx].showUrl+'">' + myObj.settings.sold_out_text + '</a>';
389						}
389 else if(myObj.settings.add_buy_btn) {
390							thisHtml += '<a class="btn-primary" href="'+thisTimeSlot[tIdx].showUrl+'">' + myObj.settings.buy_btn_text + '</a>';
391						}
392					}
393					thisHtml += '</div>';
394					return { html: thisHtml };
395				}
396			});
397			calendar.render();
398			$('.fc-header-toolbar .fc-toolbar-chunk:nth-child(2)').append('<div class="loading-event"><div class="spinner-cal"><div class="dot1"></div><div class="dot2"></div></div></div>');
399		}
400
401        function covertTime24(time) {
402			var tObj = time.split(':');
403			var hour = parseInt(tObj[0]);
404			var min = tObj[1];
405			var sec = tObj[2];
406			var ampm = 'AM';
407			if(hour > 12) {
408				ampm = 'PM';
409				hour -= 12;
410			} else if (hour === 12) {
411				ampm = 'PM';
412			}
413			var timeStr = hour + ':' + min + (sec === '00' ? '' : ':' + sec) + ' ' + ampm;
414			//console.log('hour', hour);
415			//console.log('min', min);
416			//console.log('sec', sec);
417			//console.log('timeStr', timeStr);
418			return timeStr;
419		}
420
421        function loadShows(s, e) {
422            //console.log('loadShows',{s,e});
423			HBCommerce
424			  .graphql({ sdkSrc: 'https://my.hornblower.com/sdk' })
425			  .then(function(gql) {
426                console.log('gql', {thisPropId,thisSearchTerm});
427				gql.searchTours({ propertyId: thisPropId,
428				                  searchTerm: thisSearchTerm,
429				                  crossSellCities: [],
430				                  siteId: '',
431				                  includeAvailability: false,
432				                  includeMenu: false,
433				                  date: s.fullStr,
434				                  endDate: e.fullStr,
435				                  filterNoVacancyEvents: false })
436				  .then(function(tour) {
437				  	console.log('tourtour-loadshows',tour);
438					for(var idx=0; idx < tour.available.length; idx++) {
439						var thisTour = tour.available[idx];
440						var thisTourAvail = thisTour.availability;
441						var key = thisTour.bookingTypeId + '-' + thisTour.tourDate;
442						var sDate = thisTour.tourDate;
443						var isVIPShow = false;
444						var bookingTypeId = thisTour.bookingTypeId;
445						var propertyID = thisTour.propertyId;
446						var timeSlot = [];
447						if(thisTour.bookingTypeId === 0) console.log('thisTourAvail',thisTourAvail);
448						for(aIdx=0; aIdx < thisTourAvail.length; aIdx++) {
449							var thisThisTourAvail = thisTourAvail[aIdx];
450							var sTime = covertTime24(thisThisTourAvail.StartTime);
451							var addConcatChar = (thisTour.permalink !== null ? thisTour.permalink : '').indexOf('?') >= 0 ? '&' : '?';
452							var showUrl = thisTour.permalink + addConcatChar + 'date=' + sDate + '&timeId=' + thisThisTourAvail.TimedTicketTypeId + '&departure=' + (thisThisTourAvail.fromStopId || 0) + '&destination=' + (thisThisTourAvail.toStopId || 0);
453							var preselectionData = {  };
454							if(myObj.settings.buy_tickets_to_checkout || false) {
455								preselectionData['selectedTimedTicketTypeId'] = thisThisTourAvail.TimedTicketTypeId;
456                                                        	preselectionData['selectedDate'] = sDate;
457								preselectionData['departureStop'] = thisThisTourAvail.fromStopId;
458								preselectionData['destinationStop'] = thisThisTourAvail.toStopId;
459								var preselectionStr = encodeURIComponent(JSON.stringify(preselectionData));
460								showUrl = '/checkout/?propertyID='+propertyID+'&bookingTypeId='+bookingTypeId+'&preselection='+preselectionStr;;
461							}
462							var thisDateStr = new Date(thisThisTourAvail.StartDate);
463							var thisEpochDate = Date.parse(thisDateStr);
464							var thisSoldOut = thisThisTourAvail.vacancy <= 0;
465							var isVIPShowtime = false;
466							var thisVacancy = (myObj.settings.bookId_use_vehicleVacancy || []).includes(bookingTypeId) ? thisThisTourAvail.vehicleVacancy : thisThisTourAvail.vacancy;
467							timeSlot.push({showUrl: showUrl,sTime: sTime, epochTime: thisEpochDate, isSoldOut: thisSoldOut, isVIPShowtime: isVIPShowtime, vacancy: thisVacancy, bookingTypeId: bookingTypeId});
468						}
469						if(timeSlot.length > 1) {
470							timeSlot = timeSlot.sort(function(a, b) {
471								var timeA = a.epochTime;
472								var timeB = b.epochTime;
473								return timeA - timeB;
474							});
475							if(thisTour.bookingTypeId === 1000036) console.log('timeSlottimeSlot',timeSlot);
476						}
477						var newEvent = {
478							title: thisTour.localizedInfo.en.title,
479							start : thisThisTourAvail.StartDate,
480							media: 'https://images.hornblower.com/160x100/' + (thisTour.media.images.length ? thisTour.media.images[0].url : ''),
481							timeSlot: timeSlot,
482							isVIPShow: isVIPShow,
483							bookingTypeId: bookingTypeId,
484							sDate: sDate,
485							allDay: myObj.settings.calendar_mode_weekly || false,
486						}
487						if(loadedShow[key] === undefined) {
488							//console.log('add new event', thisTour.localizedInfo.en.title + ' - ' + bookingTypeId);
489							//console.log(newEvent);
490							calendar.addEvent(newEvent);
491							loadedShow[key] = '';
492						}
493					}
494					//console.log('finished loading shows');
495					$('.fc-header-toolbar .fc-toolbar-chunk:nth-child(2) .loading-event').addClass('hide');
496				  })
497				  .catch(console.log);
498			  })
499			  .catch(function(error) {
500				//Handle error
501			  });
502		}
503
504        if(thisMode === 'account') {
505            HBCommerce.launch({
506                customStyles: thisStyle,
507                locale: thisLang,
508                theme: thisTheme,
509                flags: {
510                    initialPage: HBCommerce.ROUTES.SELFSERVICE
511                }
512            }, thisTag);
513        }
514        if(thisMode === 'giftcards') {
515            HBCommerce.launch({
516                customStyles: thisStyle,
517                locale: thisLang,
518                propertyId: thisPropId,
519                theme: thisTheme,
520                flags: {
521                    initialPage: HBCommerce.ROUTES.GIFTCARD
522                }
523            }, thisTag);
524        }
525        if(thisMode === 'booking') {
526            var order_id = decodeURIComponent(getUrlParam('id', ''));
527            HBCommerce.launch({
528                customStyles: thisStyle,
529                customerInfo: {
530                    orderId: order_id
531                },
532                locale: thisLang,
533                theme: thisTheme,
534                flags: {
535                    initialPage: HBCommerce.ROUTES.SERVICE
536                }
537            }, thisTag);
538        }
539        if(thisMode === 'waiver') {
540            var waiver_id = decodeURIComponent(getUrlParam('id', ''));
541            HBCommerce.launch({
542                theme: thisTheme,
543                customStyles: thisStyle,
544                waiverId: waiver_id,
545                locale: thisLang,
546                flags: {
547                initialPage: HBCommerce.ROUTES.SIGNWAIVER,
548                hideLogoInWaiverForm: true,
549                }
550            }, thisTag);
551        }
552        if(thisMode === 'proposal') {
553            var proposal_id = decodeURIComponent(getUrlParam('id',''));
554            console.log('proposal');
555            HBCommerce.launch({
556                customStyles: thisStyle,
557                propertyId: thisPropId,
558                locale: thisLang,
559                proposalId: proposal_id,
560                theme: thisTheme,
561                flags: {
562                    initialPage: HBCommerce.ROUTES.SIGNPROPOSAL,
563                }
564            }, thisTag);
565        }
566        if(thisMode === 'tour-calendar') {
567            HBCommerce.launch({
568                propertyId: thisPropId,
569                locale: thisLang,
570                bookingTypeId: thisBookId,
571                customStyles: thisStyle,
572                theme: thisTheme,
573                flags: { preselectionMode: !singleFormCheckout, cartMode: thisCartMode, singleFormCheckout: singleFormCheckout, },
574                onPreselectionComplete: function (event) {
575                    var preselection = encodeURIComponent(JSON.stringify(event));
576                    var fullUrl = thisCheckoutUrl + '?bookingTypeId='+thisBookId+'&propertyID='+thisPropId+'&preselection='+preselection;
577                    //console.log('onPreselectionComplete', {thisCheckoutUrl, fullUrl});
578                    window.location = fullUrl;
579                },
580                onViewCart: function(event) {
581                    //console.log('onViewCart');
582                    var extraUrl = '';
583                    window.location = thisCheckoutUrl + extraUrl;
584                },
585                onCartChange: function(event) {
586                    var rerenderSdk = (((event || {}).payload || {}).continueShopping || false);
587                    console.log('onCartChange');
588                    if(rerenderSdk) {
589                        window.location.href = thisContinueUrl;
590                    } else {
591                        var topPx = jQuery("#hb-commerce-sdk-root").offset().top;
592                        jQuery( "html, body" ).animate( { scrollTop: topPx - 100 } );
593                    }
594                    anchorCartChange(getCartCount());
595                },
596            }, thisTag).then(function (instance) {
597                _HBCOMMERCEINSTANCE_ = instance;
598            }).catch(function (err) {
599                console.log("Error launching commerce sdk", err);
600            });
601        }
602        if(thisMode === 'checkout') {
603            var preselection;
604            var urlPreselection = getUrlParam('preselection','');
605            var urlMembershipId = getUrlParam('membership','');
606            var urlSubscriptionType = getUrlParam('subscriptionType','');
607            var urlSelectedDate = getUrlParam('date', '');
608            try {
609                preselection = JSON.parse(decodeURIComponent(urlPreselection));
610            } catch(err) {
611                preselection = {};
612            }
613            //console.log('preselection', preselection);
614            HBCommerce.launch({
615                propertyId: thisPropId,
616                locale: thisLang,
617                bookingTypeId: thisBookId,
618                membershipId: urlMembershipId,
619                customStyles: thisStyle,
620                inlineStyles: constructInlineStyle(),
621                theme: 'hbbrvrbt2',
622                costRateId: preselection.costRateId || '',
623                selectedDate: urlSelectedDate,
624                selectedTimedTicketTypeId: preselection.selectedTimedTicketTypeId,
625                roundTripEventId: preselection.roundTripEventId,
626                departureStop: preselection.departureStop,
627                destinationStop: preselection.destinationStop,
628                ticketSelection: preselection.ticketSelection,
629                onReserveTimeout: function(event) {
630                    window.history.go(-1);
631                },
632                flags: {
633                    initialPage: thisCartMode ? HBCommerce.ROUTES.CART_CHECKOUT : HBCommerce.ROUTES.CHECKOUT,
634                    singleFormCheckout: singleFormCheckout,
635                    membershipSubscriptionType: urlSubscriptionType,
636                    disableGooglePayForCart: false,
637                    disableApplePayForCart: false,
638                    disableBraintreeForCart: false,
639                    hideSelectQuantityTitle: true,
640                    hideCalendarHeader: true,
641                    hideSelectedTourInfo: true,
642                    enableCustomCalendarStyle: true,
643                    disableStepConnector: true,
644                    qtyPickerVariant: 'outlined',
645                    specialRequestV2: true
646                },
647                onStageChange: function(event) {
648                    try {
649                        if (event && event.payload && event.payload.position && event.payload.position.top) {
650                            var widgetTopOffset = jQuery("#"+thisTag).offset().top;
651                            var stickyHeaderOffset = 90;
652                            jQuery( "html, body" ).animate( { scrollTop: widgetTopOffset + event.payload.position.top - stickyHeaderOffset } );
653                        }
654                    } catch (err) {
655                        console.log("Commerce:onStageChange:error", err);
656                    }
657                },
658            }, thisTag).then(function(instance) {
659                _HBCOMMERCEINSTANCE_ = instance;
660            }).catch(function(err) {
661                console.log("Error launching commerce sdk", err);
662            });
663        }
664        if(thisMode === 'search' && thisCity.length) {
665            //var selectedDate = getTodayDateOrUrlParam('date');
666			var todays = new Date();
667			var weekFromToday = new Date();
668			weekFromToday.setDate(todays.getDate() + 7);
669			var weekFromTodayStr = (weekFromToday.getMonth() + 1) + '/' + weekFromToday.getDate() + '/' + weekFromToday.getFullYear();
670			var todayStr = (todays.getMonth() + 1) + '/' + todays.getDate() + '/' + todays.getFullYear();
671            var selectedDate = {start: todayStr, end: weekFromTodayStr};
672            var dateformat = 'MM/DD/YYYY';
673            jQuery('input[name="start-date"]').daterangepicker({
674                singleDatePicker: true,
675                autoApply: true,
676                startDate: todayStr,
677                locale: {
678                  format: dateformat,
679                },
680              },
681              function(start, end, label) {
682                var selectedDateVal = start.format(dateformat);
683                console.log('end', selectedDateVal);
684                jQuery('input[name="end-date"]').daterangepicker({
685                  singleDatePicker: true,
686                  autoApply: true,
687                  startDate: selectedDateVal,
688                  minDate: selectedDateVal,
689                  locale: {
690                    format: dateformat,
691                  },
692                },
693                function(start, end, label) {
694                });
695              });
696              jQuery('input[name="end-date"]').daterangepicker({
697                singleDatePicker: true,
698                autoApply: true,
699                startDate: weekFromTodayStr,
700                locale: {
701                  format: dateformat,
702                },
703              }, function(start, end, label) {
704              });
705            jQuery('button[name="search-tour"]').on('click', function(e) {
706                var selSDate = jQuery('input[name="start-date"]').val();
707                var selEDate = jQuery('input[name="end-date"]').val();
708                reloadSearchSDK({start: selSDate, end: selEDate});
709            });
710            reloadSearchSDK(selectedDate);
711        }
712        if(thisMode === 'calendar' && thisCity.length) {
713            var isFirstLoad = true;
714            var loadedBatch = [];
715            var loadedShow = [];
716            var myObj = { settings: {} };
717            render_calendar('hb-calendar');
718        }
719        if(thisMode === 'tour-filters-date') {
720            loadToursByDateTagSdk(selDate, selEDate, thisTag);
721        }
722    });
723})(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.