mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
⚡ Perf(postChat): auto switch dark/light theme mode
This commit is contained in:
@@ -1130,6 +1130,22 @@ class FixIt {
|
||||
this.scrollEventSet.add(_closeRewardExclude);
|
||||
}
|
||||
|
||||
initPostChatUser() {
|
||||
window.postChat_mode = postChatConfig.userMode || 'iframe';
|
||||
if (window.postChat_mode !== 'iframe' || !window.postChatUser) {
|
||||
return;
|
||||
}
|
||||
postChat_theme = this.isDark ? 'dark' : 'light';
|
||||
this.switchThemeEventSet.add((isDark) => {
|
||||
const targetFrame = document.getElementById("postChat_iframeContainer")
|
||||
if (targetFrame) {
|
||||
window.postChatUser.setPostChatTheme(isDark ? 'dark' : 'light');
|
||||
} else {
|
||||
postChat_theme = isDark ? 'dark' : 'light';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onScroll() {
|
||||
const $headers = [];
|
||||
const ACCURACY = 20;
|
||||
@@ -1269,6 +1285,7 @@ class FixIt {
|
||||
this.initWatermark();
|
||||
this.initAutoMark();
|
||||
this.initReward();
|
||||
this.initPostChatUser();
|
||||
|
||||
window.setTimeout(() => {
|
||||
this.initComment();
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
PostChat AI service.
|
||||
PostChat: https://postchat.zhheo.com/addCode.html
|
||||
PostSummary: https://postchat.zhheo.com/summary.html
|
||||
TODO dark/light mode switch
|
||||
TODO chat API development
|
||||
*/ -}}
|
||||
{{- $params := .Params | merge .Site.Params -}}
|
||||
|
||||
Reference in New Issue
Block a user