Files
FixIt/assets/js/lib/aplayer.js
T
Cell fe129dd207 feat: add APlayer shortcode and audio support (#650)
* docs: improve error message clarity for shortcode parent block validation

* feat: add APlayer shortcode and audio support

* feat: support both APlayer and MetingJS

* feat: initialize APlayer when content decrypted
2025-10-21 15:47:04 +08:00

20 lines
593 B
JavaScript

window.FixItAPlayer = {
init: () => {
Array.from(document.getElementsByClassName("aplayer-shortcode")).forEach((aplayer) => {
if (aplayer.dataset.processed) return
const audio = JSON.parse(aplayer.dataset.audio)
const options = JSON.parse(aplayer.dataset.options)
options.audio = audio
options.container = aplayer
new APlayer(options)
aplayer.dataset.processed = true
})
},
}
if (document.readyState !== 'loading') {
window.FixItAPlayer.init()
} else {
document.addEventListener('DOMContentLoaded', window.FixItAPlayer.init, false)
}