https://sportando.basketball/wp-content/plugins/disqus-last-comments/assets/widgets.js?m=1790259564g
1( function () { 2 'use strict'; 3 4 var FALLBACK_AVATAR = '//a.disquscdn.com/1789080375/images/noavatar32.png'; 5 6 function pad( n ) { 7 return n < 10 ? '0' + n : n; 8 } 9 10 function formatDate( value ) { 11 var d = new Date( value ); 12 if ( isNaN( d.getTime() ) ) { 13 return ''; 14 } 15 return pad( d.getDate() ) + '/' + pad( d.getMonth() + 1 ) + '/' + d.getFullYear() + 16 ' ' + pad( d.getHours() ) + ':' + pad( d.getMinutes() ); 17 } 18 19 function escapeHtml( value ) { 20 return String( value === null || value === undefined ? '' : value ).replace( /[&<>"']/g, function ( c ) { 21 return { 22 '&': '&', 23 '<': '<', 24 '>': '>', 25 '"': '"', 26 "'": ''', 27 }[ c ]; 28 } ); 29 } 30 31 function lazyLoadImages( root ) { 32 if ( ! ( 'IntersectionObserver' in window ) ) { 33 ( root || document ).querySelectorAll( 'img[data-src]' ).forEach( function ( img ) { 34 img.src = img.dataset.src; 35 img.removeAttribute( 'data-src' ); 36 } ); 37 return; 38 } 39 40 var observer = new IntersectionObserver( function ( entries, obs ) { 41 entries.forEach( function ( entry ) { 42 if ( entry.isIntersecting ) { 43 var img = entry.target; 44 if ( img.dataset.src ) { 45 img.src = img.dataset.src; 46 img.removeAttribute( 'data-src' ); 47 } 48 obs.unobserve( img ); 49 } 50 } ); 51 }, { threshold: 0.4 } ); 52 53 ( root || document ).querySelectorAll( 'img[data-src]' ).forEach( function ( img ) { 54 observer.observe( img ); 55 } ); 56 } 57 58 /** 59 * Costruisce il markup di un singolo commento (equivalente al v-for del template Vue). 60 * item.message arriva già come HTML da Disqus (era un v-html anche nella versione Vue), 61 * per cui non viene escapato; tutto il resto del testo sì. 62 */ 63 function buildCommentItem( item ) { 64 var author = item.author || {}; 65 var thread = item.thread || {}; 66 var authorName = author.name || ''; 67 var authorUrl = author.profileUrl || '#'; 68 var avatarUrl = ( author.avatar && author.avatar.small && author.avatar.small.cache ) ? author.avatar.small.cache : FALLBACK_AVATAR; 69 70 var article = document.createElement( 'article' ); 71 article.className = 'single-post'; 72 article.innerHTML = 73 '<figure class="float-left">' + 74 '<a href="' + escapeHtml( authorUrl ) + '" title="' + escapeHtml( authorName ) + '" target="_blank" rel="noopener">' + 75 '<img data-src="' + escapeHtml( avatarUrl ) + '" alt="' + escapeHtml( authorName ) + '" class="img-thumbnail" ' + 76 'onerror="this.onerror=null;this.src=\'' + FALLBACK_AVATAR + '\';" />' + 77 '</a>' + 78 '</figure>' + 79 '<div class="content">' + 80 '<h4 class="user-title"><a href="' + escapeHtml( authorUrl ) + '" title="' + escapeHtml( authorName ) + '" target="_blank" rel="noopener">' + escapeHtml( authorName ) + '</a></h4>' + 81 '<p class="post-date">' + escapeHtml( formatDate( item.createdAt ) ) + '</p>' + 82 '<h3 class="post-title"><a href="' + escapeHtml( item.url || '#' ) + '" title="' + escapeHtml( thread.title ) + '">' + escapeHtml( thread.title ) + '</a></h3>' + 83 '<div class="dlc-message"></div>' + 84 '</div>'; 85 86 var messageEl = article.querySelector( '.dlc-message' ); 87 if ( messageEl ) { 88 messageEl.innerHTML = item.message || ''; 89 } 90 91 return article; 92 } 93 94 /** 95 * Costruisce il markup di un thread "hot" (più commentati). 96 */ 97 function buildHotItem( item ) { 98 var article = document.createElement( 'article' ); 99 article.className = 'single-post'; 100 article.innerHTML = 101 '<div><a href="' + escapeHtml( item.link || '#' ) + '" title="' + escapeHtml( item.title ) + '" class="btn btn-sm btn-primary btn-term btn-comments">' + escapeHtml( item.posts ) + '</a></div>' + 102 '<h3 class="post-title padding-top-5"><a href="' + escapeHtml( item.link || '#' ) + '" title="' + escapeHtml( item.title ) + '">' + escapeHtml( item.title ) + '</a></h3>'; 103 return article; 104 } 105 106 /** 107 * Widget "Gli ultimi commenti" 108 */ 109 function initLastComments( root ) { 110 var refreshSeconds = parseInt( root.dataset.refresh, 10 ) || 30; 111 var endpointList = root.dataset.endpoint || ( DLC_Data.site_url + '/disqus/list.json' ); 112 var countdownWrap = root.querySelector( '.disqus-countdown' ); 113 var countdownValue = root.querySelector( '.dlc-countdown-value' ); 114 var itemsWrap = root.querySelector( '.dlc-items' ); 115 var currentCountDown = refreshSeconds; 116 117 if ( countdownValue ) { 118 countdownValue.textContent = currentCountDown; 119 } 120 121 function renderComments( items ) { 122 if ( ! itemsWrap ) { 123 return; 124 } 125 itemsWrap.innerHTML = '';
126 items.forEach( function ( item ) { 127 itemsWrap.appendChild( buildCommentItem( item ) ); 128 } ); 129 lazyLoadImages( itemsWrap ); 130 } 131 132 function runCountdown() { 133 if ( currentCountDown > 0 ) { 134 setTimeout( function () { 135 currentCountDown -= 1; 136 if ( countdownValue ) { 137 countdownValue.textContent = currentCountDown; 138 } 139 runCountdown(); 140 }, 1000 ); 141 } else { 142 currentCountDown = refreshSeconds; 143 fetchComments(); 144 } 145 } 146 147 function fetchComments() { 148 fetch( endpointList + '?ver=' + Date.now() ) 149 .then( function ( r ) { return r.json(); } ) 150 .then( function ( data ) { 151 renderComments( data.response || [] ); 152 } ) 153 .catch( function ( err ) { 154 console.error( err ); 155 } ) 156 .finally( function () { 157 if ( countdownWrap ) { 158 countdownWrap.style.display = ''; 159 } 160 runCountdown(); 161 } ); 162 } 163 164 fetchComments(); 165 } 166 167 /** 168 * Widget "Hot news" (più commentati) 169 */ 170 function initMostCommented( root ) { 171 var endpointHot = root.dataset.endpoint || ( DLC_Data.site_url + '/disqus/listHot.json' ); 172 var itemsWrap = root.querySelector( '.dlc-hot-items' ); 173 174 fetch( endpointHot + '?ver=' + Date.now() ) 175 .then( function ( r ) { return r.json(); } ) 176 .then( function ( data ) { 177 var items = data.response || []; 178 if ( ! itemsWrap ) { 179 return; 180 } 181 itemsWrap.innerHTML = ''; 182 items.forEach( function ( item ) { 183 itemsWrap.appendChild( buildHotItem( item ) ); 184 } ); 185 } ) 186 .catch( function ( err ) { 187 console.error( err ); 188 } ); 189 } 190 191 var lastCommentsEl = document.getElementById( 'disqus-last-comments-app' ); 192 if ( lastCommentsEl && typeof DLC_Data !== 'undefined' ) { 193 initLastComments( lastCommentsEl ); 194 } 195 196 var mostCommentedEl = document.getElementById( 'disqus-more-commented-app' ); 197 if ( mostCommentedEl && typeof DLC_Data !== 'undefined' ) { 198 initMostCommented( mostCommentedEl ); 199 } 200} )();
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.