File: /home/agritoday/www/wp-content/plugins/td-cloud-library/assets/js/js_posts_autoload.min.js
var tdbAutoload={};
(function(g,c,m){var p=g(document),h=g(c);tdbAutoload={original_post_id:null,loaded_posts:[],is_ajax_running:!1,init:function(){var a=g("#tdb-autoload-article");if(0!==a.length){var e=a.data("autoload"),b=a.data("autoload-type"),l=a.data("autoload-count"),d=a.data("autoload-org-post-id"),k=d,f=0;tdbAutoload.original_post_id=d;tdbAutoload.loaded_posts.push(d);tdbAutoload.log("%c tdbAutoload(inf) art. settings","background: #ffaa00; color: #ffffff; padding:3px 6px");tdbAutoload.log("tdbAutoload status: "+e);
tdbAutoload.log("tdbAutoload type: "+b);tdbAutoload.log("tdbAutoload original post id: "+d);tdbAutoload.log("tdbAutoload count: "+parseInt(l,10));tdbAutoload.log("tdbAutoload scroll percent: "+c.tdb_p_autoload_vars.autoloadScrollPercent);b=m.debounce(function(){tdbAutoload.log("ajax autoload > scroll");if(!0!==tdbAutoload.is_ajax_running){var b=100*h.scrollTop()/(p.height()-h.height()),e=c.tdb_p_autoload_vars.autoloadScrollPercent;(!l||f<parseInt(l,10))&&b>=e&&d===k&&(tdbAutoload._ajaxLoadingStart(a),
tdbAutoload.is_ajax_running=!0,g.ajax({timeout:5E4,type:"POST",url:tdbAutoload._getRestEndPoint("td-cloud-library/ajax_autoload","uid="+tdbAutoload._getUniqueID()),data:{currentPostId:k,originalPostId:tdbAutoload.original_post_id,loadedPosts:tdbAutoload.loaded_posts},success:function(b,e,n){null!==b&&void 0===b.error&&(void 0!==b.noPosts?tdbAutoload._ajaxLoadingEnd(a):(f++,e=g(b.article),g(e).appendTo(a.find(".tdc-content-wrap")),k=d=b.id,tdbAutoload.loaded_posts.push(d),e.filter("#tdb-infinte-post-"+
k+"-iframe").on("load",function(){var b=g(this);tdbAutoload.is_ajax_running=!1;tdbAutoload._ajaxLoadingEnd(a);b.css("opacity",1);setTimeout(function(){var a=b.contents().find("html").outerHeight(!0)+2;tdbAutoload.log("initial iframe load height set to: "+a);b.height(a)},50);b.contents().find("html").attr("id",b.attr("id"));b.contents().find(".grecaptcha-badge").css("visibility","hidden");var e=c.MutationObserver||c.WebKitMutationObserver||c.MozMutationObserver,f=document.querySelector("#"+b.attr("id")),
n=(f.contentDocument||f.contentWindow.document).getElementsByTagName("html"),d=m.debounce(function(){var a=n[0].offsetHeight;tdbAutoload.log("setHeight: height set to: "+a);b.height(a)},10);(new e(function(a){a.forEach(function(a){tdbAutoload.log("mutation occurred!");tdbAutoload.log(a);d()})})).observe(n[0],{childList:!0,subtree:!0})})))},error:function(a,b,e){}}))}},100);var n=m.debounce(function(){tdbAutoload.log("ajax_autoload > resize");g(".tdb-autoload-wrap").find(".tdb-infinte-post-iframe").each(function(){var a=
g(this);a.height(a.contents().find("html").outerHeight())})},100),q=m.debounce(function(){tdbAutoload.log("ajax autoload > scroll location change");tdbAutoload._locationChange()},100);"on"===e&&(h.scroll(b),h.scroll(q),h.resize(n),h.resize(function(){}),h.scroll(function(){}))}},_fixSmartSidebar:function(){var a=h.scrollTop(),e=a+h.height();g(".tdb-autoload-wrap").find("iframe").each(function(){var b=g(this),c=b.offset().top-g("#wpadminbar").outerHeight(),d=b.outerHeight(!0);b=b.attr("id");c<a&&c+
d>e&&document.getElementById(b).contentWindow.tdSmartSidebar.td_events_scroll(a-c)})},_locationChange:function(){var a=h.scrollTop(),e=a+h.height(),b=[];g(".tdb-autoload-wrap").find("article, iframe").filter(function(){return g(this).parent().hasClass("tdb-autoload-wrap")}).each(function(){var f=g(this),c=g(".td-header-menu-wrap.td-affix");c=c.length?c.outerHeight():0;var d=g("#wpadminbar");d=d.length?d.outerHeight():0;c=f.offset().top-(c+d);var k=f.outerHeight(!0);d=f.data("post-url");var h="",l=
f.data("post-title");f.is("iframe")?(f=f.contents().find("#tdb-autoload-article article"),f.length&&(h=f.data("post-edit-url"))):h=f.data("post-edit-url");f=c+k;c<a&&f>e?b.push({top:c,bottom:f,post_url:d,post_edit_url:h,post_title:l}):c>a&&c<e?b.push({top:c,bottom:f,post_url:d,post_edit_url:h,post_title:l}):f>a&&f<e&&b.push({top:c,bottom:f,post_url:d,post_edit_url:h,post_title:l})});if(0===b.length){var l=c.location.href;var d=c.tdb_p_autoload_vars.origPostEditUrl;var k=document.title}else 1===b.length?
(k=b.pop(),l=k.post_url,d=k.post_edit_url,k=k.post_title):(l=b[0].post_url,d=b[0].post_edit_url,k=b[0].post_title);tdbAutoload._updatePostURL(l,d,k)},_updatePostURL:function(a,e,b){c.location.href===a||""===a||c.location.href.includes(a)||(c.history.replaceState(null,null,a),document.title=b,c.tdb_p_autoload_vars.isAdminBarShowing&&e&&g("#wp-admin-bar-edit").find("a").attr("href",e))},_ajaxLoadingStart:function(a){g(".td-loader-gif").remove();a.find(".tdc-content-wrap").append('<div class="td-loader-gif td-loader-animation-start tdb-loader-autoload"></div>');
tdLoadingBox.init(tds_theme_color_site_wide);setTimeout(function(){g(".td-loader-gif").removeClass("td-loader-animation-start").addClass("td-loader-animation-mid")},50)},_ajaxLoadingEnd:function(a){a.find(".td-loader-gif").removeClass("td-loader-animation-mid").addClass("td-loader-animation-end");setTimeout(function(){a.find(".td-loader-gif").remove();tdLoadingBox.stop()},400)},_getRestEndPoint:function(a,e){return m.isEmpty(c.tdb_global_vars.permalinkStructure)?c.tdb_global_vars.wpRestUrl+a+"&"+
e:c.tdb_global_vars.wpRestUrl+a+"?"+e},_getUniqueID:function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()},log:function(a,c){}};p.ready(function(){tdbAutoload.init()})})(jQuery,this,_);