mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
refactor: Refactor duplicated code in theme.js (#655)
* 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>
This commit is contained in:
@@ -11,9 +11,3 @@ window.FixItAPlayer = {
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
if (document.readyState !== 'loading') {
|
||||
window.FixItAPlayer.init()
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', window.FixItAPlayer.init, false)
|
||||
}
|
||||
|
||||
@@ -116,9 +116,3 @@ window.FixItMermaid = {
|
||||
init: initMermaid,
|
||||
}
|
||||
window.mermaid = mermaid
|
||||
|
||||
if (document.readyState !== 'loading') {
|
||||
initMermaid()
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', initMermaid, false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user