PageSourceSearch

https://www.hketony.gov.hk/js/main.js?v=2.0

js hketony.gov.hk collected 2026-10-02 18:05:50 UTC 3,423 bytes, 126 lines download raw bytes

1function toggleParentHover(e){
2    if(e.type === 'mouseenter'){
3        $(this).prev().addClass('themeColorSecondary');
4    }else{
5        $(this).prev().removeClass('themeColorSecondary');
6    }
7}
8
9function toggleMenuHover(e){
10    if(e.type === 'mouseenter'){
11        $(this).find(".nav-link").addClass('themeColorSecondary');
12    }else{
13        $(this).find(".nav-link").removeClass('themeColorSecondary');
14    }
15}
16
17function toggleMenuSearch(){
18    if ($("#searchBar").is(":visible")){
19        $('#menuBar').show();
20        $('#searchBar').hide();
21    } else {
22        $('#menuBar').hide();
23        $('#searchBar').show();
24    }
25}
26
27function toggleMenuSearchXS(){
28    if ($("#searchBar").is(":visible")){
29        $('#menuBar').show();
30        $('#navbar-collapse-button').show();
31        $('#searchBar').hide();
32        if($('#navbarCollapse').hasClass('show')){
33			$('#navbarCollapse').removeClass('show');
34		}
35    } else {
36    	if($('#navbarCollapse').hasClass('show')){
37    		$('#navbarCollapse').removeClass('show');
38    	}
39        $('#menuBar').hide();
40        $('#navbar-collapse-button').hide();
41        $('#searchBar').show();
42    }
43}
44
45function doSearch(){
46  if($('#query').val().trim() != ""){
47    $('#searchForm').submit();
48  }
49}
50
51function resizeText(e){
52    var newSize =  $(this).data('size-percentage') + '%';
53    var selectedOption = $(this).data('font-option');
54    $('.font-item').removeClass('active');
55    $(this).addClass('active');
56    $('body').css('font-size', newSize);
57    $('#top-head-marker').attr('class', 'top-head-marker themeColorBG top-head-marker'+selectedOption);
58}
59
60function urlParam(name){
61    var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
62    if (results == null){
63       return null;
64    }
65    else {
66       return decodeURI(results[1]) || 0;
67    }
68}
69
70function isIE() {
71    return /Trident\/|MSIE/.test(window.navigator.userAgent);
72}
73
74// $('#myCarousel').carousel({
75//     interval: 6000
76// })
77
78var $item = $('.carousel-item');
79var $wHeight = $(window).height();
80
81$item.height($wHeight);
82$item.addClass('full-screen');
83
84$('.carousel img').each(function() {
85    var $src = $(this).attr('src');
86    var $color = $(this).attr('data-color');
87    $(this).parent().css({
88        'background-image' : 'url(' + $src + ')',
89        'background-color' : $color
90    });
91    $(this).remove();
92});
93
94$('#navBar .dropdown-menu').on('mouseenter mouseleave', toggleParentHover);
95$('#navBar .nav-item').on('mouseenter mouseleave', toggleMenuHover);
96$('#searchButton').on('click', toggleMenuSearch);
97$('#searchButtonXS').on('click', toggleMenuSearchXS);
98$('#closeSearch').on('click', toggleMenuSearch);
99$('#closeSearchXS').on('click', toggleMenuSearchXS);
100$('#submitSearch').on('click', doSearch);
101
102$('.font-size1').on('click', resizeText);
103$('.font-size2').on('click', resizeText);
104$('.font-size3').on('click', resizeText);
105
106$(window).on('resize', function (){
107  $wHeight = $(window).height();
108  $item.height($wHeight);
109});
110
111/* SMOOTH SCROLL */
112var $root = $('html, body');
113
114$('.href-smooth').click(function(event) {
115    event.preventDefault();
116
117    var href = $.attr(this, 'href');
118
119    $root.animate({
120      scrollTop: $(href).offset().top
121    }, 500, function () {
122      window.location.hash = href;
123    });
124
125    return false;
126});      

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.