1(function() { 2 var $ = jQuery; 3 var eventListRow; 4 var owl; 5 var currentMatchDay = 1; 6 var lastMatchDay; 7 var loader; 8 var pageWrapper; 9 10 var footerCopyExpanded = false; 11 $(document).ready(function() { 12 handleFooterCopy(); 13 }); 14 15 function showContent() { 16 loader.style.display = 'none'; 17 pageWrapper.classList.remove('loading'); 18 } 19 function estimateMatchDay() { 20 21 if (!eventListRow) return; 22 const now = Date.now(); 23 const later = now + (7 * 24 * 60 * 60 *1000); //aggiungo 7 giorni 24 25 for (var i=0; i<eventListRow.length; i++) { 26 const node = eventListRow[i]; 27 if (node.children.length > 0 && node.getAttribute('data-match-day')) { 28 const date = node.childNodes[0].getAttribute('content'); 29 if (!date) return; 30 const timestamp = Date.parse(date); 31 if (timestamp >= now && timestamp <= later) { 32 changeMatchDay(node.getAttribute('data-match-day')); 33 break; 34 } 35 } 36 } 37 38 } 39 40 function handleFooterCopy() { 41 var copyReadMore = document.querySelector('#footer-copy-read-more'); 42 var copyHidden = document.querySelector('#footer-copy-hidden'); 43 copyReadMore.addEventListener('click', function() { 44 footerCopyExpanded = !footerCopyExpanded; 45 copyHidden.style.display = footerCopyExpanded ? 'inline' : 'none'; 46 copyReadMore.innerText = footerCopyExpanded ? '(Leggi meno...)' : '(Leggi di più...)'; 47 }) 48 } 49 function loadOwl() { 50 owl = $(".pn-owl-carousel"); 51 if (owl) { 52 owl.owlCarousel({ 53 loop: false, 54 nav: false, 55 dots: false, 56 URLhashListener:true, 57 startPosition: 'URLHash', 58 59 responsive: { 60 0: { 61 items: 1, 62 }, 63 480: { 64 items: 2 65 }, 66 768: { 67 items: 12, 68 } 69 }, 70 onInitialized: function() { 71 showContent(); 72 }, 73 navText: ["‹","›"], 74 }); 75 76 function handleSwipe(e) { 77 if (!e) return; 78 console.log(e.item.index, e.item.count); 79 } 80 /* owl.on('next.owl.carousel', function() { 81 alert("aa"); 82 });*/ 83 eventListRow = document.querySelectorAll('.pn-sp-event-list-row,.pn-sp-event-list-day-row'); 84 estimateMatchDay(); 85 $('.pn-owl-carousel-next-trigger').on('click', function() { 86 if (currentMatchDay === lastMatchDay) return; 87 owl.trigger('next.owl.carousel'); 88 changeMatchDay(parseInt(currentMatchDay)+1); 89 90 }); 91 $('.pn-owl-carousel-prev-trigger').on('click', function() { 92 if (currentMatchDay === 1) return; 93 owl.trigger('prev.owl.carousel'); 94 changeMatchDay(parseInt(currentMatchDay)-1); 95 96 }); 97 const lastMatchDayEl = document.querySelector('.pn-owl-carousel .pn-sp-matchday[data-last]'); 98 if (lastMatchDayEl) lastMatchDay = parseInt(lastMatchDayEl.getAttribute('data-target')); 99 100 $(".pn-owl-carousel .owl-item").on('click', function () { 101 $(".pn-owl-carousel .owl-item").each(function () { 102 $(this).removeClass('current'); 103 }); 104 105 const targetDay = this.children[0].getAttribute('data-target'); 106 $(this).addClass('current'); 107 changeMatchDay(targetDay); 108 109 }) 110 } 111 } 112 function changeMatchDay(matchDay) { 113 eventListRow.forEach(function (node) { 114 if (parseInt(node.getAttribute('data-match-day')) === parseInt(matchDay)) { 115 node.style.display = 'flex'; 116 } else { 117 node.style.display = 'none'; 118 } 119 currentMatchDay = parseInt(matchDay) ; 120 }); 121 122 $(".pn-owl-carousel .owl-item").each(function () { 123 const child = $(this).find('.pn-owl-carousel-item'); 124 125 if (!(child.length > 0)) return; 126 if (parseInt(child[0].getAttribute('data-target')) === parseInt(matchDay)) { 127 $(this).addClass('current') 128 } else { 129 $(this).removeClass('current'); 130 } 131 }); 132 window.location.hash = matchDay; 133 134 } 135})();
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.