PageSourceSearch

https://www.income.com.sg/assets/js/widgets/audience/audience.js?v=YTPf0KF4prRgxzm8xfmRvpPkvSS6BD6FaYEtt2QcQzA

js income.com.sg collected 2026-09-24 09:16:01 UTC 4,136 bytes, 1 lines download raw bytes

1import{s as v}from"../../../../vendor/scrolling-utility.js";import"../../../../vendor/react-vendors.js";import"../../../../vendor/index.js";import{i as b}from"../carousel/carousel.js";import{h as S,a as f}from"../navbar-tab/navbar-tab.js";function C(r){this.value=r,this.valueChangedCallback=null,this.setValue=function(e){this.value!=e&&(this.value=e,this.raiseChangedEvent(e))},this.getValue=function(){return this.value},this.onChange=function(e){this.valueChangedCallback=e},this.raiseChangedEvent=function(e){this.valueChangedCallback&&this.valueChangedCallback(e)}}const g=(r,e)=>{r.forEach(o=>o.classList.remove("active")),r[e].classList.add("active")},w=(r,e)=>{r.querySelectorAll(".audience-related-article").forEach((o,n)=>{const a=n==e;o.classList.toggle("d-none",!a)})},m=(r,e)=>{const t=r.querySelector(".audience-goal-switcher .navbar-tab-mobile");if(!t)return;const o=document.querySelector(".navbar-mobile");if(o)o.appendChild(t),v(r.closest(".audience-goal").querySelector(".audience-goal-switcher"),t,()=>{});else{t.remove();return}const n=t.querySelectorAll(".dropdown-menu .dropdown-item");n.length!==0&&n.forEach((a,l)=>{a.addEventListener("click",u=>{u.preventDefault(),e.setValue(l);const i=r.closest(".audience-goal").querySelector(".audience-goal-content");i&&i.scrollIntoView({behavior:"smooth"})})})},y=(r,e)=>{const t=r.querySelector(".audience-goal-switcher .navbar-tab");if(!t)return;const o=document.querySelector(".navbar");if(o)o.appendChild(t),v(r.closest(".audience-goal").querySelector(".audience-goal-switcher"),t,()=>{});else{t.remove();return}const n=t.querySelectorAll(".nav-item .nav-link");n.length!==0&&(n.forEach((a,l)=>{a.addEventListener("click",u=>{u.preventDefault(),e.setValue(l);const i=r.closest(".audience-goal").querySelector(".audience-goal-content");i&&i.scrollIntoView({behavior:"smooth"})})}),S(t),f())},A=(r,e)=>{const t=r.querySelector(".audience-goal-switcher-cards");if(!t)return;const o=t.querySelectorAll(".audience-goal-switcher-card");o.length!==0&&o.forEach((n,a)=>{n.addEventListener("click",()=>{e.setValue(a)})})},q=(r,e)=>{const t=r.querySelector(".audience-goal-switcher-carousel .carousel-wrapper");if(!t||t.querySelectorAll(".audience-goal-switcher-card").length===0)return;const n=a=>{e.setValue(a)};b(t,n,n)},L=r=>{const t=new URLSearchParams(window.location.search).get("category");if(!t)return 0;const o=r.querySelectorAll(".audience-goal-switcher-card");if(o.length===0)return 0;const n=Array.from(o).findIndex(a=>(a.getAttribute("data-related-article-id")||"")===t);return n>=0?n:0},G=r=>{const e=r.querySelector(".audience-goal-switcher");if(!e)return;let t=new C(0);const o=(a,l)=>{if(!a||!l)return;const u=l.getBoundingClientRect(),i=a.getBoundingClientRect(),d=i.left+i.width/2,c=u.left+u.width/2,s=d-c;l.scrollBy({left:s,behavior:"smooth"})},n=a=>{const l=e.querySelector(".audience-goal-switcher .navbar-tab-mobile")||document.querySelector(".navbar-mobile .navbar-tab-mobile");if(l){const c=l.querySelectorAll(".dropdown-menu .dropdown-item");if(c.length>0&&a<c.length){c.forEach(h=>{h.classList.remove("active")}),c[a].classList.add("active");const s=l.querySelector(".dropdown-toggle .dropdown-toggle-text");s&&(s.textContent=c[a].textContent)}}const u=e.querySelector(".audience-goal-switcher .navbar-tab")||document.querySelector(".navbar .navbar-tab");if(u){const c=u.querySelectorAll(".nav-item .nav-link");c.length>0&&a<c.length&&(c.forEach(s=>{s.classList.remove("active")}),c[a].classList.add("active"))}const i=e.querySelector(".audience-goal-switcher-cards");if(i){const c=i.querySelectorAll(".audience-goal-switcher-card"),s=c.length;if(s<0||a>s)return;g(c,a),o(c[a],i)}const d=e.querySelector(".audience-goal-switcher-carousel .carousel-wrapper");if(d){const c=d.querySelectorAll(".audience-goal-switcher-card"),s=c.length;if(s<0||a>s)return;g(c,a);const h=d.querySelector(".carousel");o(c[a],h||d)}w(r,a)};t.onChange(n),t.setValue(L(e)),m(e,t),y(e,t),A(e,t),q(e,t)},p=r=>{const e=r.querySelector(".audience-goal");e&&G(e)},E=()=>{document.querySelectorAll(".audience").forEach(e=>p(e))};document.addEventListener("DOMContentLoaded",E);

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.