1(function() { 2 "use strict"; 3 4 /** 5 * Easy selector helper function 6 */ 7 const select = (el, all = false) => { 8 el = el.trim() 9 if (all) { 10 return [...document.querySelectorAll(el)] 11 } else { 12 return document.querySelector(el) 13 } 14 } 15 16 /** 17 * Easy event listener function 18 */ 19 const on = (type, el, listener, all = false) => { 20 let selectEl = select(el, all) 21 if (selectEl) { 22 if (all) { 23 selectEl.forEach(e => e.addEventListener(type, listener)) 24 } else { 25 selectEl.addEventListener(type, listener) 26 } 27 } 28 } 29 30 /** 31 * Easy on scroll event listener 32 */ 33 const onscroll = (el, listener) => { 34 el.addEventListener('scroll', listener) 35 } 36 37 /** 38 * Back to top button 39 */ 40 let backtotop = select('.back-to-top') 41 if (backtotop) { 42 const toggleBacktotop = () => { 43 if (window.scrollY > 100) { 44 backtotop.classList.add('active') 45 } else { 46 backtotop.classList.remove('active') 47 } 48 } 49 window.addEventListener('load', toggleBacktotop) 50 onscroll(document, toggleBacktotop) 51 } 52 53 /** 54 * Games isotope and filter 55 */ 56 window.addEventListener('load', () => { 57 let gameContainer = select('.games-container'); 58 if (gameContainer) { 59 let gameIsotope = new Isotope(gameContainer, { 60 itemSelector: '.games-item', 61 layoutMode: 'fitRows' 62 }); 63 64 let gameFilters = select('#games-flters li', true); 65 66 on('click', '#games-flters li', function(e) { 67 e.preventDefault(); 68 gameFilters.forEach(function(el) { 69 el.classList.remove('filter-active'); 70 }); 71 this.classList.add('filter-active'); 72 73 gameIsotope.arrange({ 74 filter: this.getAttribute('data-filter') 75 }); 76 }, true); 77 } 78 }); 79})()
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.