-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathfb_getPageId.js
32 lines (31 loc) · 1007 Bytes
/
fb_getPageId.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
export default {
name: {
en: "Get fb Page ID",
vi: "Lấy fb Page ID",
},
description: {
en: "Get id of page in current website",
vi: "Lấy id của page trong trang web hiện tại",
},
blackList: [],
whiteList: ["www.facebook.com"],
// Lấy page id - khi đang trong trang của page fb. Ví dụ: https://www.facebook.com/ColourfulSpace
func: function () {
const page_name = document.title;
const found = (check) => {
if (check && check[0]) {
window.prompt(`PAGE ID của ${page_name}:`, check[0]);
return true;
}
return false;
};
if (found(/(?<=\"pageID\"\:\")(.*?)(?=\")/.exec(document.body.innerHTML)))
return;
if (found(/(?<=facebook\.com\/)(.*?)($|(?=\/)|(?=&))/.exec(location.href)))
return;
window.prompt(
"Không tìm thấy PAGE ID nào trong url!\nBạn có đang ở đúng trang page fb chưa?\nTrang web Ví dụ:",
"https://www.facebook.com/ColourfulSpace"
);
},
};