mirror of
https://ghfast.top/https://github.com/zsjy/halo-theme-dream2.0-plus.git
synced 2025-03-16 00:49:40 +08:00
支持获取aplayer
This commit is contained in:
parent
bdcb309fed
commit
0963144853
@ -31,7 +31,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
let isToc = $this.find('h1,h2,h3,h4,h5').length !== 0
|
let isToc = $this.find('h1,h2,h3,h4,h5').length !== 0
|
||||||
this.setAttribute('hide', window.encrypt(this.innerHTML))
|
this.setAttribute('hide', window.encrypt(this.innerHTML))
|
||||||
this.innerHTML = ''
|
this.innerHTML = ''
|
||||||
if(isToc) {
|
if (isToc) {
|
||||||
this.setAttribute('toc', true)
|
this.setAttribute('toc', true)
|
||||||
commonContext.initTocAndNotice()
|
commonContext.initTocAndNotice()
|
||||||
}
|
}
|
||||||
@ -144,7 +144,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
this.aplayer = new APlayer(this.options)
|
this.aplayer = new APlayer(this.options)
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
.catch((e) => {})
|
.catch((e) => {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getAPlayer() {
|
||||||
|
return this.aplayer
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
@ -382,10 +387,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
}
|
}
|
||||||
if (this.options.id || this.options.slug) {
|
if (this.options.id || this.options.slug) {
|
||||||
await Utils.request({
|
await Utils.request({
|
||||||
url: this.options.id? `/api/content/${this.options.type}s/${this.options.id}` : `/api/content/${this.options.type}s/slug?slug=${this.options.slug}`,
|
url: this.options.id ? `/api/content/${this.options.type}s/${this.options.id}` : `/api/content/${this.options.type}s/slug?slug=${this.options.slug}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
})
|
})
|
||||||
.then(res=>{
|
.then(res => {
|
||||||
this.options.img = this.options.img || res.thumbnail
|
this.options.img = this.options.img || res.thumbnail
|
||||||
this.options.href = this.options.title || res.fullPath
|
this.options.href = this.options.title || res.fullPath
|
||||||
this.options.title = this.options.title || res.title
|
this.options.title = this.options.title || res.title
|
||||||
@ -447,6 +452,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
this.render()
|
this.render()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
this.options = {
|
this.options = {
|
||||||
captions: this.hasAttribute('captions') && this.getAttribute('captions') !== 'false',
|
captions: this.hasAttribute('captions') && this.getAttribute('captions') !== 'false',
|
||||||
@ -466,7 +472,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
init() {
|
init() {
|
||||||
let html = this.innerHTML
|
let html = this.innerHTML
|
||||||
this.innerHTML = ''
|
this.innerHTML = ''
|
||||||
const shadowRoot = this.attachShadow({ mode: 'closed' })
|
const shadowRoot = this.attachShadow({mode: 'closed'})
|
||||||
shadowRoot.innerHTML = html
|
shadowRoot.innerHTML = html
|
||||||
this.drawComplete()
|
this.drawComplete()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user