PageSourceSearch

https://www.hawaiiactivities.com/ac2020/js/header.js?1790105626

js hawaiiactivities.com collected 2026-09-24 22:54:46 UTC 9,580 bytes, 268 lines download raw bytes

1/*****
2Header Interactivity
3*****/
4$(document).ready(function(){
5	if($('#global-header').length) {
6		// New Header
7		var headerIntersectPoint = parseInt($('#global-header').offset().top + $('#global-header').outerHeight(true));
8		var lastScrollPosition = 0;
9
10		$(window).scroll(function(){
11			if($(window).scrollTop() > headerIntersectPoint){
12
13				// scrolling down direction
14				if ($(this).scrollTop() > lastScrollPosition){
15					if($('#global-crumb').length){
16				  		$('#global-crumb').find('.for-fixed-container').removeClass('show');
17					}
18					$('#global-header').find('.for-fixed').removeClass('show');
19				} else {
20					if($('#global-crumb').length){
21				  		$('#global-crumb').find('.for-fixed-container').addClass('show');
22					}
23					$('#global-header').find('.for-fixed').addClass('show');
24				}
25				} else {
26					if($('#global-crumb').length){
27						$('#global-crumb').find('.for-fixed-container').removeClass('show');
28					}
29				$('#global-header').find('.for-fixed').removeClass('show');
30			}
31
32			// update last scroll position
33		    lastScrollPosition = $(this).scrollTop();
34		});
35
36		if (typeof IS_TR_LOGIN != 'undefined' && IS_TR_LOGIN == false && AUTO_LOGIN == true) {
37			$.ajax({
38			  type: 'GET',
39			  url: '/tr_json/authorize/',
40			  data: {
41				lang_id: LANG_ID
42			  },
43			  dataType: 'json',
44			  success: function(data) {	  
45				if (data != null && data.status == 'success' && !jQuery.isEmptyObject(data.dom)) {
46	  
47				  // Welcome message and name
48				  if (LANG_ID == 2 && data.dom.login_info) {
49					$('#header_mypage_open-menu .right-account-menu').html(data.dom.login_info);
50				  }
51	  
52				  if (LANG_ID == 2 && data.dom.name_info) {
53					$('#header_name_info').html(data.dom.name_info);
54					$('#header_mypage_open-menu .menu-text').html(data.dom.name_info);
55				  }
56	  
57				  //First section
58				  $('#header_mypage_move-orderhistory').addClass( "d-flex" );         
59				  $('#header_mypage_move-reviews').addClass( "d-flex" );  
60				  $('#header_mypage_move-pointhistory').addClass( "d-flex" );  
61				  $('#header_mypage_move-coupons').addClass( "d-flex" );  
62				  $('#header_mypage_move-subscription').addClass( "d-flex" );     
63			
64				  //Second section
65				  $('#second-section').css('display','block');
66				  if (LANG_ID == 2 && data.dom.email_verification_url) {
67					$('#email_verification_url').attr('href', data.dom.email_verification_url);
68					$('#email_verification_url').css('display','block');
69				  }
70	  
71				  // Login and logout
72				  $('#header_mypage_logout').css('display','block');
73				  $('#header_mypage_login').css('display','none');
74	  
75				}
76			  },
77			  error: function() {
78				console.error("tr_json/authorize failed.");
79			  }
80			});
81		} else {
82			console.log('Auto-login conditions not met or user is already logged in.');
83		}
84
85		// Category List
86		$('.open-ctglist').on('click', function() {
87			$('#ctglist').addClass('show');
88			$('.ctglist-overlay').addClass('show');
89			$('html, body').addClass('overflow-hidden');
90		});
91
92		$('#catlist_close-catlist').on('click', function() {
93			$('#ctglist').removeClass('show');
94			$('.ctglist-overlay').removeClass('show');
95			$('html, body').removeClass('overflow-hidden');
96		})
97
98		$('.ctglist-overlay').on('click', function() {
99			$('#catlist_close-catlist').trigger('click');
100		});
101
102		if($('.category-link').length) {
103			$(".category-link [data-toggle='collapse']").each(function() {
104
105				$(this).vcollapse({
106					openFirstChild: false,
107					withIndicator: false,
108				});
109
110				$(this).on("click", function() {
111					var parent = $(this).data("target");
112					$("#"+parent+".parent-ctg").toggleClass("active");
113					$("#"+parent+".parent-ctg").parent().toggleClass("active");
114					$(this).toggleClass("icon-down-o icon-up-o");
115				});
116			});
117
118			$(".category-link.selected .parent-open-trigger[data-toggle='collapse']").each(function() {
119				$(this).trigger("click");
120			});
121
122			// check for child category that has no child, open parent element
123			$(".child-category.selected [data-toggle='collapse']").each(function() {
124				var parent = $(this).data("parent");
125				$(".parent-open-trigger[data-target='"+parent+"']").trigger("click");
126				$(this).trigger("click");
127			});
128
129			// check for last child that is selected
130			$(".grandchild-category.selected").each(function() {
131				var parent = $(this).parent().attr("id");
132				var grandParent = $(".child-category [data-target='"+parent+"']").data("parent");
133				$(".parent-open-trigger[data-target='"+grandParent+"']").trigger("click");
134				$(".child-category [data-target='"+parent+"']").trigger("click");
135			});
136
137			var categoryItemLength = $('.category-link').length;
138			var categoryItemIteration = 10; 
139
140			function showAdditionalList(target, current_iteration) {
141				for (var i = 1; i <= current_iteration; i++) {
142					$(target + i).addClass('show');
143				}
144			}
145
146			$('#category-list-toggle').on('click', function(e) {
147				e.preventDefault();
148				if(categoryItemIteration < categoryItemLength) {
149					categoryItemIteration += 10;
150					if(categoryItemIteration >= categoryItemLength) {
151						$(this).hide();
152					}
153					showAdditionalList('.category-link-', categoryItemIteration);
154				}
155			});
156
157			if($(".category-link.hide-category").hasClass("selected") || $(".category-link.hide-category").children().find(".selected").length > 0) {
158				$("#category-list-toggle").hide();
159				$(".category-link.hide-category").addClass("show");
160			}
161		}
162
163		// Go back to previous page
164	    $('#navi_move-prevpage').on('click', function(e) {
165	        e.preventDefault();
166	        window.history.back();
167		});
168
169		//new header
170        var currency_code = CURRENCY_CODE;
171        currency_image_change(currency_code);
172        function currency_image_change(n){
173            if($('.new_currency_flag').length > 0){
174                var v = n.toUpperCase();
175                $(".header_btn_currency .currency-text, #side_menu_currency_change .side_menu_currency_text").text(v);
176                $(".header_btn_currency .header-currency-icon").css("background-image", "url(" + tr_path + LANG_ID + "/img/currency_flag/" + n + ".png)");
177            }
178        }
179
180		$('#side_menu_currency_change').on('click', function(){
181			$('#side_menu_currency_change').addClass('z-index-auto');
182			$('.select_currency_side_menu').addClass('show');
183			$('.side-menu-currency-overlay').show();
184		});
185
186        if ( $('.select_currency .dropdown_currency, .select_currency_side_menu .dropdown_currency').length > 0 ) {
187            var allCurrency = $('.select_currency .dropdown_currency, .select_currency_side_menu .dropdown_currency').children('li');
188            for (var i = 0; i < allCurrency.length; i++) {
189                var currency_container_id = $(allCurrency[i]).find('.currency_change_js').attr('id');
190                if (currency_container_id.replace('btn_', '').toLowerCase() === currency_code.toLowerCase()) {
191                    $(allCurrency[i]).find('a').addClass('selected');
192                }
193                var currency_img = $(allCurrency[i]).find('.currency_change_js').children('.currency-icon').find('img');
194                var currency_icon = currency_img.attr('data-original');
195                currency_img.attr('src', currency_icon)
196            }
197
198			$('.side-menu-currency-overlay, #side_menu_currency_close').on('click', function(){
199      			$('.side-menu-currency-overlay').hide();
200      			$('.select_currency_side_menu').removeClass('show');
201				$('#side_menu_currency_change').removeClass('z-index-auto');
202			});
203        }
204
205	} else {
206		// Old Header
207		var headerIntersectPoint = parseInt($('header').offset().top + $('header').outerHeight(true));
208		var lastScrollPosition = 0;
209
210		$(window).on('scroll', function(){
211			if($(window).scrollTop() > headerIntersectPoint){
212
213				// scrolling down direction
214				if ($(this).scrollTop() > lastScrollPosition){
215					if($('#crumb').length){
216				  		$('#crumb').find('.for-fixed').removeClass('show');
217					}
218					$('header').find('.for-fixed').removeClass('show');
219				} else {
220					if($('#crumb').length){
221				  		$('#crumb').find('.for-fixed').addClass('show');
222					}
223					$('header').find('.for-fixed').addClass('show');
224				}
225				} else {
226					if($('#crumb').length){
227						$('#crumb').find('.for-fixed').removeClass('show');
228					}
229				$('header').find('.for-fixed').removeClass('show');
230			}
231
232			// update last scroll position
233		    lastScrollPosition = $(this).scrollTop();
234		});
235
236
237		// Reposition header's crumb position
238		if($('#crumb').length){
239			function detectCrumbContentScroll(){
240				if($('#crumb .content')[0].scrollWidth > $('#crumb .content').width()){
241		    		$('#crumb .content').addClass('has-scroll');
242			  	} else {
243			    	$('#crumb .content').removeClass('has-scroll');
244			  	}
245			}
246
247			$(window).on('resize', function(){
248		  		detectCrumbContentScroll();
249			});
250
251			detectCrumbContentScroll();
251 // fire when on dom ready
252		}
253	}
254});
255
256// Clone a copy for fixed mode
257$(window).on('load', function(){
258	if($('#global-header').length) {
259		// New Header
260    $('#global-crumb').append('<div class="for-fixed-container overflow-hidden overflow-lg-visible"></div>')
261    $('#global-crumb').find('.content').clone(true).addClass('for-fixed').removeClass('pl-sm-0').appendTo('.for-fixed-container');
262	} else {
263		// Old Header
264		$('#crumb').find('.content').clone().addClass('for-fixed').appendTo('#crumb');
265		$('header').find('.open-search-menu-list').clone(true).addClass('for-fixed').attr('id', 'floating_menu_open-menu').appendTo('.search-menu');
266		$('#floating_menu_open-menu').find('.text-dark-gray').text($('#floating_menu_open-menu').attr('data-floating-text'));
267	}
268});

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.