-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMAIN_FUNC.js
151 lines (131 loc) · 6.79 KB
/
MAIN_FUNC.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
function GET_W(){
document.getElementById('low').click();
// var MY_BOT = 'GFY :)';
var MY_BOT = 'گوگولی';
var mybox;
mybox = document.getElementById('ali').childNodes.length;
var count = document.getElementById('Result').innerHTML = (mybox-6);
var Last_MS = document.getElementsByClassName('bubbles-date-group')[count-1];
var Last_MS_1 = document.getElementsByClassName('bubbles-date-group')[count-2];
// var LF = Last_MS.getElementsByClassName('service-msg')[0];
// var LF_us = Last_MS.contains(LF);
// if(LF_us){
// var left = Last_MS.getElementsByClassName('service-msg')[0].hasChildNodes();
// if(left){
// var left_a = Last_MS.getElementsByClassName('service-msg')[0].childNodes[0].hasChildNodes();
// if(left_a){
// var left_b = Last_MS.getElementsByClassName('service-msg')[0].childNodes[0].childNodes[9].hasChildNodes();
// if(left_b){
// var left_1 = Last_MS.getElementsByClassName('service-msg')[0].childNodes[0].childNodes[9].innerHTML;
// if( left_1 == 'ترک گروه '){
// var ANS = short_ANS("left");
// return ANS;
// }
// }
// }
// }
// }
// var JO = Last_MS.getElementsByClassName('service-msg')[0];
// var JO_us = Last_MS.contains(JO);
// if(JO_us){
// var join = Last_MS.getElementsByClassName('service-msg')[0].hasChildNodes();
// if(join){
// var join_a = Last_MS.getElementsByClassName('service-msg')[0].childNodes[0].childNodes[4].hasChildNodes();
// if(join_a){
// var join_1 = Last_MS.getElementsByClassName('service-msg')[0].childNodes[0].childNodes[4].innerHTML;
// var join_us = join_1.indexOf("پیوست");
// var ANS = short_ANS("welcome");
// return ANS;
// }
// }
// }
var MS = Last_MS.getElementsByClassName('message')[0];
var MS_us = Last_MS.contains(MS);
if(MS_us){
var MS = Last_MS.getElementsByClassName('voice')[0];
var MS_us = Last_MS.contains(MS);
if(MS_us){
var ANS = short_ANS("voice");
return ANS;
}
var MS = Last_MS.getElementsByClassName('peer-title')[0];
var MS_us = Last_MS.contains(MS);
if(!MS_us){
return false;
}
var name = Last_MS.getElementsByClassName('peer-title')[0].innerHTML;
var value = Last_MS.getElementsByClassName('message')[0].childNodes[0].innerHTML;
var value_1 = Last_MS_1.getElementsByClassName('message')[0].childNodes[0].innerHTML;
var users = document.getElementById('users');
var users_length = users.childNodes.length;
// alert(users_length);
var mk;
mk = true;
var mk_ms;
mk_ms = true;
for(var i = 0;i < users_length;i++){
var re_ms = users.childNodes[i].hasChildNodes();
if(re_ms){
var name_ms = users.childNodes[i].getAttribute('name');
if(name_ms == name){
var mk = false;
var ms_user_length = users.childNodes[i].childNodes.length;
var last_ms_user = users.childNodes[i].getElementsByTagName("p")[(ms_user_length-1)].innerHTML;
if(last_ms_user == value){
mk_ms = false;
}
if(mk_ms){
users.childNodes[i].innerHTML += '<p>'+value+'</p>';
}
}
}
}
if(mk){
users.innerHTML += '<div name="'+name+'">'+'<p>'+value+'</p>'+'</div>';
}
if(value_1 == 'گوگولی ریست شو'){
Last_MS.innerHTML = "";
Last_MS_1.innerHTML = "";
return "پاک شد گلم";
}
if(name !== MY_BOT){
if(value == 'گوگولی خاموش'){
document.getElementById('Result_2').innerHTML = 'off';
var ANS = short_ANS("off");
return ANS;
}
if(value == 'گوگولی روشن'){
var OFFON =document.getElementById('Result_2').innerHTML = 'on';
var ANS = short_ANS("on");
return ANS;
}
var OFFON = document.getElementById('Result_2').innerHTML;
if(OFFON == 'off'){
return false;
}
// var veri = document.getElementById('num_state').innerHTML;
// if(value == veri){
// document.getElementById('num_state_lo').innerHTML = 'off';
// return false;
// }
if(value == 'گوگولی یاد بگیر'){
document.getElementById('type').innerHTML = 'imp';
var ANS = short_ANS("imp");
return ANS;
}
if(value == 'گوگولی صحبت کن'){
document.getElementById('type').innerHTML = 'us';
var ANS = short_ANS("us");
return ANS;
}
var type = document.getElementById('type').innerHTML;
if(type == 'us'){
return mode_us(name,value,MY_BOT,Last_MS,Last_MS_1);
}
if(type == 'imp'){
return mode_imp(name,value,MY_BOT,Last_MS,Last_MS_1);
}
}
}
return false;
}