<?php if (comments_open()) : ?>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
<style>
#system #comments .comment-head .avatar {
//border: 1px solid #ccc;
border-radius: 50%;
}
a.permalink {
color: #999;
}
a.permalink:hover {
color: #469bdb;
}
.commentItem.rem {
display: none;
}
</style>
<section id="comments">
<?php if (have_comments()) : ?>
<?php
$classes = array("level1");
if (get_option('comment_registration') && !is_user_logged_in()) {
$classes[] = "no-response";
}
if (get_option('thread_comments')) {
$classes[] = "nested";
}
?>
<ul class="commentsList <?php echo implode(" ", $classes);?>">
<?php
// single comment
$GLOBALS['comment_count'] = 0;
function mytheme_comment($comment, $args, $depth) {
global $user_identity;
static $cnt = 0;
$GLOBALS['comment_count']++;
$GLOBALS['comment'] = $comment;
$warp = Warp::getInstance();
$_GET['replytocom'] = get_comment_ID();
?>
<li class="commentItem <?= $cnt++ < 15 ? '' : 'rem' ?>">
<!--li class="commentItem"-->
<article id="comment-<?php comment_ID(); ?>" class="comment <?php echo ($comment->user_id > 0) ? 'comment-byadmin' : '';?>">
<div class="comment-body" style="padding: 20px 20px; background-color: #f8f8f8; border: 1px solid #eaeaea; color: #666;">
<p class="comment-dody"><div class="content" style="font-size: 16px;"><?php comment_text(); ?></div>
<?php if (comments_open()) : ?>
<p class="ReviewBox-Header"><p class="ReviewBox-small">
<?php endif; ?>
</div>
<header class="comment-head" style="background-color: transparent; border: 0px;">
<?php echo get_avatar($comment, $size='50', get_bloginfo('template_url').'/images/default_avatar.png'); ?>
<h4 class="author" style="font-size: 16px; font-weight: normal; margin-top: 0; color: #999999; padding: 3.5px;"><i class="fa fa-user"></i>
<?php echo get_comment_author_link(); ?></h4>
<p class="meta" style="font-size: 16px; color: #999999;">
<i class="fa fa-calendar"></i> <time datetime="<?php echo get_comment_date('Y-m-d'); ?>" pubdate><?php printf(__('%1$s в %2$s', 'warp'), get_comment_date(), get_comment_time()) ?></time>
<?php edit_comment_link(__('Edit'),' ','') ?>
</p>
</header>
</article>
<?php
unset($_GET['replytocom']);
// </li> is rendered by system
}
if (empty($_SERVER['HTTP_X_REQUESTED_WITH']))
{
wp_list_comments('type=all&page=0&per_page=1000000&callback=mytheme_comment');
//echo "COUNT: " . print_r(get_comment_count(the_ID()), true);
//exit;
}
else
{
wp_list_comments('type=all&callback=mytheme_comment');
}
?>
</ul>
<script>
//var comment_count = <?= $GLOBALS['comment_count'] ?>;
var els = document.querySelectorAll('.commentItem.rem');
for (var i = 0; i < els.length; i++) els[i].remove();
window.commentLink = 'https://ggraft.ru/reviews/comment-page-<?= (int)(($GLOBALS['comment_count'] / 15) - 2) ?>/#comments';
$(document).ready(function() {
$('.more-comments').bind('DOMSubtreeModified', function() {
var that = this;
setTimeout(function() {
var count = that.querySelector('span').innerText * 1;
console.log('count', count);
if (count <= 0) {
that.remove();
}
}, 150);
});
});
</script>
<div style="display:none;">
<?php echo $this->render("_pagination", array("type"=>"comments")); ?>
</div>
<?php if (get_comments_number() > 0) : ?>
<p class="text"><?php comments_open() ? printf(__('', 'warp'), get_comments_number()) : _e('Comments are closed', 'warp'); ?></p>
<?php endif; ?>
<div class = "center">
<a href="#" class="more-comments" data-comments-number="<?=get_comments_number();?>">Загрузить ещё<span class="counter"><?=get_comments_number();?></span>
<div class="scroller-status">
<div class="loader-ellips">
<div class="loader-ellips__dot"></div>
<div class="loader-ellips__dot"></div>
<div class="loader-ellips__dot"></div>
<div class="loader-ellips__dot"></div>
</div>
</div>
</a>
</div>
<?php endif; ?>
<div id="respond">
<br /><br />
<a name="vniz"></a>
<h3 style="font-family: 'Roboto', sans-serif; font-weight: 700; font-size: 26px;"><?php comment_form_title(__('Оставить отзыв', 'warp')); ?></h3>
<br />
Ваш e-mail не будет опубликован. Обязательные поля помечены <span style="color:red;">*</span>
<br />
<?php if (get_option('comment_registration') && !is_user_logged_in()) : ?>
<p class="user"><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.', 'warp'), wp_login_url(get_permalink())); ?></p>
<?php else : ?>
<?php endif; ?>
</div>
</section>
<script type="text/javascript">
jQuery(function($) {
var respond = $("#respond");
$("p.reply > a").bind("click", function(){
var id = $(this).attr('rel');
respond.find(".comment-cancelReply:first").remove();
var cancel = $('<a><?php echo __("Cancel");?></a>').addClass('comment-cancelReply').attr('href', "#respond").bind("click", function(){
respond.find(".comment-cancelReply:first").remove();
respond.appendTo($('#comments')).find("[name=comment_parent]").val(0);
return false;
}).appendTo(respond.find(".actions:first"));
respond.find("[name=comment_parent]").val(id);
respond.appendTo($("#comment-"+id));
return false;
})
$('form.short input[placeholder]').placeholder();
});
</script>
<?php endif;