PageSourceSearch

https://thecurrent.pk/wp-content/cache/perfmatters/thecurrent.pk/minify/788577d8c1bf.videos.min.js

js thecurrent.pk collected 2026-10-02 06:03:41 UTC 4,943 bytes, 43 lines download raw bytes

1document.addEventListener('DOMContentLoaded',()=>{const slider=document.getElementById('tc-videos-slider');function syncHiddenSlide(activeId){const slides=document.querySelectorAll('#tc-videos-slider .videos-slider__slide');slides.forEach(slide=>{if(slide.dataset.id===activeId){slide.style.display='none'}else{slide.style.display=''}})}
2function renderVideos(videos){return videos.map(v=>`
3            <div class="brxe-block videos-slider__slide"
4                data-id="${v.id}"
5                data-title="${v.title}"
6                data-thumb="${v.thumb}"
7                data-date="${v.date_formatted}"
8                data-duration="${v.duration}">
9
10                <img loading="lazy" src="${v.thumb}"
11                    class="brxe-image videos-slider__img css-filter size-large"
12                    alt="${v.title}">
13
14                <h3 class="brxe-heading videos-slider__title">
15                    ${v.title}
16                </h3>
17
18                <div class="brxe-post-meta tc-meta post-meta">
19                    <span class="item">${v.date_formatted}</span>
20
21                    ${v.duration ? `<span class="separator">•</span><span class="item">${v.duration}</span>` : ''}
22                </div>
23
24            </div>
25        `).join('')}
26function updateFeatured(video){const oldMedia=document.getElementById('tc-featured-media');if(oldMedia){const iframe=document.createElement('iframe');iframe.src=`https://www.youtube-nocookie.com/embed/${video.id}?rel=0&modestbranding=1`;iframe.title=video.title;iframe.width='100%';iframe.loading='lazy';iframe.height='100%';iframe.frameBorder='0';iframe.allow='autoplay; encrypted-media';iframe.allowFullscreen=!0;iframe.id='tc-featured-media';iframe.className=oldMedia.className;oldMedia.parentNode.replaceChild(iframe,oldMedia)}
27const linkWrap=document.getElementById('tc-featured-link');const a=linkWrap?.querySelector('a');if(a){a.href=`https://www.youtube.com/watch?v=${video.id}`;a.textContent=video.title}
28const meta=document.getElementById('tc-featured-meta');if(meta){meta.innerHTML=`
29                <span class="item">${video.date_formatted}</span>
30                <span class="separator">•</span>
31                <span class="item">${video.duration}</span>
32            `}
33const shareWrap=document.getElementById('tc-video-share-wrap');if(shareWrap){const url=encodeURIComponent(`https://www.youtube.com/watch?v=${video.id}`);const title=encodeURIComponent(video.title);const fb=shareWrap.querySelector('a.facebook');const tw=shareWrap.querySelector('a.twitter');const li=shareWrap.querySelector('a.linkedin');const wa=shareWrap.querySelector('a.whatsapp');if(fb){fb.href=`https://www.facebook.com/sharer.php?u=${url}`}
34if(tw){tw.href=`https://twitter.com/intent/tweet?text=${title}&url=${url}`}
35if(li){li.href=`https://www.linkedin.com/shareArticle?mini=true&url=${url}&title=${title}`}
36if(wa){wa.href=`https://api.whatsapp.com/send?text=*${title}*+${url}`}}
37syncHiddenSlide(video.id)}
38async function loadPlaylist(key){slider.innerHTML='Loading...';const res=await fetch(tc_data.ajax_url,{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body:new URLSearchParams({action:'tc_get_videos',key})});const data=await res.json();if(!data.success)return;const videos=data.data.videos;slider.innerHTML=renderVideos(videos);if(videos.length)updateFeatured(videos[0]);}
39document.addEventListener('click',(e)=>{const tab=e.target.closest('.tab-title');if(!tab)return;loadPlaylist(tab.dataset.key)});document.addEventListener('click',(e)=>{const slide=e.target.closest('.videos-slider__slide');if(!slide)return;updateFeatured({id:slide.dataset.id,title:slide.dataset.title,date_formatted:slide.dataset.date,duration:slide.dataset.duration})});if(tc_data.firstVideo){updateFeatured(tc_data.firstVideo)}
40const btnUp=document.getElementById('tc-video-up');const btnDown=document.getElementById('tc-video-down');if(!slider)return;const scrollAmount=250;btnUp?.addEventListener('click',()=>{slider.scrollBy({top:-scrollAmount,behavior:'smooth'})});btnDown?.addEventListener('click',()=>{slider.scrollBy({top:scrollAmount,behavior:'smooth'})});function updateButtons(){const isTop=slider.scrollTop<=0;const isBottom=slider.scrollTop+slider.clientHeight>=slider.scrollHeight-1;toggleState(btnUp,isTop);toggleState(btnDown,isBottom)}
41function toggleState(el,disabled){if(!el)return;if(disabled){el.style.opacity='0.3';el.style.cursor='not-allowed';el.style.pointerEvents='none'}else{el.style.opacity='1';el.style.cursor='pointer';el.style.pointerEvents='auto'}}
42slider.addEventListener('scroll',updateButtons);updateButtons();const tabs=document.querySelectorAll('.tab-title');if(tabs.length){tabs[0].setAttribute('data-active','active')}
43document.addEventListener('click',(e)=>{const tab=e.target.closest('.tab-title');if(!tab)return;document.querySelectorAll('.tab-title').forEach(t=>t.removeAttribute('data-active'));tab.setAttribute('data-active','active')})})

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.