PageSourceSearch

https://www.income.com.sg/assets/js/widgets/navbar-tab/navbar-tab.…3_eSci8HdLUIdHWAd1weu3rXylvT-zC0EMluOEVNozE

js income.com.sg collected 2026-09-24 09:15:56 UTC 5,471 bytes, 1 lines download raw bytes

1import{s as g}from"../../../../vendor/scrolling-utility.js";const y=t=>{const e=[],n=Array.from(t.querySelectorAll(".nav-link, .dropdown-item")).filter(o=>{var r;return((r=o.getAttribute("href"))==null?void 0:r.indexOf("#"))===0});return n.length&&n.forEach(o=>{const r=o.getAttribute("href");if(!r||r=="#")return;const a=document.querySelector(r);a&&e.push(a)}),e},S=t=>{var f,u,d,m,v;if(!t.length)return null;const e=window.scrollY,n=e+window.innerHeight,o=document.querySelector(".topbar");let r=0;if(o){const i=window.matchMedia("(max-width: 1024px)").matches,l=((f=o.querySelector(".announcement-bar"))==null?void 0:f.offsetHeight)||0,b=i?((u=o.querySelector(".navbar.navbar-mobile .container"))==null?void 0:u.offsetHeight)||0:((d=o.querySelector(".navbar:not(.navbar-mobile) .wide-container"))==null?void 0:d.offsetHeight)||0,c=i?((m=o.querySelector(".navbar-tab-mobile-widget"))==null?void 0:m.offsetHeight)||0:((v=o.querySelector(".navbar-tab-widget"))==null?void 0:v.offsetHeight)||0;r=l+b+c}for(let i=0;i<t.length;i++){const l=t[i],b=l.offsetTop;if(b+l.offsetHeight>e+r+200&&b<n){if(i===0)return l;const h=t[i-1];return h.offsetTop+h.offsetHeight<=e+r?l:h}}const a=t[t.length-1],s=a.offsetTop+a.offsetHeight;return e>=s?a:null},q=(t,e)=>{const n=t.querySelector(`.nav-link[href="#${e.id}"], .dropdown-item[href="#${e.id}"]`);if(!n)return;const o=t.querySelector(".dropdown-toggle .dropdown-toggle-text");o&&(o.textContent=n.textContent),t.querySelectorAll(".nav-link, .dropdown-item").forEach(r=>{r.classList.toggle("active",r==n)})},p=t=>{const e=y(t);e.length&&window.addEventListener("scroll",()=>{const n=S(e);n&&q(t,n)})},T=()=>{var b;const t=document.querySelector(".navbar-tab-widget"),e=window.matchMedia("(min-width: 1024px)").matches;if(!t||e)return;const n=t.querySelector(".navbar-tab-call-to-action"),o=n==null?void 0:n.closest(".nav-item"),r=document.querySelector(".masthead-banners"),a=document.querySelector(".footer");if(!n||!o||!r||document.querySelector(".floating-container"))return;const s=document.createElement("div");s.classList.add("floating-container","d-none");let f=!1,u=!1;n.classList.remove("btn-small"),s.appendChild(n),o.remove(),document.body.appendChild(s);const d=()=>{const c=f&&!u;s.classList.toggle("d-none",!c),s.classList.toggle("d-md-none",!c)},v=(((b=document.querySelector(".topbar .navbar.navbar-mobile"))==null?void 0:b.offsetHeight)||0)+50,i=new IntersectionObserver(c=>{c.forEach(h=>{f=h.boundingClientRect.bottom<h.rootBounds.top,d()})},{threshold:0,rootMargin:`-${v}px 0px 0px 0px`}),l=new IntersectionObserver(c=>{c.forEach(h=>{u=h.isIntersecting,d()})},{threshold:0});i.observe(r),a&&l.observe(a)},w=(t,e)=>{e.querySelectorAll(".nav-link, .dropdown-item").forEach(n=>{const o=n.getAttribute("href");(!o||o=="#")&&n.classList.add("d-none")}),t.appendChild(e)},L=()=>{const t=document.querySelector(".navbar-mobile");if(!t)return;const e=document.querySelector(".navbar-tab-mobile-widget");if(!e)return;if(w(t,e),!e.classList.contains("nav-tab-always-show")){const r=document.querySelector(".promotion-options")||document.querySelector(".masthead-banners");g(r,e)}p(e);const o=e.querySelector(".navbar-tab-mobile-backdrop");o&&o.addEventListener("click",()=>{const r=t.querySelector(".navbar-tab-mobile-search .search-field");r&&r.classList.toggle("collapsed")})},A=t=>{const e=t.querySelector(".navbar-tab-arrow-left"),n=t.querySelector(".navbar-tab-arrow-right"),o=t.querySelector(".navbar-tab-content");if(!e||!n||!o)return;const r=300,a=()=>{const{scrollLeft:s,scrollWidth:f,clientWidth:u}=o,d=Math.ceil(s);d<=0?e.classList.add("d-none"):e.classList.remove("d-none"),d>=f-u?n.classList.add("d-none"):n.classList.remove("d-none")};a(),o.addEventListener("scroll",a),window.addEventListener("resize",a),e.addEventListener("click",()=>{o.scrollBy({left:-r,behavior:"smooth"})}),n.addEventListener("click",()=>{o.scrollBy({left:r,behavior:"smooth"})})},H=()=>{const t=document.querySelector(".navbar");if(!t)return;const e=document.querySelector(".navbar-tab-widget");if(!e)return;if(w(t,e),!e.classList.contains("nav-tab-always-show")){const o=document.querySelector(".promotion-options")||document.querySelector(".masthead-banners");g(o,e)}p(e),A(e)},x=()=>{const t=window.matchMedia("(max-width: 1024px)").matches,e=document.querySelector(".topbar");if(!e||!e.querySelector(".navbar-toggler"))return;const o=!!e.querySelector(".navbar-tab.nav-tab-always-show")||!!e.querySelector(".navbar-tab-mobile.nav-tab-always-show");let r=!1;const a=()=>{var v,i,l,b,c;if(r){e.style.removeProperty("max-height");return}if(window.scrollY===0){e.style.removeProperty("max-height");return}const u=((v=e.querySelector(".announcement-bar"))==null?void 0:v.offsetHeight)||0,d=t?((i=e.querySelector(".navbar.navbar-mobile .container"))==null?void 0:i.offsetHeight)||0:((l=e.querySelector(".navbar:not(.navbar-mobile) .wide-container"))==null?void 0:l.offsetHeight)||0;let m=u+d;if(o){const h=t?((b=e.querySelector(".navbar-tab-mobile-widget"))==null?void 0:b.offsetHeight)||0:((c=e.querySelector(".navbar-tab-widget"))==null?void 0:c.offsetHeight)||0;m+=h}e.style.setProperty("max-height",`${m}px`)},s=document.querySelector(".navbar-collapse");s&&(s.addEventListener("show.bs.collapse",()=>{r=!0,e.style.removeProperty("max-height")}),s.addEventListener("hidden.bs.collapse",()=>{r=!1,a()})),window.addEventListener("scroll",a)},E=()=>{T(),L(),H(),x()};document.addEventListener("DOMContentLoaded",E);export{x as a,A as h};

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.