(window.blocksyJsonP=window.blocksyJsonP||[]).push([[18],{59:function(t,e,r){"use strict";function n(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e0&&void 0!==arguments[0]?arguments[0]:{};if((t=i({el:null,action:null},t)).el&&t.action&&!t.el.classList.contains("ct-loading")){var e=parseInt(t.el.dataset.page,10);if(("prev"!==t.action||1!==e)&&!(t.el.querySelectorAll(".ct-container > a").length<4&&1===e||t.el.classList.contains("ct-last-page")&&"next"===t.action)){t.el.classList.add("ct-loading");var r="prev"===t.action?e-1:e+1;fetch("".concat(ct_localizations.ajax_url,"?action=blocksy_get_trending_posts&page=").concat(r)).then(function(e){e.json().then(function(e){var n=e.success,o=e.data;if(n){var i=o.posts,l=i.is_last_page,s=i.posts;l?t.el.classList.add("ct-last-page"):t.el.classList.remove("ct-last-page"),a(t.el.querySelectorAll("a")).map(function(t){return t.remove()}),t.el.dataset.page=r,s.map(function(e){return t.el.insertAdjacentHTML("beforeend",'\n ').concat(e.image,'\n

\n ').concat(e.title,"\n

\n
"))}),setTimeout(function(){t.el.classList.add("ct-enter-active"),requestAnimationFrame(function(){t.el.classList.remove("ct-enter-active"),t.el.classList.add("ct-active"),setTimeout(function(){t.el.classList.remove("ct-active"),t.el.classList.remove("ct-loading")},950)})}),c(t.el)}})})}}},u=function(t){t.hasListeners||(t.hasListeners=!0,t.querySelector(".ct-arrow-left").addEventListener("click",function(e){e.preventDefault(),s({el:t,action:"prev"})}),t.querySelector(".ct-arrow-right").addEventListener("click",function(e){e.preventDefault(),s({el:t,action:"next"})}))}}}]);