-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
175 lines (158 loc) · 5.33 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
<!DOCTYPE html>
<html>
<head>
<title>Where's Waldo, Walden, and Waldorf</title>
<link type="text/css" rel="stylesheet" href="stylesheet.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
</head>
<body>
<div id="background">
<img src="images\PPanther.jpg">
</div>
<div id="center">
<p>
<i>Attention Attorney</i>
</p>
<div id="formDiv">
<form onsubmit="return myMap()" id="getLoc">
User:
<select id="drop">
<option value="user1">Rocky Balboa</option>
<option value="user2">Vladimir Putin</option>
<option value="user3">George Bush</option>
<option value="user4">Donald J Trump</option>
</select>
Distance (in meters):
<input type="number" id="dist" value="40"></input>
<input type="submit"></input><br/><br/>
</form>
</div>
<div id="map">
<script>
// var locs =
// [
// {name: "Steve", latitude: 50, longitude: -50, address: "503 N Greensboro St", distance: 5, company: "Apple", position: "VP"},
// {name: "Herbert", latitude: -49, longitude: 50, address: "504 N Greensboro St", distance: 15, company: "Hoover Industries", position: "CEO"},
// {name: "Baldwin", latitude: 50, longitude: 50, address: "503D N Greensboro St", distance: 35, company: "GE", position: "President"}
// ];
function myMap()
{
var pos;
var path;
var star =
{
url: "http://www.freeiconspng.com/uploads/blue-star-icon-14.png", // url
scaledSize: new google.maps.Size(30, 30), // scaled size
origin: new google.maps.Point(0,0), // origin
anchor: new google.maps.Point(0,0) // anchor
};
var gavel =
{
url: "http://bolivar-circuit-clerk.ms/wp-content/uploads/2016/05/gavel-icon-300px-200x200.png", // url
scaledSize: new google.maps.Size(30, 30), // scaled size
origin: new google.maps.Point(0,0), // origin
anchor: new google.maps.Point(0,0) // anchor
};
if(document.getElementById("drop").value == "user1")
{
pos = {lat: -31.948, lng: 115.840806,};
path = 'user_jsons/user1_TOALL.json';
}
else if(document.getElementById("drop").value == "user2")
{
pos = {lat: 55.7520, lng: 37.6175};
path = 'user_jsons/user2_TOALL.json';
}
else if(document.getElementById("drop").value == "user3")
{
pos = {lat: 51.509865, lng: -0.118092};
path = 'user_jsons/user3_TOALL.json';
}
else if(document.getElementById("drop").value == "user4")
{
pos = {lat: 40.7624, lng: -73.9738};
path = 'user_jsons/user4_TOALL.json';
}
else
pos = {lat: 0, lng: 0};
var locs = {};
$.getJSON(path, function(data)
{
data;
var i;
for(i = 0; i < data.length; i++)
{
if(data[i].distance < document.getElementById("dist").value)
{
putMarker(data[i]);
}
else
continue;
}
});
//alert("Lat: " + pos.lat + "\nLng: " + pos.lng);
var mapCanvas = document.getElementById("map");
var mapOptions =
{
center: new google.maps.LatLng(pos.lat, pos.lng),
zoom: 15
}
var infowindow = new google.maps.InfoWindow();
var map = new google.maps.Map(mapCanvas, mapOptions);
var marker = new google.maps.Marker
({
position: pos,
map: map,
title: "Your Location",
icon: star
});
$("tbody").empty();
function putMarker(loc)
{
var marker = new google.maps.Marker
({
position: {lat: loc.latitude, lng: loc.longitude},
map: map,
icon: gavel
});
var contentString = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h1 id="firstHeading" class="firstHeading">' + loc.attoney + '</h1>'+
'<img src="https://i.ytimg.com/vi/TX7xyKx8eqg/hqdefault.jpg" height="35%" width="35%">' +
'<div id="bodyContent">'+
'<p><b>' + loc.attoney + '</b> is a ' + loc.position +
'with ' + loc.company + '. Their address is ' + loc.address + ', and they are only ' + loc.distance + ' miles away from you.</p>'+
'</div>'+
'</div>';
google.maps.event.addListener(marker, 'click', function()
{
infowindow.close(); // Close previously opened infowindow
infowindow.setContent(contentString);
infowindow.open(map, marker);
});
$("tbody").append("<tr><td>" + loc.attoney + "</td><td>" + loc.address + "</td><td>" + loc.distance + "</td><td>" + loc.company + "</td><td>" + loc.position + "</td></tr>");
}
return false;
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB9U1nsKph3sbUjlv8so-osDe220IgzGHg&callback=myMap"></script>
</div>
<div>
<table id="table">
<thead>
<tr>
<td>Name</td>
<td>Address</td>
<td>Distance</td>
<td>Company</td>
<td>Position</td>
</tr>
</thead>
<tbody id="body">
</tbody>
</table>
</div>
</div>
</body>
</html>