This commit is contained in:
Van
2018-12-06 22:42:01 +08:00
parent 6ca3f2c627
commit 7ec3fba248
34 changed files with 3685 additions and 0 deletions

130
Jane/js/common.js Normal file
View File

@@ -0,0 +1,130 @@
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-2018, b3log.org & hacpai.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* 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/>.
*/
/**
* @fileoverview util and every page should be used.
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 0.2.1.0, Sep 30, 2018
*/
/**
* @description 皮肤脚本
* @static
*/
var Skin = {
_initCommon: function ($goTop) {
$(window).scroll(function () {
if ($(window).scrollTop() > 125) {
$goTop.show()
} else {
$goTop.hide()
}
})
},
_initAnimation: function () {
if (!('IntersectionObserver' in window)) {
$('.item').addClass('item--active')
return false
}
if (window.imageIntersectionObserver) {
window.imageIntersectionObserver.disconnect()
$('.item').each(function () {
window.imageIntersectionObserver.observe(this)
})
} else {
window.imageIntersectionObserver = new IntersectionObserver(
function (entries) {
entries.forEach(function (entrie) {
if (typeof entrie.isIntersecting === 'undefined'
? entrie.intersectionRatio !== 0 : entrie.isIntersecting) {
$(entrie.target).addClass('item--active')
} else {
if ($(entrie.target).closest('.side').length === 1 ||
$(entrie.target).closest('.article-list').hasClass('content') ||
$(entrie.target).outerHeight() > 768) {
return
}
$(entrie.target).removeClass('item--active')
}
})
})
$('.item').each(function () {
window.imageIntersectionObserver.observe(this)
})
}
},
init: function () {
Util.initPjax(function () {
Skin._initAnimation()
if ($('#articlePage').length === 0) {
$('.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 () {
if ($('.b3-solo-list li').length > 0 && $(window).width() > 1000) {
$('.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 () {
if ($('#externalRelevantArticlesWrap li').length === 0) {
$('#externalRelevantArticlesWrap').next().remove()
$('#externalRelevantArticlesWrap').remove()
}
if ($('#relevantArticlesWrap li').length === 0) {
$('#relevantArticlesWrap').prev().remove()
$('#relevantArticlesWrap').remove()
}
if ($('#randomArticlesWrap li').length === 0) {
$('#randomArticlesWrap').prev().remove()
$('#randomArticlesWrap').remove()
}
}, 1000)
},
}
Skin.init()

18
Jane/js/common.min.js vendored Normal file
View File

@@ -0,0 +1,18 @@
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-2018, b3log.org & hacpai.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* 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/>.
*/
var Skin={_initCommon:function(e){$(window).scroll(function(){125<$(window).scrollTop()?e.show():e.hide()})},_initAnimation:function(){if(!("IntersectionObserver"in window))return $(".item").addClass("item--active"),!1;window.imageIntersectionObserver?window.imageIntersectionObserver.disconnect():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")||768<$(e.target).outerHeight())return;$(e.target).removeClass("item--active")}})}),$(".item").each(function(){window.imageIntersectionObserver.observe(this)})},init:function(){Util.initPjax(function(){Skin._initAnimation(),0===$("#articlePage").length&&$(".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(){0<$(".b3-solo-list li").length&&1e3<$(window).width()&&($(".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();

19
Jane/js/isotope.pkgd.js Normal file

File diff suppressed because one or more lines are too long

18
Jane/js/isotope.pkgd.min.js vendored Normal file

File diff suppressed because one or more lines are too long