-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathfb_getGroupId.js
37 lines (35 loc) · 1.25 KB
/
fb_getGroupId.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
export default {
icon: '<i class="fa-solid fa-people-group fa-lg"></i>',
name: {
en: "Get fb Group ID",
vi: "Lấy fb Group ID",
},
description: {
en: "Get id of group in facebook website",
vi: "Lấy id của group trong trang facebook hiện tại",
},
whiteList: ["https://*.facebook.com/*"],
pageScript: {
onClick: async function () {
// Lấy group id - trường hợp url của group hiển thị tên chứ ko hiển thị id. Ví dụ: https://www.facebook.com/groups/j2team.community.girls
const group_name = document.title;
const found = (check) => {
if (check && check[0]) {
prompt(`GROUP ID của ${group_name}:`, check[0]);
return true;
}
return false;
};
if (found(/(?<=\/groups\/)(.\d+?)($|(?=\/)|(?=&))/.exec(location.href)))
return;
const list_a = document.querySelectorAll("a");
for (let a of Array.from(list_a)) {
if (found(/(?<=\/groups\/)(.\d+?)(?=\/user\/)/.exec(a.href))) return;
}
prompt(
"Không tìm thấy GROUP ID nào trong trang web!\nBạn có đang ở đúng trang group chưa?\nTrang web Ví dụ:",
"https://www.facebook.com/groups/j2team.community.girls"
);
},
},
};