function scrollIt(destination, duration = 200, easing = 'linear', callback) { const easings = { linear(t) { return t; }, easeInQuad(t) { return t * t; }, easeOutQuad(t) { return t * (2 - t); }, easeInOutQuad(t) { return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; }, easeInCubic(t) { return t * t * t; }, easeOutCubic(t) { return (--t) * t * t + 1; }, easeInOutCubic(t) { return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; }, easeInQuart(t) { return t * t * t * t; }, easeOutQuart(t) { return 1 - (--t) * t * t * t; }, easeInOutQuart(t) { return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t; }, easeInQuint(t) { return t * t * t * t * t; }, easeOutQuint(t) { return 1 + (--t) * t * t * t * t; }, easeInOutQuint(t) { return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t; } }; const start = window.pageYOffset; const startTime = 'now' in window.performance ? performance.now() : new Date().getTime(); const documentHeight = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight); const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight; const destinationOffset = typeof destination === 'number' ? destination : destination.offsetTop; const destinationOffsetToScroll = Math.round(documentHeight - destinationOffset < windowHeight ? documentHeight - windowHeight : destinationOffset); if ('requestAnimationFrame' in window === false) { window.scroll(0, destinationOffsetToScroll); if (callback) { callback(); } return; } function scroll() { const now = 'now' in window.performance ? performance.now() : new Date().getTime(); const time = Math.min(1, ((now - startTime) / duration)); const timeFunction = easings[easing](time); window.scroll(0, Math.ceil((timeFunction * (destinationOffsetToScroll - start)) + start)); if (window.pageYOffset === destinationOffsetToScroll) { if (callback) { callback(); } return; } requestAnimationFrame(scroll); } scroll(); } /* Polyfill for closest */ if (window.Element && !Element.prototype.closest) { Element.prototype.closest = function(s) { var matches = (this.document || this.ownerDocument).querySelectorAll(s), i, el = this; do { i = matches.length; while (--i >= 0 && matches.item(i) !== el) {}; } while ((i < 0) && (el = el.parentElement)); return el; }; } /* Current and ancestor nav items */ var arrNavs = document.getElementsByClassName("nav"); var i; for (i = 0; i < arrNavs.length; i++) { var arrLinks = arrNavs[i].getElementsByTagName("a"); for(j=0;j'; } else { arrPaginators[i].innerHTML += '' + (page+1) + ''; } } } /* General */ var header = document.getElementById("header"); var logo = document.getElementById("logo"); var nav = document.getElementById("nav"); var navInside = document.getElementById("nav-inside"); var navSwitch = document.getElementById("nav-switch"); var langSwitch = document.getElementById("lang-switch"); var goTop = document.getElementById("gotop"); function updateScrollingState() { if(window.pageYOffset == 0) { header.classList.remove("scrolled"); nav.classList.remove("scrolled"); logo.classList.remove("scrolled"); langSwitch.classList.remove("scrolled"); gotop.classList.remove("active"); } else { header.classList.add("scrolled"); nav.classList.add("scrolled"); logo.classList.add("scrolled"); langSwitch.classList.add("scrolled"); gotop.classList.add("active"); } } updateScrollingState(); window.onscroll = function(e) { updateScrollingState(); } /* Intro */ var intro = document.getElementById("intro"); if(intro) { var isi01 = document.getElementById("isi-01"); var isi02 = document.getElementById("isi-02"); var isi03 = document.getElementById("isi-03"); intro.classList.add("stage-01"); function changeIntro() { if(intro.classList.contains("stage-01")) { intro.classList.remove("stage-01"); intro.classList.add("stage-02"); } else if(intro.classList.contains("stage-02")) { intro.classList.remove("stage-02"); intro.classList.add("stage-03"); } else { intro.classList.remove("stage-03"); intro.classList.add("stage-01"); } } setInterval(function() { changeIntro(); }, 3000); } /* Block Items Pics */ var biItemPics = document.getElementsByClassName("bi-item-pic"); for(var i=0;i 0) { for(var i=0;i< eexoosResponsiveTable.length;i++) { var curTable = eexoosResponsiveTable[i]; var arrLabels = []; var curTh = curTable.querySelectorAll(".ert-th"); for(var ith=0;ith' + innerHtmlPre + ''; } } } } document.addEventListener("DOMContentLoaded", function(event) { var element = document.querySelector("[data-lang-item='ru']"); element.addEventListener("click", function(e) { e.preventDefault() var url = "https://ru.ethnogames.org"+location.pathname; window.location = url; }, false); });