PageSourceSearch

https://www.nafa.edu.sg/nafa-corp/theme/default/js/common.js

js nafa.edu.sg collected 2026-10-01 12:05:46 UTC 39,177 bytes, 1,154 lines download raw bytes

1var jq14 = jQuery.noConflict(true);
2var wpLPage;
3//(function($){
4
5(function ($) {
6String.prototype.format = String.prototype.f = function () {
7    var s = this, i = arguments.length;
8    while (i--) {
9        s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]);
10    }
11    return s;
12};
13
14var getUrlParameter = function getUrlParameter(sParam) {
15	var sPageURL = window.location.search.substring(1),
16		sURLVariables = sPageURL.split('&'),
17		sParameterName,
18		i;
19
20	for (i = 0; i < sURLVariables.length; i++) {
21		sParameterName = sURLVariables[i].split('=');
22
23		if (sParameterName[0] === sParam) {
24			return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
25		}
26	}
27	return false;
28};
29
30function getParameterByName( name ){
31  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
32  var regexS = "[\\?&]"+name+"=([^&#]*)";
33  var regex = new RegExp( regexS );
34  var results = regex.exec( window.location.href );
35  if( results == null )
36    return "";
37  else
38    return decodeURIComponent(results[1].replace(/\+/g, " "));
39}
40
41var getParameterByUrl = function getUrlParameter(sParam) {
42    var sPageURL = window.location.search.substring(1),
43        sURLVariables = sPageURL.split('&'),
44        sParameterName,
45        i;
46
47    for (i = 0; i < sURLVariables.length; i++) {
48        sParameterName = sURLVariables[i].split('=');
49
50        if (sParameterName[0] === sParam) {
51            return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
52        }
53    }
54    return false;
55};
56
57
58 wpLPage = {
59    mobileMenuPrevList: [],
60    init: function (onComplete) {
61		
62		var currentOrigin = window.location.origin;
63
64		$('.footer-wrapper .col-lg-2 a').each(function () {
65			var link = $(this).attr('href');
66
67			if (!link || link.startsWith('#')) return;
68
69			// Normalize URL
70			var url = new URL(link, window.location.origin);
71
72			var isExternal = url.origin !== currentOrigin;
73
74			var isSpecialCase = url.pathname.toLowerCase().includes('eventspaces');
75
76			if (isExternal || isSpecialCase) {
77				$(this).attr({
78					target: '_blank',
79					rel: 'noopener noreferrer'
80				});
81			}
82		});
83		
84		
85        var p = wpLPage;
86		
87		
88		//p.sitemap.init();
89		
90        p.backToTop();
91        p.megaMenu.init()
92        p.tabs.init()
93        p.topSubmenu.init()
94        p.mobileNavMenu.init()
95
96        p.dropdownMenu.init()
97
98        p.tabMenu.init()
99        p.header.init();
100		p.searchBtn.init()
101		p.contentLoadMoreWrapper.init();
102		p.panelAccordion.init();
103		
104		p.removeImgTitles.init();
105		
106		p.navigationTilesImagePopup.init();
107		
108		p.search.init();
109		
110		p.socialShare.init();
111		
112		
113		p.backButton.init();
114
115        p.timetable.init();
116
117        p.wechatPopup.init();
118     },
119     wechatPopup: {
120         init: function () {
121                 $(".wechat-icon").click(function () {
122                     const isMobile = window.matchMedia("(max-width: 768px)").matches;
123
124                     if (isMobile) {
125                         $(".wechat-popup").slideToggle("fast", function () {
126                             if ($(this).is(":hidden")) {
127                                 $(this).css({ bottom: "95px", top: "auto" });
128                             }
129                         });
130                     } else {
131                         $(".wechat-popup").slideToggle("fast", function () {
132                             if ($(this).is(":hidden")) {
133                                 $(this).css({ top: "50px", bottom: "auto" });
134                             }
135                         });
136                     }
137                 });
138
139
140             // Close popup on close button click
141             $(".close-popup").click(function () {
142                 event.preventDefault(); 
143                 $(".wechat-popup").slideUp(500, "easeOutQuart");
144             });
145
146             // Optional: Close popup when clicking outside
147             $(document).click(function (event) {
148                 if (!$(event.target).closest(".wechat-icon, .wechat-popup").length) {
149                     $(".wechat-popup").slideUp(500, "easeOutQuart");
150                 }
151             });
152         
153         }
154     },
155	timetable: {
156		init: function() {
157			var total = 0;
158			var value = 0;
159
160			$('.timetable input').on('change', function() {
161			  total = 0;
162			  $('.timetable input').each(function() {
163					// 'this' refers to the current input element in the loop
164					value = parseInt($(this).val(), 10) || 0;
165					total += value;
166			  });
167			  if( total >= 0 && total <= 5 ){
168				$(".result-text").text("That’s normal! Whilst we try to be on-time for most things, everyone is late sometimes.");
169			  }
170			  else if( total >= 6 && total <= 7 ){
171				$(".result-text").text("Aiiii - you do seem to be late for quite a number of occasions! It might be good for you to have a think - were there any common points as to why you were late? Was it that they were all early morning classes? Try and think of lateness from the other person's perspective.");
172			  }
173			  else{
174				$(".result-text").text("Oh no! This might indicate that you are avoiding situations and tasks that are unpleasant to you. Or maybe you find it difficult to wait for others and would rather they wait for you?  Try and think of lateness from the other person's perspective.");
175			  }
176			  $(".result").text(total);
177			});
178
179		}
180    },
181	backButton: {
182		init: function() {
183			
184			if ($('.back-button').length > 0) {
185				
186				if(document.referrer != "") {
187					$('.back-button').addClass("active");
188					
189				}
190				
191				$('.back-button').on('click', function(e){
192					e.preventDefault();
193					
194					//history.back()
195					
196					history.back()
197		
198					
199				})
200			}
201			
202		}
203	},
204	socialShare: {
205		init: function() {
206			if ($('.social-icons').length > 0) {
207				
208			$('.social-icons').find('a[data-social="facebook"]').click(function(e){
209				  e.preventDefault()
210				  window.open("https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(window.location.href)+"&t=" + document.title, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');
211				  return false; 
212				})
213
214			$('.social-icons').find('a[data-social="twitter"]').click(function(e){
215				  e.preventDefault()
216				  window.open("https://twitter.com/intent/tweet?url=" + encodeURIComponent(window.location.href), '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=450, width=550');
217
218				  return false; 
219				})
220
221			$('.social-icons').find('a[data-social="linkedin"]').click(function(e){
222				  e.preventDefault()
223				  window.open("https://www.linkedin.com/shareArticle?mini=true&url=" + encodeURIComponent(window.location.href), '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');
224				  return false; 
225				})
226
227			$('.social-icons').find('a[data-social="wa"]').click(function(e){
228				 e.preventDefault()
229					
230					
231				  window.open("https://api.whatsapp.com/send?text=" + encodeURIComponent(window.location.href), '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');
232				  return false; 
233				})
234			}
235			
236		}
237	},
238	search: {
239		init: function(){
240			
241			$(".search-input-wrapper input").keyup(function(event) {
242				if (event.keyCode === 13) {
243					var query = $(".search-input-wrapper input").val();
244					var searchResults = '/search-results?q=' + encodeURIComponent(query);
245					window.location.href = searchResults;					
246				}
247			});
248
249			$(".search-input-wrapper .search-button").on('click', function(event) {
250				
251
252		
253					var query = $(".search-input-wrapper input").val();
254					var searchResults = '/search-results?q=' + encodeURIComponent(query);
255					window.location.href = searchResults;					
256				
257			});
258			
259
260			$(".search-mobile-input-wrapper input").keyup(function(event) {
261				if (event.keyCode === 13) {
262					var query = $(".search-mobile-input-wrapper input").val();
263					var searchResults = '/search-results?q=' + encodeURIComponent(query);
264					window.location.href = searchResults;					
265				}
266			});
267
268			$(".search-mobile-input-wrapper .search-button").on('click', function(event) {
269		
270				
271					var query = $(".search-mobile-input-wrapper input").val();
272					var searchResults = '/search-results?q=' + encodeURIComponent(query);
273					window.location.href = searchResults;					
274				
275			});
276
277		}
278	},
279	navigationTilesImagePopup: {
280		init: function() {
281			
282			if ($('.popup-images-wrapper a.image-popup').length > 0) {
283$('.popup-images-wrapper a.image-popup').magnificPopup({
284					type: 'image',
285					  mainClass: 'mfp-with-zoom', 
286					  gallery:{
287								enabled:true
288							},
289						image: {
290						  titleSrc: function(item) {
291							var markup = '';
292							
293							if (item.el[0].hasAttribute("title")) {
294							  markup += '<p class="mb-0"><strong>' + item.el.attr('title') + '</strong></p>';
295							}
296
297							if (item.el[0].hasAttribute("data-desc")) {
298							  markup += '<p class="mb-0">' + item.el.attr('data-desc') + '</p>';
299							}
300							
301							if (item.el[0].hasAttribute("data-event")) {
302							  markup += '<p>' + item.el.attr('data-event') + '</p>';
303							}
304							
305							if (item.el[0].hasAttribute("data-content")) {
306							  markup += '<p>' + item.el.attr('data-content') + '</p>';
307							}
308							
309							
310							return markup
311						  }
312						},
313
314					  zoom: {
315						enabled: true, 
316
317						duration: 300, // duration of the effect, in milliseconds
318						easing: 'ease-in-out', // CSS transition easing function
319
320						opener: function(openerElement) {
321
322						  return openerElement.is('img') ? openerElement : openerElement.find('img');
323					  }
324					}
325
326				});
327			}
328				
329		}
330	},
331	removeImgTitles: {
332		init: function() {
333			
334			
335			$('img[title]').each(function() { $(this).removeAttr('title'); });
336			
337			$('img').hover(
338			  function () {
339				$(this).data('title',$(this).attr('title')).removeAttr('title');
340			  }, 
341			  function () {
342				$(this).attr('title',$(this).data('title'));
343			  }
344			);
345			
346			
347		}
348	},
349	panelAccordion: {
350		init: function() {
351			if ($('.panel-heading').length > 0) {
352				$('.panel-heading').on('click', function(){
353					
354					if ($(this).next(".panel-collapse").hasClass("collapse")) {
355						$(this).addClass("active")
356						$(this).next(".panel-collapse").removeClass("collapse")
357						
358					} else {
359						$(this).removeClass("active")
360						$(this).next(".panel-collapse").addClass("collapse")
361						
362					}
363					
364				})
365			}
366		}
367	},
368	contentLoadMoreWrapper: {
369		init: function() {
370			
371			
372			if ($('.load-more-wrapper').length > 0) {
373				
374				$('.load-more-wrapper').each(function(){
375					
376					
377					if ($(this).children().length <= 0) {
378						$(this).hide()
379						$(this).next('.load-more-trigger').hide()
380					}
381					
382					if ($(this).outerHeight() > 500) {
383						
384						
385						var count = 0;
386                        var lastPos = 0;
387                        $(this).find('table').children('tbody').children('tr').each(function(){
388							if (count == 6) {
389								
390                                lastPos = $(this).offset().top + $(this).outerHeight();
391								
392							}
393							
394							
395							
396							count++;
397							
398						})
399						
400                        var heightToShow = lastPos - $(this).offset().top
401
402
403                        if (heightToShow <= 0) {
404                            heightToShow = 500
405                        }
406						if($(this).hasClass("load-more-wrapper-200")){
407							heightToShow = 200
408						}
409                        $(this).addClass("collapsed")
410						
411                        $(this).attr("height-to-show", heightToShow)
412						
413                        $(this).css("max-height", (heightToShow - 15) + "px");
414						
415						
416					}else{
417						var trigger = $(this).next();
418						if(trigger.hasClass("load-more-trigger")){
419							trigger.css("display","none")
420						}
421					}
422					
423				})
424				
425				$('.load-more-trigger').on('click', function() {
426					
427					if ($(this).prev(".load-more-wrapper").hasClass("collapsed")) {
428						
429                        $(this).prev(".load-more-wrapper").css("max-height", "100%")
430						$(this).prev(".load-more-wrapper").removeClass("collapsed")
431						//$(this).text("Load Less")
432						$(this).css("display","none")
433					} else {
434                        $(this).prev(".load-more-wrapper").css("max-height", $(this).prev(".load-more-wrapper").attr("height-to-show") + "px")
435						$(this).prev(".load-more-wrapper").addClass("collapsed")
436						$(this).text("Load More")
437					}
438					
439				})
440				
441			}
442			
443			
444			if ($('.events-load-more-wrapper').length > 0) {
445				
446				$('.events-load-more-wrapper').each(function(){
447					
448					
449					if ($(this).children().length <= 0) {
450						$(this).hide()
451						$(this).next('.events-load-more-trigger').hide()
452					}
453					
454					if ($(this).parent().outerHeight() <= 200) {
455
456						$(this).next('.events-load-more-trigger').hide()
457					}
458					
459					if ($(this).outerHeight() > 160) {
460						
461						
462						var count = 0;
463                        var lastPos = 0;
464                        $(this).find('table').children('tbody').children('tr').each(function(){
465							if (count == 6) {
466								
467                                lastPos = $(this).offset().top + $(this).outerHeight();
468								
469							}
470							
471							
472							
473							count++;
474							
475						})
476						
477                        var heightToShow = lastPos - $(this).offset().top
478
479
480                        if (heightToShow <= 0) {
481                            heightToShow = 160
482                        }
483						
484                        $(this).addClass("collapsed")
485						
486                        $(this).attr("height-to-show", heightToShow)
487						
488                        $(this).css("max-height", (heightToShow) + "px");
489						
490						
491					}
492					
493				})
494				
495				$('.events-load-more-trigger').on('click', function() {
496					
497					if ($(this).prev(".events-load-more-wrapper").hasClass("collapsed")) {
498						
499                        $(this).prev(".events-load-more-wrapper").css("max-height", "unset")
500						$(this).prev(".events-load-more-wrapper").removeClass("collapsed")
501						$(this).text("Load Less")
502					} else {
503                        $(this).prev(".events-load-more-wrapper").css("max-height", $(this).prev(".events-load-more-wrapper").attr("height-to-show") + "px")
504						$(this).prev(".events-load-more-wrapper").addClass("collapsed")
505						$(this).text("Load More")
506					}
507					
508				})
509				
510			}
511		}
512	},
513	sitemap: {
514		init: function() {
515			$('.hidden-sitemap li[data-cat="secondary"]').each(function(){
516				
517				$('.top-menubar').append('<li>' + $(this).children('a')[0].outerHTML + '</li>')
518				
519				$('.top-submenu-wrapper').append('<div class="top-submenu-item" id="' + $(this).children('a').data("url") + '"></div>')
520				
521				
522				var currParentURL = $(this).children('a').data("url");
523				
524				$('.top-submenu-wrapper #' + currParentURL).append('<ul></ul>');
525				$(this).children('ul').children().each(function(){
526					
527					$('.top-submenu-wrapper #' + currParentURL + ' ul').append($(this)[0].outerHTML)
528					
529				})
530				
531				
532			})
533			
534			$('.hidden-sitemap li[data-cat="primary"]').each(function(){
535				
536				$('.desktop-navbar-view .navbar').append('<li>' + $(this).children('a')[0].outerHTML + '</li>')
537				
538				$('header').append('<div class="submenu-wrapper" id="' + $(this).children('a').data("url") + '">
538<div class="row submenu-inner-wrapper"><div class="col-lg-4 tab-list"><ul></ul></div><div class="col-lg-8 tab-submenu"></div></div></div>')
539			
540			
541				var currParentURL = $(this).children('a').data("url");
542			
543			
544			
545				$(this).children('ul').children('li').each(function(){
546					
547					var facultyObj = $(this)
548					
549					if (currParentURL == 'school-and-courses') {
550						$('header #' + currParentURL + ' .tab-list ul').append('<li data-url="' + $(this).children('a').data('url') + '">' + $(this).children('a').text() + '</li>')
551					} else {
552						$('header #' + currParentURL + ' .tab-list ul').append('<li data-url="' + $(this).children('a').data('url') + '">' + $(this).children('a')[0].outerHTML + '</li>')
553						$('header #' + currParentURL + ' .tab-submenu').append('<div class="tab-menu-item" id="' + facultyObj.children('a').data('url') + '"><div class="row"><div class="col-lg-9"><ul></ul></div></div></div>')
554								
555					}
556					
557					
558					
559				
560					if ($(this).children('ul').children('li').length > 0) {
561						$(this).children('ul').children('li').each(function(){
562							
563							var schoolUrl = $(this).children('a').data('url')
564							
565							
566							
567							if (currParentURL == 'school-and-courses') {
568								$('header #' + currParentURL + ' .tab-list ul li[data-url="' + facultyObj.children('a').data('url') + '"]').append('<p>' + $(this).children('a')[0].outerHTML + '</p>')
569								
570								
571								if ($(this).children('ul').children('li').length > 0) {
572									
573									
574									$('header #' + currParentURL + ' .tab-submenu').append('<div class="tab-menu-item" id="' + schoolUrl + '"><div class="row"><div class="col-lg-9"><ul></ul></div></div></div>')
575									
576									$(this).children('ul').children('li').each(function(){
577							
578										
579										
580										$('header #' + currParentURL + ' .tab-submenu #' + schoolUrl + ' ul').append($(this)[0].outerHTML)
581										
582										
583									})
584								}
585			
586							} else {
587								
588								$('header #' + currParentURL + ' .tab-submenu #' + facultyObj.children('a').data('url') + ' ul').append('<li>' + $(this).children('a')[0].outerHTML + '</li>')
589							}
590							
591							
592						})
593					}
594	
595					
596				})
597				
598				
599
600				
601			})
602			
603			$('.hidden-sitemap li[data-cat="footer"]').each(function(){
604
605				
606				$('<div id="' + $(this).children('a').data("url") + '" class="col-lg-2"><p class="menu-title">' + $(this).children('a')[0].outerHTML + '</p><ul></ul></div>').insertBefore($('.footer-wrapper .col-lg-4'))
607
608				
609				
610				var currParentURL = $(this).children('a').data("url");
611				
612				
613				$(this).children('ul').children().each(function(){
614					
615					$('.footer-wrapper .col-lg-2#' + currParentURL + " ul").append($(this)[0].outerHTML)
616					
617				})
618				
619				
620			})
621			
622		}
623	},
624    header: {
625        init: function () {
626            this.hideOnScroll();
627        },
628        megaMenuOffest: 0,
629        hideOnScroll: function () {
630            var lastScrollTop = 0;
631            $(window).scroll(function (e) {
632
633                var st = $(this).scrollTop();
634                /*if(!$(".btn-apply-wrapper").hasClass("sticky")){
635                    $(".btn-apply-wrapper").addClass("sticky")
636                }*/
637                if((st/$(document).height()>0.7 && st>lastScrollTop) || Math.ceil(st+$(window).height())>=$(document).height()){
638					
639					if ($('.always-visible').length > 0) {
640						
641					} else {
642						$(".menu-bar-wrapper").css("opacity","0");
643						$(".menu-bar-wrapper").css("visibility","hidden");
644						$(".submenu-wrapper.active").removeClass("active")
645						return;
646					}
647					
648
649                }else{
650					
651                    $(".menu-bar-wrapper").css("opacity","1");
652					$(".menu-bar-wrapper").css("visibility","visible");
653                }
654                if (window.innerWidth <= 1181) {
655					$("header").css("transform","translateY(0)");
656                    return;
657                }
658                else if(st===0){
659                    //$(".btn-apply-wrapper").removeClass("sticky")
660                    $(".header").css("transform", `translateY(0)`);
661                    $(".menu-bar").removeClass("minimize");
662                    
663                    setTimeout(() => {
664                        $(".submenu-wrapper.active").css("top",$(".header").innerHeight())
665                    }, 200);
666                    
667                }
668                else if (st > lastScrollTop) {
669                    
670                    var hdr = wpLPage.header;
671                    var height = -($(".menu-bar").innerHeight() + $(".top-navbar-wrapper").innerHeight());
672                    var maxHeight = $(".row.submenu-wrapper.active").innerHeight() - $(window).height();
673                    if (hdr.megaMenuOffest === 0) hdr.megaMenuOffest = height;
674                    // $(".header + *").css("padding-top","0px")
675                    if (maxHeight > 0) {
676                        hdr.megaMenuOffest = hdr.megaMenuOffest + height < -maxHeight ? hdr.megaMenuOffest = -maxHeight + height : hdr.megaMenuOffest + lastScrollTop - st;
677                    }
678                    var h = $(".top-navbar-wrapper").innerHeight();
679                    // upscroll code
680                    $(".header").css("transform", `translateY(${-h}px)`);
681                    $(".menu-bar").addClass("minimize");
682                    $(".search-input-wrapper.active").removeClass("active")
683                    setTimeout(() => {
684                    $(".submenu-wrapper.active").css("top",$(".header").innerHeight())
685                    }, 200);
686                    $(".wechat-popup").slideUp(500, "easeOutQuart");
687                } else {
688
689                    var h = $(".top-navbar-wrapper").innerHeight();
690                   
691                    $(".header").css("transform", `translateY(${-h}px)`);
692                    // $(".header + *").css("padding-top","")
693
694                }
695                
696                lastScrollTop = st;
697
698
699
700            })
701        }
702    },
703    tabMenu: {
704        init: function () {
705            if ($('.tab-menu-wrapper').length > 0 && !$('.tab-menu-wrapper').hasClass("custom-mobile-dropdown")) {
706                $('.tab-menu-wrapper ul li').on('click', function (e) {
707                    var idx = $(this).data("index")
708
709                    $('.tab-menu-wrapper ul li').each(function () {
710                        if ($(this).hasClass('active')) {
711                            $(this).removeClass('active')
712                        }
713                    })
714
715
716                    $('.tab-context-wrapper').each(function () {
717                        if ($(this).hasClass('active')) {
718                            $(this).removeClass('active')
719                        }
720                    })
721					$(e.target).addClass('active')
722                    $('.tab-menu-wrapper ul li[data-index="' + idx + '"]').addClass('active')
723                    $('.tab-context-wrapper[data-index="' + idx + '"]').addClass('active')
724                })
725
726                $('.tab-menu-wrapper').append('<select class="tab-menu-dropdown"></select>')
727
728                $('.tab-menu-wrapper ul li').each(function () {
729                    $('.tab-menu-wrapper .tab-menu-dropdown').append('<option value="' + $(this).data('id') + '">' + $(this).html() + '</option>')
730                })
731
732                $('.tab-menu-wrapper .tab-menu-dropdown').on('change', function () {
733                    var idx = $(this).val()
734
735
736
737                    $('.tab-menu-wrapper ul li').each(function () {
738                        if ($(this).hasClass('active')) {
739                            $(this).removeClass('active')
740                        }
741                    })
742
743
744                    $('.tab-context-wrapper').each(function () {
745                        if ($(this).hasClass('active')) {
746                            $(this).removeClass('active')
747                        }
748                    })
749
750                    $('.tab-menu-wrapper ul li[data-index="' + idx + '"]').addClass('active')
751                    $('.tab-context-wrapper[data-index="' + idx + '"]').addClass('active')
752                })
753
754
755            }
756        }
757    },
758    backToTop: function () {
759        $("#btn-go-to-top").on("click", function (e) {
760            e.preventDefault();
761            window.scrollTo({
762                left: 0,
763                top: 0,
764                behavior: "smooth"
765            });
766        })
767    },
768    megaMenu: {
769        timeOut: [],
770
771        init: function () {
772            this.navbarOnHover()
773        },
774        navbarOnHover: function () {
775
776            $(".navbar a").hover(function (e) {
777                if ($(e.target).hasClass("active")) {
778                    for (var i = 0; i < wpLPage.megaMenu.timeOut.length; i++) {
779                        clearTimeout(wpLPage.megaMenu.timeOut[i]);
780
781                    }
782                    wpLPage.megaMenu.timeOut = []
783                } else {
784
785                    wpLPage.megaMenu.timeOut.push(setTimeout(function () {
786
787                        if ($(".submenu-wrapper").hasClass("active")) $(".submenu-wrapper").removeClass("active");
788                        $(".navbar li a").removeClass("active")
789                        $(e.target).addClass("active")
790                        var id = $(e.target).attr("data-submenu-id")
791
792
793
794
795                        var posY = $("header.header").innerHeight();
796
797                        $('[data-mega-id="' + id + '"]').addClass("active")
798                        $('[data-mega-id="' + id + '"]').css("top", `${posY}px`)
799                    }, 400))
800                }
801
802
803
804
805
806            },
807                function (e) {
808
809                    if (($(e.relatedTarget).closest(".menu-bar").length !== 0)) {
810
811
812                        wpLPage.megaMenu.timeOut.push(setTimeout(function () {
813
814                            $(".submenu-wrapper").removeClass("active");
815                            $(".navbar li a").removeClass("active")
816
817
818                        }, 400))
819
820
821                    }
822
823                    else if ((!$(e.relatedTarget).hasClass("submenu-wrapper") && $(e.relatedTarget).closest(".submenu-wrapper").length === 0)) {
824
825                        wpLPage.megaMenu.timeOut.push(setTimeout(function () {
826                            $(e.target).removeClass("active")
827                            $(".submenu-wrapper").removeClass("active");
828                        }, 400))
829
830                    }
831
832
833
834                }
835            )
836            $(".submenu-wrapper div,.submenu-wrapper").on("mouseenter", function (e) {
837                for (var i = 0; i < wpLPage.megaMenu.timeOut.length; i++) {
838                    clearTimeout(wpLPage.megaMenu.timeOut[i]);
839
840                }
841                wpLPage.megaMenu.timeOut = []
842
843
844                // wpLPage.megaMenu.timeOut = null;
845            })
846
847            $(".submenu-wrapper div,.submenu-wrapper").on("mouseleave", function (e) {
848                if ($(e.relatedTarget).hasClass("active") && $(e.relatedTarget).closest(".
848navbar").length !== 0) {
849                    return;
850                }
851                else if ($(".submenu-wrapper").hasClass("active") && (!$(e.relatedTarget).hasClass("submenu-wrapper") && $(e.relatedTarget).closest(".submenu-wrapper").length === 0)) {
852
853                    $(".navbar a").removeClass("active")
854                    $(".submenu-wrapper").removeClass("active");
855                }
856
857            })
858        }
859    },
860    tabs: {
861        timeOut: [],
862        prevMenuLevel: null,
863        init: function () {
864            this.submenuTabsOnHover()
865        },
866        submenuTabsOnHover: function () {
867
868            $(".submenu-wrapper li a").on("mouseenter", function (e) {
869                var currentLevel = $(e.target).closest("[data-menu-level]").attr('data-menu-level');
870
871                if ($(e.target).hasClass("active") && currentLevel === wpLPage.tabs.prevMenuLevel) {
872                    console.log("triigger");
873                    for (var i = 0; i < wpLPage.tabs.timeOut.length; i++) {
874                        clearTimeout(wpLPage.tabs.timeOut[i]);
875
876                    }
877                    wpLPage.megaMenu.timeOut = []
878                } else if (currentLevel !== wpLPage.tabs.prevMenuLevel) {
879                    if ($(e.target).closest(".tab-list").length !== 0) {
880                        $(".tab-submenu[data-menu-level=2] .tab-menu-item").removeClass("active");
881                        $(".tab-submenu[data-menu-level=3] .tab-menu-item").removeClass("active");
882                        $(".tab-submenu[data-menu-level=2] .tab-menu-item a").removeClass("active")
883                        $(".tab-list li a").removeClass("active")
884                    }
885                    else if ($(e.target).closest(".tab-submenu[data-menu-level=2]").length !== 0) {
886
887                        $(".tab-submenu[data-menu-level=3] .tab-menu-item").removeClass("active");
888                        $(".tab-submenu[data-menu-level=2] .tab-menu-item a").removeClass("active")
889                    }
890
891                    var id = $(e.target).attr("data-submenu-id");
892
893                    $(e.target).addClass("active")
894                    //console.log("triigger",$("#" + id));
895                    $('[data-mega-id="' + id + '"]').addClass("active");
896                } else {
897
898
899                    wpLPage.megaMenu.timeOut.push(setTimeout(function () {
900
901                        if ($(e.target).closest(".tab-list").length !== 0) {
902                            $(".tab-submenu[data-menu-level=2] .tab-menu-item").removeClass("active");
903                            $(".tab-submenu[data-menu-level=3] .tab-menu-item").removeClass("active");
904                            $(".tab-submenu[data-menu-level=2] .tab-menu-item a").removeClass("active")
905                            $(".tab-list li a").removeClass("active")
906                        }
907                        else if ($(e.target).closest(".tab-submenu[data-menu-level=2]").length !== 0) {
908
909                            $(".tab-submenu[data-menu-level=3] .tab-menu-item").removeClass("active");
910                            $(".tab-submenu[data-menu-level=2] .tab-menu-item a").removeClass("active")
911                        } else {
912                            $(".tab-submenu[data-menu-level=3] .tab-menu-item a").removeClass("active");
913                        }
914
915                        var id = $(e.target).attr("data-submenu-id");
916
917                        $(e.target).addClass("active")
918                        //console.log("triigger",$("#" + id));
919                        $('[data-mega-id="' + id + '"]').addClass("active");
920                    }, 300))
921                }
922                wpLPage.tabs.prevMenuLevel = currentLevel
923                e.preventDefault()
924
925
926
927
928
929            })
930        }
931    },
932    topSubmenu: {
933        init: function () {
934            this.topSubmenuOnHover()
935        }, topSubmenuOnHover: function () {
936            $(".top-menubar li a").hover(function (e) {
937                if ($(".top-submenu-item").hasClass("active")) $(".top-submenu-item").removeClass("active")
938
939                $(".top-submenu-wrapper").addClass("active")
940                var id = $(e.target).attr("data-submenu-id")
941
942                var posY = $(e.target).outerHeight();
943                var posX = $(e.target).position().left
944                $(e.target).addClass("active")
945                $('[data-mega-id="' + id + '"]').addClass("active")
946                $(".top-submenu-wrapper").css("top", `${posY}px`)
947                $(".top-submenu-wrapper").css("left", `${posX}px`)
948
949            },
950                function (e) {
951                    if ($(".top-submenu-wrapper").hasClass("active") && (!$(e.relatedTarget).hasClass("top-submenu-wrapper") || !$(e.relatedTarget).closest(".top-submenu-wrapper").length === 0)) {
952
953                        $(".top-submenu-wrapper").removeClass("active");
954                        $(e.target).removeClass("active")
955                    }
956
957
958                }
959            )
960
961            $(".top-submenu-wrapper div,.top-submenu-wrapper").on("mouseleave", function (e) {
962
963                if ($(".top-submenu-wrapper").hasClass("active") && (!$(e.relatedTarget).hasClass("top-submenu-wrapper") && $(e.relatedTarget).closest(".top-submenu-wrapper").length === 0)) {
964
965                    $(".top-submenu-wrapper").removeClass("active");
966                    $(".top-menubar li a").removeClass("active")
967                }
968
969            })
970        }
971    },
972    mobileNavMenu: {
973        init: function () {
974            this.drillDown()
975            this.backToPrev()
976            this.burgerMenuOnClick()
977			this.idOnClick()
978        },
979        burgerMenuOnClick: function () {
980            $(".burger-menu-wrapper").on("click", function () {
981                $(".header.sticky").css("transform", "");
982                if (!$(".mobile-menu").hasClass("active")){ 
983					$("header.sticky").css("height","100%");
984					$("html,body").addClass("scroll-lock")
985				}
986                else{ 
987				$("html,body").removeClass("scroll-lock")
988				$("header.sticky").css("height","auto");
989				}
990
991                $(".mobile-menu").toggleClass("active")
992                $(".burger-menu-wrapper").toggleClass("active")
993				if($(".search-btn-wrapper").hasClass("active")){
994					var page = wpLPage;
995					page.searchBtn.closeBtn();
996				}
997				
998            })
999
1000        },
1001		idOnClick:function(){
1002				$(".mobile-menu a[href*='#']").on("click",function(){
1003					wpLPage.mobileNavMenu.closeMenu();
1004				})
1005		}
1006		,
1007		closeMenu:function(){
1008			
1009                
1010                $("html,body").css("overflow-y", "auto")
1011
1012                $(".mobile-menu").removeClass("active")
1013                $(".burger-menu-wrapper").removeClass("active")
1014		}
1015        ,
1016        drillDown: function () {
1017            $(".mobile-navbar ul  li:not(.menu-accordion) span ").on("click", function (e) {
1018
1019
1020                var prevObj = $(".mobile-navbar.active");
1021                if ($(".mobile-navbar").hasClass("active")) $(".mobile-navbar").removeClass("active")
1022                var id = $(e.target).prev().attr("data-submenu-id")
1023                console.log(id);
1024                $("[data-mobile-link=" + id + "]").addClass("active");
1025                if (!$(".back-button-tab").hasClass("active")) $(".back-button-tab").addClass("active")
1026                prevObj.addClass("prev");
1027
1028                wpLPage.mobileMenuPrevList.push(prevObj.attr("data-mobile-link"))
1029
1030            })
1031            $(".menu-accordion span").on("click", function (e) {
1032                e.preventDefault()
1033                var id = $(e.target).prev().attr("data-accordion-id")
1034
1035                $("[data-mobile-link=" + id + "]").toggleClass("active");
1036                if ($("[data-mobile-link=" + id + "]").hasClass("active")) {
1037                    $(e.target).text("-")
1038                } else {
1039                    $(e.target).text("+")
1040                }
1041
1042
1043            })
1044        },
1045        backToPrev: function () {
1046            $(".mobile-menu .back-button-tab").on("click", function (e) {
1047                if (wpLPage.mobileMenuPrevList.length > 0) {
1048                    var prevId = wpLPage.mobileMenuPrevList.pop();
1049                    if ($(".mobile-navbar").hasClass("active")) $(".mobile-navbar").removeClass("active")
1050                    $("[data-mobile-link=" + prevId + "]").addClass("active");
1051                    $("[data-mobile-link=" + prevId + "]").removeClass("prev");
1052                    if (wpLPage.mobileMenuPrevList.length === 0) $(".back-button-tab").removeClass("active")
1053                }
1054            })
1055        }
1056    },
1057    dropdownMenu: {
1058        init: function () {
1059            $(".mobile-drop-down-menu > .label").on("click", function (e) {
1060                $(e.target).next().toggleClass("active")
1061            })
1062            $(".mobile-drop-down-menu > ul > li").on('click', function (e) {
1063                $(e.target).closest(".mobile-drop-down-menu").find("ul>li").removeClass("active")
1064                $(e.target).closest(".mobile-drop-down-menu").find(".label").text($(e.target).text());
1065                $(e.target).addClass("active")
1066                $(e.target).closest("ul").removeClass("active")
1067
1068
1069                var index = $(e.target).attr("data-index")
1070                var targetTabGroup = $(e.target).closest("ul").attr("data-group") + "-tab-item";
1071                $(`[data-group=${targetTabGroup}]`).removeClass("active")
1072                $(`[data-group=${targetTabGroup}][data-index=${index}]`).addClass("active")
1073            })
1074			 $(".drop-down-menu > .label").on("click", function (e) {
1075                 $(e.target).next().toggleClass("active")
1076             })
1077            // $(".drop-down-menu > ul > li").on('click', function (e) {
1078                // $(e.target).closest(".drop-down-menu").find("ul>li").removeClass("active")
1079                // $(e.target).closest(".drop-down-menu").find(".label").text($(e.target).text());
1080                // $(e.target).addClass("active")
1081                // $(e.target).closest("ul").removeClass("active")
1082
1083
1084                // var index = $(e.target).attr("data-index")
1085                // var targetTabGroup = $(e.target).closest("ul").attr("data-group") + "-tab-item";
1086                // $(`[data-group=${targetTabGroup}]`).removeClass("active")
1087                // $(`[data-group=${targetTabGroup}][data-index=${index}]`).addClass("active")
1088            // })
1089        }
1090    },
1091    searchBtn:{
1092
1093        init:function(){
1094            $(".search-icon-wrapper").on("click",function(){
1095				
1096
1097				
1098				
1099                $(".search-input-wrapper").toggleClass("active")
1100				
1101				if ($(".search-input-wrapper").hasClass("active")) {
1102					
1103					setTimeout(function() {
1104						$(".search-input-wrapper input").focus();
1105						
1106					}, 300)
1107				}
1108
1109            })
1110			$(".search-btn-wrapper").on("click",function(e){
1111				
1112				
1113				
1114				if($(".burger-menu-wrapper").hasClass("active")){
1115					var l=wpLPage;
1116					l.mobileNavMenu.closeMenu();
1117				}
1118				$(e.target).toggleClass("active");
1119                $(".search-mobile-input-wrapper").toggleClass("active")
1120				
1121				if ($(".search-mobile-input-wrapper").hasClass("active")) {
1122					
1123					setTimeout(function() {
1124						$(".search-mobile-input-wrapper input").focus();
1125						
1126					}, 300)
1127				}
1128
1129            })
1130            //$(".search-input-wrapper .search-button,.search-mobile-input-wrapper .search-button").on('click', function(event) {
1131                //event.preventDefault()
1132				
1133				
1134				
1135                //var query = $(".search-input-wrapper input").val();
1136                //var searchResults = '/search-results?itemscount=8&year=2022&q=' + encodeURIComponent(query.trim().toLowerCase());
1137                //window.location.href = searchResults;					
1138            
1139			//});
1140        },
1141		closeBtn:function(){
1142			$(".search-btn-wrapper").removeClass("active");
1143			$(".search-input-wrapper").removeClass("active")
1144			$(".search-mobile-input-wrapper").removeClass("active")
1145		}
1146    }
1147}
1148
1149
1150$(document).ready(function () {
1151    wpLPage.init();
1152});
1153
1154})(jq14);

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.