var navTop = "Top", navCart = "Cart", navTickets = "Entry Tickets", navBookings = "Make a Booking", navRetail = "Gift Shop", navVouchers = "Gift Vouchers"; function replaceNoDepartText() { //var newText = $('body').find('.departure-body-no-avail').html(); var newText = 'No online availability, please select an alternative day.'; $('body').find('.departure-body-no-avail').html(newText); } if (location.href.indexOf('supersale.ibisnz.com/Membership') > 0) { var $ProdName = ''; } $(function () { FIT5Initial.navTop = navTop; FIT5Initial.navCart = navCart; FIT5Initial.navTickets = navTickets; FIT5Initial.navBookings = navBookings; FIT5Initial.navRetail = navRetail; FIT5Initial.navVouchers = navVouchers; FIT5Initial.populateTopNavigation(); FIT5Initial.populateBreadcrumbs(); /* set background smooth scroll | param 70 = 70% of the page scroll */ //FIT5Initial.setBackgroundSmoothScroll(70); if ($('#BookingNote').length) { $('#BookingNote').attr('placeholder', ''); } /* Case 20609 - Continue Shopping */ if (location.href.indexOf('hanmersprings.ibisnz.com') > 0) { //$('.empty-cart-content-wrapper p').after(''); //$('#shopping-cart-wrapper .btn-payment-wrapper').before('
Or
'); $('body').on('click', '.btn-payment-continue-shopping-wrapper a', function () { top.location.replace('https://hanmersprings.co.nz/buy-online/'); }) } /* Case 20119 - more user-friendly version of "No departures available." */ $('body').on('ibEventDeparturePartialReload', function () { if ($('body').find('.departure-body-no-avail').text().indexOf('No departures available') > -1 && $('body').find('.departure-body-no-avail').text().indexOf('No online availability') == -1) { replaceNoDepartText(); } }) // Case 22555 - Set default to 0 for SESSION1, SESSION2 and SESSION3 var defaultAdjusted = false; $('body').on('ibEventBookingUnitChange', function () { if (location.href.toLowerCase().indexOf('session1') > 0 || location.href.toLowerCase().indexOf('session2') > 0 || location.href.toLowerCase().indexOf('session3') > 0) { if (defaultAdjusted == false) { $('.ticket-item-wrapper:eq(0) select option').each(function () { $(this).removeAttr('selected'); }) $('.ticket-item-wrapper:eq(0) select option:eq(0)').prop('selected', true).trigger('change'); defaultAdjusted = true; } } // Case 22699 - Disable 1 x adult option for private pools if (location.href.toLowerCase().indexOf('.pool30-4.') > 0 || location.href.toLowerCase().indexOf('.pool30-8.') > 0 || location.href.toLowerCase().indexOf('.pool60-4.') > 0 || location.href.toLowerCase().indexOf('.pool60-8.') > 0) { $('.ticket-units:eq(0) option[value="1"]').remove(); } }) /* Hide Specials */ $('#prod-image-Special').closest('.item-grid').hide(); /* 3D secure text and link */ $('.payment-3d-secure').append(' Find out more here.'); /* SuperSale */ $('.supersale-select').on('change', function () { var qty = $(this).find('option:selected').val(); $(this).parents('.supersale-add-wrapper').find('.btn-supersale-add').data('units', qty); }) $('.btn-supersale-add').click(function () { var URL = $(this).data('href') + '&units=' + $(this).data('units'); location.href = URL; }) $('.hanmer-supersale-email').on('keypress', function (e) { if (e.which == 13) { $(this).closest('form').submit(); } }); if (location.href.toLowerCase().indexOf('supersale.ibisnz.com/membership/new/') > 0) { var contentUpdated = false, termsAdded = false; // Select the node that will be observed for mutations var targetNode = document.querySelector('#member-partial-wrapper'); // Options for the observer (which mutations to observe) var config = { attributes: true, childList: true, subtree: true }; // Callback function to execute when mutations are observed var callback = function (mutationsList, observer) { //for (var mutation of mutationsList) { for (var i = 0; i < mutationsList.length; i++) { var mutation = mutationsList[i]; if (mutation.type == 'childList') { if ($('body').find('#Country').length > 0 && contentUpdated == false) { if (termsAdded == false) { $('body').find('.membership-email-text p').before('Membership only available for New Zealand residents.
'); termsAdded = true; } var selectLen = $('body').find('#Country option').length; for (i = 0; i < selectLen; i++) { $('body').find('#Country option:nth-child(' + i + ')').prop('disabled', true); } $('body').find('#Country option[value="NZL"]').prop('disabled', false); $('body').find('#Country').select2(); contentUpdated = true; setTimeout(function () { contentUpdated = false; }, 200); } } } }; // Create an observer instance linked to the callback function var observer = new MutationObserver(callback); // Start observing the target node for configured mutations observer.observe(targetNode, config); } if (location.href.toLowerCase().indexOf('supersale.ibisnz.com/cart') > 0) { $('.btn-cancel-cart').hide(); } }); $(window).load(function () { if (location.href.toLowerCase().indexOf('/departures') > 0) { if ($('body').find('#departure-partial').length > 0 && $('body').find('#departure-partial table tbody tr td').text().indexOf('No departures available') > 0) { replaceNoDepartText(); contentUpdated = true; } } })