1/** 2 * To Top "Arco / niche" (element `totop`) â client script. 3 * 4 * Comparsa in dissolvenza allo scroll: aggiunge/toglie la classe 5 * `.sm-totop-visible` sui link `.sm-totop[data-sm-autoshow="1"]` oltre la soglia 6 * `data-sm-offset`. Lo scroll fluido verso l'alto resta di `uk-scroll`. 7 * 8 * File esterno (NON inline nel template): un `<script>` inline nell'output degli 9 * element passa da wptexturize e si romperebbe (es. `&&` â `&`). Caricato 10 * globalmente da modules/custom_js/bootstrap.php; un solo listener per pagina. 11 */ 12(function () { 13 'use strict'; 14 15 function update() { 16 var y = window.pageYOffset || document.documentElement.scrollTop || 0; 17 var items = document.querySelectorAll('.sm-totop[data-sm-autoshow="1"]'); 18 for (var i = 0; i < items.length; i++) { 19 var el = items[i]; 20 var off = parseInt(el.getAttribute('data-sm-offset'), 10) || 400; 21 el.classList.toggle('sm-totop-visible', y > off); 22 } 23 } 24 25 var ticking = false; 26 window.addEventListener('scroll', function () { 27 if (ticking) { return; } 28 ticking = true; 29 requestAnimationFrame(function () { update(); ticking = false; }); 30 }, { passive: true }); 31 window.addEventListener('resize', update, { passive: true }); 32 33 if (document.readyState !== 'loading') { 34 update(); 35 } else { 36 document.addEventListener('DOMContentLoaded', update); 37 } 38})();
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.