-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
314 lines (273 loc) · 10.2 KB
/
example.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>InfoBubble</title>
<style type="text/css">
body {
font-size: 83%;
}
body, input, textarea {
font-family: arial, sans-serif;
}
#map {
width: 600px;
height: 500px;
}
#styles, #add-tab {
float: left;
margin-top: 10px;
width: 400px;
}
#styles label,
#add-tab label {
display: inline-block;
width: 130px;
}
.phoney {
background: -webkit-gradient(linear,left top,left bottom,color-stop(0, rgb(112,112,112)),color-stop(0.51, rgb(94,94,94)),color-stop(0.52, rgb(57,57,57)));
background: -moz-linear-gradient(center top,rgb(112,112,112) 0%,rgb(94,94,94) 51%,rgb(57,57,57) 52%);
}
.phoneytext {
text-shadow: 0 -1px 0 #000;
color: #fff;
font-family: Helvetica Neue, Helvetica, arial;
font-size: 18px;
line-height: 25px;
padding: 4px 45px 4px 15px;
font-weight: bold;
background: url(../images/arrow.png) 95% 50% no-repeat;
}
.phoneytab {
text-shadow: 0 -1px 0 #000;
color: #fff;
font-family: Helvetica Neue, Helvetica, arial;
font-size: 18px;
background: rgb(112,112,112) !important;
}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var script = '<script type="text/javascript" src="http://google-maps-' +
'utility-library-v3.googlecode.com/svn/trunk/infobubble/src/infobubble';
if (document.location.search.indexOf('compiled') !== -1) {
script += '-compiled';
}
script += '.js"><' + '/script>';
document.write(script);
</script>
<script type="text/javascript">
var map, infoBubble;
function init() {
var mapCenter = new google.maps.LatLng(-35.397, 150.644);
map = new google.maps.Map(document.getElementById('map'), {
zoom: 8,
center: mapCenter,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var marker = new google.maps.Marker({
map: map,
position: new google.maps.LatLng(-35, 150),
draggable: true
});
var contentString = '<div id="content">'+
'<h1>Uluru</h1>'+
'<p><b>Uluru</b>, also referred to as <b>Ayers Rock</b>, is a large ' +
'sandstone rock formation in the southern part of the '+
'Northern Territory, central Australia. It lies 335 km (208 mi) '+
'south west of the nearest large town, Alice Springs; 450 km '+
'(280 mi) by road. Kata Tjuta and Uluru are the two major '+
'features of the Uluru - Kata Tjuta National Park. Uluru is '+
'sacred to the Pitjantjatjara and Yankunytjatjara, the '+
'Aboriginal people of the area. It has many springs, waterholes, '+
'rock caves and ancient paintings. Uluru is listed as a World '+
'Heritage Site.</p>'+
'<p>Attribution: Uluru, <a href="http://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
'http://en.wikipedia.org/w/index.php?title=Uluru</a> '+
'(last visited June 22, 2009).</p>'+
'</div>';
infoBubble = new InfoBubble({
maxWidth: 300
});
infoBubble2 = new InfoBubble({
map: map,
content: '<div class="phoneytext">Some label</div>',
position: new google.maps.LatLng(-35, 151),
shadowStyle: 1,
padding: 0,
backgroundColor: 'rgb(57,57,57)',
borderRadius: 4,
arrowSize: 10,
borderWidth: 1,
borderColor: '#2c2c2c',
disableAutoPan: true,
hideCloseButton: true,
arrowPosition: 30,
backgroundClassName: 'phoney',
arrowStyle: 2
});
infoBubble.open(map, marker);
infoBubble2.open();
var div = document.createElement('DIV');
div.innerHTML = 'Hello';
infoBubble.addTab('A Tab', div);
infoBubble.addTab('Uluru', contentString);
google.maps.event.addListener(marker, 'click', function() {
if (!infoBubble.isOpen()) {
infoBubble.open(map, marker);
}
});
google.maps.event.addDomListener(document.getElementById('update'),
'click', updateStyles);
google.maps.event.addDomListener(document.getElementById('add'),
'click', addTab);
google.maps.event.addDomListener(document.getElementById('update-tab'),
'click', updateTab);
google.maps.event.addDomListener(document.getElementById('remove'),
'click', removeTab);
google.maps.event.addDomListener(document.getElementById('open'),
'click', function() {
infoBubble2.open();
});
google.maps.event.addDomListener(document.getElementById('close'),
'click', function() {
infoBubble2.close();
});
}
google.maps.event.addDomListener(window, 'load', init);
function updateStyles() {
var shadowStyle = document.getElementById('shadowstyle').value;
infoBubble.setShadowStyle(shadowStyle);
var padding = document.getElementById('padding').value;
infoBubble.setPadding(padding);
var borderRadius = document.getElementById('borderRadius').value;
infoBubble.setBorderRadius(borderRadius);
var borderWidth = document.getElementById('borderWidth').value;
infoBubble.setBorderWidth(borderWidth);
var borderColor = document.getElementById('borderColor').value;
infoBubble.setBorderColor(borderColor);
var backgroundColor = document.getElementById('backgroundColor').value;
infoBubble.setBackgroundColor(backgroundColor);
var maxWidth = document.getElementById('maxWidth').value;
infoBubble.setMaxWidth(maxWidth);
var maxHeight = document.getElementById('maxHeight').value;
infoBubble.setMaxHeight(maxHeight);
var minWidth = document.getElementById('minWidth').value;
infoBubble.setMinWidth(minWidth);
var minHeight = document.getElementById('minHeight').value;
infoBubble.setMinHeight(minHeight);
var arrowSize = document.getElementById('arrowSize').value;
infoBubble.setArrowSize(arrowSize);
var arrowPosition = document.getElementById('arrowPosition').value;
infoBubble.setArrowPosition(arrowPosition);
var arrowStyle = document.getElementById('arrowStyle').value;
infoBubble.setArrowStyle(arrowStyle);
}
function addTab() {
var title = document.getElementById('tab-title').value;
var content = document.getElementById('tab-content').value;
if (title != '' && content != '') {
infoBubble.addTab(title, content);
}
}
function updateTab() {
var index = document.getElementById('tab-index-update').value;
var title = document.getElementById('tab-title-update').value;
var content = document.getElementById('tab-content-update').value;
if (index) {
infoBubble.updateTab(index, title, content);
}
}
function removeTab() {
var index = document.getElementById('tab-index').value;
infoBubble.removeTab(index);
}
</script>
</head>
<body>
<h3>InfoBubble</h3>
<p><a href="?compiled">Compiled</a> or <a href="?">Standard</a> version of the script.</p>
<div id="map"></div>
<div id="styles">
<h2>Style</h2>
<div>
<label>ShadowStyle:</label>
<select id="shadowstyle">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</div>
<div>
<label>Padding:</label>
<input type="text" id="padding" value="10"/>
</div>
<div>
<label>borderRadius:</label>
<input type="text" id="borderRadius" value="10"/>
</div>
<div>
<label>borderWidth:</label>
<input type="text" id="borderWidth" value="1"/>
</div>
<div>
<label>borderColor:</label>
<input type="text" id="borderColor" value="#ccc"/>
</div>
<div>
<label>backgroundColor:</label>
<input type="text" id="backgroundColor" value="#fff"/>
</div>
<div>
<label>minWidth:</label>
<input type="text" id="minWidth"/>px
</div>
<div>
<label>maxWidth:</label>
<input type="text" id="maxWidth" value="300"/>px
</div>
<div>
<label>minHeight:</label>
<input type="text" id="minHeight"/>px
</div>
<div>
<label>maxHeight:</label>
<input type="text" id="maxHeight"/>px
</div>
<div>
<label>arrowSize:</label>
<input type="text" id="arrowSize" value="15"/>px
</div>
<div>
<label>arrowPosition:</label>
<input type="text" id="arrowPosition" value="50"/>%
</div>
<div>
<label>arrowStyle:</label>
<select id="arrowStyle">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</div>
<button id="update">Update styles</button>
</div>
<div id="add-tab">
<h2>Add Tab</h2>
<div><label>Title:</label><input type="text" id="tab-title"/></div>
<div><label>Content:</label><textarea id="tab-content"></textarea></div>
<button id="add">Add</button>
<h2>Update Tab</h2>
<div><label>Index:</label><input type="text" id="tab-index-update"/></div>
<div><label>Title:</label><input type="text" id="tab-title-update"/></div>
<div><label>Content:</label><textarea id="tab-content-update"></textarea></div>
<button id="update-tab">Update</button>
<h2>Remove Tab</h2>
<div><label>Index:</label><input type="text" id="tab-index"/></div>
<button id="remove">Remove</button>
<h2>Other InfoBubble</h2>
<button id="open">Open</button>
<button id="close">Close</button>
</div>
</body>
</html>