MENU
Kategori Berita
Daerah
Layanan
Top Up & Tagihan
Detik Network

Update

${Array(3).fill(`
`).join('')}

Schedule

${Array(3).fill(`
`).join('')}
The 8 Trust Wallets Top 100 Spot How Assets
`; this.articleContainer = this.shadowRoot.querySelector("[data-article='container']"); this.articleTemplate = this.shadowRoot.querySelector("#community-article-template"); this.eventContainer = this.shadowRoot.querySelector("[data-event='container']"); this.eventSection = this.shadowRoot.querySelector("[data-event='section']"); this.eventTemplate = this.shadowRoot.querySelector("#community-event-template"); } connectedCallback() { this.fetchData(); } async fetchData() { try { const response = await fetch("https://health.detik.com/ajax/communityconnect", { headers: { 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/json' } }); if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`); const data = await response.json(); this._renderData(data); this._toggleWrapper(data); } catch (error) {} } _toggleWrapper(data) { const hasContent = data.data_articles.length > 0 || data.data_events.length > 0; this.style.display = hasContent ? 'block' : 'none'; } _setTracking(el, { title, id, index, evt, sec, act }) { if (!el) return; el.setAttribute("dtr-evt", evt); el.setAttribute("dtr-sec", sec); el.setAttribute("dtr-act", act); el.setAttribute("onclick", "_pt(this)"); el.setAttribute("dtr-idx", parseInt(index) + 1); el.setAttribute("dtr-id", id); el.setAttribute("dtr-ttl", title); } _renderData(data) { const artSkeleton = this.shadowRoot.querySelector("[data-article='skeleton']"); const evtSkeleton = this.shadowRoot.querySelector("[data-event='skeleton']"); if (artSkeleton) artSkeleton.remove(); if (evtSkeleton) evtSkeleton.remove(); if (data.data_events.length == 0){ this.eventSection.style.display = 'none'; } data.data_events.forEach((event, index) => { const clone = this.eventTemplate.content.cloneNode(true); const title = clone.querySelector("[data-event='title']"); const cover = clone.querySelector("[data-event='cover']"); const loc = clone.querySelector("[data-event='location']"); const time = clone.querySelector("[data-event='time']"); if (title) { title.textContent = event.title; if (event.url) title.href = event.url; this._setTracking(title, { title: event.evt_title, id: event.id, index, evt: 'box community connect', sec: 'community date', act: 'community date' }); } if (cover) cover.src = event.image; if (loc) loc.textContent = event.location || 'Location not set'; if (time) time.textContent = event.time || 'Time not set'; this.eventContainer.appendChild(clone); }); data.data_articles.forEach((article, index) => { const clone = this.articleTemplate.content.cloneNode(true); const titleEl = clone.querySelector("[data-article='title']"); const urlEl = clone.querySelector("[data-article='url']"); const cover = clone.querySelector("[data-article='cover']"); if (titleEl) { titleEl.textContent = article.title; titleEl.href = article.url; this._setTracking(titleEl, { title: article.evt_title, id: article.id, index, evt: 'box community connect', sec: 'community update', act: 'artikel community' }); } if (cover) cover.src = article.image; if (urlEl) { urlEl.href = article.url; this._setTracking(urlEl, { title: article.evt_title, id: article.id, index, evt: 'box community connect', sec: 'community update', act: 'artikel community' }); } this.articleContainer.appendChild(clone); }); } } customElements.define("community-connect", CommunityConnect);
Kirim Pertanyaan Seputar Kesehatan Anda di Sini
Evolution Games Play Gaming Mutation Age Evolution Run Selection Runner

ADVERTISEMENT

SCROLL TO CONTINUE WITH CONTENT

BGN Klaim Kasus Keracunan MBG Menurun

Senin, 23 Nov 2026 10:11 WIB

Dokter Online 24 Jam

Vr7 Login Your Vr7 Vr7 Registering At Vr7 Enjoy Blackjack Private

Sabtu, 21 Nov 2026 20:03 WIB

Kolom Gizi

Play Free Hidden Now Enjoy Free Online Phone Newest

Sabtu, 21 Nov 2026 17:09 WIB
Indeks Berita

Tag Terpopuler

Hitung BMI & BMR

Temukan kondisi fisikmu dan pelajari cara mengelola kebugaran tubuhmu di sini.

  • thn
  • Umur hanya bisa untuk 18-65
  • kg
  • cm

Berita Terpopuler

Komentar Terbanyak

Obat & Penyakit

Temukan informasi seputar obat & penyakit di sini

`; $('#wid_select_obatpenyakit_wp').change(function(){ var value = $(this).val(); $('[d-widget="obatpenyakit_wp"]').remove(); if ( $('[d-widget="obatpenyakit_wp"]').length == 0 ){ var el = '
'+_box_obatpenyakit_placeholder+'
'; var html = $.parseHTML(el); $('#cb_obatpenyakit_wp').append(html); dWidget.init($(html)); } $(this).attr('dtr-idx', value); $(this).attr('dtr-ttl', value); _pt(this); });
Hide Ads