Skip to content
This repository has been archived by the owner on May 13, 2018. It is now read-only.

Commit

Permalink
The micromap now shows information windows if it can.
Browse files Browse the repository at this point in the history
  • Loading branch information
hugowetterberg committed Aug 13, 2009
1 parent 8963892 commit 2a2dbd2
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions js/micromap.js
Expand Up @@ -53,34 +53,37 @@ if (google && google.load) {
}

map.addOverlay(marker);
GEvent.addListener(marker, "click", function (geo) {
GEvent.addListener(marker, "click", function (geo, marker) {
return function () {
var level = geo.parentNode, has_title;
while (!(has_title = jQuery(level).children('.simple-geo-title,.title,.views-field-title').length) && level.parentNode) {
var level = geo, has_title, title;
while (!(has_title = (title = jQuery(level).children('.simple-geo-title,.title,.views-field-title')).length) && level.parentNode) {
level = level.parentNode;
}
if (!has_title) {
level = geo.parentNode;
if (!level.id) {
level.id = 'micromap-' + (tmp_ids);
tmp_ids = tmp_ids + 1;
}
window.location.hash = '#' + level.id;

if (map_highlight) {
jQuery(map_highlight).removeClass('micromap-highlight');
}
jQuery(level).addClass('micromap-highlight');
map_highlight = level;

jQuery(level).css({ backgroundImage: 'none' }).animate({ backgroundColor: "#FFFFAA" }, 1000, function () {
jQuery(this).animate({ backgroundColor: "#FFFFFF" }, 1000, function () {
jQuery(this).css({ backgroundImage: '', backgroundColor: '' });
});
});
}
if (!level.id) {
level.id = 'micromap-' + (tmp_ids);
tmp_ids = tmp_ids + 1;
}
window.location.hash = '#' + level.id;

if (map_highlight) {
jQuery(map_highlight).removeClass('micromap-highlight');
else {
map.openInfoWindow(marker.getLatLng(),title.get(0).cloneNode(true));
}
jQuery(level).addClass('micromap-highlight');
map_highlight = level;

jQuery(level).css({ backgroundImage: 'none' }).animate({ backgroundColor: "#FFFFAA" }, 1000, function () {
jQuery(this).animate({ backgroundColor: "#FFFFFF" }, 1000, function () {
jQuery(this).css({ backgroundImage: '', backgroundColor: '' });
});
});
};
}(positions.get(i)));
}(positions.get(i), marker));

jQuery(positions.get(i).parentNode).find('a[rel=map]').click(function (m) {
return function () {
Expand Down

0 comments on commit 2a2dbd2

Please sign in to comment.