mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
96b2f5f8ae
* Initial plan * Refactor duplicated code in theme.js - Extract highlight text logic into _applyHighlightToText helper method - Extract search UI reset logic into _resetSearchUI helper method - Extract content initialization logic into _initContentComponents helper method - Extract encrypted class toggling into _toggleEncryptedClass helper method - Reduce code duplication in initSearch, initFixItDecryptor, and init methods Co-authored-by: Lruihao <33419593+Lruihao@users.noreply.github.com> * Simplify _toggleEncryptedClass with boolean parameter - Replace fromClass and toClass parameters with a single show boolean - Hardcode class names 'encrypted-hidden' and 'decrypted-shown' in function body - More semantic API: true to show decrypted content, false to hide - Simplifies all 3 call sites with clearer intent Co-authored-by: Lruihao <33419593+Lruihao@users.noreply.github.com> * refactor: remove redundant DOMContentLoaded checks in aplayer and mermaid initialization --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Lruihao <33419593+Lruihao@users.noreply.github.com> Co-authored-by: Cell <1024@lruihao.cn>
14 lines
430 B
JavaScript
14 lines
430 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
|
|
})
|
|
},
|
|
}
|