Van 2018-09-25 10:48:28 +08:00
parent 751599e758
commit 73c125c9f0
No known key found for this signature in database
GPG Key ID: 7059B8783A78F16C
2 changed files with 160 additions and 146 deletions

View File

@ -51,64 +51,64 @@
</head> </head>
<body> <body>
<#include "header.ftl"> <#include "header.ftl">
<div id="pjaxArticle"> <div id="pjax">
<#if pjax><!---- pjax {#pjaxArticle} start ----></#if> <#if pjax><!---- pjax {#pjax} start ----></#if>
<div class="main post__main"> <div class="main post__main">
<#if noticeBoard??> <#if noticeBoard??>
<div class="board"> <div class="board">
${noticeBoard} ${noticeBoard}
</div> </div>
</#if> </#if>
<div class="wrapper content"> <div class="wrapper content">
<article class="post"> <article class="post">
<header> <header>
<h1 class="post__title"> <h1 class="post__title">
${article.articleTitle} ${article.articleTitle}
<#if article.articlePutTop> <#if article.articlePutTop>
<sup> <sup>
${topArticleLabel} ${topArticleLabel}
</sup> </sup>
</#if> </#if>
<#if article.hasUpdated> <#if article.hasUpdated>
<sup> <sup>
${updatedLabel} ${updatedLabel}
</sup> </sup>
</#if> </#if>
</h1> </h1>
</header> </header>
<section class="content-reset"> <section class="content-reset">
${article.articleContent} ${article.articleContent}
<#if "" != article.articleSign.signHTML?trim> <#if "" != article.articleSign.signHTML?trim>
<div> <div>
${article.articleSign.signHTML} ${article.articleSign.signHTML}
</div> </div>
</#if> </#if>
</section> </section>
<footer data-oid="${article.oId}" <footer data-oid="${article.oId}"
class="post__tags" class="post__tags"
data-tag="<#list article.articleTags?split(",") as articleTag>${articleTag}<#if articleTag_has_next>,</#if></#list>"> data-tag="<#list article.articleTags?split(",") as articleTag>${articleTag}<#if articleTag_has_next>,</#if></#list>">
<#list article.articleTags?split(",") as articleTag> <#list article.articleTags?split(",") as articleTag>
<a class="tag" rel="tag" href="${servePath}/tags/${articleTag?url('UTF-8')}"> <a class="tag" rel="tag" href="${servePath}/tags/${articleTag?url('UTF-8')}">
${articleTag}</a> ${articleTag}</a>
</#list> </#list>
</footer> </footer>
<div class="post__share fn-clear"> <div class="post__share fn-clear">
<time class="ft-gray"> <time class="ft-gray">
${article.articleCreateDate?string("yyyy-MM-dd")} • ${article.articleCreateDate?string("yyyy-MM-dd")} •
</time> </time>
<a class="post__view" href="${servePath}${article.articlePermalink}"> <a class="post__view" href="${servePath}${article.articlePermalink}">
${article.articleViewCount} ${viewLabel}</a> ${article.articleViewCount} ${viewLabel}</a>
<div class="fn-right"> <div class="fn-right">
<span class="pipe-tooltipped pipe-tooltipped--n post__share-icon ft-green" <span class="pipe-tooltipped pipe-tooltipped--n post__share-icon ft-green"
onclick="$('#comment').focus()" onclick="$('#comment').focus()"
aria-label="${commentLabel}"> aria-label="${commentLabel}">
<svg> <svg>
<use xlink:href="#icon-comment"></use> <use xlink:href="#icon-comment"></use>
</svg> </svg>
${article.articleCommentCount} &nbsp; &nbsp; ${article.articleCommentCount} &nbsp; &nbsp;
</span> </span>
<span id="articleShare"> <span id="articleShare">
<span class="post__share-icon" data-type="wechat"> <span class="post__share-icon" data-type="wechat">
<svg><use xlink:href="#icon-wechat"></use></svg> <svg><use xlink:href="#icon-wechat"></use></svg>
</span> &nbsp; &nbsp; </span> &nbsp; &nbsp;
@ -127,97 +127,96 @@
data-url="${servePath}${article.articlePermalink}" data-url="${servePath}${article.articlePermalink}"
data-avatar="${article.authorThumbnailURL}"></span> data-avatar="${article.authorThumbnailURL}"></span>
</span> </span>
</div>
</div>
</article>
</div>
<div class="article__bottom">
<div class="wrapper">
<div class="fn-flex footer__tag">
<div class="fn-flex-1" id="externalRelevantArticles"></div>
<div class="fn-flex-1" id="relevantArticles"></div>
<div class="fn-flex-1" id="randomArticles"></div>
</div>
<@comments commentList=articleComments article=article></@comments>
</div>
</div>
<div class="article__toolbar">
<div class="wrapper">
<a class="post__view" href="${servePath}${article.articlePermalink}">
${article.articleViewCount} ${viewLabel}
</a>
<div class="fn-right">
<span class="pipe-tooltipped pipe-tooltipped--n post__share-icon ft-green"
onclick="$('#comment').focus()"
aria-label="${commentLabel}">
<svg>
<use xlink:href="#icon-comment"></use>
</svg>
${article.articleCommentCount} &nbsp; &nbsp;
</span>
<span id="articleBottomShare">
<span class="post__share-icon" data-type="wechat">
<svg><use xlink:href="#icon-wechat"></use></svg>
</span> &nbsp; &nbsp;
<span class="post__share-icon" data-type="weibo">
<svg><use xlink:href="#icon-weibo"></use></svg>
</span> &nbsp; &nbsp;
<span class="post__share-icon" data-type="twitter">
<svg><use xlink:href="#icon-twitter"></use></svg>
</span> &nbsp; &nbsp;
<span class="post__share-icon" data-type="google">
<svg><use xlink:href="#icon-google"></use></svg>
</span>
<span class="article__code"
data-title="${article.articleTitle}"
data-blogtitle="${blogTitle}"
data-url="${servePath}${article.articlePermalink}"
data-avatar="${article.authorThumbnailURL}"></span>
</span>
<#if nextArticlePermalink??>
<a href="${servePath}${nextArticlePermalink}" rel="next" class="article__next">
<span class="ft-12 ft-gray">${nextArticleLabel}</span> <br>
${nextArticleTitle}
</a>
</#if>
</div> </div>
</div> </div>
</article>
</div>
</div>
<div class="article__bottom">
<div class="wrapper">
<div class="fn-flex footer__tag">
<div class="fn-flex-1" id="externalRelevantArticles"></div>
<div class="fn-flex-1" id="relevantArticles"></div>
<div class="fn-flex-1" id="randomArticles"></div>
</div> </div>
<@comments commentList=articleComments article=article></@comments>
</div>
</div>
<div class="article__toolbar"> <div class="post__side">
<div class="wrapper"> <span class="pipe-tooltipped pipe-tooltipped--e post__share-icon ft-green"
<a class="post__view" href="${servePath}${article.articlePermalink}"> onclick="$('#comment').focus()"
${article.articleViewCount} ${viewLabel} aria-label="${commentLabel}">
</a> <span class="ft-gray">${article.articleCommentCount}</span>
<div class="fn-right"> <svg>
<span class="pipe-tooltipped pipe-tooltipped--n post__share-icon ft-green" <use xlink:href="#icon-comment"></use>
onclick="$('#comment').focus()" </svg>
aria-label="${commentLabel}"> </span>
<svg> <div id="articleSideShare">
<use xlink:href="#icon-comment"></use> <span class="post__share-icon" data-type="wechat">
</svg> <svg><use xlink:href="#icon-wechat"></use></svg>
${article.articleCommentCount} &nbsp; &nbsp; </span> &nbsp; &nbsp;
</span>
<span id="articleBottomShare">
<span class="post__share-icon" data-type="wechat">
<svg><use xlink:href="#icon-wechat"></use></svg>
</span> &nbsp; &nbsp;
<span class="post__share-icon" data-type="weibo"> <span class="post__share-icon" data-type="weibo">
<svg><use xlink:href="#icon-weibo"></use></svg> <svg><use xlink:href="#icon-weibo"></use></svg>
</span> &nbsp; &nbsp; </span> &nbsp; &nbsp;
<span class="post__share-icon" data-type="twitter"> <span class="post__share-icon" data-type="twitter">
<svg><use xlink:href="#icon-twitter"></use></svg> <svg><use xlink:href="#icon-twitter"></use></svg>
</span> &nbsp; &nbsp; </span> &nbsp; &nbsp;
<span class="post__share-icon" data-type="google"> <span class="post__share-icon" data-type="google">
<svg><use xlink:href="#icon-google"></use></svg> <svg><use xlink:href="#icon-google"></use></svg>
</span> </span>
<span class="article__code" <span class="article__code"
data-title="${article.articleTitle}" data-title="${article.articleTitle}"
data-blogtitle="${blogTitle}" data-blogtitle="${blogTitle}"
data-url="${servePath}${article.articlePermalink}" data-url="${servePath}${article.articlePermalink}"
data-avatar="${article.authorThumbnailURL}"></span> data-avatar="${article.authorThumbnailURL}"></span>
</span> </div>
<#if nextArticlePermalink??>
<a href="${servePath}${nextArticlePermalink}" rel="next" class="article__next">
<span class="ft-12 ft-gray">${nextArticleLabel}</span> <br>
${nextArticleTitle}
</a>
</#if>
</div> </div>
</div> </div>
</div> <#if pjax><!---- pjax {#pjax} end ----></#if>
<div class="post__side">
<span class="pipe-tooltipped pipe-tooltipped--e post__share-icon ft-green"
onclick="$('#comment').focus()"
aria-label="${commentLabel}">
<span class="ft-gray">${article.articleCommentCount}</span>
<svg>
<use xlink:href="#icon-comment"></use>
</svg>
</span>
<div id="articleSideShare">
<span class="post__share-icon" data-type="wechat">
<svg><use xlink:href="#icon-wechat"></use></svg>
</span> &nbsp; &nbsp;
<span class="post__share-icon" data-type="weibo">
<svg><use xlink:href="#icon-weibo"></use></svg>
</span> &nbsp; &nbsp;
<span class="post__share-icon" data-type="twitter">
<svg><use xlink:href="#icon-twitter"></use></svg>
</span> &nbsp; &nbsp;
<span class="post__share-icon" data-type="google">
<svg><use xlink:href="#icon-google"></use></svg>
</span>
<span class="article__code"
data-title="${article.articleTitle}"
data-blogtitle="${blogTitle}"
data-url="${servePath}${article.articlePermalink}"
data-avatar="${article.authorThumbnailURL}"></span>
</div>
</div>
<#if pjax><!---- pjax {#pjaxArticle} end ----></#if>
</div> </div>
<script type="text/javascript" src="${staticServePath}/js/lib/compress/pjax.min.js" charset="utf-8"></script> <script type="text/javascript" src="${staticServePath}/js/lib/compress/pjax.min.js" charset="utf-8"></script>
<script type="text/javascript" src="${staticServePath}/js/common${miniPostfix}.js?${staticResourceVersion}" <script type="text/javascript" src="${staticServePath}/js/common${miniPostfix}.js?${staticResourceVersion}"
@ -229,50 +228,52 @@
charset="utf-8"></script> charset="utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
var latkeConfig = { var latkeConfig = {
"servePath": "${servePath}", 'servePath': "${servePath}",
"staticServePath": "${staticServePath}", 'staticServePath': "${staticServePath}",
"isLoggedIn": "${isLoggedIn?string}", 'isLoggedIn': "${isLoggedIn?string}",
"userName": "${userName}" 'userName': "${userName}",
}; }
var Label = { var Label = {
"skinDirName": "${skinDirName}", 'skinDirName': "${skinDirName}",
"em00Label": "${em00Label}", 'em00Label': "${em00Label}",
"em01Label": "${em01Label}", 'em01Label': "${em01Label}",
"em02Label": "${em02Label}", 'em02Label': "${em02Label}",
"em03Label": "${em03Label}", 'em03Label': "${em03Label}",
"em04Label": "${em04Label}", 'em04Label': "${em04Label}",
"em05Label": "${em05Label}", 'em05Label': "${em05Label}",
"em06Label": "${em06Label}", 'em06Label': "${em06Label}",
"em07Label": "${em07Label}", 'em07Label': "${em07Label}",
"em08Label": "${em08Label}", 'em08Label': "${em08Label}",
"em09Label": "${em09Label}", 'em09Label': "${em09Label}",
"em10Label": "${em10Label}", 'em10Label': "${em10Label}",
"em11Label": "${em11Label}", 'em11Label': "${em11Label}",
"em12Label": "${em12Label}", 'em12Label': "${em12Label}",
"em13Label": "${em13Label}", 'em13Label': "${em13Label}",
"em14Label": "${em14Label}" 'em14Label': "${em14Label}",
}; }
Util.killIE() Util.killIE()
Util.parseMarkdown('content-reset'); Util.parseMarkdown('content-reset')
Skin.initArticle(); Skin.initArticle()
</script> </script>
<!---- pjax {#pjax} start ----></#if>
<@comment_script oId=article.oId> <@comment_script oId=article.oId>
Skin.initComment = function (articleOId, articleTags) { Skin.initComment = function (articleOId, articleTags) {
page.tips.externalRelevantArticlesDisplayCount = "${externalRelevantArticlesDisplayCount}"; page.tips.externalRelevantArticlesDisplayCount = "${externalRelevantArticlesDisplayCount}";
<#if 0 != randomArticlesDisplayCount> <#if 0 != randomArticlesDisplayCount>
page.loadRandomArticles("<div class='module__title'><span>${randomArticlesLabel}</span></div>"); page.loadRandomArticles("<div class='module__title'><span>${randomArticlesLabel}</span></div>");
</#if> </#if>
<#if 0 != externalRelevantArticlesDisplayCount> <#if 0 != externalRelevantArticlesDisplayCount>
page.loadExternalRelevantArticles(articleTags, "<div class='module__title'><span>${externalRelevantArticlesLabel}</span></div>"); page.loadExternalRelevantArticles(articleTags, "<div class='module__title'><span>${externalRelevantArticlesLabel}</span></div>");
</#if> </#if>
<#if 0 != relevantArticlesDisplayCount> <#if 0 != relevantArticlesDisplayCount>
page.loadRelevantArticles(articleOId, '<div class="module__title"><span>${relevantArticlesLabel}</span></div>'); page.loadRelevantArticles(articleOId, '<div class="module__title"><span>${relevantArticlesLabel}</span></div>');
</#if> </#if>
} }
Skin.initComment('${article.oId}', "<#list article.articleTags?split(",") as articleTag>${articleTag}<#if articleTag_has_next>,</#if></#list>") Skin.initComment('${article.oId}', "<#list article.articleTags?split(",") as articleTag>${articleTag}<#if articleTag_has_next>,</#if></#list>")
</@comment_script> </@comment_script>
<!---- pjax {#pjax} end ----></#if>
${plugins} ${plugins}
</body> </body>
</html> </html>

View File

@ -51,10 +51,17 @@ var Skin = {
if (location.href === latkeConfig.servePath + '/tags.html') { if (location.href === latkeConfig.servePath + '/tags.html') {
Skin.initTags() Skin.initTags()
} }
}, function () { if (Util.isArticlePage(location.href)) {
Util.parseMarkdown('content-reset'); if (!$('#articleSideShare .article__code').qrcode) {
Skin.initArticle(); $.ajax({
Skin.initComment($('.post__tags').data('oid'), $('.post__tags').data('tag')) method: "GET",
url: latkeConfig.staticServePath + '/js/jquery.qrcode.min.js',
dataType: "script",
cache: true
});
}
Skin.initArticle();
}
}) })
}, },
initTags: function () { initTags: function () {
@ -83,6 +90,9 @@ var Skin = {
})); }));
}, },
initArticle: function () { initArticle: function () {
if ($('#articleShare').length === 0) {
return
}
Skin._share('#articleShare') Skin._share('#articleShare')
Skin._share('#articleSideShare') Skin._share('#articleSideShare')
Skin._share('#articleBottomShare') Skin._share('#articleBottomShare')
@ -96,6 +106,9 @@ var Skin = {
var sideAbsoluteTop = ($(window).height() - 249) / 2 + 125 var sideAbsoluteTop = ($(window).height() - 249) / 2 + 125
var beforScrollTop = $(window).scrollTop() var beforScrollTop = $(window).scrollTop()
$(window).scroll(function () { $(window).scroll(function () {
if ($('#articleShare').length === 0) {
return
}
var scrollTop = $(window).scrollTop() var scrollTop = $(window).scrollTop()
var bottomTop = $('.article__bottom').offset().top var bottomTop = $('.article__bottom').offset().top
if (scrollTop > 65) { if (scrollTop > 65) {