-
Notifications
You must be signed in to change notification settings - Fork 0
/
big_panel_yifei.php
executable file
·201 lines (155 loc) · 6.98 KB
/
big_panel_yifei.php
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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Simple markers</title>
<!-- jQuery -->
<script src="javascript/jquery.js" type="text/javascript"></script>
<!-- jQuery UI -->
<link href="javascript/jquery-ui-1.11.3/jquery-ui.css" rel="stylesheet" />
<script src="javascript/jquery-ui-1.11.3/jquery-ui.min.js" type="text/javascript"></script>
<!-- Facebox -->
<link href="javascript/facebox/src/facebox.css" media="screen" rel="stylesheet" type="text/css" />
<script src="javascript/facebox/facebox.js" type="text/javascript"></script>
<!-- Virtual keyboard -->
<link href="javascript/Keyboard-master/css/keyboard.css" rel="stylesheet" />
<script src="javascript/Keyboard-master/js/jquery.keyboard.js" type="text/javascript"></script>
<!-- Google Map -->
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script src="javascript/gmap3/gmap3.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="table_style.css">
<style>
.gmap3{
width: 500px;
height: 250px;
}
.button
{
width:100px;
float:left;
}
</style>
<script type="text/javascript">
var showMenu = null, fullMenu = null;
function ShowMenuButton(map)
{
var $container = $(document.createElement('DIV')),
$outer = $(document.createElement('DIV')),
$inner = $(document.createElement('DIV'));
$inner.addClass("inner").html("<div style='margin-bottom:50px;border:2px solid;border-color: #2a3333;border-radius: 6px;background-color: white;width:73px;height:68px;'><img style='' src='images/open_button.png' alt='Smiley face'/></div>");
$container.addClass("outer").attr('title', "Click to set the map to Home");
$container.attr("id", "showMenu");
$container.append( $outer.append( $inner ) );
google.maps.event.addDomListener($outer.get(0), 'click', function() {
$('#showMenu').fadeOut();
$('#fullMenu').fadeIn();
});
this.index = 1;
map.controls[google.maps.ControlPosition.BOTTOM_LEFT].push($container.get(0));
}
function Menu(map)
{
var $container = $(document.createElement('DIV'));
$container.attr("id", "fullMenu");
$container.attr("style", "display:none;margin-left:-77px;margin-bottom:50px;border:2px solid;border-color: #2a3333;border-radius: 6px;background-color: white;width:800px;height:68px;");
var $closeButton = $(document.createElement('DIV'));
$closeButton.attr("class", "button");
$closeButton.attr("style", "margin-left:3px");
$closeButton.html("<img src='images/close_button.png' />");
google.maps.event.addDomListener($closeButton.get(0), 'click', function() {
$('#fullMenu').fadeOut();
$('#showMenu').fadeIn();
});
var $navigationButton = $(document.createElement('DIV'));
$navigationButton.attr("class", "button");
$navigationButton.html("<center><img src='images/navigation_button.png' /><div>Navigation</div></center>");
google.maps.event.addDomListener($navigationButton.get(0), 'click', function() {
console.log($('#fullMenu').height())
//Define a logic to dynamically expand the fullMenu element and make it collapsed if click twice
if ($('#fullMenu').height() == 68) {
$('#fullMenu').css('height', '100px');
}else {
$('#fullMenu').css('height', '68px')
};
$('#navigationForm').fadeToggle(); //Use fadeToggle instead of fadeIn, then even clicks can make it fadeOut
$('#start_place').keyboard();
$('#destination').keyboard();
});
var $navigationForm = $(document.createElement('DIV'));
$navigationForm.attr("id", "navigationForm");
$navigationForm.attr("style", "display:none; position: relative; top:-100px; left:-8px;,");
$navigationForm.html("From: <input id='start_place' /> To: <input id='destination' /> <button id='find_route' >Find</button>");
google.maps.event.addDomListener($navigationForm.get(0), 'load', function() {
});
<!-- (document.createElement('DIV'))that's just an element that isn't in the DOM yet, unless you append it to something -->
var $busTimeTable = $('<table></table>');
$busTimeTable.attr('id', 'busTimeTable');
//The main difference is that appendChild is a DOM method and append is a jQuery method
//Use $busTimeTable.remove() to delete an element
$busTimeTable.append("<tr><th colspan='3'>Bus time table</th></tr>");
$busTimeTable.append("<tr><td>Time</td><td>Arrive</td><td>Leave</td></tr>");
$busTimeTable.hide();
var $busTimetableButton = $(document.createElement('DIV'));
$busTimetableButton.attr("class", "button");
$busTimetableButton.html("<center><img src='images/bus_timetable_button.png' /><div>Timetable</div></center>");
google.maps.event.addDomListener($busTimetableButton.get(0), 'click', function() {
//TODO Yifei
$busTimeTable.toggle();
});
$busTimetableButton.append($busTimeTable);
var $placeButton = $(document.createElement('DIV'));
$placeButton.attr("class", "button");
$placeButton.html("<center><img src='images/place_button.png' /><div>Place</div></center>");
google.maps.event.addDomListener($placeButton.get(0), 'click', function() {
//TODO Yifei
});
var $trafficCongestionButton = $(document.createElement('DIV'));
$trafficCongestionButton.attr("class", "button");
$trafficCongestionButton.html("<center><img src='images/traffic_congestion_button.png' /><div>Traffic Congestion</div></center>");
google.maps.event.addDomListener($trafficCongestionButton.get(0), 'click', function() {
//TODO Yifei
});
var $resetCSS = $(document.createElement('DIV'));
$resetCSS.attr("style", "clear:both");
$container.append($closeButton);
$container.append($navigationButton);
$container.append($busTimetableButton);
$container.append($placeButton);
$container.append($trafficCongestionButton);
$container.append($resetCSS);
$container.append($navigationForm);
map.controls[google.maps.ControlPosition.BOTTOM_LEFT].push($container.get(0));
}
$(function(){
$("#map_panel").gmap3({
marker:{
values:[
{latLng:[65.013130, 25.476192], data:"Paris !"},
{latLng:[65.013130, 25.476292], data:"Paris !"},
{latLng:[65.013130, 25.476392], data:"Paris !"},
{address:"Isokatu 8, Oulu, Finland", data:"Poitiers : great city !"},
{address:"Isokatu 15, Oulu, Finland", data:"Perpignan ! GO USAP !",options:{icon: "http://maps.google.com/mapfiles/marker_green.png"}}
],
options:{
draggable: false
}
},
map:{
options:{
zoom: 16,
disableDefaultUI: true
},
callback: function(map){
showMenu = new ShowMenuButton(map);
fullMenu = new Menu(map);
}
}
});
});
</script>
</head>
<body>
<div style="border:10px solid;border-color: #2a3333;border-radius: 25px;width:960px;height:486px" id="map_panel"></div>
</body>
</html>