breaking changes: 更新 fancybox 到 4

improvement: 網站資料顯示,但標籤和分類為0時,數量顯示為 0,而不是隱藏
improvement: subtitle 代碼優化, 1.當source設為false,同時sub也沒有配置,將會讀取hexo配置文件的 subtitle,2.無須使用轉義字符
improvement: 禁止ios點擊搜索框,頁面放大的問題
This commit is contained in:
Jerry
2021-08-08 15:36:22 +08:00
parent 45d6ced507
commit f1bf2413a0
13 changed files with 142 additions and 152 deletions

View File

@@ -20,7 +20,7 @@
meta(charset='UTF-8')
meta(http-equiv="X-UA-Compatible" content="IE=edge")
meta(name="viewport" content="width=device-width,initial-scale=1")
meta(name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no")
title= tabTitle
if pageKeywords
meta(name="keywords" content=pageKeywords)

View File

@@ -13,7 +13,7 @@
each item in i.link_list
.flink-list-item
a(href=url_for(item.link) title=item.name target="_blank")
.flink-item-icon
.flink-item-icon.not-lightbox
img(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name )
.flink-item-name= item.name
.flink-item-desc(title=item.descr)= item.descr

View File

@@ -3,26 +3,21 @@
#sidebar-menus
.avatar-img.is-center
img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar")
.site-data
if site.posts.length
.data-item.is-center
.data-item-link
a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles')
.length-num= site.posts.length
.site-data.is-center
.data-item
a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles')
.length-num= site.posts.length
if site.tags.length
.data-item.is-center
.data-item-link
a(href=url_for(config.tag_dir) + '/' )
.headline= _p('aside.tags')
.length-num= site.tags.length
.data-item
a(href=url_for(config.tag_dir) + '/' )
.headline= _p('aside.tags')
.length-num= site.tags.length
.data-item
a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories')
.length-num= site.categories.length
if site.categories.length
.data-item.is-center
.data-item-link
a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories')
.length-num= site.categories.length
hr
!=partial('includes/header/menu_item', {}, {cache: true})

View File

@@ -1,4 +1,5 @@
- let source = theme.subtitle.source
- const { effect,loop,source,sub } = theme.subtitle
- let subContent = sub || new Array()
case source
when 1
@@ -7,14 +8,14 @@ case source
fetch('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json')
.then(response => response.json())
.then(data => {
if (!{theme.subtitle.effect}) {
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var both = sub.unshift(data.text)
typed = new Typed('#subtitle', {
if (!{effect}) {
const sub = !{JSON.stringify(subContent)}
sub.unshift(data.text)
window.typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
loop: !{loop},
backSpeed: 50,
})
} else {
@@ -23,7 +24,7 @@ case source
})
}
if (!{theme.subtitle.effect}) {
if (!{effect}) {
if (typeof Typed === 'function') {
subtitleType()
} else {
@@ -39,15 +40,15 @@ case source
fetch('https://v1.hitokoto.cn')
.then(response => response.json())
.then(data => {
if (!{theme.subtitle.effect}) {
var from = '出自 ' + data.from
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var both = sub.unshift(data.hitokoto, from)
var typed = new Typed('#subtitle', {
if (!{effect}) {
const from = '出自 ' + data.from
const sub = !{JSON.stringify(subContent)}
sub.unshift(data.hitokoto, from)
window.typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
loop: !{loop},
backSpeed: 50,
})
} else {
@@ -56,7 +57,7 @@ case source
})
}
if (!{theme.subtitle.effect}) {
if (!{effect}) {
if (typeof Typed === 'function') {
subtitleType()
} else {
@@ -70,16 +71,16 @@ case source
script.
function subtitleType () {
getScript('https://yijuzhan.com/api/word.php?m=js').then(() => {
var con = str[0]
if (!{theme.subtitle.effect}) {
var from = '出自 ' + str[1]
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var both = sub.unshift(con, from)
var typed = new Typed('#subtitle', {
const con = str[0]
if (!{effect}) {
const from = '出自 ' + str[1]
const sub = !{JSON.stringify(subContent)}
sub.unshift(con, from)
window.typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
loop: !{loop},
backSpeed: 50,
})
} else {
@@ -88,7 +89,7 @@ case source
})
}
if (!{theme.subtitle.effect}) {
if (!{effect}) {
if (typeof Typed === 'function') {
subtitleType()
} else {
@@ -102,16 +103,16 @@ case source
script.
function subtitleType () {
getScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js').then(() => {
jinrishici.load(function (result) {
if (!{theme.subtitle.effect}) {
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var content = result.data.content
var both = sub.unshift(content)
var typed = new Typed('#subtitle', {
jinrishici.load(result =>{
if (!{effect}) {
const sub = !{JSON.stringify(subContent)}
const content = result.data.content
sub.unshift(content)
window.typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
loop: !{loop},
backSpeed: 50,
})
} else {
@@ -121,7 +122,7 @@ case source
})
}
if (!{theme.subtitle.effect}) {
if (!{effect}) {
if (typeof Typed === 'function') {
subtitleType()
} else {
@@ -132,22 +133,23 @@ case source
}
default
- subContent = subContent.length ? subContent : new Array(config.subtitle)
script.
function subtitleType () {
if (!{theme.subtitle.effect}) {
var typed = new Typed("#subtitle", {
strings: "!{theme.subtitle.sub}".split(","),
if (!{effect}) {
window.typed = new Typed("#subtitle", {
strings: !{JSON.stringify(subContent)},
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
loop: !{loop},
backSpeed: 50
})
} else {
document.getElementById("subtitle").innerHTML = '!{theme.subtitle.sub[0]}'
document.getElementById("subtitle").innerHTML = '!{subContent[0]}'
}
}
if (!{theme.subtitle.effect}) {
if (!{effect}) {
if (typeof Typed === 'function') {
subtitleType()
} else {

View File

@@ -6,24 +6,21 @@ if theme.aside.card_author.enable
.author-info__name= config.author
.author-info__description!= theme.aside.card_author.description || config.description
.card-info-data
if site.posts.length
.card-info-data-item.is-center
a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles')
.length-num= site.posts.length
.card-info-data.is-center
.card-info-data-item
a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles')
.length-num= site.posts.length
if site.tags.length
.card-info-data-item.is-center
a(href=url_for(config.tag_dir) + '/')
.headline= _p('aside.tags')
.length-num= site.tags.length
.card-info-data-item
a(href=url_for(config.tag_dir) + '/')
.headline= _p('aside.tags')
.length-num= site.tags.length
if site.categories.length
.card-info-data-item.is-center
a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories')
.length-num= site.categories.length
.card-info-data-item
a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories')
.length-num= site.categories.length
if theme.aside.card_author.button.enable
a#card-info-btn.button--animated(href=theme.aside.card_author.button.link)