Skip to content

Commit

Permalink
#18
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Jan 14, 2020
1 parent 672d848 commit 7dfaebd
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 49 deletions.
1 change: 1 addition & 0 deletions src/main/resources/common-template/label.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
-->
<script src="https://cdn.jsdelivr.net/npm/uvstat@v1.0.4/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vcmt@v1.0.2/dist/index.min.js"></script>
<script>
var Label = {
servePath: "${servePath}",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/js/admin/staticsite.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ admin.staticsite = {
type: 'PUT',
cache: false,
data: JSON.stringify(requestJSONObject),
success: function (result, textStatus) {
success: function (result) {
$('#tipMsg').text(result.msg)
$('#loadMsg').text('')
},
Expand Down
30 changes: 30 additions & 0 deletions src/main/resources/js/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,35 @@ var Page = function (tips) {
}

$.extend(Page.prototype, {
/**
* 第三方评论
*/
vcomment: function ( ) {
const $vcomment = $('#vcomment')
if ($vcomment.length === 0) {
return
}
const vcomment = new Vcomment({
id: 'vcomment',
postId: $vcomment.data('postid'),
url: 'https://hacpai.com',
userName: $vcomment.data('name'),
currentPage: 1,
vditor: {
hljsEnable: !Label.luteAvailable,
hljsStyle: Label.hljsStyle,
},
error () {
$vcomment.remove()
$vcomment.next().show()
},
})

vcomment.render()
},
/**
* 分享
*/
share: function () {
var $this = $('.article__share')
if ($this.length === 0) {
Expand Down Expand Up @@ -92,6 +121,7 @@ $.extend(Page.prototype, {
$('#soloEditorAdd').click(function () {
that.submitComment()
})
that.vcomment()
},
toggleEditor: function (commentId, name) {
var $editor = $('#soloEditor')
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/skins/Finding/css/base.css

Large diffs are not rendered by default.

95 changes: 49 additions & 46 deletions src/main/resources/skins/nijigen/article.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@
<div class="item item--active">
<time class="vditor-tooltipped vditor-tooltipped__n item__date"
aria-label="${article.articleUpdateDate?string("yyyy")}${yearLabel}">
${article.articleUpdateDate?string("MM")}${monthLabel}
${article.articleUpdateDate?string("MM")}${monthLabel}
<span class="item__day">${article.articleUpdateDate?string("dd")}</span>
</time>

<h2 class="item__title">
<a rel="bookmark" href="${servePath}${article.articlePermalink}">
${article.articleTitle}
${article.articleTitle}
</a>
<#if article.articlePutTop>
<sup>
${topArticleLabel}
</sup>
</#if>
<#if article.articlePutTop>
<sup>
${topArticleLabel}
</sup>
</#if>
</h2>

<div class="item__date--m fn__none">
<i class="icon__date"></i>
${article.articleUpdateDate?string("yyyy-MM-dd")}
${article.articleUpdateDate?string("yyyy-MM-dd")}
</div>

<div class="ft__center">
Expand All @@ -73,9 +73,9 @@
</#list>
</span>
<#if commentable>
<a class="tag" href="${servePath}${article.articlePermalink}#comments">
<i class="icon__comments"></i> ${article.articleCommentCount} ${commentLabel}
</a>
<a class="tag" href="${servePath}${article.articlePermalink}#comments">
<i class="icon__comments"></i> ${article.articleCommentCount} ${commentLabel}
</a>
</#if>
<span class="tag">
<i class="icon__views"></i>
Expand All @@ -84,70 +84,73 @@
</div>

<div class="vditor-reset">
${article.articleContent}
${article.articleContent}
<#if "" != article.articleSign.signHTML?trim>
<div>
${article.articleSign.signHTML}
</div>
<div>
${article.articleSign.signHTML}
</div>
</#if>
</div>
</div>
</div>

<#if previousArticlePermalink?? || nextArticlePermalink??>
<div class="module mobile__hidden">
<div class="module__content fn__clear">
<#if previousArticlePermalink??>
<a href="${servePath}${previousArticlePermalink}" rel="prev" class="fn__left breadcrumb">
${previousArticleLabel}: ${previousArticleTitle}
</a>
</#if>
<#if nextArticlePermalink??>
<a href="${servePath}${nextArticlePermalink}" rel="next"
class="fn__right breadcrumb">
${nextArticleTitle}: ${nextArticleLabel}
</a>
</#if>
<div class="module mobile__hidden">
<div class="module__content fn__clear">
<#if previousArticlePermalink??>
<a href="${servePath}${previousArticlePermalink}" rel="prev" class="fn__left breadcrumb">
${previousArticleLabel}: ${previousArticleTitle}
</a>
</#if>
<#if nextArticlePermalink??>
<a href="${servePath}${nextArticlePermalink}" rel="next"
class="fn__right breadcrumb">
${nextArticleTitle}: ${nextArticleLabel}
</a>
</#if>
</div>
</div>
</div>
</#if>

<#if previousArticlePermalink??>
<div class="module mobile__hidden fn__none">
<div class="module__content">
<a href="${servePath}${previousArticlePermalink}" rel="prev" class="breadcrumb">
${previousArticleLabel}: ${previousArticleTitle}
</a>
<div class="module mobile__hidden fn__none">
<div class="module__content">
<a href="${servePath}${previousArticlePermalink}" rel="prev" class="breadcrumb">
${previousArticleLabel}: ${previousArticleTitle}
</a>
</div>
</div>
</div>
</#if>

<#if nextArticlePermalink??>
<div class="module mobile__hidden fn__none">
<div class="module__content">
<a href="${servePath}${nextArticlePermalink}" rel="next"
class="breadcrumb">
${nextArticleLabel}: ${nextArticleTitle}
</a>
<div class="module mobile__hidden fn__none">
<div class="module__content">
<a href="${servePath}${nextArticlePermalink}" rel="next"
class="breadcrumb">
${nextArticleLabel}: ${nextArticleTitle}
</a>
</div>
</div>
</div>
</#if>

<@comments commentList=articleComments article=article></@comments>
<div id="vcomment" class="module__content" data-name="${article.authorName}" data-postId="${article.oId}"></div>
<div class="fn__none">
<@comments commentList=articleComments article=article></@comments>
</div>

<div class="fn__flex article__relevant">
<div class="fn__flex-1" id="externalRelevantArticlesWrap">
<div class="module">
<div id="externalRelevantArticles" class="module__list"></div>
</div>
</div>
<div class="mobile__hidden">&nbsp; &nbsp; &nbsp; &nbsp; </div>
<div class="mobile__hidden">&nbsp; &nbsp; &nbsp; &nbsp;</div>
<div class="fn__flex-1" id="randomArticlesWrap">
<div class="module">
<div id="randomArticles" class="module__list"></div>
</div>
</div>
<div class="mobile__hidden">&nbsp; &nbsp; &nbsp; &nbsp; </div>
<div class="mobile__hidden">&nbsp; &nbsp; &nbsp; &nbsp;</div>
<div class="fn__flex-1" id="relevantArticlesWrap">
<div class="module">
<div id="relevantArticles" class="module__list"></div>
Expand All @@ -158,7 +161,7 @@
</div>
<#include "side.ftl">
<#if pjax><!---- pjax {#pjax} end ----></#if>
</div>
</div>
</div>
<#include "footer.ftl">
<#if pjax><!---- pjax {#pjax} start ----></#if>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/skins/nijigen/css/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -795,4 +795,4 @@ a {
display: block;
float: none;
}
}
}

0 comments on commit 7dfaebd

Please sign in to comment.