forked from SyedGhazanferAnwar/MailGeek
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcontent.js
More file actions
238 lines (202 loc) · 6.51 KB
/
content.js
File metadata and controls
238 lines (202 loc) · 6.51 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
var random=Math.floor(Math.random() * 1000000);
var filenamea="dot.png?abc="+random;
var email_id="";
var button_Active=true;
var image_shower=false;
chrome.runtime.onMessage.addListener(function(response,sender,sendResponse)
{
if(response=="true")
{
chrome.storage.sync.set({'response':1});
}else if(response=="false")
{
chrome.storage.sync.set({'response':0});
button_Active=false;
}
});
document.addEventListener("mouseover",function()
{
chrome.storage.sync.get('response',function(res){
if(parseInt(res.response)==1)button_Active=true;
else if(parseInt(res.response)==0)button_Active=false;
});
if(button_Active==true){
myfunction();
}
});
function myfunction(){
var email_container=document.getElementsByClassName("gb_kb");//for my email
email_id=email_container[0].innerHTML;
var muui=document.getElementsByClassName("Ax pl editable LI-aAvf");
if(muui[0] !=null && image_shower==false)
{
console.log("In sent ");
image_shower=true;
setTimeout(function(){
console.log("pick a booo");
var email_double_tick="";
var subject_double_tick="";
var content_double_tick="";
var conts=document.getElementsByClassName("zA yO");
for (var i = 0; i<conts.length; i++) {
//image refrence
var double_tick_img_cont=conts[i].getElementsByClassName("apU xY");
// console.log(double_tick_img_cont[0].innerHTML);
var class_afn=conts[i].getElementsByClassName("yW");//afn
var to_class_afn=(class_afn[0].innerHTML.substring(0,3));
if(to_class_afn==="To:"){
var rec2=conts[i].getElementsByClassName("yW");//afn
var rec=rec2[0].getElementsByClassName("yP");
var recspecial=conts[i].getElementsByClassName("afn");
var recspecial2=recspecial[0].getElementsByClassName("yp");
//var rec=rec2;
if(rec[0]!=null){
email_double_tick=rec[0].getAttribute('email');
if(rec[1]!= null){
email_double_tick+=" , "+rec[1].getAttribute('email')+" or other recipient";
}
}
else if(recspecial2[0]!=null){
email_double_tick=recspecial2[0].getAttribute('email');
if(recspecial2[1]!= null){
email_double_tick+=" , "+recspecial2[1].getAttribute('email')+" or other recipient";
}
}
var class_bog=conts[i].getElementsByClassName("bog");
subject_double_tick=class_bog[0].innerHTML;
var class_y2=conts[i].getElementsByClassName("y2");
if(class_y2[0]!=null){
content_double_tick=class_y2[0].innerHTML.substring(13);//removing nbsp and -
}
console.log("8888 "+email_double_tick);
console.log("111 "+subject_double_tick);
console.log("555 "+content_double_tick);
var image_path_comp;
//Sending data to server
var formData2 = new FormData();
formData2.append("user_name", "abcx");
formData2.append("Pass_word", "123");
formData2.append("sender",email_id);
formData2.append("content_mail",content_double_tick);
formData2.append("subject",subject_double_tick);
formData2.append("recipients",email_double_tick);
// console.log(email_id +" "+content_double_tick+" "+email_double_tick+" "+subject_double_tick);
$.ajax({
url: "https://geekacode2.000webhostapp.com/checker.php",
type: "POST",
data: formData2,
processData: false,
contentType: false,
success: function(response) {
// console.log(response);
// .. do something
// console.log(response);
myarray[i]=response;
},
error: function(jqXHR, textStatus, errorMessage) {
console.log(errorMessage); // Optional
}
});
//Assigning the appropiate image
if(!(double_tick_img_cont[0].innerHTML.includes('class="abcxdqq"'))){
console.log("oioinjf");
if(image_path_comp!=null)
var img_url=chrome.extension.getURL(image_path_comp);
double_tick_img_cont[0].innerHTML+='<span class="abcxdqq" tabindex="-1" data-order-hint="0"><div class="lala" data="161905cd8fc478fa"><img class="mama" src="'+img_url+'"></div></span>';
}
}
}
}, 5000);
for(i=0;i<myarray.length;i++)
{
if(myarray[i]==="0")
{
console.log("not received");
image_path_comp=null;
}
else if(myarray[i]==="1")
{
console.log("received");
image_path_comp="/icon16.png";
}
else
{
console.log("none");
image_path_comp=null;
}
}
}
var a=document.getElementsByClassName("Am Al editable LW-avf");
var val="";
if(a[0]!=null){
var text=a[0].innerHTML;
var body_block=document.getElementsByName("body");
var rec_id="";
var sub_id="";
var sub_id_block2=document.getElementsByClassName("aYF");
var rec_id_block=document.getElementsByName("to");
rec_id=((rec_id_block[0].value).match(/<.*>/));
if(rec_id != null){
rec_id[0]=rec_id[0].replace('>', '');
rec_id[0]=rec_id[0].replace('<', '');
}
else{
rec_id=rec_id_block[0].value
}
if(rec_id_block[2]!=null)
{
var rec_id_2=(rec_id_block[1].value).match(/<.*>/);
if(rec_id_2 != null){
rec_id_2[0]=rec_id_2[0].replace('>', '');
rec_id_2[0]=rec_id_2[0].replace('<', '');
}
else{
rec_id_2=rec_id_block[1].value
}
rec_id_2[0]=rec_id_2[0].replace('>', '');
rec_id_2[0]=rec_id_2[0].replace('<', '');
rec_id+=" , "+rec_id_2+" or other recipient";
}
sub_id=sub_id_block2[0].innerHTML; //Subject Extracted
var res = text.replace(/<img .*>/,'');
if(/<img .*>/.test(text)){
}
else
{
a[0].innerHTML='<img alt="MailGeek" src='+"https://geekacode2.000webhostapp.com/images/"+filenamea+' style="display:none">'+text;
}
var z=document.getElementsByClassName("J-J5-Ji btA");//class="T-I J-J5-Ji aoO T-I-atl L3 T-I-JW T-I-JO T-I-Je T-I-Zf-aw2"
var k=z[0].childNodes;
k[1].onclick=function()
{
if(a.length>0){
alert("WOW");
var formData = new FormData();
formData.append("user_name", "abcx");
formData.append("Pass_word", "123");
formData.append("filename",random)
formData.append("sender",email_id);
formData.append("content_mail",res);
formData.append("subject",sub_id);
formData.append("recipients",rec_id);
$.ajax({
url: "https://geekacode2.000webhostapp.com/index.php",
type: "POST",
data: formData,
processData: false,
contentType: false,
success: function(response) {
alert("HANN")
console.log(response)
},
error: function(jqXHR, textStatus, errorMessage) {
console.log(errorMessage)
alert("NAHII")
}
});
random=Math.floor(Math.random() * 1000000);
filenamea="dot.png?abc="+random;
}
}
}
}