mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-10-04 06:22:00 +08:00
✨ aplayer的間距調整
🐛 修復tabs外挂標簽與aplayer插件衝突而異常的bugs
This commit is contained in:
1 parent
baa6f72d35
commit
1d293c0fc7
6 files changed
+41
-44
No files matched your search
+19
-19
@@ -7,17 +7,17 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
function postTabs (args, content) {
|
function postTabs (args, content) {
|
||||||
var tabBlock = /<!--\s*tab (.*?)\s*-->\n([\w\W\s\S]*?)<!--\s*endtab\s*-->/g
|
const tabBlock = /<!--\s*tab (.*?)\s*-->\n([\w\W\s\S]*?)<!--\s*endtab\s*-->/g
|
||||||
|
|
||||||
args = args.join(' ').split(',')
|
args = args.join(' ').split(',')
|
||||||
var tabName = args[0]
|
const tabName = args[0]
|
||||||
var tabActive = Number(args[1]) || 0
|
const tabActive = Number(args[1]) || 0
|
||||||
|
|
||||||
var matches = []
|
const matches = []
|
||||||
var match
|
let match
|
||||||
var tabId = 0
|
let tabId = 0
|
||||||
var tabNav = ''
|
let tabNav = ''
|
||||||
var tabContent = ''
|
let tabContent = ''
|
||||||
|
|
||||||
!tabName && hexo.log.warn('Tabs block must have unique name!')
|
!tabName && hexo.log.warn('Tabs block must have unique name!')
|
||||||
|
|
||||||
@@ -26,12 +26,12 @@ function postTabs (args, content) {
|
|||||||
matches.push(match[2])
|
matches.push(match[2])
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < matches.length; i += 2) {
|
for (let i = 0; i < matches.length; i += 2) {
|
||||||
var tabParameters = matches[i].split('@')
|
const tabParameters = matches[i].split('@')
|
||||||
var postContent = matches[i + 1]
|
let postContent = matches[i + 1]
|
||||||
var tabCaption = tabParameters[0] || ''
|
let tabCaption = tabParameters[0] || ''
|
||||||
var tabIcon = tabParameters[1] || ''
|
let tabIcon = tabParameters[1] || ''
|
||||||
var tabHref = ''
|
let tabHref = ''
|
||||||
|
|
||||||
postContent = hexo.render.renderSync({ text: postContent, engine: 'markdown' }).trim()
|
postContent = hexo.render.renderSync({ text: postContent, engine: 'markdown' }).trim()
|
||||||
|
|
||||||
@@ -40,14 +40,14 @@ function postTabs (args, content) {
|
|||||||
|
|
||||||
((tabCaption.length === 0) && (tabIcon.length === 0)) && (tabCaption = tabName + ' ' + tabId)
|
((tabCaption.length === 0) && (tabIcon.length === 0)) && (tabCaption = tabName + ' ' + tabId)
|
||||||
|
|
||||||
var isOnlyicon = tabIcon.length > 0 && tabCaption.length === 0 ? ' style="text-align: center;"' : ''
|
const isOnlyicon = tabIcon.length > 0 && tabCaption.length === 0 ? ' style="text-align: center;"' : ''
|
||||||
var icon = tabIcon.trim()
|
const icon = tabIcon.trim()
|
||||||
tabIcon.length > 0 && (tabIcon = `<i class="${icon}"${isOnlyicon}></i>`)
|
tabIcon.length > 0 && (tabIcon = `<i class="${icon}"${isOnlyicon}></i>`)
|
||||||
|
|
||||||
var toTop = '<button class="tab-to-top" onclick="scrollToDest($(this).parents(\'.tabs\'),65)"><i class="fas fa-arrow-up"></i></button>'
|
const toTop = '<button class="tab-to-top" onclick="scrollToDest($(this).parents(\'.tabs\'),65)"><i class="fas fa-arrow-up"></i></button>'
|
||||||
|
|
||||||
var isActive = (tabActive > 0 && tabActive === tabId) || (tabActive === 0 && tabId === 1) ? ' active' : ''
|
const isActive = (tabActive > 0 && tabActive === tabId) || (tabActive === 0 && tabId === 1) ? ' active' : ''
|
||||||
tabNav += `<li class="tab${isActive}"><a href="#${tabHref}">${tabIcon + tabCaption.trim()}</a></li>`
|
tabNav += `<li class="tab${isActive}"><button data-href="#${tabHref}">${tabIcon + tabCaption.trim()}</button></li>`
|
||||||
tabContent += `<div class="tab-item-content${isActive}" id="${tabHref}">${postContent + toTop}</div>`
|
tabContent += `<div class="tab-item-content${isActive}" id="${tabHref}">${postContent + toTop}</div>`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,3 +85,8 @@ if hexo-config('beautify.enable')
|
|||||||
|
|
||||||
.has-jax
|
.has-jax
|
||||||
overflow: auto
|
overflow: auto
|
||||||
|
|
||||||
|
//aplayer
|
||||||
|
#article-container
|
||||||
|
.aplayer
|
||||||
|
margin: 0 0 1rem
|
||||||
@@ -288,19 +288,19 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
|
|||||||
> .nav-tabs
|
> .nav-tabs
|
||||||
background: #2c2c2c
|
background: #2c2c2c
|
||||||
|
|
||||||
a
|
button
|
||||||
border-top: 2px solid #2c2c2c
|
border-top: 2px solid #2c2c2c
|
||||||
background: #2c2c2c
|
background: #2c2c2c
|
||||||
color: alpha(#FFFFFF, .6)
|
color: alpha(#FFFFFF, .6)
|
||||||
|
|
||||||
.tab:not(.active)
|
.tab:not(.active)
|
||||||
a
|
button
|
||||||
&:hover
|
&:hover
|
||||||
border-top: 2px solid lighten(#121212, 20)
|
border-top: 2px solid lighten(#121212, 20)
|
||||||
background: lighten(#121212, 20)
|
background: lighten(#121212, 20)
|
||||||
|
|
||||||
.active
|
.active
|
||||||
a
|
button
|
||||||
background: #121212
|
background: #121212
|
||||||
|
|
||||||
// 第三方
|
// 第三方
|
||||||
|
|||||||
Loaded 3 of 6 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user