var pagination_click;(function(){var currentPage=1;function handleLinks(){document.querySelectorAll('.pagination a').forEach(function(el,i){el.addEventListener("click",function(ev){ev.preventDefault();let parent=(!ev.target.parentNode.classList.contains("pagination")?ev.target.parentNode.parentNode:ev.target.parentNode);pagination_click(this.getAttribute("href"),parent)})})} document.querySelectorAll('.pagination a').forEach(function(el,i){el.setAttribute("href","/json"+el.getAttribute("href")+".json")});handleLinks();const preloadImage=src=>new Promise(r=>{const image=new Image();image.onload=r;image.onerror=r;image.src=src});pagination_click=function(href,pagination){pagination.classList.add("working");var xhttp=new XMLHttpRequest();xhttp.onreadystatechange=async function(){if(this.readyState==4&&this.status==200){var result=JSON.parse(this.responseText);var pageOld=document.getElementById("pageCurrent");var pageNew=document.createElement("div");pageNew.setAttribute("id","pageNew");if(currentPage{if(value.image)images.push(value.image)});if(images.length>0)await Promise.all(images.map(x=>preloadImage(x)));new Promise(function(resolve,reject){document.getElementById("paginated_container").appendChild(pageNew);resolve(1)}).then(function(promiseResult){let el=document.getElementById("paginated_container");var startTime=null,percent,elapsed,duration=200,end=100;el.setAttribute("data-animating",!0);requestAnimationFrame(function(timestamp){if(startTime===null)startTime=timestamp;elapsed=timestamp-startTime;percent=elapsed/duration;var moveDirection="left";if(currentPage*1>result.page*1)moveDirection="right";if(elapsedframeDist?pageNew.style.left:(moveDirection=="left"?end-frameDist:frameDist-end)+"%";pageOld.style.left=Math.abs(pageOld.style.left)>frameDist?pageOld.style.left:(moveDirection=="left"?"-"+frameDist:frameDist)+"%";requestAnimationFrame(arguments.callee)}else{pageNew.style.left=0;pageOld.style.left=(moveDirection=="left"?0-end:end)+"%";pageOld.setAttribute("id","pageOld");setTimeout(function(){pageOld.remove();pageNew.setAttribute("id","pageCurrent");el.setAttribute("data-animating",!1);currentPage=result.page;pagination.innerHTML=result.pagination;handleLinks();pagination.classList.remove("working")},100)}})})}};xhttp.open("GET",href,!0);xhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");var data=new FormData();data.append("ajax",!0);xhttp.send(data)}})()