PageSourceSearch

https://seafood.etnet.com.hk/assets/js/main.js?v=1790271415

js etnet.com.hk collected 2026-09-24 17:37:43 UTC 3,944 bytes, 119 lines download raw bytes

1
2
3/*=============== SHOW MENU ===============*/
4const navMenu = document.getElementById('nav-menu'),
5      navToggle = document.getElementById('nav-toggle'),
6      navClose = document.getElementById('nav-close')
7
8/*=============== SIDE BANNER CLOSE ===============*/
9const sideBannerClose = document.getElementById('sideBannerClose'),
10      sideBanner = document.querySelector('.side__banner')
11
12/* Initialize side banner state */
13if(sideBanner){
14   // Add side-banner-visible class to body when banner is visible
15   document.body.classList.add('side-banner-visible')
16}
17
18/* Side banner close */
19if(sideBannerClose){
20   sideBannerClose.addEventListener('click', () =>{
21      if(sideBanner){
22         // Add hidden class for CSS positioning
23         sideBanner.classList.add('hidden')
24         // Remove side-banner-visible class from body
25         document.body.classList.remove('side-banner-visible')
26         // Hide the banner
27         sideBanner.style.display = 'none'
28      }
29   })
30}
31
32/* Menu show */
33if(navToggle){
34   navToggle.addEventListener('click', () =>{
35      navMenu.classList.add('show-menu')
36      document.body.classList.add('menu-open')
37
38      // Hide mobile notice when menu opens
39      const mobileNotice = document.getElementById('mobileNotice')
40      if (mobileNotice) {
41        mobileNotice.style.display = 'none'
42        mobileNotice.style.visibility = 'hidden'
43        mobileNotice.style.opacity = '0'
44        mobileNotice.style.zIndex = '-1'
45      }
46
47      // Hide back to top button when menu opens
48      const topBtn = document.getElementById('topBtn')
49      if (topBtn) {
50        topBtn.style.display = 'none'
51      }
52   })
53}
54
55/* Menu hidden */
56if(navClose){
57   navClose.addEventListener('click', () =>{
58      navMenu.classList.remove('show-menu')
59      document.body.classList.remove('menu-open')
60
61      // Show mobile notice when menu closes (if on mobile and notice exists)
62      if (window.innerWidth <= 768) {
63        const mobileNotice = document.getElementById('mobileNotice')
64        if (mobileNotice) {
65          mobileNotice.style.display = 'block'
66          mobileNotice.style.visibility = 'visible'
67          mobileNotice.style.opacity = '1'
68          mobileNotice.style.zIndex = '998'
69        }
70      }
71
72      // Show back to top button when menu closes (if user has scrolled)
73      const topBtn = document.getElementById('topBtn')
74      if (topBtn && (document.body.scrollTop > 10 || document.documentElement.scrollTop > 10)) {
75        topBtn.style.display = 'block'
76      }
77   })
78}
79const navLinks = document.querySelectorAll('.nav__link')
80
81navLinks.forEach(link => {
82  link.addEventListener('click', (e) => {
83    navMenu.classList.remove('show-menu')
84    document.body.classList.remove('menu-open')
85
86    // Show mobile notice when menu closes (if on mobile and notice exists)
87    if (window.innerWidth <= 768) {
88      const mobileNotice = document.getElementById('mobileNotice')
89      if (mobileNotice) {
90        mobileNotice.style.display = 'block'
91        mobileNotice.style.visibility = 'visible'
92        mobileNotice.style.opacity = '1'
93        mobileNotice.style.zIndex = '998'
94      }
95    }
96
97    // Show back to top button when menu closes (if user has scrolled)
98    const topBtn = document.getElementById('topBtn')
99    if (topBtn && (document.body.scrollTop > 10 || document.documentElement.scrollTop > 10)) {
100      topBtn.style.display = 'block'
101    }
102
103    // Handle anchor links with smooth scrolling and proper offset
104    const href = link.getAttribute('href')
105    if (href && href.includes('#')) {
106      // Only handle same-page anchors, let cross-page links navigate naturally
107      if (href.startsWith('#')) {
108        const targetId = href.substring(1)
109        if (targetId && targetId !== 'slideshow') { // Skip slideshow as it's at the top
110          e.preventDefault()
111        }
112      }
113      // For cross-page links (like index.php#about), let browser handle naturally
114    }
115  })
116})
117
118
119

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.