This commit is contained in:
Van 2019-03-22 16:20:33 +08:00
parent 7de1250af0
commit 1121ffae30
No known key found for this signature in database
GPG Key ID: 7059B8783A78F16C
4 changed files with 648 additions and 609 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -16,162 +16,164 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
/** /**
* @fileoverview neoease js. * @fileoverview neoease js.
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.0.0.8, Sep 6, 2012 * @version 1.0.0.8, Sep 6, 2012
*/ */
var goTop = function (acceleration) { var goTop = function (acceleration) {
acceleration = acceleration || 0.1; acceleration = acceleration || 0.1
var y = $(window).scrollTop(); var y = $(window).scrollTop()
var speed = 1 + acceleration; var speed = 1 + acceleration
window.scrollTo(0, Math.floor(y / speed)); window.scrollTo(0, Math.floor(y / speed))
if (y > 0) { if (y > 0) {
var invokeFunction = "goTop(" + acceleration + ")"; var invokeFunction = 'goTop(' + acceleration + ')'
window.setTimeout(invokeFunction, 16); window.setTimeout(invokeFunction, 16)
} }
}; }
var collapseArchive = function (it, year) { var collapseArchive = function (it, year) {
var tag = true; var tag = true
if (it.className === "collapse-ico") { if (it.className === 'collapse-ico') {
it.className = "expand-ico"; it.className = 'expand-ico'
tag = false; tag = false
} else { } else {
it.className = "collapse-ico"; it.className = 'collapse-ico'
}
$('#archiveSide li').each(function () {
var $this = $(this)
// hide other year month archives
if ($this.data('year') === year) {
if (tag) {
$(this).show()
} else {
$(this).hide()
}
} }
})
$("#archiveSide li").each(function () { }
var $this = $(this);
// hide other year month archives
if ($this.data("year") === year) {
if (tag) {
$(this).show();
} else {
$(this).hide();
}
}
});
};
var getArticle = function (it, id) { var getArticle = function (it, id) {
var $abstract = $("#abstract" + id), var $abstract = $('#abstract' + id),
$content = $("#content" + id); $content = $('#content' + id)
if ($content.html() === "") { if ($content.html() === '') {
$.ajax({ $.ajax({
url: "/get-article-content?id=" + id, url: '/get-article-content?id=' + id,
type: "GET", type: 'GET',
dataType: "html", dataType: 'html',
beforeSend: function () { beforeSend: function () {
$abstract.css("background", $abstract.css('background',
"url(/skins/neoease/images/ajax-loader.gif) no-repeat scroll center center transparent"); 'url(/skins/neoease/images/ajax-loader.gif) no-repeat scroll center center transparent')
}, },
success: function(result, textStatus){ success: function (result, textStatus) {
it.className = "collapse-ico"; it.className = 'collapse-ico'
$content.html(result); $content.html(result)
$abstract.hide().css("background", "none"); $abstract.hide().css('background', 'none')
$content.fadeIn("slow"); $content.fadeIn('slow')
} Util.parseLanguage()
}); Util.parseMarkdown()
},
})
} else {
if (it.className === 'expand-ico') {
$abstract.hide()
$content.fadeIn()
it.className = 'collapse-ico'
} else { } else {
if (it.className === "expand-ico") { $content.hide()
$abstract.hide(); $abstract.fadeIn()
$content.fadeIn(); it.className = 'expand-ico'
it.className = "collapse-ico";
} else {
$content.hide();
$abstract.fadeIn();
it.className = "expand-ico";
}
} }
}
return false;
}; return false
}
var goTranslate = function () { var goTranslate = function () {
window.open("http://translate.google.com/translate?sl=auto&tl=auto&u=" + location.href); window.open('http://translate.google.com/translate?sl=auto&tl=auto&u=' +
}; location.href)
}
$(document).ready(function () {
// go top icon show or hide
$(window).scroll(function () {
var y = $(window).scrollTop();
if (y > 182) { $(document).ready(function () {
var bodyH = $(window).height(); // go top icon show or hide
var top = y + bodyH - 21; $(window).scroll(function () {
if ($("body").height() - 58 <= y + bodyH) { var y = $(window).scrollTop()
top = $(".footer").offset().top - 21;
} if (y > 182) {
$("#goTop").fadeIn("slow").css("top", top); var bodyH = $(window).height()
} else { var top = y + bodyH - 21
$("#goTop").hide(); if ($('body').height() - 58 <= y + bodyH) {
} top = $('.footer').offset().top - 21
}); }
$('#goTop').fadeIn('slow').css('top', top)
} else {
// archive $('#goTop').hide()
var currentYear = (new Date()).getFullYear(), }
year = currentYear; })
$("#archiveSide li").each(function (i) {
var $this = $(this); // archive
var currentYear = (new Date()).getFullYear(),
// hide other year month archives year = currentYear
if ($this.data("year") !== currentYear) { $('#archiveSide li').each(function (i) {
$(this).hide() var $this = $(this)
}
// hide other year month archives
// append year archive if ($this.data('year') !== currentYear) {
if (year !== $this.data("year")) { $(this).hide()
year = $this.data("year"); }
$this.before("<li class='archive-year'><div onclick='collapseArchive(this, " +
year + ")' class='expand-ico'>" + year + "&nbsp;\u5e74</div></li>"); // append year archive
} if (year !== $this.data('year')) {
}); year = $this.data('year')
$this.before('<li class=\'archive-year\'><div onclick=\'collapseArchive(this, ' +
// recent comment mouse click year + ')\' class=\'expand-ico\'>' + year + '&nbsp;\u5e74</div></li>')
$(".recent-comments .expand-ico").click(function () { }
if (this.className === "expand-ico") { })
$(this).parent().next().css({
"height": "auto", // recent comment mouse click
"white-space": "normal" $('.recent-comments .expand-ico').click(function () {
}); if (this.className === 'expand-ico') {
this.className = "collapse-ico"; $(this).parent().next().css({
} else { 'height': 'auto',
$(this).parent().next().animate({ 'white-space': 'normal',
"height": "18px" })
}, function () { this.className = 'collapse-ico'
$(this).css("white-space", "nowrap"); } else {
}); $(this).parent().next().animate({
this.className = "expand-ico"; 'height': '18px',
} }, function () {
}); $(this).css('white-space', 'nowrap')
})
// nav current this.className = 'expand-ico'
$(".nav ul li").each(function () { }
var $a = $(this).find("a"); })
if ($a.attr("href") === Label.servePath + location.pathname) {
$(this).addClass("current"); // nav current
} else if (/\/[0-9]+$/.test(location.pathname)) { $('.nav ul li').each(function () {
$(".nav ul li")[0].className = "current"; var $a = $(this).find('a')
} if ($a.attr('href') === Label.servePath + location.pathname) {
}); $(this).addClass('current')
} else if (/\/[0-9]+$/.test(location.pathname)) {
Util.setTopBar() $('.nav ul li')[0].className = 'current'
Util.replaceSideEm($(".recent-comments-content")); }
Util.buildTags("tagsSide"); })
// recent comments Util.setTopBar()
$(".recent-comments .recent-comments-main").each(function () { Util.replaceSideEm($('.recent-comments-content'))
if ($(this).find(".recent-comments-content>a").height() < 30) { Util.buildTags('tagsSide')
$(this).find(".expand-ico").remove();
} else { // recent comments
$(this).find(".expand-ico").parent().next().css({ $('.recent-comments .recent-comments-main').each(function () {
"white-space": "nowrap" if ($(this).find('.recent-comments-content>a').height() < 30) {
}); $(this).find('.expand-ico').remove()
} } else {
}); $(this).find('.expand-ico').parent().next().css({
}); 'white-space': 'nowrap',
})
}
})
})

View File

@ -18,77 +18,87 @@
--> -->
<div class="side"> <div class="side">
<#if "" != noticeBoard>
<div> <div>
<h4>${noticeBoardLabel}</h4> <br>
<div>${noticeBoard}</div> <#include "../../common-template/macro-user_site.ftl"/>
<@userSite dir="nw"/>
<#if "" != noticeBoard>
<br><br>
<div style="text-align: center">${noticeBoard}</div>
</#if>
</div> </div>
</#if> <#if article?? && article.articleToC?? && article.articleToC?size &gt; 0>
<#if 0 != recentComments?size> <div>
<h4>${tocLabel}</h4>
<#include "../../common-template/toc.ftl"/>
</div>
<#else>
<#if 0 != recentComments?size>
<div> <div>
<h4>${recentCommentsLabel}</h4> <h4>${recentCommentsLabel}</h4>
<ul class="recent-comments"> <ul class="recent-comments">
<#list recentComments as comment> <#list recentComments as comment>
<li> <li>
<img class='left' title='${comment.commentName}' <img class='left' title='${comment.commentName}'
alt='${comment.commentName}' alt='${comment.commentName}'
src='${comment.commentThumbnailURL}'/> src='${comment.commentThumbnailURL}'/>
<div class='recent-comments-main'> <div class='recent-comments-main'>
<div> <div>
<span class="left"> <span class="left">
<#if "http://" == comment.commentURL> <#if "http://" == comment.commentURL>
${comment.commentName} ${comment.commentName}
<#else> <#else>
<a target="_blank" href="${comment.commentURL}">${comment.commentName}</a> <a target="_blank" href="${comment.commentURL}">${comment.commentName}</a>
</#if> </#if>
</span> </span>
<span class="expand-ico"></span> <span class="expand-ico"></span>
<span class="clear"></span> <span class="clear"></span>
</div>
<div class="recent-comments-content">
<a href="${servePath}${comment.commentSharpURL}">
${comment.commentContent}
</a>
</div>
</div> </div>
<div class="recent-comments-content"> <div class='clear'></div>
<a href="${servePath}${comment.commentSharpURL}"> </li>
${comment.commentContent}
</a>
</div>
</div>
<div class='clear'></div>
</li>
</#list> </#list>
</ul> </ul>
</div> </div>
</#if> </#if>
<#if 0 != mostCommentArticles?size> <#if 0 != mostCommentArticles?size>
<div> <div>
<h4>${mostCommentArticlesLabel}</h4> <h4>${mostCommentArticlesLabel}</h4>
<ul class="side-li"> <ul class="side-li">
<#list mostCommentArticles as article> <#list mostCommentArticles as article>
<li> <li>
<sup>[${article.articleCommentCount}]</sup> <sup>[${article.articleCommentCount}]</sup>
<a title="${article.articleTitle}" href="${servePath}${article.articlePermalink}"> <a title="${article.articleTitle}" href="${servePath}${article.articlePermalink}">
${article.articleTitle} ${article.articleTitle}
</a> </a>
</li> </li>
</#list> </#list>
</ul> </ul>
</div> </div>
</#if> </#if>
<#if 0 != mostViewCountArticles?size> <#if 0 != mostViewCountArticles?size>
<div> <div>
<h4>${mostViewCountArticlesLabel}</h4> <h4>${mostViewCountArticlesLabel}</h4>
<ul class="side-li"> <ul class="side-li">
<#list mostViewCountArticles as article> <#list mostViewCountArticles as article>
<li> <li>
<sup>[${article.articleViewCount}]</sup> <sup>[${article.articleViewCount}]</sup>
<a title="${article.articleTitle}" href="${servePath}${article.articlePermalink}"> <a title="${article.articleTitle}" href="${servePath}${article.articlePermalink}">
${article.articleTitle} ${article.articleTitle}
</a> </a>
</li> </li>
</#list> </#list>
</ul> </ul>
</div> </div>
</#if> </#if>
<#if 0 != mostUsedCategories?size> <#if 0 != mostUsedCategories?size>
<div> <div>
<h4>${categoryLabel}</h4> <h4>${categoryLabel}</h4>
<ul class="tags"> <ul class="tags">
@ -102,58 +112,64 @@
</ul> </ul>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
</#if> </#if>
<#if 0 != mostUsedTags?size> <#if 0 != mostUsedTags?size>
<div> <div>
<h4>${tagsLabel}</h4> <h4>${tagsLabel}</h4>
<ul id="tagsSide" class="tags"> <ul id="tagsSide" class="tags">
<#list mostUsedTags as tag> <#list mostUsedTags as tag>
<li> <li>
<a data-count="${tag.tagPublishedRefCount}" <a data-count="${tag.tagPublishedRefCount}"
href="${servePath}/tags/${tag.tagTitle?url('UTF-8')}" title="${tag.tagTitle}(${tag.tagPublishedRefCount})"> href="${servePath}/tags/${tag.tagTitle?url('UTF-8')}"
<span>${tag.tagTitle}</span> title="${tag.tagTitle}(${tag.tagPublishedRefCount})">
</a> <span>${tag.tagTitle}</span>
</li> </a>
</li>
</#list> </#list>
</ul> </ul>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
</#if> </#if>
<#if 0 != links?size> <#if 0 != links?size>
<div> <div>
<h4>${linkLabel}</h4> <h4>${linkLabel}</h4>
<ul> <ul>
<#list links as link> <#list links as link>
<li> <li>
<a rel="friend" href="${link.linkAddress}" title="${link.linkTitle}" target="_blank"> <a rel="friend" href="${link.linkAddress}" title="${link.linkTitle}" target="_blank">
<img alt="${link.linkTitle}" <img alt="${link.linkTitle}"
src="${faviconAPI}<#list link.linkAddress?split('/') as x><#if x_index=2>${x}<#break></#if></#list>" width="16" height="16" /></a> src="${faviconAPI}<#list link.linkAddress?split('/') as x><#if x_index=2>${x}<#break></#if></#list>"
<a rel="friend" href="${link.linkAddress}" title="${link.linkTitle}" target="_blank">${link.linkTitle} width="16" height="16"/></a>
</a> <a rel="friend" href="${link.linkAddress}" title="${link.linkTitle}"
</li> target="_blank">${link.linkTitle}
</a>
</li>
</#list> </#list>
</ul> </ul>
</div> </div>
</#if> </#if>
<#if 0 != archiveDates?size> <#if 0 != archiveDates?size>
<div> <div>
<h4>${archiveLabel}</h4> <h4>${archiveLabel}</h4>
<ul id="archiveSide"> <ul id="archiveSide">
<#list archiveDates as archiveDate> <#list archiveDates as archiveDate>
<li data-year="${archiveDate.archiveDateYear}"> <li data-year="${archiveDate.archiveDateYear}">
<#if "en" == localeString?substring(0, 2)> <#if "en" == localeString?substring(0, 2)>
<a href="${servePath}/archives/${archiveDate.archiveDateYear}/${archiveDate.archiveDateMonth}" <a href="${servePath}/archives/${archiveDate.archiveDateYear}/${archiveDate.archiveDateMonth}"
title="${archiveDate.monthName} ${archiveDate.archiveDateYear}(${archiveDate.archiveDatePublishedArticleCount})"> title="${archiveDate.monthName} ${archiveDate.archiveDateYear}(${archiveDate.archiveDatePublishedArticleCount})">
${archiveDate.monthName} ${archiveDate.archiveDateYear}</a>(${archiveDate.archiveDatePublishedArticleCount}) ${archiveDate.monthName} ${archiveDate.archiveDateYear}</a>(${archiveDate.archiveDatePublishedArticleCount}
)
<#else> <#else>
<a href="${servePath}/archives/${archiveDate.archiveDateYear}/${archiveDate.archiveDateMonth}" <a href="${servePath}/archives/${archiveDate.archiveDateYear}/${archiveDate.archiveDateMonth}"
title="${archiveDate.archiveDateYear} ${yearLabel} ${archiveDate.archiveDateMonth} ${monthLabel}(${archiveDate.archiveDatePublishedArticleCount})"> title="${archiveDate.archiveDateYear} ${yearLabel} ${archiveDate.archiveDateMonth} ${monthLabel}(${archiveDate.archiveDatePublishedArticleCount})">
${archiveDate.archiveDateYear} ${yearLabel} ${archiveDate.archiveDateMonth} ${monthLabel}</a>(${archiveDate.archiveDatePublishedArticleCount}) ${archiveDate.archiveDateYear} ${yearLabel} ${archiveDate.archiveDateMonth} ${monthLabel}</a>(${archiveDate.archiveDatePublishedArticleCount}
)
</#if> </#if>
</li> </li>
</#list> </#list>
</ul> </ul>
</div> </div>
</#if> </#if>
</#if>
</div> </div>