MCPcopy Create free account
hub / github.com/NsLearning/LangHelper / init

Function init

ChatGPT/src-tauri/src/scripts/chat.js:25–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23var chatConf = {};
24
25async function init() {
26 new MutationObserver(function (mutationsList) {
27 for (const mutation of mutationsList) {
28 // console.log(mutation);
29 // if (mutation.target.closest(".text-sm")) {
30 // console.log("create btns");
31 // chatBtns();
32 // }
33 if (mutation.target.closest("form")) {
34 chatBtns();
35 }
36 if (mutation.target.matches("#__next")) {
37 console.log("---CheckNewMessages");
38 Helper_Messages_Count = document.querySelectorAll('.text-base').length;
39 AddRecognitionBtn();
40 Helper_CheckNewMessages();
41 // setTimeout(AddRecognitionBtn, 1000);
42 }
43 }
44 }).observe(document.body, {
45 childList: true,
46 subtree: true,
47 });
48 document.addEventListener('visibilitychange', () =>
49 document.getElementsByTagName('textarea')[0]?.focus()
50 );
51 window.__helper = Helper_Words
52 setTimeout(AddRecognitionBtn, 1000);
53 setTimeout(Helper_CheckNewMessages, 1000);
54 setTimeout(Get_app_conf,1000);
55}
56async function Get_app_conf(){
57 chatConf = await invoke('get_app_conf') || {};
58 if(chatConf == {}){

Callers 1

chat.jsFile · 0.70

Calls 3

chatBtnsFunction · 0.85
AddRecognitionBtnFunction · 0.85
Helper_CheckNewMessagesFunction · 0.85

Tested by

no test coverage detected