Skip to content
This repository was archived by the owner on Sep 19, 2018. It is now read-only.

Commit 7c03716

Browse files
committed
Merge pull request #327 from Konviser/master
move click marker event handler out of the createMarker loop
2 parents 63d52cf + ad2db22 commit 7c03716

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

static/js/index.js

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,33 @@ var Codeweek = window.Codeweek || {};
3838
content: "loading..."
3939
});
4040

41+
overlapSpiderifier.addListener('click', function(marker) {
42+
placeinfowindow.close();
43+
44+
var infoWindowContent = '',
45+
buble_content = '',
46+
image = '',
47+
description = '';
48+
49+
if (marker.image !== "") {
50+
image += '<img src="' + Codeweek.Index.media_url + marker.image + '" class="img-polaroid marker-buble-img">';
51+
}
52+
53+
if (marker.description.length > 150) {
54+
description = marker.description.substring(0, 150) + '... ';
55+
} else {
56+
description = marker.description;
57+
}
58+
59+
buble_content = '<div><h4><a href="' + marker.url + '" class="map-marker">' + marker.title + '</a></h4><div>' +
60+
image +
61+
'<p style="overflow:hidden;">' + description +
62+
'&nbsp;<a href="' + marker.url + '" class="map-marker"><span>More...</span></a></p>';
63+
64+
placeinfowindow.setContent(buble_content);
65+
placeinfowindow.open(map, marker);
66+
});
67+
4168
for (i = 0; i <= events.length; i = i + 1) {
4269
if (events[i] && typeof events[i] === 'object') {
4370

@@ -100,35 +127,6 @@ var Codeweek = window.Codeweek || {};
100127
image: markImg,
101128
url: markUrl
102129
});
103-
104-
overlapSpiderifier.addListener('click', function(marker) {
105-
placeinfowindow.close();
106-
107-
var infoWindowContent = '',
108-
buble_content = '',
109-
image = '',
110-
description = '';
111-
112-
if (marker.image !== "") {
113-
image += '<img src="' + Codeweek.Index.media_url + marker.image + '" class="img-polaroid marker-buble-img">';
114-
}
115-
116-
if (marker.description.length > 150) {
117-
description = marker.description.substring(0, 150) + '... ';
118-
} else {
119-
description = marker.description;
120-
}
121-
122-
buble_content = '<div><h4><a href="' + marker.url + '" class="map-marker">' + marker.title + '</a></h4><div>' +
123-
image +
124-
'<p style="overflow:hidden;">' + description +
125-
'&nbsp;<a href="' + marker.url + '" class="map-marker"><span>More...</span></a></p>';
126-
127-
128-
placeinfowindow.setContent(buble_content);
129-
placeinfowindow.open(marker.map, marker);
130-
});
131-
132130
overlapSpiderifier.addMarker(marker);
133131

134132
return marker;

0 commit comments

Comments
 (0)