<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">jQuery(document).ready(function($){
	"use strict";
	var pageNum    = [];
 	var total      = [];
	var max        = [];
 	var perpage    = [];
	var nextLink   = [];
	var masonry    = [];
	var cposts     = [];
	var newItems   = [];
	$('.cms-grid-wraper').each(function(){
		var $this = $(this);
		var $masonry_container;
		var html_id = $this.attr('id');
		var is_entry_like = null;
		var cms_variable = window["cms_more_obj" + html_id.replace(new RegExp('-', 'g'),'_')];
		if(typeof cms_variable != 'undefined'){
			 pageNum[html_id]    = parseInt(cms_variable.startPage) + 1;
		 	 total[html_id]      = parseInt(cms_variable.total);
			 max[html_id]        = parseInt(cms_variable.maxPages);
		 	 perpage[html_id]    = parseInt(cms_variable.perpage);
			 nextLink[html_id]   = cms_variable.nextLink;
			 masonry[html_id]    = cms_variable.masonry;
			setInterval(function(){
				jQuery('#main').find('audio,video').mediaelementplayer();
			},3000);
			$.html_idPost = function(total,perpage,pageNum){
				cposts[html_id] = total-perpage*pageNum;
				return cms_variable.loadmore_text;
			}
			$.loadData = function(html_id){
				"use strict";
				$.get(nextLink[html_id],function(data){
					// Update page number and nextLink.
                      
					if(masonry[html_id] == 'masonry'){
						var items = $(data).find('#'+html_id + ' .cms-grid-masonry &gt; .cms-grid-item');
						$('#'+html_id).children('.cms-grid-masonry').append(items);
						$(items).imagesLoaded(function(){
							$('#'+html_id).children('.cms-grid-masonry').shuffle('appended',items);
						});
                       
					}
					else{
						newItems[html_id] = $($(data).find('#'+html_id).children('.cms-grid').html());
						$('#'+html_id).children('.cms-grid').append(newItems[html_id]);
                        
					}
                   
					pageNum[html_id]++;
					if(nextLink[html_id].indexOf('/page/') &gt; -1){
						nextLink[html_id] = nextLink[html_id].replace(/\/page\/[0-9]?/, '/page/'+ pageNum[html_id]);
					}
					else{
						nextLink[html_id] = nextLink[html_id].replace(/paged=[0-9]?/, 'paged='+ pageNum[html_id]);
					}
					// Add a new placeholder, for when user clicks again.
					$('#'+html_id +' .cms-load-posts')
						.before('&lt;div class="cms-placeholder-'+ pageNum[html_id] +'"&gt;&lt;/div&gt;')
			 		// Update the button message.
					if(pageNum[html_id] &lt;= max[html_id]) {
						$('#'+html_id +' .cms-load-posts a').text($.html_idPost(total[html_id],perpage[html_id],pageNum[html_id]-1));
					} else {
						$('#'+html_id +' .cms-load-posts a').text('No more posts to load.');
					}
					$('#'+html_id +' .cms-load-posts').find('a').data('loading',0);

					$('.entry-like').on('click', function (event) {
            		var bt_like = $(this);
            		is_entry_like = $(this);
            		var post_id = bt_like.attr('data-id');
            		
            		if(post_id != undefined &amp;&amp; post_id != '') {
            			$.post(ajax_data.url, {
            				'action' : 'cms_post_like',
            				'id' : post_id
            			}, function(response) {
            				if(response != ''){
            					bt_like.find('i').attr('class', 'fa fa-heart')
            					bt_like.find('span').html(response);
            				}
            			});
            		}
            		event.preventDefault();
            	});
              
				});
			}
			if(pageNum[html_id] &lt;= max[html_id]) {
				var text = $.html_idPost(total[html_id],perpage[html_id],1);
				$('#'+html_id +' .cms_pagination').append('&lt;div class="cms-placeholder-'+ pageNum[html_id] +'"&gt;&lt;/div&gt;&lt;div class="cms-load-posts"&gt;&lt;a data-loading="0" href="#" class="btn-loadmore"&gt;'+text+'&lt;/a&gt;&lt;/div&gt;');
			}
			$('#'+html_id +' .cms-load-posts a').click(function(){
				if(pageNum[html_id] &lt;= max[html_id]){
					$(this).text('Loading posts...');
					$.loadData(html_id);
                    
				}else {
					$('#'+html_id +' .cms-load-posts a').append('.');
				}
				return false;
			});
		}

	});
});</pre></body></html>