-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
62 lines (60 loc) · 2.53 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
<html>
<head>
<title>Kevan's real estate comparison tool</title>
<meta name='viewport' content='initial-scale=1.0, user-scalable=no' />
<link rel='stylesheet' type='text/css' href='style.css' />
<script type='text/javascript'
src='http://maps.googleapis.com/maps/api/js?key=AIzaSyAc_MG5TzW9v8498N065gy0NKjhcVGLx7s&sensor=false'>
</script>
<script type='text/javascript' src='maps.js'></script>
<script type='text/javascript'>
var remap;
function initialize() {
var element = document.getElementById("map_canvas");
remap = new RealEstateMap(element);
makeAddForm();
makeAddDestForm();
}
function handleFormSubmit() {
var element = document.getElementById("address")
var address = element.value;
element.value = "";
remap.add_house(address);
}
function handleDestFormSubmit() {
var element = document.getElementById("dest_addr");
var address = element.value;
element.value = "";
remap.add_destination(address);
}
function makeAddForm() {
var add_form = "<h3>Add a place</h3>";
add_form = add_form + "<label for='address'>Address:</label>";
add_form = add_form + "<input type='text' name='address' id='address' />";
add_form = add_form + "<input type='submit' value='Submit' onclick='handleFormSubmit()'/>";
var add_window = new google.maps.InfoWindow({"content": add_form});
google.maps.event.addListener(remap.map, "click", function(mevent) {
add_window.open(remap.map);
add_window.setPosition(mevent.latLng);
});
}
function makeAddDestForm() {
var add_form = "<h3>Add a destination</h3>";
add_form = add_form + "<label for='dest_addr'>Address:</label>";
add_form = add_form + "<input type='text' name='dest_addr' id='dest_addr' />";
add_form = add_form + "<input type='submit' value='Submit' onclick='handleDestFormSubmit()'/>";
var add_window = new google.maps.InfoWindow({"content": add_form});
google.maps.event.addListener(remap.map, "rightclick", function(mevent) {
add_window.open(remap.map);
add_window.setPosition(mevent.latLng);
});
}
function exit() {
remap.save();
}
</script>
</head>
<body onload='initialize()' onunload='exit()'>
<div id='map_canvas' style='width: 100%; height: 100%'></div>
</body>
</html>