PageSourceSearch

https://leotechnologies.com/wp-content/themes/leotech/js/custom.js?time=1791058616

js leotechnologies.com collected 2026-10-03 20:17:53 UTC 54,816 bytes, 1,285 lines download raw bytes

1jQuery(document).ready(function(){
2    console.log('this running');
3    var tabs = jQuery('.real_impact .content-area .tabs_area .top_area .tab_title_area a');
4    var tab_content = jQuery('.real_impact .content-area .tabs_area .tab_area .tab_content[id]');
5    var intervalTime = 6000; // 4 seconds
6    var tabInterval;
7
8    function rotateTabs() {
9        var onTab = tabs.filter('.active');
10        var nextTab;
11
12		console.log('rotate tabs', onTab.index(), tab_content.length - 1)
13        if (onTab.index() < tab_content.length - 1) {
14            nextTab = onTab.next();
15        } else {
16            nextTab = tabs.first();
17        }
18
19        // Deactivate current tab and content
20        onTab.removeClass('active');
21        tab_content.removeClass('active');
22        tab_content.removeClass('done_animation');
23
24        // Activate the next tab and corresponding content
25        nextTab.addClass('active');
26        var nextTabId = nextTab.data('tab');
27        jQuery('#' + nextTabId).addClass('active');
28        setTimeout(() => {
29            jQuery('#' + nextTabId).addClass('done_animation');
30        }, 50);
31        jQuery('.real_impact .content-area .tabs_area .top_area .right_area .wrap svg').removeClass('active');
32        setTimeout(() => {            
33            jQuery('.real_impact .content-area .tabs_area .top_area .right_area .wrap svg').addClass('active');
34        }, 10);
35    }
36
37    if(jQuery("[data-fancybox]").length){
38        jQuery("[data-fancybox]").fancybox({
39            afterClose: function(instance, current) {
40                if( jQuery('.real_impact .content-area .tabs_area .tab_area .tab_content .img_area .play_wrapper').length) {
41                    tabInterval = setInterval(rotateTabs, intervalTime);
42                    jQuery('.real_impact .content-area .tabs_area .top_area .right_area .wrap .active .stroke-draw').removeClass('stop_animation');
43                }
44            }
45        });
46    }
47
48    function rotateStopTabs() {
49        clearInterval(tabInterval);
50    }
51
52    jQuery(document).on('click', '.real_impact .content-area .tabs_area .tab_area .tab_content .img_area a', function(e){
53        rotateStopTabs();
54        jQuery('.real_impact .content-area .tabs_area .top_area .right_area .wrap .active .stroke-draw').addClass('stop_animation');
55    })
56
57    if(window.matchMedia('(min-width: 767.98px)').matches) {
58        if(jQuery('.real_impact .content-area .tabs_area .top_area .tab_title_area').length) {
59            var st = jQuery(window).scrollTop();
60            var sectionTop = jQuery('.real_impact .content-area .tabs_area .top_area .tab_title_area').offset().top; 
61
62            if (st > sectionTop - 600) {
63                if(window.matchMedia('(min-width: 767.98px)').matches) {
64                    jQuery('.real_impact .content-area .tabs_area .top_area .right_area .wrap svg').addClass('active');
65                    tabInterval = setInterval(rotateTabs, intervalTime);
66                }
67            }
68
69            tabs.click(function() {
70                // Stop the current interval and restart it
71                jQuery('.real_impact .content-area .tabs_area .top_area .right_area .wrap svg').removeClass('active');
72                setTimeout(() => {            
73                    jQuery('.real_impact .content-area .tabs_area .top_area .right_area .wrap svg').addClass('active');
74                }, 10);
75
76                clearInterval(tabInterval);
77                tabs.removeClass('active');
78                tab_content.removeClass('active');
79                tab_content.removeClass('done_animation');
80
81                jQuery(this).addClass('active');
82                var currentTabId = jQuery(this).data('tab');
83                setTimeout(() => {
84                    jQuery('#' + currentTabId).addClass('done_animation');
85                }, 50);
86                
87                if(window.matchMedia('(min-width: 767.98px)').matches) {
88                    // Restart the interval after a user interaction
89                    tabInterval = setInterval(rotateTabs, intervalTime);
90                } else {
91                    let childOffsetLeft  = jQuery(this).offset().left;
92                    var parentOffsetLeft = jQuery(this).parent().offset().left;
93                    var parentScrollLeft = jQuery(this).parent().scrollLeft();
94                    var relativeLeftPosition = childOffsetLeft - parentOffsetLeft + parentScrollLeft;
95                    console.log(relativeLeftPosition);
96                    jQuery(".real_impact .content-area .tabs_area .top_area .tab_title_area").scrollLeft(relativeLeftPosition);
97                    // if(currentTabId == 'tab_impact_1') {
98                    //     jQuery(".real_impact .content-area .tabs_area .top_area .tab_title_area").scrollLeft(0);
99                    // } else if(currentTabId == 'tab_impact_2') {
100                    //     jQuery(".real_impact .content-area .tabs_area .top_area .tab_title_area").scrollLeft(213);
101                    // } else {
102                    //     jQuery(".real_impact .content-area .tabs_area .top_area .tab_title_area").scrollLeft(425);
103                    // }
104                }
105            })
106        }
107    }
108
109
110    jQuery(window).scroll(function (event) {
111        var st = jQuery(window).scrollTop();
112
113        if(jQuery('.real_impact .content-area .tabs_area .top_area .tab_title_area').length) {
114            var sectionTop = jQuery('.real_impact .content-area .tabs_area .top_area .tab_title_area').offset().top; 
115            sectionTop = sectionTop - 600;
116            if (st > sectionTop) {
117                if(!tabInterval) {
118                    if(window.matchMedia('(min-width: 767.98px)').matches) {
119                        jQuery('.real_impact .content-area .tabs_area .top_area .right_area .wrap svg').addClass('active');
120                        tabInterval = setInterval(rotateTabs, intervalTime);
121                    }
122                }
123            }
124        }
125
126        if(jQuery('footer .footer-menu').length) {
127            var sectionTop = jQuery('footer .footer-menu').offset().top; 
128            sectionTop = sectionTop - 700;
129
130            if (st > sectionTop) {
131                jQuery('.see_leotech:last-child').addClass('smaller_animation');
132            } else {
133                jQuery('.see_leotech:last-child').removeClass('smaller_animation');
134
135            }
136        }
137		
138		if( jQuery(".three_tiers .content-area .slider_area").length ) {
139			var element_pos = jQuery(".three_tiers").offset().top;
140			var elemen_pos_bottom = element_pos + jQuery(".three_tiers").height();
141
142			if( st > element_pos && st < elemen_pos_bottom ) {
143				//$('html').attr('style', 'overflow:hidden !important');
144			}
145		}
146    })
147
148    if(jQuery(".real_impact .content-area .tabs_area .top_area .tab_title_area").length) {
149        if(window.matchMedia('(max-width: 767.98px)').matches) {
150            jQuery(".real_impact .content-area .tabs_area .top_area .tab_title_area").scroll(function() {
151                jQuery('.real_impact .content-area .tabs_area .top_area .tab_title_area a').each(function(e){
152                   if(jQuery(this).offset().left < 60 && jQuery(this).offset().left > 0) {
153                    if(!jQuery(this).hasClass('active')) {
154                        jQuery(this).trigger('click');
155                    }
156                   }
157                })
158        
159            })
160        }
161    }
162
163    jQuery('.homepage-video .wrap_homepage .testimonial_w_slider .bottom_sliders .cursor_left').on('click', function(e){
164        jQuery('.homepage-video .wrap_homepage .content-area .testimonial_w_slider .bottom_sliders .slick-prev.slick-arrow').trigger('click');
165    })
166
167    jQuery('.homepage-video .wrap_homepage .testimonial_w_slider .bottom_sliders .cursor_right').on('click', function(e){
168        jQuery('.homepage-video .wrap_homepage .content-area .testimonial_w_slider .bottom_sliders .slick-next.slick-arrow').trigger('click');
169    })
170
171    jQuery(document).on('mouseover', "header:not(.moving_position) .main-header .header-container .menu-area .menu-area-box .menu-links .menu-link.w-megamenu", function(){
172        jQuery('body').addClass('push_to_bottom');
173    });
174    
175    jQuery(document).on('mouseout', "header:not(.moving_position) .main-header .header-container .menu-area .menu-area-box .menu-links .menu-link.w-megamenu", function(){
176        jQuery('body').removeClass('push_to_bottom');
177    });
178
179    jQuery(window).scroll(function (event) {
180        var st = jQuery(window).scrollTop();
181        if (st < 20) {
182        } else {
183            jQuery('body').removeClass('push_to_bottom');
184        }
185    })
186
187    if(jQuery('.trusted_agencies').length) {
188        if(window.matchMedia("(min-width: 1025px)").matches) {
189            gsap.registerPlugin(ScrollTrigger);
190
191            var loadPos= jQuery(window).scrollTop();
192            var loadSectionTop = jQuery("#trusted_agencies_section").offset().top; 
193
194            jQuery(window).scroll(function () {
195                var scrollPos = jQuery(window).scrollTop();
196
197                 var sectionTop = jQuery("#trusted_agencies_section").offset().top; 
198
199                 if (scrollPos > (sectionTop - 2000)) {
200                    jQuery("#trusted_agencies_section").addClass("active");
201                 }
202            })
203
204            console.log(loadPos);
205            console.log(loadSectionTop);
206
207            if (loadPos > (loadSectionTop - 1000)) {
208                jQuery("#trusted_agencies_section").addClass("active_testi active_manually active");
209            } else {
210                let st = gsap.fromTo(".custom_scroll_affect", 
211                    { scale: 0.2 }, // Start state: Smaller
212                    {
213                        scale: 1, // End state: Larger
214                        scrollTrigger: {
215                            snap: null,
216                            trigger: ".trusted_agencies", // Container that starts the animation
217                            start: 'top +=600',
218                            end: "+=400",
219                            scrub: true,
220                            once: true,
221                            markers: false
222                        }
223                    }
224                );
225            
226                const tl = gsap.timeline({
227                    scrollTrigger: {
228                        trigger: '.trusted_agencies',
229                        snap: null,
230                        start: 'top top',
231                        end: "+=900",
232                        pin: true,
233                        markers: false,
234                        once: true,
235                        onLeave: (self) => {
236                            jQuery("#trusted_agencies_section").addClass("active_testi active_manually active active_bg");
237                            st.kill(true);
238                            self.disable(false);
239                            window.scrollTo(0, self.start);
240                            ScrollTrigger.refresh();
241                        },
242                        onEnter: (self) => {
243                            jQuery("#trusted_agencies_section").addClass("active");
244                        },
245                        onUpdate: (self) => {
246                            const currentScrollPos = self.scroll();
247                            // console.log(currentScrollPos);
248                            console.log(currentScrollPos, self);
249//                             if(currentScrollPos > 6776 && currentScrollPos < 7280) {
250                             if(self.progress > .25 && self.progress < .5) {
251                                if(jQuery('.trusted_agencies.active_manually').length == 0) {
252                                    jQuery("#trusted_agencies_section").addClass("active_blue");
253                                    jQuery(".trusted_wrapper").addClass("active_testi");
254                                }
255                            } else {
256                                jQuery("#trusted_agencies_section").removeClass("active_blue");
257                            }
258                            
259//                             if(currentScrollPos > 7280) {
260                            if(self.progress >= .5) {
261                                jQuery("#trusted_agencies_section").addClass("active_testi active_manually");
262                                jQuery("#trusted_agencies_section").removeClass("active_blue");
263                            } else {
264                                // jQuery("#trusted_agencies_section").removeClass("active_testi");
265                            }
266                        },
267                    }
268                });
269            }
270
271            // console.log(st.start);
272
273            // tl.to('.trusted_agencies .bg_area', {
274            //     scale: 1
275            // })
276        }
277    }
278
279//     if(jQuery('.three_tiers .content-area .slider_area').length) {
280//         let isTweening = false;
281//         // jQuery('.three_tiers .content-area .slider_area').on('wheel', (function (e) {
282//         //     let $slider = jQuery('.three_tiers .content-area .slider_area');
283//         //     var currentSlide = $slider.slick('slickCurrentSlide'); // Get the current 0-based index
284//         //     // Get the total number of slides. Note: slideCount gives total slides
285//         //     var totalSlides = $slider.slick('getSlick').slideCount;
286//         //     var slidesToScroll = $slider.slick('getSlick').options.slidesToScroll;
287
288//         //     var lastIndex = totalSlides - slidesToScroll; 
289//         //     if(currentSlide == lastIndex) {
290//         //         return;
291//         //     } else {
292//         //         e.preventDefault();
293//         //     }
294
295//         //     if (isTweening) return;
296
297
298
299//         //     isTweening = true;
300
301//         //     if (e.originalEvent.deltaY < 0) {
302//         //         jQuery(this).slick('slickPrev');
303//         //     } else {
304//         //         jQuery(this).slick('slickNext');
305//         //     }
306
307//         //     // Reset the tweening flag after the slide transition completes
308//         //     // Slick has events like 'afterChange' you can use for this
309//         //     // The duration is an estimate, adjust based on your slick speed
310//         //     gsap.to({}, {duration: 0.3, onComplete: () => isTweening = false}); 
311//         // }))
312
313//         let total_slide = jQuery('.three_tiers .content-area .slider_area .item').length;
314//         let count_total = total_slide * 200;
315
316// 		// debounce from underscore.js
317// 		function debounce(func, wait, immediate) {
318// 			var timeout;
319// 			return function() {
320// 				var context = this, args = arguments;
321// 				var later = function() {
322// 					timeout = null;
323// 					if (!immediate) func.apply(context, args);
324// 				};
325// 				var callNow = immediate && !timeout;
326// 				clearTimeout(timeout);
327// 				timeout = setTimeout(later, wait);
328// 				if (callNow) func.apply(context, args);
329// 			};
330// 		};
331		
332// 		function throttle(fn, interval) {
333// 		  let lastTime = 0;
334// 		  return function (...args) {
335// 			const now = Date.now();
336// 			if (now - lastTime >= interval) {
337// 			  lastTime = now;
338// 			  fn.apply(this, args);
339// 			}
340// 		  };
341// 		}
342
343// 		// use x and y mousewheel event data to navigate flickity
344// // 		function slick_handle_wheel_event(e, slick_instance, slick_is_animating) {
345// // 		  // do not trigger a slide change if another is being animated
346// // 		  if (!slick_is_animating) {
347// // 			// pick the larger of the two delta magnitudes (x or y) to determine nav direction
348// // 			var direction =
349// // 			  Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY;
350
351// // 			//console.log("wheel scroll ", e.deltaX, e.deltaY, direction);
352
353// // 			if (direction > 0) {
354// // 			  // next slide
355// // 			  slick_instance.slick("slickNext");
356// // 			} else {
357// // 			  // prev slide
358// // 			  slick_instance.slick("slickPrev");
359// // 			}
360// // 		  }
361// // 		}
362
363// 		// debounce the wheel event handling since trackpads can have a lot of inertia
364// // 		var slick_handle_wheel_event_debounced = debounce( 
365// // 		  slick_handle_wheel_event
366// // 		  , 100, true
367// // 		);
368// // 		throttle(  slick_handle_wheel_event  , 500)
369
370// 		var slick_is_animating = false;
371//         var complete_slider = false;
372//         var first_slider = true;
373//         var lastScrollTopNew = 0; // Initialize the variable to store the last scroll position
374//         var deltaNew = 50;
375//         let functionOnce = 0;
376//         let currentSlideSlick = 0;
377//         let totalSlidesSlick = jQuery('.three_tiers .content-area .slider_area .item').length;
378
379//         jQuery(".three_tiers .content-area .slider_area").on(
380//             "beforeChange",
381//             function (event, slick, currentSlide, nextSlide) {
382//                 // jQuery(':not(.page-id-694) .three_tiers .content-area .slider_area .item .right_area .icon_area .wrap .stroke-draw').addClass('reset_animation');
383//                 slick_is_animating = true;
384//                 // if(!complete_slider) {
385//                 // }
386//             },
387//         );
388
389//         jQuery(".three_tiers .content-area .slider_area").on(
390//             "afterChange",
391//             function (event, slick, currentSlide) {
392//                 // jQuery(':not(.page-id-694) .three_tiers .content-area .slider_area .item .right_area .icon_area .wrap .stroke-draw').removeClass('reset_animation');
393// 				slick_is_animating = false;
394// 				currentSlideSlick = currentSlide;
395//                 console.log(currentSlide);
396// 				if( currentSlide == (slick.slideCount-1) ) {
397//                     // $('html').removeAttr('style');
398//                     complete_slider = true;
399//                     // jQuery('.three_tiers .content-area .slider_area .item .right_area .icon_area .wrap .stroke-draw').addClass('completed_animation');
400//                     // functionOnce = 1;
401//                     // jQuery(".three_tiers .content-area .slider_area ").slick("slickPlay");
402//                     // setTimeout(() => {
403//                     //     jQuery(".three_tiers .content-area .slider_area").slick('slickGoTo', 0);
404//                     // }, 7300);
405
406// 				} else if( currentSlide == 0 ) {
407// 					// $('html').removeAttr('style');
408//                     // complete_slider = true;
409// 				} else {
410// 					//$('html').attr('style', 'overflow:hidden !important');
411//                     complete_slider = false;
412// 				}
413//             },
414//         );
415
416// // 		let sliderActivated = false;;
417// //         let moveOnce = 0;
418// //         function activateSlider() {
419// //             document.body.style.overflow = 'hidden';
420            
421// //             // Lock scroll position
422// //             const scrollY = window.scrollY;
423// //             // console.log(scrollY);
424// //             document.body.style.position = 'fixed';
425// //             if(scrollY !== 0) {
426// //                 document.body.style.top = `-${scrollY}px`;
427// //             }
428// //             document.body.style.width = '100%';
429
430// //             jQuery('header').addClass('moving_position hide_header scrolljacking_position');
431// // 			sliderActivated = true
432// //         }
433
434// //         function deactivateSlider() {
435// //             // Restore scroll position
436// //             const scrollY = document.body.style.top;
437// //             document.body.style.position = '';
438// //             document.body.style.top = '';
439// //             document.body.style.overflow = '';
440// //             document.body.style.width = '';
441// //             window.scrollTo(0, parseInt(scrollY || '0') * -1);
442// // 			sliderActivated = false;
443// //             jQuery('header').removeClass('scrolljacking_position');
444// //         }
445		
446
447// //         let timeoutId;
448// //         let moveOnce = 0;
449		
450// //		const nextThreeTiersSlide = debounce(function() {
451// //			console.log('move once check', moveOnce)
452// //			if (moveOnce) { return }
453// //			console.log('next')
454// //			moveOnce = 1;
455// //			setTimeout(function() {
456// //				moveOnce = 0;
457// //				console.log('move once off', moveOnce)
458// //			}, 2000)
459// //			jQuery('.three_tiers .content-area .slider_area').slick('slickNext');
460// //		}, 2000, true)
461// //		const prevThreeTiersSlide = debounce(function() {
462// //			console.log('move once check', moveOnce)
463// //			if (moveOnce) { return }
464// //			console.log('prev')
465// //			moveOnce = 1;
466// //			setTimeout(function() {
467// //				moveOnce = 0;
468// //				console.log('move once off', moveOnce)
469// //			}, 2000)
470// //			jQuery('.three_tiers .content-area .slider_area').slick('slickPrev');
471// //		}, 2000, true)
472//  //       function handleScroll(event) {
473// // 			if (moveOnce) {
474// // 				event.preventDefault();
475// // 				return;
476// // 			}
477			
478//             // const delta = event.deltaY || event.detail || event.wheelDelta;
479
480//             // console.log('scrolling works');
481
482//             if(jQuery('.three_tiers .trigger_tiers').length) {
483//                 if(window.matchMedia('(min-width: 991.98px)').matches) {
484//                     let offset_top = jQuery('.three_tiers .trigger_tiers').offset().top - 300;
485
486//                     if(window.matchMedia('(max-width: 1536.98px)').matches) {
487//                         offset_top = jQuery('.three_tiers .trigger_tiers').offset().top - 200;
488//                     }
489
490//                     if(window.matchMedia('(max-width: 1440.98px)').matches) {
491//                         offset_top = jQuery('.three_tiers .trigger_tiers').offset().top - 300;
492//                     }
493
494//                     if(window.matchMedia('(max-width: 1366.98px)').matches) {
495//                         offset_top = jQuery('.three_tiers .trigger_tiers').offset().top - 200;
496//                     }
497
498//                     if(window.matchMedia('(max-width: 1266.98px)').matches) {
499//                         offset_top = jQuery('.three_tiers .trigger_tiers').offset().top - 200;
500//                     }
501//                     var scrollPosition = jQuery(window).scrollTop();
502        
503//                     if(scrollPosition > offset_top && scrollPosition < (offset_top + 100)) {
504// // 						moveOnce
505//                         activateSlider();
506						
507//                         if (delta > 0 && currentSlideSlick < totalSlidesSlick - 1) {
508//                             if(moveOnce === 0) {
509// //                                 moveOnce = 1;
510//                                 // Scroll down within slider
511// 								nextThreeTiersSlide()
512                               
513//                                 console.log('this running');
514//                                 console.log(moveOnce);
515//                             }
516//                             event.preventDefault();
517//                         } else if (delta < 0 && currentSlideSlick > 0) {
518//                             // Scroll up within slider
519//                             if(moveOnce === 0) {
520// //  moveOnce = 1;
521//                                 // Scroll down within slider
522                           
523// 								prevThreeTiersSlide()
524//                             }
525//                             event.preventDefault();
526//                         } else if (sliderActivated && delta > 0 && currentSlideSlick === totalSlidesSlick - 1) {
527//                             // At last slide, exit and continue scrolling down
528//                             const scrollY = parseInt(document.body.style.top || '0') * -1;
529//                             deactivateSlider();
530// 							moveOnce = 0;
531//                             // currentSlideSlick = 0;
532// //                             setTimeout(() => {
533// //                                 window.scrollTo(0, scrollY);
534// //                             }, 10);
535//                             // event.preventDefault();
536//                             return;
537//                         } else if (sliderActivated && delta < 0 && currentSlideSlick === 0) {
538//                             // At first slide, exit and continue scrolling up
539//                             const scrollY = parseInt(document.body.style.top || '0') * -1;
540//                             deactivateSlider();
541// 							 moveOnce = 0;
542//                             // currentSlideSlick = 0;
543//                             setTimeout(() => {
544//                                 window.scrollTo(0, scrollY - 100);
545//                             }, 10);
546//                             event.preventDefault();
547//                             return;
548//                         }
549//                     }
550
551//                     if(moveOnce) {
552// //                         clearTimeout(timeoutId);
553// //                         timeoutId = setTimeout(() => {
554// //                             moveOnce = 0;
555// //                         }, 1000);
556//                     } else {
557//                         return;
558//                     }
559               
560// 				} else if (sliderActivated) {
561// 					 deactivateSlider();
562// 					moveOnce = 0;
563// 				}
564// 			}
565//         }
566
567//         window.addEventListener('wheel', handleScroll, { passive: false });
568
569        // function disabled_scrolling(e) {
570        //     jQuery('body, html').css({'overflow': 'hidden'});
571        //     var storedPosition = jQuery('body').data('scroll-position');
572            
573        //     if (storedPosition) {
574        //         e.preventDefault();
575        //         window.scrollTo(0, storedPosition);
576        //         // jQuery(window).scrollTop(storedPosition);
577        //     }
578        // }
579
580        // let scrollOnce = 0;
581        // let offset_top_first = jQuery('body.page-id-694 .three_tiers .trigger_tiers').offset().top - 100;
582        // var scrollPositionTop = jQuery(window).scrollTop();
583        // let moving_sensitivy = false;
584
585        // window.addEventListener('wheel', (event) => {
586        //     // event.deltaY provides the vertical scroll amount
587        //     // A positive value means scrolling down, negative means scrolling up
588        //     const scrollDistance = event.deltaY;
589        //     // console.log('Scroll distance per event:', scrollDistance);
590        //     // console.log(Math.abs(scrollDistance));
591
592        //     if (Math.abs(scrollDistance) > 80) {
593        //         moving_sensitivy = true;
594        //     }  else {
595        //         moving_sensitivy = false;
596        //     }
597        // }, {passive: false});
598
599        // jQuery(window).scroll(function (e) {
600        //     if(jQuery('body.page-id-694 .three_tiers .trigger_tiers').length && !functionOnce && scrollPositionTop < offset_top_first) {
601
602        //         if(window.matchMedia('(min-width: 991.98px)').matches) {
603        //             let offset_top = jQuery('body.page-id-694 .three_tiers .trigger_tiers').offset().top - 100;
604        //             var scrollPosition = jQuery(window).scrollTop();
605        
606        //             if(scrollPosition > offset_top && scrollPosition < (offset_top + 800)) {
607        //                 jQuery('body').attr('data-scroll-position', scrollPosition);
608        //                 if(!complete_slider) {
609        //                     disabled_scrolling(e);
610        //                 }
611
612        //                 if(moving_sensitivy) {
613        //                     if (scrollPosition > lastScrollTopNew) {
614        //                         if(!scrollOnce) {
615        //                             scrollOnce = 1;
616        //                             jQuery('.three_tiers .content-area .slider_area').slick('slickNext');
617        //                         }
618        //                     } else {
619        //                         if(jQuery('.three_tiers .content-area .slider_area .item.slick-active:last-child').length) {
620        //                             // complete_slider = false;
621        //                         }
622        //                         if(!scrollOnce) {
623        //                             scrollOnce = 1;
624        //                             jQuery('.three_tiers .content-area .slider_area').slick('slickPrev');
625        //                         }
626        //                     }
627    
628        //                     setTimeout(() => {
629        //                         scrollOnce = 0;
630        //                     }, 1000);
631        //                 } 
632
633                        
634        //                 // Update the last scroll position to the current position for the next check
635        //                 lastScrollTopNew = scrollPosition;
636
637        //             } else {
638        //             }
639        //         }
640        //     }
641        // })
642
643
644        // if(jQuery('.page-id-694').length) {
645        //     const tl = gsap.timeline({
646        //         scrollTrigger: {
647        //             trigger: '.trigger_tiers',
648        //             start: 'top +=290',
649        //              pinSpacing: false,
650        //             end: "+=" + count_total,
651        //             pin: true,
652        //             markers: false,
653        //             // snap: null,
654        //             onEnter: (self) => {
655        //             },
656        //             onUpdate: (self) => {
657        //                 if (self.direction === 1) {
658        //                     jQuery('.three_tiers .content-area .slider_area').slick('slickNext');
659                         
660        //                     // Add your scroll down logic here
661        //                 } else if (self.direction === -1) {
662        //                     console.log("Scrolling Up/Backward");
663        //                     // Add your scroll up logic here
664        //                     jQuery('.three_tiers .content-area .slider_area').slick('slickPrev');
665        //                 }
666        //             },
667        //         }
668        //     });
669        // }
670//     }
671
672    // jQuery(document).on('click', '.partnerships .content-area .filter-area .filter-container button', function(e){
673    //     e.preventDefault();
674    //     let data_filter = jQuery(this).attr('data-filter');
675    //     console.log(data_filter);
676    //     if(data_filter == 'all') {
677    //         jQuery('.partnerships .content-area .partnerships-logos .partnerships-logo').removeClass('d-none');
678    //     } else {
679    //         jQuery('.partnerships .content-area .partnerships-logos .partnerships-logo').removeClass('d-none');
680    //         jQuery(`.partnerships .content-area .partnerships-logos .partnerships-logo:not(.${data_filter})`).addClass('d-none');
681
682    //     }
683    // })
684
685    if(jQuery('.solutions-inner-hero .content-area .bottom-animation-boxes .column-boxes .column-box').length) {
686        jQuery('.solutions-inner-hero .content-area .bottom-animation-boxes .column-boxes .column-box').each(function(item) {
687            if(jQuery(this).find('.full-width').length) {
688                jQuery(this).addClass('v2');
689            }
690        })
691        jQuery('.solutions-inner-hero .content-area .bottom-animation-boxes .column-boxes .column-box').addClass('active');
692    }
693
694    jQuery(
695      "header .main-header .header-container .menu-area .menu-area-box .menu-links .menu-link .menu_sub .box_wrap .left_area .headiline_link",
696    ).hover(
697      function () {
698        jQuery("header .main-header .header-container .menu-area .menu-area-box .menu-links .menu-link .menu_sub .box_wrap .left_area .headiline_link").removeClass('hover_active');
699        jQuery("header .main-header .header-container .menu-area .menu-area-box .menu-links .menu-link .menu_sub .box_wrap .left_area .sub_links .sub_link").removeClass('hover_active');
700        jQuery(this).addClass('hover_active');
701      }
702    );
703
704    jQuery(document).on("mouseover", function (e) {
705      if (
706        !jQuery(e.target).is(
707          "header .main-header .header-container .menu-area .menu-area-box .menu-links .menu-link .menu_sub .box_wrap .left_area",
708        ) &&
709        !jQuery(e.target).closest(".left_area").length &&
710        !jQuery(e.target).is(
711          "header .main-header .header-container .menu-area .menu-area-box .menu-links .menu-link .menu_sub .box_wrap .right_area",
712        ) &&
713        !jQuery(e.target).closest(".right_area").length
714      ) {
715        jQuery("header .main-header .header-container .menu-area .menu-area-box .menu-links .menu-link .menu_sub .box_wrap .left_area .headil
715ine_link").removeClass('hover_active');
716        jQuery("header .main-header .header-container .menu-area .menu-area-box .menu-links .menu-link .menu_sub .box_wrap .left_area .sub_links .sub_link").removeClass('hover_active');
717      }
718    });
719
720    jQuery(
721      "header .main-header .header-container .menu-area .menu-area-box .menu-links .menu-link .menu_sub .box_wrap .left_area .sub_links .sub_link",
722    ).hover(
723      function () {
724        jQuery("header .main-header .header-container .menu-area .menu-area-box .menu-links .menu-link .menu_sub .box_wrap .left_area .headiline_link").removeClass('hover_active');
725        jQuery("header .main-header .header-container .menu-area .menu-area-box .menu-links .menu-link .menu_sub .box_wrap .left_area .sub_links .sub_link").removeClass('hover_active');
726        jQuery(this).addClass('hover_active');
727      }
728    );
729
730    jQuery(document).on("gform_post_render", function (e, form_id) {
731        // jQuery(`#gform_fields_${form_id} label`).addClass('visually-hidden');
732        // jQuery(`#gform_fields_${form_id} .gchoice label`).removeClass('visually-hidden');
733        // jQuery('.form-yellow-bg .content-area .yellow-box .form-box #gform_fields_1 legend').addClass('visually-hidden');
734        jQuery(`#gform_fields_${form_id} .gfield:not(.gform_hidden)`).each(function(e){
735            if(jQuery(this).hasClass('gfield_contains_required')) {
736                jQuery(this).wrap('<div class="form-box required" />');
737            } else {
738                jQuery(this).wrap('<div class="form-box" />');
739            }
740        })
741
742        // jQuery(`#gform_fields_${form_id} .gfield.gfield--width-half`).each(function(e){
743        //     jQuery(this).wrap('<div class="form-column half" />');
744        // })
745
746        jQuery(`#gform_fields_${form_id} .gchoice input`).removeClass('form-control');
747
748        jQuery(`#gform_fields_${form_id} .gfield_radio`).addClass('radio-input');
749
750        jQuery(`#gform_fields_${form_id} .gfield_radio .gchoice`).addClass('form-check');
751
752        jQuery(`#gform_fields_${form_id} .gfield_radio .gchoice .gfield-choice-input`).addClass('form-check-input');
753
754        jQuery(`#gform_${form_id} .gform_footer`).addClass(`form-submit w-100 text-end`);
755        // jQuery(`#gform_${form_id} .gform_footer`).append('<p class="smallest"><strong>*Required Field</strong></p>');
756
757        if(jQuery(`#gform_${form_id}`).closest('.purchase-orders').length) {
758            jQuery(`#gform_${form_id} .gform_footer`).find('button span').removeClass('grey_color');
759        }
760
761        jQuery('.contact-us .bottom-area .content-area .column-boxes .column-left form').addClass('active');
762        jQuery('.request-a-demo .content-area .content-boxes .right-area form').addClass('active');
763        jQuery('.dir-container .content-area .purchase-orders form').addClass('active');
764    });
765
766    
767    if(jQuery('.news-resources-archive .content-area .news-boxes .news-box').length) {
768        // Don't remove featured posts
769
770        // if (typeof featured_post !== undefined) {
771        //     featured_post.forEach(function(item) {
772        //         jQuery(`.news-resources-archive .content-area .news-boxes .news-box[data-post="${item}"]`).remove();
773        //     })
774        // }
775
776        if(typeof data_post !== undefined) {
777            let arr_filter = [];
778            let arr_tag = [];
779            data_post.forEach(function(item) {
780                let post_id = item.post_id;
781                let category_post = item.category_post;
782                // if(!featured_post.includes(post_id)) {
783                    if(category_post) {
784                        category_post.forEach(function(item) {
785                            if(!arr_tag.includes(item.slug)) {
786                                arr_tag.push(item.slug);
787                                arr_filter.push({
788                                    'name': item.name,
789                                    'slug': item.slug,
790                                });
791                            }
792                        })
793                    }
794                // }
795            })
796
797            if(arr_filter.length) {
798                arr_filter.forEach(function(item){
799                    jQuery(`.news-resources-archive .content-area .filter-area .filter-container [data-filter=${item.slug}]`).removeClass('d-none');
800                })
801            }
802
803            jQuery('.news-resources-archive .content-area .filter-area .filter-container').addClass('show');
804        }
805
806        jQuery('.news-resources-archive .content-area .news-boxes .news-box').slice(0, 6).addClass('active');
807
808        if(jQuery('.news-resources-archive .content-area .news-boxes .news-box').length > 6) {
809            jQuery('.news-resources-archive .content-area .load-more').removeClass('d-none');
810        }
811
812        jQuery(document).on('click', '.news-resources-archive .content-area .load-more button', function(e){
813            e.preventDefault();
814            jQuery('.news-resources-archive .content-area .news-boxes .news-box').addClass('active');
815            jQuery(this).parent().addClass('d-none');
816        })
817
818        jQuery(document).on('click', '.news-resources-archive .content-area .filter-area .filter-container button', function(e){
819            e.preventDefault();
820            jQuery(
821            ".news-resources-archive .content-area .filter-area .filter-container button",
822            ).removeClass("active");
823            jQuery(this).toggleClass("active");
824            var h6textnews = jQuery(this).text();
825            jQuery(
826            ".news-resources-archive .content-area .filter-area .filter-toggle h6",
827            ).text(h6textnews);
828            jQuery(
829            ".news-resources-archive .content-area .filter-area .filter-toggle",
830            ).removeClass("active");
831            jQuery(
832            ".news-resources-archive .content-area .filter-area .filter-container",
833            ).removeClass("active");
834            let filter = jQuery(this).attr('data-filter');
835
836
837            if(filter == 'all') {
838                jQuery('.news-resources-archive .content-area .news-boxes .news-box').removeClass('active');
839                jQuery('.news-resources-archive .content-area .news-boxes .news-box').slice(0, 6).addClass('active');
840                if(jQuery('.news-resources-archive .content-area .news-boxes .news-box').length > 6) {
841                    jQuery('.news-resources-archive .content-area .load-more').removeClass('d-none');
842                } else {
843                    jQuery('.news-resources-archive .content-area .load-more').addClass('d-none');
844                }
845            } else {
846                jQuery('.news-resources-archive .content-area .news-boxes .news-box').removeClass('active');
847                jQuery(`.news-resources-archive .content-area .news-boxes .news-box.${filter}`).addClass('active');
848                jQuery('.news-resources-archive .content-area .load-more').addClass('d-none');
849            }
850        })
851
852    }
853
854    if(jQuery('.dir-container .content-area .wp-block-table table').length) {
855        jQuery('.dir-container .content-area .wp-block-table table').each(function(){
856            jQuery(this).wrap('<div class="mobile_overflow" />');
857        })
858    }
859
860    if(jQuery('.resources-post-content .content-area .content-box .wp-block-table table').length) {
861        jQuery('.resources-post-content .content-area .content-box .wp-block-table table').each(function(){
862            jQuery(this).wrap('<div class="mobile_overflow" />');
863        })
864    }
865
866    if(jQuery('.solutions-hero .scroll-container').length) {
867        if(window.matchMedia('(min-width: 768px)')) {
868            // const scrollContainer = document.querySelector(".main_wrap_page");
869            const scrollContainer = document.querySelector(".page-template-default");
870            const scrolljackSection = document.querySelector(".scrolljack-section");
871            const gridContainer = document.querySelector(".grid-container");
872            const gridItems = document.querySelectorAll(".grid-item");
873    
874            function clamp(v, min, max) {
875                return Math.max(min, Math.min(max, v));
876            }
877    
878            function setScrolljackHeight() {
879                const points = gridItems.length;
880                scrolljackSection.style.height = `${points * window.innerHeight}px`;
881            }
882    
883            function getActiveIndex() {
884                const start = scrolljackSection.offsetTop;
885                const scrollTop = scrollContainer.scrollTop;
886                const relative = scrollTop - start;
887                const index = Math.floor(relative / window.innerHeight);
888                return clamp(index, 0, gridItems.length - 1);
889            }
890    
891            function centerItem(index) {
892                const item = gridItems[index];
893                const maxTranslate = Math.max(
894                    0,
895                    gridContainer.scrollWidth - scrollContainer.clientWidth
896                );
897                const target =
898                    item.offsetLeft - (scrollContainer.clientWidth - item.clientWidth) / 2;
899                const clamped = clamp(target, 0, maxTranslate);
900                gridContainer.style.transform = `translateX(-${clamped}px)`;
901            }
902    
903            function update() {
904                const idx = getActiveIndex();
905                gridItems.forEach((item, i) => item.classList.toggle("active", i === idx));
906                centerItem(idx);
907                // console.log(idx);
908            }
909    
910            scrollContainer.addEventListener("scroll", update, { passive: true });
911
912            var lastScrollTop = 0,
913            delta = 15;
914
915            jQuery('body').scroll(function (event) {
916                var st = jQuery('body').scrollTop();
917    
918                if (Math.abs(lastScrollTop - st) <= delta) return;
919                if (st > lastScrollTop && lastScrollTop > 0) {
920                    // downscroll code
921                    jQuery("header").addClass("hide_header");
922                } else {
923                    // upscroll code
924                    jQuery("header").removeClass("hide_header");
925                }
926    
927                if (st < 20) {
928                    jQuery("header").removeClass("moving_position");
929                } else {
930                    jQuery("header").addClass("moving_position");
931                }
932                lastScrollTop = st;
933
934                if(jQuery('footer .footer-menu').length) {
935                    var sectionTop = jQuery('footer .footer-menu').offset().top; 
936                    sectionTop = sectionTop - 700;
937
938                    // console.log(st);
939                    // console.log(sectionTop);
940
941                    if (sectionTop < 40) {
942                        jQuery('.see_leotech:last-child').addClass('smaller_animation');
943                    } else {
944                        jQuery('.see_leotech:last-child').removeClass('smaller_animation');
945
946                    }
947                }
948            })
949    
950            // scrollContainer.addEventListener('scroll', function() {
951            //  update();
952            // });
953    
954            // scrollContainer.addEventListener("scroll", update, {
955            //     passive: true
956            // });
957    
958            window.addEventListener("resize", () => {
959                setScrolljackHeight();
960                update();
961            });
962    
963            // Initialize
964            setScrolljackHeight();
965            update();
966        }
967    }
968
969    jQuery(".partnerships .content-area .partnerships-logos .partnerships-logo a[data-fancybox]").fancybox({
970        afterShow: function() {
971            // Scroll to the top of the main window/body
972            setTimeout(() => {                
973                jQuery(".modal .modal-content-area").scrollTop(0);
974                jQuery(".modal.fancybox-content").scrollTop(0);
975                console.log('hellow');
976            }, 200);
977            // Alternatively, use vanilla JS:
978            // window.scrollTo(0, 0);
979        }
980    });
981
982    // if(jQuery('.solutions-inner-hero .content-area .bottom-animation-boxes .column-boxes .column-box.v3 .right-area ul').length) {
983    //     jQuery('.solutions-inner-hero .content-area .bottom-animation-boxes .column-boxes .column-box.v3 .right-area ul').addClass('with-')
984    // }
985
986    var minWidth = 992; // The target width threshold
987    var initialWidth = $(window).width();
988    var isBelowThreshold = initialWidth <= minWidth;
989
990    jQuery(window).resize(function() {
991        // Use a timeout to wait until the user has finished resizing
992        if (this.resizeTimeout) {
993            clearTimeout(this.resizeTimeout);
994        }
995        this.resizeTimeout = setTimeout(function() {
996            var currentWidth = jQuery(window).width();
997            
998            // Check if the screen size crosses the 992px boundary
999            if ((initialWidth > minWidth && currentWidth <= minWidth) || 
1000                (initialWidth <= minWidth && currentWidth > minWidth)) {
1001                
1002                // Reload the page
1003                location.reload(); 
1004            }
1005            // Update the initial width for the next resize event
1006            initialWidth = currentWidth;
1007
1008        }, 250); // Delay in milliseconds to prevent multiple rapid reloads
1009    });
1010
1011    if(jQuery('.solutions-category .content-area .solutions-category-boxes .solutions-category-box').length) {
1012        if (window.matchMedia('(min-width: 1200px)').matches) {
1013            jQuery('body').addClass('no_overflow_sticky');
1014            var startTop = window.innerWidth < 768 ? "top 15%" : "top 250px";
1015            document.querySelectorAll(".solutions-category-box").forEach((cardcore) => {
1016                gsap.killTweensOf(cardcore);
1017                gsap.set(cardcore, { filter: "blur(0px)" });
1018                gsap.to(cardcore, {
1019                filter: "blur(12px)",
1020                scale: 0.9,
1021                opacity: 0,
1022                scrollTrigger: {
1023                    trigger: cardcore,
1024                    start: startTop,
1025                    bottom: "bottom 15%",
1026                    end: "bottom-=200px",
1027                    // markers: true,
1028                    scrub: true,
1029                },
1030                });
1031            });
1032            
1033            document.querySelectorAll(".solutions-category-box").forEach((cardcore) => {
1034                var topScroll = 600;
1035                var startTop = window.innerWidth < 768 ? "top 15%" : "top 250px";
1036                gsap.set(cardcore, { filter: "blur(0px)" });
1037                gsap.to(cardcore, {
1038                filter: "blur(12px)",
1039                scale: 0.9,
1040                opacity: 0,
1041                y: topScroll,
1042                scrollTrigger: {
1043                    trigger: cardcore,
1044                    start: startTop,
1045                    end: "bottom-=200px",
1046                    // markers: true,
1047                    scrub: true,
1048                },
1049                });
1050            });
1051        }
1052    }
1053
1054    if(jQuery('.from_manual_investigation .content-area .bottom_area .right_area .icon_w_text .accordion_trigger').length) {
1055        jQuery('.from_manual_investigation .content-area .bottom_area .right_area .icon_w_text .accordion_trigger').on('click', function(e){
1056            e.preventDefault();
1057            jQuery('.from_manual_investigation .content-area .bottom_area .right_area .icon_w_text .item').not(jQuery(this).parent()).removeClass('is-open');
1058            jQuery(this).parent().toggleClass('is-open');
1059        })
1060    }
1061
1062    if(jQuery('.from_manual_investigation .content-area .bottom_area .img_area').length) {
1063        const $section = jQuery('.from_manual_investigation');
1064        if (!$section.length) return;
1065
1066        const $bottomArea = $section.find('.bottom_area');
1067        const $imgArea = $section.find('.img_area');
1068        const $rightArea = $section.find('.right_area');
1069
1070        if (!$bottomArea.length || !$imgArea.length || !$rightArea.length) return;
1071
1072        // Offset from top of viewport when sticky (match your fixed header height)
1073        const STICKY_OFFSET = 80;
1074
1075        let imgWidth = 0;
1076        let imgLeft = 0;
1077
1078        function updateDimensions() {
1079            imgWidth = $imgArea.outerWidth();
1080            imgLeft = $bottomArea.offset().left;
1081        }
1082
1083        function handleScroll() {
1084            const bottomRect = $bottomArea[0].getBoundingClientRect();
1085            const imgHeight = $imgArea.outerHeight();
1086            const rightHeight = $rightArea.outerHeight();
1087
1088            // Only activate sticky if the accordion column is taller than the image
1089            if (rightHeight <= imgHeight) {
1090                $imgArea.removeClass('is-sticky is-stuck-bottom').removeAttr('style');
1091                return;
1092            }
1093
1094            if (bottomRect.top >= STICKY_OFFSET) {
1095                // Section hasn't reached the top — normal flow
1096                $imgArea.removeClass('is-sticky is-stuck-bottom').removeAttr('style');
1097            } else if (bottomRect.bottom - imgHeight <= 380) {
1098                // Reached end of accordion — pin to bottom of container
1099                $imgArea
1100                    .removeClass('is-sticky')
1101                    .addClass('is-stuck-bottom')
1102                    .removeAttr('style');
1103            } else {
1104                // In between — stick to viewport
1105                updateDimensions();
1106                $imgArea
1107                    .addClass('is-sticky')
1108                    .removeClass('is-stuck-bottom');
1109                    jQuery('.from_manual_investigation .content-area .bottom_area .img_area.is-sticky .box_area').css({
1110                        width: imgWidth + 'px',
1111                    });
1112            }
1113        }
1114
1115        // Throttle scroll events with requestAnimationFrame
1116        let ticking = false;
1117        jQuery(window).on('scroll', function () {
1118            if (!ticking) {
1119                window.requestAnimationFrame(function () {
1120                    handleScroll();
1121                    ticking = false;
1122                });
1123                ticking = true;
1124            }
1125        });
1126
1127        jQuery(window).on('resize', function () {
1128            updateDimensions();
1129            handleScroll();
1130        });
1131
1132        // Recalculate when accordion items open/close (right_area height changes)
1133        $section.on('click', '.accordion_trigger', function () {
1134            setTimeout(handleScroll, 350); // wait for accordion animation
1135        });
1136
1137        // Initial run
1138        updateDimensions();
1139        handleScroll();
1140    }
1141    
1142})
1143
1144
1145// Deep link news & resource filters
1146function scrollToNewsFilter() {
1147	// If news and resources block is present, and has in the url
1148	const section = document.querySelector('section.news-resources-archive');
1149	const hash = document.location.hash
1150
1151	if (section && hash) {
1152		const tabName = hash.replace('#', '')
1153		// Match tab to hash
1154		setTimeout(() =>{
1155			jQuery(`section.news-resources-archive [data-filter=${tabName}]`).click()
1156			setTimeout(() => {
1157				section.style.scrollMarginTop = window.getComputedStyle(section).marginTop
1158				section.scrollIntoView({
1159					behavior: "smooth"
1160				})
1161			},100);
1162		}, 1);
1163	}
1164}
1165document.addEventListener("DOMContentLoaded", scrollToNewsFilter);
1166
1167/** Match theme.js menu-toggle: .mobile_menu.active is open. */
1168function closeLeotechMobileMenu() {
1169	if (typeof jQuery === "undefined") {
1170		return;
1171	}
1172	jQuery(".mobile_menu").removeClass("active");
1173	jQuery(
1174		"header .main-header .header-container .menu-toggle, .mobile_menu .top_area .menu-toggle"
1175	).removeClass("active");
1176}
1177
1178/** Megamenu dismiss + scroll to news archive tab (hashchange does not run when hash is unchanged). */
1179function handleNewsResourcesHashDeepLink() {
1180	closeLeotechMobileMenu();
1181	document.body.classList.remove("push_to_bottom");
1182
1183	const hoveredMenuLink = document.querySelector(
1184		"header .main-header .header-container .menu-area .menu-area-box .menu-links .menu-link:hover"
1185	);
1186	if (hoveredMenuLink) {
1187		hoveredMenuLink.classList.add("menu-link--temp-no-pointer");
1188	}
1189
1190	const clearNavPointerLock = () => {
1191		if (hoveredMenuLink) {
1192			hoveredMenuLink.classList.remove("menu-link--temp-no-pointer");
1193		}
1194	};
1195
1196	/* Let megamenu transition start, then scroll — do NOT unlock pointer yet or :hover returns while the cursor is still on the header. */
1197	setTimeout(() => {
1198		scrollToNewsFilter();
1199	}, 350);
1200
1201	if (hoveredMenuLink) {
1202		let navLockDone = false;
1203		const finishNavPointerLock = () => {
1204			if (navLockDone) {
1205				return;
1206			}
1207			navLockDone = true;
1208			window.clearTimeout(fallbackUnlockId);
1209			window.removeEventListener("scrollend", onScrollEnd);
1210			clearNavPointerLock();
1211		};
1212
1213		const onScrollEnd = () => {
1214			finishNavPointerLock();
1215		};
1216
1217		const fallbackUnlockId = window.setTimeout(finishNavPointerLock, 1400);
1218		window.addEventListener("scrollend", onScrollEnd);
1219	}
1220}
1221
1222window.addEventListener("hashchange", handleNewsResourcesHashDeepLink);
1223
1224/*
1225 * Same hash as current URL: hashchange does not fire — re-run deep link / close mobile.
1226 * On phones, iOS Safari often does not emit a synthetic click for same-document same-hash
1227 * taps; pointerup/touchend still run. We listen to pointerup + click and debounce so one
1228 * gesture does not run the handler twice (pointerup then click on many devices).
1229 */
1230let leotechSameHashNavLast = { href: "", t: 0 };
1231
1232function tryHandleSameHashInPageNav(e) {
1233	const anchor = e.target.closest("a[href]");
1234	if (!anchor) {
1235		return false;
1236	}
1237	let url;
1238	try {
1239		url = new URL(anchor.href);
1240	} catch {
1241		return false;
1242	}
1243	if (
1244		url.origin !== window.location.origin ||
1245		url.pathname !== window.location.pathname ||
1246		url.search !== window.location.search
1247	) {
1248		return false;
1249	}
1250	if (!url.hash || url.hash !== window.location.hash) {
1251		return false;
1252	}
1253
1254	const now = Date.now();
1255	if (anchor.href === leotechSameHashNavLast.href && now - leotechSameHashNavLast.t < 500) {
1256		e.preventDefault();
1257		return true;
1258	}
1259	leotechSameHashNavLast = { href: anchor.href, t: now };
1260
1261	const hasNewsArchive = document.querySelector("section.news-resources-archive");
1262	if (!hasNewsArchive) {
1263		closeLeotechMobileMenu();
1264		e.preventDefault();
1265		return true;
1266	}
1267	e.preventDefault();
1268	handleNewsResourcesHashDeepLink();
1269	return true;
1270}
1271
1272function onSameHashNavPointerClickOrTouch(e) {
1273	if (e.type === "pointerup" && e.button !== 0) {
1274		return;
1275	}
1276	tryHandleSameHashInPageNav(e);
1277}
1278
1279document.addEventListener("pointerup", onSameHashNavPointerClickOrTouch, true);
1280document.addEventListener("click", onSameHashNavPointerClickOrTouch, true);
1281/* iOS often skips click for same-hash / same-URL taps; touchend still runs. */
1282document.addEventListener("touchend", onSameHashNavPointerClickOrTouch, {
1283	capture: true,
1284	passive: false,
1285});

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.