-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathinstagram.js
70 lines (52 loc) · 1.32 KB
/
instagram.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
61
62
63
64
65
66
67
68
69
70
function do_instagram_like(){
state = _STATE_WAIT_TO_CLOSE;
wait_time = 6;
var sec = document.querySelector('section.Slqrh');
if(!sec) { return; }
var btns = sec.querySelectorAll("svg._8-yf5");
if(!btns) { return; }
for(var i=0; i<btns.length; i++){
var svgs = btns[i].querySelectorAll('svg[aria-label="Like"]');
if(svgs){
btns[i].parentNode.click();
break;
}
}
}
function do_instagram_follow(){
state = _STATE_WAIT_TO_CLOSE;
wait_time = 6;
var btns = document.querySelectorAll("button.yZn4P");
if(!btns) { return false; }
if(btns.length < 1) { return false; }
for(var i=0; i<btns.length; i++){
if(btns[i].textContent == "Follow") {
btns[i].click();
console.log("Followed !");
break;
}
}
}
var instagram_done = false;
function do_instagram(){
// wait for 5 seconds
if(tick_count < 2) { return; }
if(tick_count > _TIMEOUT_IN_SECS) {
// timeout
window.close();
}
if(instagram_done) { return; }
instagram_done = true;
console.log("do_instagram");
console.log("config.actionType = "+config.actionType);
if (config.actionType === _ACTION_TYPE_INSTAGRAM_LIKE) {
console.log("do_instagram_like");
do_instagram_like();
return;
}
if (config.actionType === _ACTION_TYPE_INSTAGRAM_FOLLOW) {
console.log("do_instagram_follow");
do_instagram_follow();
return;
}
}