-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
652 lines (587 loc) · 20.3 KB
/
index.html
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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Train Maniac</title>
<meta name="description" content="Railway Search WEB App">
<meta name="author" content="SHA:{508}-Ayushi,Shubham,Harshit">
<link rel="icon" type="image/png" href="img/download.png">
<!-- Favicons
================================================== -->
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="img/apple-touch-icon-114x114.png">
<!-- Bootstrap -->
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="fonts/font-awesome/css/font-awesome.css">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="jquery.mb.YTPlayer.min.css">
<!-- Stylesheet
================================================== -->
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/nivo-lightbox/nivo-lightbox.css">
<link rel="stylesheet" type="text/css" href="css/nivo-lightbox/default.css">
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,500,600,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Dancing+Script:400,700" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- LOader -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<style type="text/css">
/* width */
::-webkit-scrollbar {
width: 10px;
}
/* Track */
::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px grey;
border-radius: 10px;
}
::-webkit-input-placeholder {
color: white;
font-weight: bold;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: yellowgreen;
border-radius: 20px;
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: limegreen;
}
</style>
</head>
<body>
<div id="page-top" data-spy="scroll" data-target=".navbar-fixed-top">
<div id="home" class="fs-video-hero">
<div id="fs-video-one-bg" class="player"
data-property="{videoURL:'http://youtu.be/Scxs7L0vhZ4',containment:'.fs-video-hero',autoPlay:true, mute:true, startAt:71, stopAt:300, opacity:1}">
</div>
</div>
<!-- Navigation
==========================================-->
<nav id="menu" class="navbar navbar-default navbar-fixed-top">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
<a class="navbar-brand page-scroll" href="#page-top">Welcome</a> </div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="#about" class="page-scroll">About</a></li>
<li><a href="#restaurant-menu" class="page-scroll">PNR Inquiry</a></li>
<li><a href="#portfolio" class="page-scroll">Trains Between Stations</a></li>
<li><a href="#team" class="page-scroll">Live Status</a></li>
<li><a href="#call-reservation" class="page-scroll">Contact</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
</nav>
<!-- Header -->
<header id="header">
<div class="intro">
<div class="overlay">
<div class="container">
<div class="row">
<div class="intro-text">
<h1>Train Maniac</h1>
<p>------Always At Your Service------</p>
<a href="#about" class="btn btn-custom btn-lg page-scroll">Discover Your Train</a> </div>
</div>
</div>
</div>
</div>
</header>
<!-- About Section -->
<div id="about">
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-6 ">
<div class="about-img"><img src="img/about.jpg" class="img-responsive" alt=""></div>
</div>
<div class="col-xs-12 col-md-6">
<div class="about-text">
<h2>History</h2>
<hr>
<p>Indian Railways (IR) is India's national railway system operated by the Ministry of Railways. It manages the fourth-largest railway network in the world by size, with 121,407 kilometres (75,439 mi) of total track over a 67,368-kilometre (41,861 mi) route. Forty nine percent of the routes are electrified with 25 KV AC electric traction while thirty three percent of them are double or multi-tracked.<a href="https://en.wikipedia.org/wiki/Indian_Railways" style="color:blue;font-size: 20px;" target="_blank"> <u>Know More in WiKi...</u></a></p>
<h3>Services</h3>
<p>From December 2017, stations are categorised into the Non-Suburban Group NSG1 to NSG6, the Suburban Group SG1 to SG3, and the Halt Group HG1 to HG3 based on the earnings, passenger footfall and strategic importance.</p>
</div>
</div>
</div>
</div>
</div>
<!-- Restaurant Menu Section -->
<div id="restaurant-menu">
<div class="section-title text-center center">
<div class="overlay">
<h2>Railway PNR InQuiry</h2>
<hr>
<input id="pnr" type="text" placeholder="PNR Code" style="background:transparent;border-radius:0%;color:white;padding: 5px;">
<br>
<br>
<p>This can be found in your ticket. Also a 10 digit number, which is alloted when u have your ticket.</p>
<br>
<button onclick="pnrItNow()" class="btn btn-success">Search</button>
<br>
<br>
<center>
<div id="showdata" style="text-align:center;">
</div>
</center>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var myObj1=[];
function pnrItNow(){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myObj1 = JSON.parse(this.responseText);
myTable1(myObj1);
}
};
xmlhttp.open("GET", `https://api.railwayapi.com/v2/pnr-status/pnr/${pnr.value}/apikey/{YOUR API KEY}/`, true);
xmlhttp.send();
}
function myTable1(my) {
var col = [];
for (var i = 0; i < my.passengers.length; i++) {
for (var key in my.passengers[i]) {
if (col.indexOf(key) === -1) {
col.push(key);
}
}
}
// CREATE DYNAMIC TABLE.
var table = document.createElement("table");
// CREATE HTML TABLE HEADER ROW USING THE EXTRACTED HEADERS ABOVE.
var tr = table.insertRow(-1); // TABLE ROW.
for (var i = 0; i < col.length; i++) {
var th = document.createElement("th"); // TABLE HEADER.
th.innerHTML = col[i];
tr.appendChild(th);
}
// ADD JSON DATA TO THE TABLE AS ROWS.
for (var i = 0; i < my.passengers.length; i++) {
tr = table.insertRow(-1);
for (var j = 0; j < col.length; j++) {
var tabCell = tr.insertCell(-1);
tabCell.innerHTML = my.passengers[i][col[j]];
}
}
// FINALLY ADD THE NEWLY CREATED TABLE WITH JSON DATA TO A CONTAINER.
var divContainer = document.getElementById("showdata");
divContainer.innerHTML = "";
divContainer.appendChild(table);
}
</script>
<!-- Dispay trains -->
<style>
#showdata
{
text-align:center;
margin-left:375px;
}
div.table-title {
display: block;
margin: auto;
max-width: 800px;
padding:5px;
width: 100%;
}
.table-title h3 {
color: #fafafa;
font-size: 20px;
font-weight: 400;
font-style:normal;
font-family: "Roboto", helvetica, arial, sans-serif;
text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.1);
text-transform:uppercase;
}
/*** Table Styles **/
.table-fill {
background: white;
border-radius:3px;
border-collapse: collapse;
height: 320px;
margin: auto;
max-width: 900px;
padding:0px;
width: 100%;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
animation: float 5s infinite;
}
th {
color:#D5DDE5;
background:#1b1e24;
border-bottom:4px solid #9ea7af;
border-right: 1px solid #343a45;
font-size:20px;
font-weight: 100;
padding:24px;
text-align:center;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
vertical-align:middle;
}
thead tr {
background-color: #8CCCF1;
}
th:first-child {
border-top-left-radius:3px;
}
th:last-child {
border-top-right-radius:3px;
border-right:none;
}
tr {
border-top: 1px solid #C1C3D1;
border-bottom: 1px solid #C1C3D1;
color:#666B85;
font-size:16px;
font-weight:normal;
text-shadow: 0 1px 1px rgba(256, 256, 256, 0.1);
}
tr:hover td {
background:#4E5066;
color:#FFFFFF;
border-top: 1px solid #22262e;
}
tr:first-child {
border-top:none;
}
tr:last-child {
border-bottom:none;
}
tr:nth-child(odd) td {
background:#EBEBEB;
}
tr:nth-child(odd):hover td {
background:#4E5066;
}
tr:last-child td:first-child {
border-bottom-left-radius:3px;
}
tr:last-child td:last-child {
border-bottom-right-radius:3px;
}
td {
background:#FFFFFF;
padding:20px;
text-align:left;
vertical-align:middle;
font-weight:300;
font-size:18px;
text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.1);
border-right: 1px solid #C1C3D1;
}
td:last-child {
border-right: 0px;
}
th.text-left {
text-align: left;
color: red;
}
th.text-center {
text-align: center;
}
th.text-right {
text-align: right;
}
td.text-left {
text-align: left;
}
td.text-center {
text-align: center;
}
td.text-right {
text-align: right;
}
input[type=text] {
width: 130px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-image: url('searchicon.png');
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 12px 40px;
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
}
input[type=text]:focus {
width: 30%;
}
</style>
<!-- Portfolio Section -->
<div id="portfolio">
<div class="section-title text-center center">
<div class="overlay">
<h2>Trains Between Stations</h2>
<hr>
<p>Enter the source from where u want to board the train. The destination will be your last stop.</p>
<input id="src" type="text" placeholder="Source" style="background:transparent;border-radius:0%;color:white;padding: 5px;"><br></br>
<input id="dest"type="text" placeholder="Destination" style="background:transparent;border-radius:0%;color:white;padding: 5px;">
<br>
<br>
<input id="date" type="text" placeholder="Date" style="background:transparent;border-radius:0%;color:white;padding: 5px;">
<br>
<br>
<button id="id02" class="w3 w3-btn btn-warning btn-large" onclick="startItNow()"><b>Search Now</b></button>
<br>
<br>
<center>
<div id="showtrains" style="margin:0;">
</div>
</center>
</div>
</div>
</div>
<script type="text/javascript">
var myObj=[];
function startItNow(){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myObj = JSON.parse(this.responseText);
console.log(myObj);
myTable2(myObj);
}
};
xmlhttp.open("GET", `https://api.railwayapi.com/v2/between/source/${src.value}/dest/${dest.value}/date/${date.value}/apikey/{YOUR API KEY}/`, true);
xmlhttp.send();
}
function myTable2(my) {
// EXTRACT VALUE FOR HTML HEADER.
// ('Book ID', 'Book Name', 'Category' and 'Price')
var col = [];
var key2='name';var key1='number';var key3='from_station';var key4='to_station';var key6='travel_time'; var key5='src_departure_time';
if (col.indexOf(key1) === -1) {
col.push(key1);
}
if (col.indexOf(key2) === -1) {
col.push(key2);
}
if (col.indexOf(key3) === -1) {
col.push(key3);
}
if (col.indexOf(key4) === -1) {
col.push(key4);
}
if (col.indexOf(key5) === -1) {
col.push(key5);
}
if (col.indexOf(key6) === -1) {
col.push(key6);
}
// CREATE DYNAMIC TABLE.
var table = document.createElement("table");
// CREATE HTML TABLE HEADER ROW USING THE EXTRACTED HEADERS ABOVE.
var tr = table.insertRow(-1); // TABLE ROW.
for (var i = 0; i < col.length; i++) {
var th = document.createElement("th"); // TABLE HEADER.
th.innerHTML = col[i];
tr.appendChild(th);
}
var th = document.createElement("th"); // TABLE HEADER.
th.innerHTML = "check-seat";
tr.appendChild(th);
var th = document.createElement("th"); // TABLE HEADER.
th.innerHTML = "Status";
tr.appendChild(th);
// ADD JSON DATA TO THE TABLE AS ROWS.
for (var i = 0; i < my.trains.length; i++) {
tr = table.insertRow(-1);
var tabCell = tr.insertCell(-1);
tabCell.innerHTML = my.trains[i].number;
tabCell = tr.insertCell(-1);
tabCell.innerHTML = my.trains[i].name;
var tabCell = tr.insertCell(-1);
tabCell.innerHTML = my.trains[i].from_station.name;
tabCell = tr.insertCell(-1);
tabCell.innerHTML = my.trains[i].to_station.name;
var tabCell = tr.insertCell(-1);
tabCell.innerHTML = my.trains[i].src_departure_time;
var tabCell = tr.insertCell(-1);
tabCell.innerHTML = my.trains[i].travel_time;
var btn = document.createElement("a");
var t = document.createTextNode("Availability");
var btn2=document.createElement("div");
var t2=document.createTextNode("");
btn.appendChild(t);
btn.appendChild(t2);
var tabCell = tr.insertCell(-1);
tabCell.appendChild(btn);
var tabCell = tr.insertCell(-1);
tabCell.appendChild(btn2);
btn2.setAttribute("id","b"+i);
btn.setAttribute("id","a"+i);
btn.setAttribute("class","btn btn-info");
btn.setAttribute("onclick","seats(" + i +")");
}
// FINALLY ADD THE NEWLY CREATED TABLE WITH JSON DATA TO A CONTAINER.
var divContainer = document.getElementById("showtrains");
divContainer.innerHTML = "";
divContainer.appendChild(table);
}
var myObj2=[];
var myob;
function seats(id){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myObj2 = JSON.parse(this.responseText);
var divContainer = document.getElementById("b"+id);
myob=myObj2.availability[0].status;
divContainer.innerHTML = myob;
//divContainer.appendChild(myob);
}
};
xmlhttp.open("GET", `https://api.railwayapi.com/v2/check-seat/train/${myObj.trains[id].number}/source/${src.value}/dest/${dest.value}/date/${date.value}/pref/3A/quota/GN/apikey/{YOUR API KEY}/`, true);
xmlhttp.send();
}
</script>
<!-- Team Section -->
<style>
#showtrains
{
margin-left:80px;
}
#map{
height: 500px;
width:100%;
}
</style>
<div id="team" class="text-center">
<div class="overlay">
<div class="container">
<h2>Know Your Trains Much Better</h2>
<center>
<hr style="align-self: center;background:green; ">
</center>
<h3> Enter Train number :
<input id="num" type="text" placeholder="Enter number" style="background:transparent;border-radius:0%;color:white;padding: 5px;">
<br>
<br>
<h3> Enter Date:
<input type="text" id="dat" placeholder="DD-MM-YYYY" style="background:transparent;border-radius:0%;color:white;padding: 5px;">
<button onclick="getStatus()" class="btn btn-primary">Get status </button>
<br>
<br>
<br>
<div id="map">
hello
</div>
</div>
</div>
</div>
<!-- Call Reservation Section -->
<div id="call-reservation" class="text-center">
<div class="container">
<h2>Want to make a reservation? Call@ <strong>+91 7209056068/8127280273</strong></h2>
</div>
</div>
<style type="text/css">
.last{
height:30px;
}
.footer-note {
margin: auto;
/*width: 500px;*/
border-top: 1px solid #CACACA;
padding-top: 10px;
padding-bottom:10px;
text-align: center;
}
</style>
<!--- Footer Starts Here ---->
<div class="last">
<div class="container">
<p class="copyright">
<div class="footer-note">
Designed and built with <i class="fa fa-heart faa-pulse animated"></i> by © Team SHA:{508}</a>
</div>
</div>
</div>
<!--- Footer Ends Here ---->
<script type="text/javascript" src="js/jquery.1.11.1.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/SmoothScroll.js"></script>
<script type="text/javascript" src="js/nivo-lightbox.js"></script>
<script type="text/javascript" src="js/jquery.isotope.js"></script>
<script type="text/javascript" src="js/jqBootstrapValidation.js"></script>
<script type="text/javascript" src="js/contact_me.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script>
// Rashi code
// Initialize and add the map
var uluru = {lat: 28.6315, lng: 77.2167};
var myObj = [];
var lati;
var longi;
function getStatus() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
myObj = JSON.parse(this.responseText);
lati = myObj.current_station.lat;
longi = myObj.current_station.lng;
uluru.lat = lati;
uluru.lng = longi;
initMap1();
}
};
xmlhttp.open("GET", `https://api.railwayapi.com/v2/live/train/${num.value}/date/${dat.value}/apikey/{YOUR API KEY}/`, true);
xmlhttp.send();
}
function initMap1() {
var myLatLng = { lat: uluru.lat, lng: uluru.lng };
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 14,
// type: terrain,
center: myLatLng
});
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
// title: 'Hello World!'
});
marker.setAnimation(google.maps.Animation.BOUNCE);
}
function initMap() {
var map = new google.maps.Map(
document.getElementById('map'), {zoom: 10, center: uluru});
// The marker, positioned at Uluru
var marker = new google.maps.Marker({position: uluru, map: map});
}
function success(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
uluru.lat=latitude;
uluru.lng=longitude;
initMap();
}
function error() {
alert( "Unable to retrieve your location");
}
navigator.geolocation.getCurrentPosition(success, error) ;
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"
type="text/javascript"></script>
</body>
</html>