-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathadd-chat-wapi.js
47 lines (41 loc) · 1.3 KB
/
add-chat-wapi.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { injectConfig, filterModule, filterObjects } from '../helper';
export async function addChatWapi() {
if (window.__debug) {
const filterMod = await filterModule(filterObjects, window.getModuleList());
filterMod.forEach((needObj) => {
if (needObj.yesModule) {
if (!window.Store[needObj.type]) {
window.Store[needObj.type] = needObj.yesModule;
}
}
});
if (Store && Store.BusinessProfile) {
Store.Chat._findAndParse = Store.BusinessProfile._findAndParse;
Store.Chat._find = Store.BusinessProfile._find;
}
} else {
// old webpack
window[injectConfig.webpack].push([
[injectConfig.parasite],
{},
async function (o) {
let modules = [];
for (let idx in o.m) {
modules.push(o(idx));
}
const filterMod = await filterModule(filterObjects, modules);
filterMod.forEach((needObj) => {
if (needObj.yesModule) {
if (!window.Store[needObj.type]) {
window.Store[needObj.type] = needObj.yesModule;
}
}
});
if (Store && Store.BusinessProfile) {
Store.Chat._findAndParse = Store.BusinessProfile._findAndParse;
Store.Chat._find = Store.BusinessProfile._find;
}
}
]);
}
}