mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
fix: 修復tabs 標簽外挂設爲-1時,按鈕點擊沒反應的bugs
This commit is contained in:
parent
d82f69e83b
commit
83299dfd2f
@ -23,11 +23,11 @@ script.
|
|||||||
const loadTwikoo = (bool = false) => {
|
const loadTwikoo = (bool = false) => {
|
||||||
if (typeof twikoo === 'object') {
|
if (typeof twikoo === 'object') {
|
||||||
init()
|
init()
|
||||||
bool && $countDom && setTimeout(()=>{getCount()},0)
|
bool && $countDom && setTimeout(getCount,0)
|
||||||
} else {
|
} else {
|
||||||
getScript('!{theme.CDN.twikoo}').then(()=> {
|
getScript('!{theme.CDN.twikoo}').then(()=> {
|
||||||
init()
|
init()
|
||||||
bool && $countDom && setTimeout(()=>{getCount()},0)
|
bool && $countDom && setTimeout(getCount,0)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ script.
|
|||||||
|
|
||||||
if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) {
|
if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) {
|
||||||
if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#vcomment'),loadValine)
|
if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#vcomment'),loadValine)
|
||||||
else setTimeout(() => loadValine(), 0)
|
else setTimeout(loadValine, 0)
|
||||||
} else {
|
} else {
|
||||||
function loadOtherComment () {
|
function loadOtherComment () {
|
||||||
loadValine()
|
loadValine()
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hexo-theme-butterfly",
|
"name": "hexo-theme-butterfly",
|
||||||
"version": "3.4.0",
|
"version": "3.4.1",
|
||||||
"description": "A Simple and Card UI Design theme for Hexo",
|
"description": "A Simple and Card UI Design theme for Hexo",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -471,7 +471,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
const currentActive = $tocLink[currentIndex]
|
const currentActive = $tocLink[currentIndex]
|
||||||
currentActive.classList.add('active')
|
currentActive.classList.add('active')
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(() => {
|
||||||
autoScrollToc(currentActive)
|
autoScrollToc(currentActive)
|
||||||
}, 0)
|
}, 0)
|
||||||
|
|
||||||
@ -626,7 +626,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
*/
|
*/
|
||||||
const addRuntime = () => {
|
const addRuntime = () => {
|
||||||
const $runtimeCount = document.getElementById('runtimeshow')
|
const $runtimeCount = document.getElementById('runtimeshow')
|
||||||
if ($runtimeCount !== null) {
|
if ($runtimeCount) {
|
||||||
const publishDate = $runtimeCount.getAttribute('data-publishDate')
|
const publishDate = $runtimeCount.getAttribute('data-publishDate')
|
||||||
$runtimeCount.innerText = btf.diffDate(publishDate) + ' ' + GLOBAL_CONFIG.runtime
|
$runtimeCount.innerText = btf.diffDate(publishDate) + ' ' + GLOBAL_CONFIG.runtime
|
||||||
}
|
}
|
||||||
@ -637,7 +637,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
*/
|
*/
|
||||||
const addLastPushDate = () => {
|
const addLastPushDate = () => {
|
||||||
const $lastPushDateItem = document.getElementById('last-push-date')
|
const $lastPushDateItem = document.getElementById('last-push-date')
|
||||||
if ($lastPushDateItem !== null) {
|
if ($lastPushDateItem) {
|
||||||
const lastPushDate = $lastPushDateItem.getAttribute('data-lastPushDate')
|
const lastPushDate = $lastPushDateItem.getAttribute('data-lastPushDate')
|
||||||
$lastPushDateItem.innerText = btf.diffDate(lastPushDate, true)
|
$lastPushDateItem.innerText = btf.diffDate(lastPushDate, true)
|
||||||
}
|
}
|
||||||
@ -685,7 +685,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
|
|
||||||
if (!$tabItem.classList.contains('active')) {
|
if (!$tabItem.classList.contains('active')) {
|
||||||
const $tabContent = $tabItem.parentNode.nextElementSibling
|
const $tabContent = $tabItem.parentNode.nextElementSibling
|
||||||
btf.siblings($tabItem, '.active')[0].classList.remove('active')
|
const $siblings = btf.siblings($tabItem, '.active')[0]
|
||||||
|
$siblings && $siblings.classList.remove('active')
|
||||||
$tabItem.classList.add('active')
|
$tabItem.classList.add('active')
|
||||||
const tabId = $this.getAttribute('data-href').replace('#', '')
|
const tabId = $this.getAttribute('data-href').replace('#', '')
|
||||||
const childList = [...$tabContent.children]
|
const childList = [...$tabContent.children]
|
||||||
@ -712,7 +713,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
|
|
||||||
const toggleCardCategory = function () {
|
const toggleCardCategory = function () {
|
||||||
const $cardCategory = document.querySelectorAll('#aside-cat-list .card-category-list-item.parent i')
|
const $cardCategory = document.querySelectorAll('#aside-cat-list .card-category-list-item.parent i')
|
||||||
if ($cardCategory.length > 0) {
|
if ($cardCategory.length) {
|
||||||
$cardCategory.forEach(function (item) {
|
$cardCategory.forEach(function (item) {
|
||||||
item.addEventListener('click', function (e) {
|
item.addEventListener('click', function (e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|||||||
@ -88,8 +88,9 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
translateButtonObject = document.getElementById('translateLink')
|
translateButtonObject = document.getElementById('translateLink')
|
||||||
if (translateButtonObject) {
|
if (translateButtonObject) {
|
||||||
if (currentEncoding !== targetEncoding) {
|
if (currentEncoding !== targetEncoding) {
|
||||||
setTimeout(function () { translateBody() }, translateDelay)
|
setTimeout(translateBody, translateDelay)
|
||||||
if (targetEncoding === 1) { translateButtonObject.innerHTML = msgToSimplifiedChinese } else translateButtonObject.innerHTML = msgToTraditionalChinese
|
if (targetEncoding === 1) translateButtonObject.innerHTML = msgToSimplifiedChinese
|
||||||
|
else translateButtonObject.innerHTML = msgToTraditionalChinese
|
||||||
}
|
}
|
||||||
translateButtonObject.addEventListener('click', translatePage, false)
|
translateButtonObject.addEventListener('click', translatePage, false)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user