This commit is contained in:
结发受长生
2019-05-09 23:10:12 +08:00
parent 1a915a94cb
commit f7b8721ec6
23 changed files with 1337 additions and 1395 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ function init() {
}
// 目录序号
if (yiliaConfig && yiliaConfig.toc_hide_index) {
if (window.themeConfig && window.themeConfig.toc_hide_index) {
let $a = document.querySelectorAll('.toc-number')
Array.prototype.forEach.call($a, function($em){
$em.style.display = 'none'
+2 -2
View File
@@ -15,12 +15,12 @@ Util.addLoadEvent(function() {
Aside.init()
})
const commentConfig = require("../config/comment.json")
if(window.yiliaConfig.isPost && commentConfig.valine.enable) {
if(window.themeConfig.isPost && commentConfig.valine.enable) {
// 文章详情页面, 并且启用了评论, 则加载评论相关代码
import(/* webpackChunkName: "comment" */ './comment')
}
if(window.yiliaConfig.pageid === 'PhotoWall') {
if(window.themeConfig.pageid === 'PhotoWall') {
// 自定义的照片墙页面
import(/* webpackChunkName: "photo-wall" */ './photo-wall')
}
+13 -13
View File
@@ -1,6 +1,3 @@
import addClass from 'dom101/add-class'
import removeClass from 'dom101/remove-class'
import after from 'dom101/after'
// 浏览器判断
import Browser from './browser'
// fix hexo 不支持的配置
@@ -14,11 +11,11 @@ function isPathMatch(path, href) {
}
function tabActive() {
let $tabs = document.querySelectorAll('.js-header-menu li a')
let tabs = document.querySelectorAll('.js-header-menu li a')
let path = window.location.pathname
Array.prototype.forEach.call($tabs, function($tab, i){
if (isPathMatch(path, $tab.getAttribute('href'))) {
addClass($tab, 'active')
Array.prototype.forEach.call(tabs, function(tab, i){
if (isPathMatch(path, tab.getAttribute('href'))) {
tab.classList.add('active')
}
})
}
@@ -49,8 +46,13 @@ function scrollStop($dom, top, limit, zIndex, diff) {
if (nowTop - limit <= diff) {
let $newDom = $dom.$newDom
if (!$newDom) {
$newDom = $dom.cloneNode(true)
after($dom, $newDom)
$newDom = $dom.cloneNode(true)
let parentNode = $dom.parentNode
if(parentNode.lastChild == $dom){ // 将新生成的节点插入到当前节点之后
parentNode.appendChild($newDom)
}else{
parentNode.insertBefore($newDom, $dom.nextSibling)
}
$dom.$newDom = $newDom
$newDom.style.position = 'fixed'
$newDom.style.top = (limit || nowTop) + 'px'
@@ -88,14 +90,12 @@ function bindScroll() {
handleScroll()
}
function init() {
(function () {
if (Browser.versions.mobile && window.screen.width < 800) {
tabActive()
bindScroll()
}
}
init();
})()
Util.addLoadEvent(function() {
Fix.init()
+9 -13
View File
@@ -1,5 +1,3 @@
import addClass from 'dom101/add-class'
import removeClass from 'dom101/remove-class'
import QRious from 'qrious'
function generate(url, opts) {
@@ -13,26 +11,24 @@ function generate(url, opts) {
var qrcodeInit = false
function showWX() {
let $wx = document.querySelector('.js-wx-box')
let $mask = document.querySelector('.mask')
let wx = document.querySelector('.js-wx-box')
let mask = document.querySelector('.mask')
if(!qrcodeInit) {
new QRious({
element: document.querySelector('.qrcode-canvas'),
value: location.href
});
})
qrcodeInit = true
}
addClass($wx, 'in')
addClass($wx, 'ready')
addClass($mask, 'in')
wx.classList.add('in', 'ready')
mask.classList.add('in')
}
function hideWX() {
let $wx = document.querySelector('.js-wx-box')
let $mask = document.querySelector('.mask')
removeClass($wx, 'in')
removeClass($wx, 'ready')
removeClass($mask, 'in')
let wx = document.querySelector('.js-wx-box')
let mask = document.querySelector('.mask')
wx.classList.remove('in', 'ready')
mask.classList.remove('in')
}
function handleClick(type, opts) {
+2 -2
View File
@@ -86,7 +86,7 @@ new Vue({
},
filters: {
urlformat: (str) => {
return (window.yiliaConfig && window.yiliaConfig.root) ? window.yiliaConfig.root + str : '/' + str;
return (window.themeConfig && window.themeConfig.root) ? window.themeConfig.root + str : '/' + str;
}
},
watch: {
@@ -101,7 +101,7 @@ new Vue({
}
},
mounted () {
axios.get(window.yiliaConfig.root + 'content.json?t=' + (+ new Date()))
axios.get(window.themeConfig.root + 'content.json?t=' + (+ new Date()))
.then((res)=>{
this.items = res.data
}).catch((err) => {
+1 -1
View File
@@ -36,6 +36,6 @@ function init() {
}
// export default { init }
if(!window.yiliaConfig.pageid) { // 非个性化页面的普通文章
if(!window.themeConfig.pageid) { // 非个性化页面的普通文章
Util.addLoadEvent(init)
}