-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathfb_searchGroupForOther.js
60 lines (57 loc) · 1.91 KB
/
fb_searchGroupForOther.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
48
49
50
51
52
53
54
55
56
57
58
59
60
export default {
icon: '<i class="fa-solid fa-users-line fa-lg"></i>',
name: {
en: "Facebook - View your friends's joined groups",
vi: "Facebook - Xem các nhóm bạn bè tham gia",
},
description: {
en: "Know about your friends's joined groups (public groups) on facebook",
vi: "Biết bạn bè của bạn đang tham gia các nhóm (công khai) nào trên facebook",
},
popupScript: {
onClick: async () => {
const {
getUidFromUrl,
getYourUserId,
getFbdtsg,
searchAllGroupForOther,
getUserInfoFromUid,
} = await import("./fb_GLOBAL.js");
const { showLoading } = await import("./helpers/utils.js");
let url = prompt("Nhập link facebook bạn bè (hoặc của bạn): ");
if (url == null) return;
let { setLoadingText, closeLoading } = showLoading("Đang chuẩn bị...");
try {
setLoadingText("Đang lấy uid, token...");
let other_uid = await getUidFromUrl(url);
let uid = await getYourUserId();
let dtsg = await getFbdtsg();
let info = await getUserInfoFromUid(other_uid);
console.log(info);
setLoadingText("Đang tải danh sách group...");
let allGroups = await searchAllGroupForOther(
other_uid,
uid,
dtsg,
(groups, all) => {
setLoadingText(
"Đang tải danh sách group...<br/>Tải được " +
all.length +
" group."
);
}
);
console.log(allGroups);
localStorage.ufs_fb_searchGroupForOther = JSON.stringify(allGroups);
localStorage.ufs_fb_searchGroupForOther_owner = JSON.stringify(info);
window.open(
chrome.runtime.getURL("scripts/fb_searchGroupForOther.html")
);
} catch (e) {
alert("ERROR: " + e);
} finally {
closeLoading();
}
},
},
};