-
-
Notifications
You must be signed in to change notification settings - Fork 226
/
Copy pathget_ID_Facebook.js
53 lines (52 loc) · 1022 Bytes
/
get_ID_Facebook.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
javascript:
function fail(){
alert("Bạn phải ở đúng trang đã");
}
function copy(id){
var b=document.createElement("textarea"),c=document.getSelection();
b.textContent=id,document.body.appendChild(b),c.removeAllRanges(),b.select(),document.execCommand("copy"),c.removeAllRanges(),document.body.removeChild(b)
};
function getMe(){
try{
var id = encodeURIComponent(require("TimelineController").getProfileID());
if(id!="null") return id;
else return "0";
}
catch (e){
return "0";
}
}
function getGroup(){
try{
var id = encodeURIComponent(require('ScriptPath').getSourcePageInfo().extraData.entity_id);
if(id!="null") return id;
else return "0";
}
catch (e){
return "0";
}
}
function getPage(){
try{
var id = encodeURIComponent(require("CurrentPage").getID());
if(id!="null") return id;
else return "0";
}
catch (e){
return "0";
}
}
var id = getMe();
if(id=="0"){
id = getGroup();
if(id=="0"){
id = getPage();
}
}
console.log(id);
if(id!="0"){
copy(id);
}
else{
fail();
}