-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgml.js
350 lines (288 loc) · 14.6 KB
/
gml.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
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
$(document).ready(function(){
var array1=[{"id":"i1","from":"Abcdefgh","subject":"ijklmnopqrstuvwxyz","mail":"Hello","time":"8:40pm"},
{"id":"i2","from":"Cross-Tab Marketing Serv.","subject":"Job|Walk-In for Trainee for Cross-tab Marketing Services","mail":"Hi,<br>"+
"I am interested in applying for Java Developer post as per the mail I received from Naukri.com. I wanted to know more details regarding the package that is going to be offered as well as a detailed job description. Please let me know."+
"<br><br>"+"Thanks & Regards,"+"Ankita","time":"8:07pm"},
{"id":"i3","from":"Adecco India Private. Lim.","subject":"Job|Job Opportunity for Fresher for a MNC Work Location:Mumbai/Pune/Kolkatta","mail":"Excuse Me","time":"12:49pm"},
{"id":"i4","from":"Home Revise Education Pr.","subject":"Job|Sales Job Opportunity with E-learning Company For Attractive Career Growth","mail":"Hello","time":"12:28pm"},
{"id":"i5","from":"e-Emphasys Systems Pvt.","subject":"Walk-in|We're Hiring...!!Support Analyst @ e-Emphasys, Mumbai","mail":"Excuse Me","time":"12:12pm"},
{"id":"i6","from":"Freshersworld","subject":"Interview Call Letter for eClinicalWorks on 20th April 2017(Thursday)","mail":"Hello","time":"11:39am"},
{"id":"i7","from":"HDFC Life Support","subject":"Market Outlook","mail":"Excuse Me","time":"Apr 18"},
{"id":"i8","from":"me,[email protected]","subject":"Complaint for charges applied and Request for closure","mail":"Hello","time":"Apr 18"},
{"id":"i9","from":"MakeMyTrip","subject":"Your ticket 17545657676 has been marked resolved","mail":"Excuse Me","time":"Apr 17"},
{"id":"i10","from":"ILeverage","subject":"CCRS Dispute","mail":"Hello","time":"Apr 16"},
{"id":"i11","from":"Naukri.com","subject":"You've created a job alert","mail":"Excuse Me","time":"Apr 16"},
{"id":"i12","from":"HR ANGEL JOBS","subject":"Hr(Recruiter) @ VASAI EAST OPP STATION","mail":"Hello","time":"Apr 15"},
{"id":"i13","from":"Axis Bank Alerts","subject":"Notification from Axis Bank","mail":"Excuse Me","time":"Apr 15"},
{"id":"i14","from":"Dave Zohrob","subject":"Get hired, fasterApr 15","mail":"Hello","time":"Apr 15"},
{"id":"i15","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Excuse Me","time":"Apr 14"},
{"id":"i16","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Hello","time":"Apr 13"},
{"id":"i17","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Excuse Me","time":"Apr 13"},
{"id":"i18","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Hello","time":"Apr 13"},
{"id":"i19","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Excuse Me","time":"Apr 13"},
{"id":"i20","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Hello","time":"Apr 11"},
{"id":"i21","from":"Asdfghjkl","subject":"qwertyuiop","mail":"Hello","time":"8:40pm"},
{"id":"i22","from":"ILeverage","subject":"CCRS Dispute","mail":"Hello","time":"Apr 16"},
{"id":"i23","from":"Adecco India Private. Lim.","subject":"Job|Job Opportunity for Fresher for a MNC Work Location:Mumbai/Pune/Kolkatta","mail":"Excuse Me","time":"12:49pm"},
{"id":"i24","from":"Naukri.com","subject":"You've created a job alert","mail":"Excuse Me","time":"Apr 16"},
{"id":"i25","from":"Freshersworld","subject":"Interview Call Letter for eClinicalWorks on 20th April 2017(Thursday)","mail":"Hello","time":"11:39am"},
{"id":"i26","from":"HR ANGEL JOBS","subject":"Hr(Recruiter) @ VASAI EAST OPP STATION","mail":"Hello","time":"Apr 15"},
{"id":"i27","from":"HDFC Life Support","subject":"Market Outlook","mail":"Excuse Me","time":"Apr 18"},
{"id":"i28","from":"Axis Bank Alerts","subject":"Notification from Axis Bank","mail":"Excuse Me","time":"Apr 15"},
{"id":"i29","from":"me,[email protected]","subject":"Complaint for charges applied and Request for closure","mail":"Hello","time":"Apr 18"},
{"id":"i30","from":"Dave Zohrob","subject":"Get hired, fasterApr 15","mail":"Hello","time":"Apr 15"},
{"id":"i31","from":"Cross-Tab Marketing Serv.","subject":"Job|Walk-In for Trainee for Cross-tab Marketing Services","mail":"Hi,<br>"+
"I am interested in applying for Java Developer post as per the mail I received from Naukri.com. I wanted to know more details regarding the package that is going to be offered as well as a detailed job description. Please let me know."+
"<br><br>"+"Thanks & Regards,"+"Ankita","time":"8:07pm"},
{"id":"i32","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Excuse Me","time":"Apr 14"},
{"id":"i33","from":"MakeMyTrip","subject":"Your ticket 17545657676 has been marked resolved","mail":"Excuse Me","time":"Apr 17"},
{"id":"i34","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Hello","time":"Apr 13"},
{"id":"i35","from":"Home Revise Education Pr.","subject":"Job|Sales Job Opportunity with E-learning Company For Attractive Career Growth","mail":"Hello","time":"12:28pm"},
{"id":"i36","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Excuse Me","time":"Apr 13"},
{"id":"i37","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Hello","time":"Apr 13"},
{"id":"i38","from":"e-Emphasys Systems Pvt.","subject":"Walk-in|We're Hiring...!!Support Analyst @ e-Emphasys, Mumbai","mail":"Excuse Me","time":"12:12pm"},
{"id":"i39","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Excuse Me","time":"Apr 13"},
{"id":"i40","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Hello","time":"Apr 11"}];
var array3=[{"id":"s1","from":"Abcdefgh","subject":"ijklmnopqrstuvwxyz","mail":"Hello","time":"8:40pm"},
{"id":"s2","from":"Cross-Tab Marketing Serv.","subject":"Job|Walk-In for Trainee for Cross-tab Marketing Services","mail":"Excuse Me","time":"8:07pm"},
{"id":"s3","from":"Adecco India Private. Lim.","subject":"Job|Job Opportunity for Fresher for a MNC Work Location:Mumbai/Pune/Kolkatta","mail":"Hello","time":"12:49pm"},
{"id":"s4","from":"Home Revise Education Pr.","subject":"Job|Sales Job Opportunity with E-learning Company For Attractive Career Growth","mail":"Excuse Me","time":"12:28pm"},
{"id":"s5","from":"e-Emphasys Systems Pvt.","subject":"Walk-in|We're Hiring...!!Support Analyst @ e-Emphasys, Mumbai","mail":"Hello","time":"12:12pm"},
{"id":"s6","from":"Freshersworld","subject":"Interview Call Letter for eClinicalWorks on 20th April 2017(Thursday)","mail":"Excuse Me","time":"11:39am"},
{"id":"s7","from":"HDFC Life Support","subject":"Market Outlook","mail":"Hello","time":"Apr 18"},
{"id":"s8","from":"me,[email protected]","subject":"Complaint for charges applied and Request for closure","mail":"Excuse Me","time":"Apr 18"}];
var array4=[{"id":"t1","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Excuse Me","time":"Apr 14"},
{"id":"t2","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Hello","time":"Apr 13"},
{"id":"t3","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Excuse Me","time":"Apr 13"},
{"id":"t4","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Hello","time":"Apr 13"},
{"id":"t5","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Excuse Me","time":"Apr 13"},
{"id":"t6","from":"dp.operations","subject":"Acknowledgement Mail","mail":"Hello","time":"Apr 11"}];
//index of first mail on the pg
var m=0;
var size = 5;
//index of last mail on the pg + 1
var k;
var noofpages = 0;
var page = 1;
var tempactive = "inbox";
var active = "inbox";
if(localStorage.getItem('array1')==null){
localStorage.setItem("array1",JSON.stringify(array1));
}
if(localStorage.getItem('array3')==null){
localStorage.setItem("array3",JSON.stringify(array3));
}
if(localStorage.getItem('array4')==null){
localStorage.setItem("array4",JSON.stringify(array4));
}
array1 = JSON.parse(localStorage.array1);
array3 = JSON.parse(localStorage.array3);
array4 = JSON.parse(localStorage.array4);
toggleActive();
function toggleActive(){
if(tempactive!=active){
m=0;
noofpages = 0;
page = 1;
}
tempactive=active;
switch(active){
case "inbox": setActive(array1); break;
case "sent": setActive(array3); break;
case "trash": setActive(array4); break;
}
}
//$("#less-than").css("visibility","hidden");
$("#less-than").css("opacity","0.5");
document.getElementById('less-than').style.pointerEvents = 'none';
$("#size li").click(function(){
$(this).parent(".ul-toggle").slideToggle('fast');
size=parseInt(this.dataset.li);
m=0;
noofpages=1;
toggleActive();
});
function setActive(contents){
var i = 0;
noofpages = contents.length/size;
document.getElementById("all-mails").innerHTML="";
if((m+size)>contents.length){
document.getElementById("noofmails").innerHTML=(m+1)+"-"+contents.length+" of "+contents.length;
k=contents.length;
}
else{
document.getElementById("noofmails").innerHTML=(m+1)+"-"+(m+size)+" of "+contents.length;
k=(m+size);
}
if(m>=(contents.length-size)){
$("#greater-than").css("opacity","0.5");
document.getElementById('greater-than').style.pointerEvents = 'none';
}
else
{
$("#greater-than").css("opacity","1");
document.getElementById('greater-than').style.pointerEvents = 'auto';
}
if(m<=0){
$("#less-than").css("opacity","0.5");
document.getElementById('less-than').style.pointerEvents = 'none';
}
else
{
$("#less-than").css("opacity","1");
document.getElementById('less-than').style.pointerEvents = 'auto';
}
for(i+=m;i<k;i++)
{
maillist="<li class='li-mail' data-span='"+i+"'><span class='mailicons'><input type='checkbox' class='star-icon' data-myid='"+contents[i].id+"'><i class='fa fa-star-o star-icon'></i>"+
"<i class='material-icons star-icon' id='lbl'>label_outline</i></span><span><span class='from'>"+contents[i].from+"</span><span class='subject'>"+
contents[i].subject+" - "+contents[i].mail+"</span><span class='time'>"+contents[i].time+"</span></span></input></li>";
document.getElementById("all-mails").innerHTML+=maillist;
}
$("[data-span]").click(function(){
var selMail = this.dataset.span;
$("#back-btn").css("display","inline-block");
document.getElementById("all-mails").innerHTML="";
$(".mail-types").css("display","none");
$("#bottom-line").css("display","none");
mailcontent="<div><b>"+contents[selMail].subject+"<hr></b>"+contents[selMail].from+"<hr>"+contents[selMail].mail;
document.getElementById("all-mails").innerHTML+=mailcontent;
});
$(".mailicons").click(function(){
event.stopPropagation();
});
}
$("#back-btn").click(function(){
$("#back-btn").css("display","none");
$(".mail-types").css("display","inline-block");
$("#bottom-line").css("display","inline-block");
toggleActive();
});
$("#goto-prompt").click(function(){
page = parseInt(prompt("Which Page No. you would like to see from 1 to "+noofpages+"?"));
if(page<1 || page>noofpages){
alert("Invalid Page Number!");
}
m=((page-1)*size);
toggleActive();
});
$("#greater-than").click(function(){
var i = 0;
m+=size;
$("#less-than").css("opacity","1");
document.getElementById('less-than').style.pointerEvents = 'auto';
document.getElementById("all-mails").innerHTML="";
toggleActive();
});
$("#less-than").click(function(){
var i = 0;
m-=size;
$("#greater-than").css("opacity","1");
document.getElementById('greater-than').style.pointerEvents = 'auto';
document.getElementById("all-mails").innerHTML="";
toggleActive();
});
$("#inbox").click(function(){
active = "inbox";
//$(".mail-types").css("display","inline-block");
toggleActive();
});
$("#sent").click(function(){
active = "sent";
//$(".mail-types").css("display","none");
toggleActive();
});
$("#trash").click(function(){
active = "trash";
//$(".mail-types").css("display","none");
toggleActive();
});
$(".i-toggle").click(function(){
$(this).next(".ul-toggle").slideToggle('fast');
$(".i-toggle").not(this).next(".ul-toggle").hide();
event.stopPropagation();
});
$('body').click(function(){
if($(".ul-toggle").show()){
$(".ul-toggle").hide();
}
});
$("#a").click(function(){
$(this).css("background-color","white");
$(this).css("border-bottom","none");
$(this).css("border-top-color","black");
$(this).css("border-top-width","3px");
});
$("#b").click(function(){
$(this).css("background-color","white");
$(this).css("border-bottom","none");
$(this).css("border-top-color","blue");
$(this).css("border-top-width","3px");
});
$("#c").click(function(){
$(this).css("background-color","white");
$(this).css("border-bottom","none");
$(this).css("border-top-color","green");
$(this).css("border-top-width","3px");
});
$(".compose-btn").click(function(){
$("#new_window").slideToggle('fast');
});
$(".close").click(function(){
$("#new_window").css("display","none");
});
$(".expand").click(function(){
$("#new_window").css("width","1000px");
$("#new_window").css("height","450px");
$("#new_window").css("right","150px");
$("#new_window").css("top","80px");
});
$("#send-btn").click(function(){
var to = document.getElementById("to").value;
var subject = document.getElementById("subject").value;
var content = document.getElementById("content").value;
$("#new_window").css("display","none");
if($.trim(to)!=''){
array3.unshift({"from":"To:"+to,"subject":subject,"mail":content,"time":"Just Now"});
setTimeout(function(){alert("Message sent successfully!!");},0);
localStorage.setItem("array3",JSON.stringify(array3));
}
});
$("#inbox").addClass("inboxSelected");
$(".inbox-list li").click(function(){
$(this).addClass("inboxSelected").siblings().removeClass("inboxSelected");
});
var selarray=[];
function selectedCB(id){
var i = 0;
for(i+=m;i<k;i++)
{
if(array1[i].id==id)
selarray.unshift(array1[i]);
}
}
$("#del").click(function(){
var j=[];
var z=0;
var i = 0;
for(i+=m;i<k;i++){
if($("[data-myid]")[i-m].checked==true){
selectedCB(array1[i].id);
j[z]=i;
z++;
}
}
for(var i=0;i<selarray.length;i++){
array4.unshift(selarray[i]);
localStorage.setItem("array4",JSON.stringify(array4));
}
selarray=[];
for(var i=0;i<j.length;i++){
array1.splice(j[i]-i,1);
localStorage.setItem("array1",JSON.stringify(array1));
}
j=[];
active="inbox";
toggleActive();
});
});