1/** 2 * Listovánà v ohlasech studentů. 3 * 4 * Trojice ohlasů jsou v HTML vÅ¡echny, vidÄt je vždy jedna. Bez tohohle skriptu 5 * zůstane prvnà a Å¡ipky se schovajà (CSS je ukazuje jen pod html.js), takže 6 * sekce dává smysl i bez JavaScriptu. 7 */ 8(function () { 9 'use strict'; 10 11 var koren = document.querySelector('[data-testimonials]'); 12 13 if (!koren) { 14 return; 15 } 16 17 var stranky = koren.querySelectorAll('.his-testimonials__page'); 18 var predchozi = koren.querySelector('.his-testimonials__arrow--prev'); 19 var dalsi = koren.querySelector('.his-testimonials__arrow--next'); 20 21 if (stranky.length < 2) { 22 // Jediná trojice â listovat nenà kam. 23 if (predchozi) { predchozi.hidden = true; } 24 if (dalsi) { dalsi.hidden = true; } 25 return; 26 } 27 28 var aktualni = 0; 29 30 function ukaz(index) { 31 // Dokola: za poslednà trojicà je zase prvnÃ. 32 aktualni = (index + stranky.length) % stranky.length; 33 34 Array.prototype.forEach.call(stranky, function (s, i) { 35 s.hidden = i !== aktualni; 36 }); 37 } 38 39 predchozi.addEventListener('click', function () { 40 ukaz(aktualni - 1); 41 }); 42 43 dalsi.addEventListener('click', function () { 44 ukaz(aktualni + 1); 45 }); 46 47 koren.addEventListener('keydown', function (e) { 48 if (e.key === 'ArrowLeft') { 49 ukaz(aktualni - 1); 50 } else if (e.key === 'ArrowRight') { 51 ukaz(aktualni + 1); 52 } 53 }); 54})();
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.