This commit is contained in:
Van 2018-09-30 15:41:00 +08:00
parent 4bd78b7cfa
commit e84389b482
No known key found for this signature in database
GPG Key ID: 7059B8783A78F16C
5 changed files with 42 additions and 23 deletions

View File

@ -36,21 +36,7 @@ var Skin = {
} }
}) })
}, },
init: function () { _initAnimation: function () {
Util.initPjax()
$('body').on('click', '.content-reset img', function () {
window.open(this.src)
})
this._initCommon($('.icon__up'))
$('.header__nav a, .header__m a').each(function () {
if (this.href === location.href) {
this.className = 'current'
}
})
if (!('IntersectionObserver' in window)) { if (!('IntersectionObserver' in window)) {
$('.item').addClass('item--active') $('.item').addClass('item--active')
return false return false
@ -82,6 +68,36 @@ var Skin = {
}) })
} }
}, },
init: function () {
Util.initPjax(function () {
Skin._initAnimation()
if (!Util.isArticlePage(location.href)) {
$('.b3-solo-list').closest('.module').remove()
}
})
Skin._initAnimation()
$('body').on('click', '.content-reset img', function () {
window.open(this.src)
})
this._initCommon($('.icon__up'))
$('.header__nav a, .header__m a').each(function () {
if (this.href === location.href) {
this.className = 'current'
}
}).click(function () {
$('.header__nav a, .header__m a').removeClass('current')
this.className = 'current'
$('.header__m .module__list').hide()
})
$('.header__logo').click(function () {
$('.header__nav a, .header__m a').removeClass('current')
})
},
_initArticleCommon: function () { _initArticleCommon: function () {
if ($('.b3-solo-list li').length > 0 && $(window).width() > 1000) { if ($('.b3-solo-list li').length > 0 && $(window).width() > 1000) {
$('.side'). $('.side').

View File

@ -15,4 +15,4 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
var Skin={_initCommon:function(e){$(window).scroll(function(){$(window).scrollTop()>125?e.show():e.hide()})},init:function(){if(Util.initPjax(),$("body").on("click",".content-reset img",function(){window.open(this.src)}),this._initCommon($(".icon__up")),$(".header__nav a, .header__m a").each(function(){this.href===location.href&&(this.className="current")}),!("IntersectionObserver"in window))return $(".item").addClass("item--active"),!1;window.imageIntersectionObserver?(window.imageIntersectionObserver.disconnect(),$(".item").each(function(){window.imageIntersectionObserver.observe(this)})):(window.imageIntersectionObserver=new IntersectionObserver(function(e){e.forEach(function(e){if(void 0===e.isIntersecting?0!==e.intersectionRatio:e.isIntersecting)$(e.target).addClass("item--active");else{if(1===$(e.target).closest(".side").length||$(e.target).closest(".article-list").hasClass("content"))return;$(e.target).removeClass("item--active")}})}),$(".item").each(function(){window.imageIntersectionObserver.observe(this)}))},_initArticleCommon:function(){$(".b3-solo-list li").length>0&&$(window).width()>1e3&&($(".side").prepend('<div class="module"><div class="module__list"></div></div>'),$(".side .module:eq(0) .module__list").html($(".b3-solo-list")))},initArticle:function(){this._initArticleCommon(),setTimeout(function(){0===$("#externalRelevantArticlesWrap li").length&&($("#externalRelevantArticlesWrap").next().remove(),$("#externalRelevantArticlesWrap").remove()),0===$("#relevantArticlesWrap li").length&&($("#relevantArticlesWrap").prev().remove(),$("#relevantArticlesWrap").remove()),0===$("#randomArticlesWrap li").length&&($("#randomArticlesWrap").prev().remove(),$("#randomArticlesWrap").remove())},1e3)}};Skin.init(); var Skin={_initCommon:function(e){$(window).scroll(function(){$(window).scrollTop()>125?e.show():e.hide()})},_initAnimation:function(){if(!("IntersectionObserver"in window))return $(".item").addClass("item--active"),!1;window.imageIntersectionObserver?(window.imageIntersectionObserver.disconnect(),$(".item").each(function(){window.imageIntersectionObserver.observe(this)})):(window.imageIntersectionObserver=new IntersectionObserver(function(e){e.forEach(function(e){if(void 0===e.isIntersecting?0!==e.intersectionRatio:e.isIntersecting)$(e.target).addClass("item--active");else{if(1===$(e.target).closest(".side").length||$(e.target).closest(".article-list").hasClass("content"))return;$(e.target).removeClass("item--active")}})}),$(".item").each(function(){window.imageIntersectionObserver.observe(this)}))},init:function(){Util.initPjax(function(){Skin._initAnimation(),Util.isArticlePage(location.href)||$(".b3-solo-list").closest(".module").remove()}),Skin._initAnimation(),$("body").on("click",".content-reset img",function(){window.open(this.src)}),this._initCommon($(".icon__up")),$(".header__nav a, .header__m a").each(function(){this.href===location.href&&(this.className="current")}).click(function(){$(".header__nav a, .header__m a").removeClass("current"),this.className="current",$(".header__m .module__list").hide()}),$(".header__logo").click(function(){$(".header__nav a, .header__m a").removeClass("current")})},_initArticleCommon:function(){$(".b3-solo-list li").length>0&&$(window).width()>1e3&&($(".side").prepend('<div class="module"><div class="module__list"></div></div>'),$(".side .module:eq(0) .module__list").html($(".b3-solo-list")))},initArticle:function(){this._initArticleCommon(),setTimeout(function(){0===$("#externalRelevantArticlesWrap li").length&&($("#externalRelevantArticlesWrap").next().remove(),$("#externalRelevantArticlesWrap").remove()),0===$("#relevantArticlesWrap li").length&&($("#relevantArticlesWrap").prev().remove(),$("#relevantArticlesWrap").remove()),0===$("#randomArticlesWrap li").length&&($("#randomArticlesWrap").prev().remove(),$("#randomArticlesWrap").remove())},1e3)}};Skin.init();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -46,7 +46,7 @@
<#list tags as tag> <#list tags as tag>
<a rel="tag" data-count="${tag.tagPublishedRefCount}" class="tag" <a rel="tag" data-count="${tag.tagPublishedRefCount}" class="tag"
href="${servePath}/tags/${tag.tagTitle?url('UTF-8')}"> href="${servePath}/tags/${tag.tagTitle?url('UTF-8')}">
<span>${tag.tagTitle}</span> <span class="name">${tag.tagTitle}</span>
(<b>${tag.tagPublishedRefCount}</b>) (<b>${tag.tagPublishedRefCount}</b>)
</a> </a>
</#list> </#list>
@ -64,11 +64,14 @@
<script> <script>
$('.tags').isotope({ $('.tags').isotope({
transitionDuration: '1.5s', transitionDuration: '1.5s',
filter: 'a', itemSelector: '.tag',
layoutMode: 'fitRows', layoutMode: 'fitRows',
getSortData: {
name: '.name'
}
}) })
$('.tags').isotope({ $('.tags').isotope({
sortBy: 'random', sortBy: 'name',
}) })
</script> </script>
<#if pjax><!---- pjax {#pjax} end ----></#if> <#if pjax><!---- pjax {#pjax} end ----></#if>