Jony/public/comment.php
2021-01-26 14:19:52 +08:00

119 lines
15 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php $this->comments()->to($comments); ?>
<div class="joe_comment">
<h3 class="joe_comment__title">评论 <?php if ($this->allow('comment')) : ?>(<?php $this->commentsNum(); ?>)<?php endif; ?></h3>
<?php if ($this->allow('comment')) : ?>
<div class="joe_comment__respond">
<div class="joe_comment__respond-type">
<button class="item" data-type="draw">画图模式</button>
<button class="item active" data-type="text">文本模式</button>
</div>
<div class="joe_comment__respond-form" data-action="<?php $this->commentUrl() ?>">
<div class="head">
<div class="list">
<input type="text" value="<?php $this->user->hasLogin() ? $this->user->screenName() : $this->remember('author') ?>" autocomplete="off" name="author" maxlength="16" placeholder="请输入昵称..." />
</div>
<div class="list">
<input type="text" value="<?php $this->user->hasLogin() ? $this->user->mail() : $this->remember('mail') ?>" autocomplete="off" name="mail" placeholder="请输入邮箱..." />
</div>
<div class="list">
<input type="text" value="<?php $this->remember('url'); ?>" autocomplete="off" name="url" placeholder="(选填)请输入网址..." />
</div>
</div>
<div class="body">
<textarea class="text" name="text" autocomplete="off" rows="5" placeholder="说点什么吧,点击右上角可切换成画图模式哦~"></textarea>
<div class="draw" style="display: none;">
<ul class="line">
<li data-line="3">细</li>
<li data-line="5" class="active">中</li>
<li data-line="8">粗</li>
</ul>
<ul class="color">
<li data-color="#303133" class="active"></li>
<li data-color="#67c23a"></li>
<li data-color="#e6a23c"></li>
<li data-color="#f56c6c"></li>
</ul>
<svg title="撤销" class="icon icon-undo" viewBox="0 0 1365 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
<path d="M754.133333 337.333333c-16.4-2.266667-32.933333-3.6-49.6-3.6h-7.066666V161.866667c0-40.4-14.666667-65.733333-36.666667-70.133334-1.466667-0.4-3.066667 0-4.666667-0.133333-2.8-0.266667-5.466667-0.666667-8.533333-0.133333-10.133333 1.466667-21.2 6.533333-33.066667 16L192 447.466667c-3.066667 2.4-4.8 5.466667-7.466667 8-3.2 3.2-6.4 6.4-9.066666 9.866666-2.4 3.333333-4.533333 6.533333-6.533334 9.866667-2.666667 4.666667-4.666667 9.466667-6.4 14.4-0.8 2.266667-1.866667 4.4-2.4 6.666667-0.8 3.333333-0.933333 6.666667-1.333333 9.866666-0.133333 1.333333-0.4 2.533333-0.4 3.866667-0.266667 3.066667-0.133333 6 0 9.066667 0.133333 1.733333 0.4 3.333333 0.666667 4.933333 0.4 2.8 0.4 5.733333 1.066666 8.533333 0.8 3.866667 2.666667 7.333333 4.133334 11.066667 1.066667 2.8 2.266667 5.733333 3.733333 8.533333 2.533333 4.8 5.466667 9.466667 9.2 14l0.133333 0.133334c4.4 5.466667 8.666667 11.066667 14.666667 15.866666L611.466667 918.666667c45.466667 36.4 85.466667-0.533333 85.466666-54.666667V680.4h63.6c22 0 43.466667 1.333333 64.133334 3.6 9.466667 1.066667 18.533333 3.2 27.866666 4.666667 11.066667 1.866667 22.4 3.333333 33.2 5.866666 8.666667 2 16.8 4.933333 25.2 7.466667 11.066667 3.333333 22.133333 6.266667 32.8 10.4 7.2 2.666667 14 6.266667 21.066667 9.333333 11.333333 5.066667 22.8 10 33.6 16 5.466667 3.066667 10.533333 6.8 15.866667 10 11.866667 7.333333 23.6 14.666667 34.533333 23.066667 3.6 2.8 6.933333 6.133333 10.533333 9.066667 12.133333 10 24.133333 20.266667 35.333334 31.733333 1.2 1.2 2.266667 2.666667 3.466666 4 26.666667 28.133333 50.666667 60.4 71.333334 97.2 8.533333 14 17.2 19.333333 23.733333 18.4 6.666667-0.533333 11.333333-7.333333 11.333333-18.4-3.333333-255.733333-206.4-540.933333-450.4-575.466667z m6.4 276.266667h-130.4V862.666667c-6-2.4-12.266667-5.733333-18.533333-10.8L232.8 548c-10-21.333333-10.133333-44.933333-0.4-66.266667l382.133333-307.466666c5.2-4.266667 10.4-7.466667 15.466667-10v236.8l66.933333-0.533334h7.6c99.866667 0 194.4 43.866667 274.133334 112.533334 62.8 73.733333 123.2 161.466667 149.066666 254.133333-85.733333-102-217.866667-153.6-367.2-153.6z m0 0" fill="" p-id="1775"></path>
</svg>
<svg title="动画" class="icon icon-animate" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
<path d="M954.9 228.4H619.1c-4.5 0-8.1 3.6-8.1 8s53.8 56 58.2 56H955c4.4 0 8.1-3.6 8.1-8v-48c-0.1-4.4-3.7-8-8.2-8z m5.3 352H837.9c-1.5 0-2.8 3.6-2.8 8v48c0 4.4 1.3 8 2.8 8h122.4c1.5 0 2.8-3.6 2.8-8v-48c-0.1-4.4-1.3-8-2.9-8z m-1.6 128H807.4c-2.4 0-4.4 3.6-4.4 8v48c0 4.4 2 8 4.4 8h151.2c2.4 0 4.4-3.6 4.4-8v-48c0-4.4-2-8-4.4-8z" p-id="4541"></path>
<path d="M457.4 798.5l-171.7 90.3c-31.3 16.4-70 4.4-86.4-26.9-6.5-12.5-8.8-26.7-6.4-40.6l32.8-191.2-139-135.4c-25.3-24.7-25.8-65.2-1.2-90.5 9.8-10.1 22.7-16.6 36.6-18.7l192-27.9 85.9-174c15.6-31.7 54-44.7 85.7-29.1 12.6 6.2 22.8 16.4 29.1 29.1l85.9 174 192 27.9c35 5.1 59.2 37.6 54.1 72.5-2 13.9-8.6 26.8-18.7 36.6L689.2 630.1 722 821.4c6 34.8-17.4 67.9-52.3 73.9-13.9 2.4-28.1 0.1-40.6-6.4l-171.7-90.4zM656 837.8c1.2 0.7 2.7 0.9 4.1 0.6 3.5-0.6 5.8-3.9 5.2-7.4l-37.9-221L788 453.4c1-1 1.7-2.3 1.9-3.7 0.5-3.5-1.9-6.7-5.4-7.3l-222-32.3-99.3-201.2c-0.6-1.3-1.6-2.3-2.9-2.9-3.2-1.6-7-0.3-8.6 2.9l-99.3 201.2-222 32.3c-1.4 0.2-2.7 0.9-3.7 1.9-2.5 2.5-2.4 6.6 0.1 9.1L287.5 610l-37.9 221.1c-0.2 1.4 0 2.8 0.6 4.1 1.6 3.1 5.5 4.3 8.6 2.7l198.6-104.4L656 837.8z" p-id="4542"></path>
</svg>
<canvas id="joe_comment_draw" height="300"></canvas>
</div>
</div>
</div>
</div>
<?php if ($comments->have()) : ?>
<div class="joe_comment__list">
<?php $comments->listComments(); ?>
</div>
<?php $comments->pageNav(
'<svg class="icon icon-prev" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="12" height="12"><path d="M822.272 146.944l-396.8 396.8c-19.456 19.456-51.2 19.456-70.656 0-18.944-19.456-18.944-51.2 0-70.656l396.8-396.8c19.456-19.456 51.2-19.456 70.656 0 18.944 19.456 18.944 45.056 0 70.656z" fill="" p-id="9417"></path><path d="M745.472 940.544l-396.8-396.8c-19.456-19.456-19.456-51.2 0-70.656 19.456-19.456 51.2-19.456 70.656 0l403.456 390.144c19.456 25.6 19.456 51.2 0 76.8-26.112 19.968-51.712 19.968-77.312 0.512zM181.248 877.056c0-3.584 0-7.68 0.512-11.264h-0.512V151.552h0.512c-0.512-3.584-0.512-7.168-0.512-11.264 0-43.008 21.504-78.336 48.128-78.336s48.128 34.816 48.128 78.336c0 3.584 0 7.68-0.512 11.264h0.512V865.792h-0.512c0.512 3.584 0.512 7.168 0.512 11.264 0 43.008-21.504 78.336-48.128 78.336s-48.128-35.328-48.128-78.336z"></path></svg>',
'<svg class="icon icon-next" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="12" height="12"><path d="M822.272 146.944l-396.8 396.8c-19.456 19.456-51.2 19.456-70.656 0-18.944-19.456-18.944-51.2 0-70.656l396.8-396.8c19.456-19.456 51.2-19.456 70.656 0 18.944 19.456 18.944 45.056 0 70.656z" fill="" p-id="9417"></path><path d="M745.472 940.544l-396.8-396.8c-19.456-19.456-19.456-51.2 0-70.656 19.456-19.456 51.2-19.456 70.656 0l403.456 390.144c19.456 25.6 19.456 51.2 0 76.8-26.112 19.968-51.712 19.968-77.312 0.512zM181.248 877.056c0-3.584 0-7.68 0.512-11.264h-0.512V151.552h0.512c-0.512-3.584-0.512-7.168-0.512-11.264 0-43.008 21.504-78.336 48.128-78.336s48.128 34.816 48.128 78.336c0 3.584 0 7.68-0.512 11.264h0.512V865.792h-0.512c0.512 3.584 0.512 7.168 0.512 11.264 0 43.008-21.504 78.336-48.128 78.336s-48.128-35.328-48.128-78.336z"></path></svg>',
1,
'...',
array(
'wrapTag' => 'ul',
'wrapClass' => 'joe_pagination',
'itemTag' => 'li',
'textTag' => 'a',
'currentClass' => 'active',
'prevClass' => 'prev',
'nextClass' => 'next'
)
);
?>
<?php else : ?>
<div class="joe_comment__empty">
<svg class="joe_comment__empty-icon" viewBox="0 0 2148 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="120" height="120">
<path d="M1635.928611 983.061118H449.948176a20.469441 20.469441 0 0 0 0 40.938882h1185.980435a20.469441 20.469441 0 1 0 0-40.938882z m327.212826-634.417113h-40.803323v-40.91177a20.442329 20.442329 0 1 0-40.884658 0v40.91177h-40.911771a20.469441 20.469441 0 0 0 0 40.938883h40.911771v40.938882a20.442329 20.442329 0 1 0 40.884658 0v-40.938882h40.91177a20.469441 20.469441 0 0 0 0-40.938883z m-1431.50528-266.021397h20.44233v20.442329a20.469441 20.469441 0 1 0 40.91177 0V82.622608h20.442329a20.469441 20.469441 0 0 0 0-40.938882h-20.442329V21.214285a20.469441 20.469441 0 1 0-40.91177 0v20.469441h-20.44233a20.469441 20.469441 0 0 0 0 40.938882zM81.850692 635.161956a81.877764 81.877764 0 1 0 81.904876 81.850652A81.82354 81.82354 0 0 0 81.850692 635.161956z m0 122.789534a40.938882 40.938882 0 1 1 40.884658-40.938882 40.938882 40.938882 0 0 1-40.884658 40.938882z m2024.54972-61.381211A40.938882 40.938882 0 1 0 2147.312182 737.482049a40.91177 40.91177 0 0 0-40.91177-40.91177z m-1307.577048 62.004784h47.174606v37.631237a13.908375 13.908375 0 0 0 27.81675 0v-37.631237h335.671721v37.631237a13.908375 13.908375 0 1 0 27.816751 0v-37.631237h47.174605a69.352093 69.352093 0 0 0 69.243646-69.243646v-217.05741a69.270757 69.270757 0 0 0-52.190297-67.10181v-77.377198c0-24.210875-12.932349-46.767928-36.519651-63.387488-22.123263-15.670645-51.160047-24.210875-81.769317-24.210875H900.058984c-30.60927 0-59.646053 8.621566-81.769317 24.210875-23.505967 16.619559-36.519652 39.095277-36.519652 63.387488v77.350086a69.270757 69.270757 0 0 0-52.190296 67.128922v217.084522a69.297869 69.297869 0 0 0 69.243645 69.216534z m10.844737-430.780064c0-32.534211 41.399783-59.646053 90.445107-59.646054h283.047634c49.072435 0 90.472218 27.355849 90.472219 59.646054v76.048718a69.297869 69.297869 0 0 0-58.371797 68.43029v65.77333a94.62033 94.62033 0 0 0-67.156034-27.816751h-212.909298a94.674554 94.674554 0 0 0-67.156034 27.870974v-65.827553a69.324981 69.324981 0 0 0-58.42602-68.403179z m405.593163 277.327036v6.588177a6.994855 6.994855 0 0 1-6.967744 6.967744H875.007642a6.994855 6.994855 0 0 1-6.967744-6.967744v-6.588177a67.237369 67.237369 0 0 1 67.156034-67.156034h212.909298a67.237369 67.237369 0 0 1 67.156034 67.156034z m-457.756348-132.848028a41.399783 41.399783 0 0 1 82.799567 0v161.776364a13.962599 13.962599 0 0 0 13.908375 13.908375h375.038116a13.962599 13.962599 0 0 0 13.908376-13.908375v-161.776364a41.399783 41.399783 0 0 1 82.799566 0v217.084522a41.454007 41.454007 0 0 1-41.399783 41.399783H798.823364a41.454007 41.454007 0 0 1-41.318448-41.426895z" p-id="21273"></path>
</svg>
<span>暂无评论,期待你来坐沙发</span>
</div>
<?php endif; ?>
<?php else : ?>
<div class="joe_comment__close">
<svg class="joe_comment__close-icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="18417" width="18" height="18">
<path d="M512.3072 0.9728C794.624 0.9728 1023.488 202.24 1023.488 450.56a402.8416 402.8416 0 0 1-39.2704 173.2608 232.448 232.448 0 0 0-52.6336-45.9776c16.384-39.7824 25.2928-82.688 25.2928-127.2832 0-211.0976-199.1168-382.1568-444.6208-382.1568-245.5552 0-444.5696 171.0592-444.5696 382.1568 0 133.4272 79.5136 250.88 200.0384 319.1808v107.9808l102.0416-65.1264a510.1568 510.1568 0 0 0 142.4896 20.1216l19.4048-0.3584c19.4048-0.7168 38.7584-2.5088 57.9584-5.4272l3.584 13.4144c5.376 17.7152 12.8512 34.7136 22.3232 50.688l-20.6336 3.328a581.4784 581.4784 0 0 1-227.1232-12.288l-131.1232 100.352c-19.6608 15.0016-35.6352 7.168-35.6352-17.664v-157.3888C79.4112 725.1968 1.024 595.968 1.024 450.56 1.024 202.24 229.9392 0.9728 512.3072 0.9728z m318.464 617.0112c97.4848 0 176.7936 80.4352 176.7936 179.2s-79.3088 179.0464-176.7936 179.0464c-97.4336 0-176.7424-80.2816-176.7424-179.0464 0-98.816 79.3088-179.1488 176.7424-179.1488z m-103.0144 101.0176a131.1744 131.1744 0 0 0-25.7536 78.1824c0 71.8848 57.8048 130.4064 128.768 130.4064 28.8768 0 55.552-9.6256 77.056-26.0096z m103.0144-52.3264c-19.712 0-39.1168 4.5568-56.6784 13.312l172.2368 174.592c8.4992-17.3056 13.1584-36.864 13.1584-57.3952 0-71.9872-57.8048-130.5088-128.7168-130.5088z m-318.464-283.5456l6.8608 0.3584a67.072 67.072 0 0 1 59.8528 67.072l-0.3072 6.8608a67.072 67.072 0 0 1-66.4064 60.5696l-6.8096-0.3584A67.072 67.072 0 0 1 445.6448 450.56a67.072 67.072 0 0 1 66.6624-67.4304z m266.752 0l6.8608 0.3584a67.072 67.072 0 0 1 59.8528 67.072l-0.3072 6.8608a67.072 67.072 0 0 1-66.4064 60.5696l-6.8096-0.3584a67.072 67.072 0 0 1-59.8528-67.072h-0.0512l0.3072-6.8608a67.072 67.072 0 0 1 66.4064-60.5696z m-533.504 0l6.8608 0.3584A67.072 67.072 0 0 1 312.2688 450.56l-0.3072 6.8608a67.072 67.072 0 0 1-66.4064 60.5696l-6.8096-0.3584A67.072 67.072 0 0 1 178.8928 450.56a67.072 67.072 0 0 1 66.6624-67.4304z" p-id="18418"></path>
</svg>
<span>博主关闭了当前页面的评论</span>
</div>
<?php endif; ?>
</div>
<?php
function threadedComments($comments, $options)
{ ?>
<li class="comment-list__item" id="li-<?php $comments->theId(); ?>">
<div class="contain" id="<?php $comments->theId(); ?>">
<img class="avatar lazyload" src="<?php _getAvatarLazyload() ?>" data-original="<?php _getAvatarByMail($comments->mail); ?>" alt="<?php $comments->author(); ?>" />
<div class="content">
<div class="user">
<span class="author"><?php $comments->author(); ?></span>
<?php if ($comments->authorId === $comments->ownerId) : ?>
<i class="owner">作者</i>
<?php endif; ?>
<?php if ($comments->status === "waiting") : ?>
<em class="waiting">(评论审核中...</em>
<?php endif; ?>
<div class="agent"><?php _getAgentOS($comments->agent); ?> · <?php _getAgentBrowser($comments->agent); ?></div>
</div>
<div class="substance">
<?php _getParentReply($comments->parent) ?>
<?php echo _parseCommentReply($comments->content); ?>
</div>
<div class="handle">
<time class="date" datetime="<?php $comments->date('Y-m-d'); ?>"><?php $comments->date('Y-m-d'); ?></time>
</div>
</div>
</div>
<?php if ($comments->children) : ?>
<div class="children">
<?php $comments->threadedComments($options); ?>
</div>
<?php endif; ?>
</li>
<?php } ?>