View file reels/templates/explore/tags.html

File size: 2.37Kb
<div class="explore-page-container explore-tags">
	<div class="sub__header">
		<div class="container">
			<h3>#<?php echo $context['tag']; ?></h3>
		</div>
		<svg width="100%" height="50px" class="pg_gray_svg" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1920 75"><path fill="currentColor" d="M1963,327H-105V65A2647.49,2647.49,0,0,1,431,19c217.7,3.5,239.6,30.8,470,36,297.3,6.7,367.5-36.2,642-28a2511.41,2511.41,0,0,1,420,48"></path></svg>
	</div>

	<div class="container">
		<div class="valign pg_widget_title"><h5><?php echo $context['total_count']; ?> {{LANG posts}}</h5></div>
		<div class="explore-posts-container pg_grid_posts pg_grid_posts_tag">
			<?php if ($context['posts']) {
				foreach ($context['posts'] as $key => $post_data) {
					include 'includes/list.html';
				}
			} else{ 
				include 'includes/no-posts-found.html';
			} ?>
		</div>
	</div>
</div>

<?php 
	include $context['dirname_theme'].'/main/templates/modals/delete-post.html';
	include $context['dirname_theme'].'/main/templates/modals/embed_post.html';
	include $context['dirname_theme'].'/main/templates/includes/lazy-load.html';
	include $context['dirname_theme'].'/main/templates/modals/delete-comment.html';
?>

	<script>
		var myLazyLoad = new LazyLoad({
		    elements_selector: ".lazy_"
		});
		
		var ajax_url = '{$xhr_url}';

		jQuery(document).ready(function($) {
			var scrolled = 0;
			var last_id  = 0;

			$(window).scroll(function() {
			    if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
			    	if (scrolled == 0) {
		                scrolled = 1;
		                var list_ids = $("div.explore-postset[id]").map(function() {
			                return $(this).attr('id');
			            }).get();

			            if (!list_ids) {
			                return false;
			            }
			            
        				var last_id = Math.min.apply(Math,list_ids);

						$.ajax({
							url: link('posts/explore-tags'),
							type: 'GET',
							dataType: 'json',
							data: {offset:last_id},
						}).done(function(data) {
							if (data.status == 200) {
								$(".explore-posts-container").append($(data.html));
								scrolled = 0;
							}
							else{
								$(window).unbind('scroll');
							}
						});
		       		}
			    }
			});
		});
	</script>