PageSourceSearch

https://pietrodefilippis.it/wp-content/litespeed/js/ce1eedf81050733c869dc36754d3fc58.js?ver=a0c3a

js pietrodefilippis.it collected 2026-10-02 01:58:54 UTC 8,382 bytes, 22 lines download raw bytes

1(function(){'use strict';function embedBase(gallery){return gallery&&gallery.getAttribute('data-privacy')==='0'?'https://www.youtube.com/embed/':'https://www.youtube-nocookie.com/embed/'}
2var state={gallery:null,lb:null,items:[],index:0,autoplay:!0};function buildItems(gallery){var nodes=gallery.querySelectorAll('.tk-ytg-item-lb');return Array.prototype.map.call(nodes,function(el){return{id:el.getAttribute('data-id')||'',short:el.getAttribute('data-short')==='1',title:el.getAttribute('data-title')||'',href:el.getAttribute('href')||''}})}
3function openLightbox(gallery,index){var lb=document.getElementById(gallery.id+'-lb');if(!lb)return!1;state.gallery=gallery;state.lb=lb;state.items=buildItems(gallery);state.index=index;state.autoplay=gallery.getAttribute('data-autoplay')!=='0';if(!state.items.length)return!1;lb.hidden=!1;document.body.style.overflow='hidden';renderSlide();var close=lb.querySelector('.tk-ytg-lb-close');if(close)close.focus({preventScroll:!0});return!0}
4function closeLightbox(){if(!state.lb)return;var content=state.lb.querySelector('.tk-ytg-lb-content');if(content)content.innerHTML='';state.lb.hidden=!0;document.body.style.overflow='';state.lb=null;state.gallery=null;state.items=[]}
5function navigate(dir){if(!state.lb||!state.items.length)return;state.index=(state.index+dir+state.items.length)%state.items.length;renderSlide()}
6function renderSlide(){if(!state.lb)return;var item=state.items[state.index];if(!item)return;var content=state.lb.querySelector('.tk-ytg-lb-content');var caption=state.lb.querySelector('.tk-ytg-lb-caption');var counter=state.lb.querySelector('.tk-ytg-lb-counter');if(content){content.innerHTML='';content.classList.toggle('tk-ytg-lb-v',item.short);if(item.id){var iframe=document.createElement('iframe');iframe.src=embedBase(state.gallery)+encodeURIComponent(item.id)+'?rel=0&playsinline=1&modestbranding=1&autoplay='+(state.autoplay?'1':'0');iframe.setAttribute('allow','accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen');iframe.setAttribute('allowfullscreen','allowfullscreen');iframe.setAttribute('referrerpolicy','strict-origin-when-cross-origin');iframe.setAttribute('title',item.title||'YouTube');content.appendChild(iframe)}else if(item.href){window.open(item.href,'_blank','noopener');closeLightbox();return}}
7if(caption)caption.textContent=item.title||'';if(counter)counter.textContent=state.items.length>1?(state.index+1)+' / '+state.items.length:'';var single=state.items.length<2;Array.prototype.forEach.call(state.lb.querySelectorAll('.tk-ytg-lb-prev, .tk-ytg-lb-next'),function(b){b.hidden=single})}
8document.addEventListener('click',function(e){var link=e.target.closest?e.target.closest('.tk-ytg-item-lb'):null;if(!link)return;if(e.ctrlKey||e.metaKey||e.shiftKey||e.button===1)return;var gallery=link.closest('.tk-ytg-gallery');if(!gallery||gallery.getAttribute('data-lightbox')!=='1')return;var nodes=gallery.querySelectorAll('.tk-ytg-item-lb');var index=Array.prototype.indexOf.call(nodes,link);if(index<0)return;if(openLightbox(gallery,index))e.preventDefault();});document.addEventListener('click',function(e){if(!state.lb)return;var t=e.target;if(t.closest('.tk-ytg-lb-close')){closeLightbox();return}
9if(t.closest('.tk-ytg-lb-prev')){navigate(-1);return}
10if(t.closest('.tk-ytg-lb-next')){navigate(1);return}
11if(t===state.lb)closeLightbox();});document.addEventListener('keydown',function(e){if(!state.lb)return;if(e.key==='Escape')closeLightbox();if(e.key==='ArrowLeft')navigate(-1);if(e.key==='ArrowRight')navigate(1);});var touchX=0,touchY=0;document.addEventListener('touchstart',function(e){if(!state.lb||!e.changedTouches.length)return;touchX=e.changedTouches[0].clientX;touchY=e.changedTouches[0].clientY},{passive:!0});document.addEventListener('touchend',function(e){if(!state.lb||!e.changedTouches.length)return;var dx=e.changedTouches[0].clientX-touchX;var dy=e.changedTouches[0].clientY-touchY;if(Math.abs(dx)>50&&Math.abs(dx)>Math.abs(dy)){navigate(dx>0?-1:1)}},{passive:!0});function startPreview(wrap){if(!wrap||wrap.querySelector('.tk-ytg-preview'))return;var id=wrap.getAttribute('data-id');if(!id)return;var gallery=wrap.closest('.tk-ytg-gallery');var frame=document.createElement('iframe');frame.className='tk-ytg-preview';frame.src=embedBase(gallery)+encodeURIComponent(id)+'?autoplay=1&mute=1&controls=0&loop=1&playlist='+encodeURIComponent(id)+'&playsinline=1&rel=0&disablekb=1&fs=0&iv_load_policy=3&modestbranding=1';frame.setAttribute('allow','autoplay; encrypted-media');frame.setAttribute('tabindex','-1');frame.setAttribute('aria-hidden','true');wrap.appendChild(frame);wrap.classList.add('tk-ytg-previewing')}
12function stopPreview(wrap){if(!wrap)return;var frame=wrap.querySelector('.tk-ytg-preview');if(frame)frame.parentNode.removeChild(frame);wrap.classList.remove('tk-ytg-previewing')}
13function initPreview(gallery){var mode=gallery.getAttribute('data-preview');if(!mode||mode==='off')return;var wraps=Array.prototype.slice.call(gallery.querySelectorAll('.tk-ytg-thumb-wrap'));if(!wraps.length)return;var finePointer=window.matchMedia&&window.matchMedia('(hover: hover) and (pointer: fine)').matches;if(mode==='hover'&&finePointer){wraps.forEach(function(wrap){var timer=null;wrap.addEventListener('mouseenter',function(){timer=setTimeout(function(){startPreview(wrap)},250)});wrap.addEventListener('mouseleave',function(){clearTimeout(timer);stopPreview(wrap)})});return}
14if(!('IntersectionObserver' in window))return;var duration=parseInt(gallery.getAttribute('data-preview-duration'),10);if(isNaN(duration)||duration<3)duration=5;var visible=[];var current=null;var timer=null;function cycle(){if(!visible.length){timer=null;return}
15if(current)stopPreview(current);var next=0;if(current){var idx=visible.indexOf(current);next=(idx+1)%visible.length}
16current=visible[next];startPreview(current);timer=setTimeout(cycle,duration*1000)}
17var io=new IntersectionObserver(function(entries){entries.forEac
17h(function(en){var i=visible.indexOf(en.target);if(en.isIntersecting&&i<0){visible.push(en.target)}else if(!en.isIntersecting&&i>=0){visible.splice(i,1);if(current===en.target){stopPreview(current);current=null}}});if(!timer&&visible.length)cycle();},{threshold:0.5});wraps.forEach(function(w){io.observe(w)});document.addEventListener('visibilitychange',function(){if(document.hidden){clearTimeout(timer);timer=null;if(current){stopPreview(current);current=null}}else if(!timer&&visible.length){cycle()}})}
18function scrollStep(track){var item=track.querySelector('.tk-ytg-item');if(!item)return track.clientWidth;var styles=window.getComputedStyle(track);var gap=parseInt(styles.columnGap||styles.gap,10);if(isNaN(gap))gap=0;return item.getBoundingClientRect().width+gap}
19function updateArrows(gallery){var track=gallery.querySelector('.tk-ytg-carousel-track');var prev=gallery.querySelector('.tk-ytg-carousel-prev');var next=gallery.querySelector('.tk-ytg-carousel-next');if(!track)return;var maxScroll=track.scrollWidth-track.clientWidth-2;if(prev)prev.disabled=track.scrollLeft<=2;if(next)next.disabled=track.scrollLeft>=maxScroll;var thumb=track.querySelector('.tk-ytg-thumb-wrap');if(thumb){var top=thumb.getBoundingClientRect().top-gallery.getBoundingClientRect().top+thumb.offsetHeight/2;gallery.style.setProperty('--tk-ytg-arrow-top',Math.round(top)+'px')}}
20document.addEventListener('click',function(e){var btn=e.target.closest?e.target.closest('.tk-ytg-carousel-prev, .tk-ytg-carousel-next'):null;if(!btn)return;var gallery=btn.closest('.tk-ytg-gallery');var track=gallery?gallery.querySelector('.tk-ytg-carousel-track'):null;if(!track)return;var dir=btn.classList.contains('tk-ytg-carousel-next')?1:-1;track.scrollBy({left:dir*scrollStep(track),behavior:'smooth'})});function init(){Array.prototype.forEach.call(document.querySelectorAll('.tk-ytg-layout-carousel'),function(gallery){var track=gallery.querySelector('.tk-ytg-carousel-track');if(!track)return;updateArrows(gallery);track.addEventListener('scroll',function(){updateArrows(gallery)},{passive:!0});window.addEventListener('resize',function(){updateArrows(gallery)});window.addEventListener('load',function(){updateArrows(gallery)})});Array.prototype.forEach.call(document.querySelectorAll('.tk-ytg-gallery'),initPreview)}
21if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',init)}else{init()}})()
22;

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.