Skip to content
Snippets Groups Projects
Commit 502b0e48 authored by Brandon Bergren's avatar Brandon Bergren
Browse files

RMT cache -- clicking on the same rmt marker more than once will show the...

RMT cache -- clicking on the same rmt marker more than once will show the previously fetched data instead of loading again.
parent 6e9f0116
No related branches found
No related tags found
No related merge requests found
......@@ -65,22 +65,31 @@ Drupal.gmap.addHandler('gmap', function (elem) {
}
// AJAX content
if (marker.rmt) {
var uri = marker.rmt;
// If there was a callback, prefix that.
// (If there wasn't, marker.rmt was the FULL path.)
if (obj.vars.rmtcallback) {
uri = obj.vars.rmtcallback + '/' + marker.rmt;
obj.rmtcache = obj.rmtcache || {};
// Cached RMT.
if (obj.rmtcache[marker.rmt]) {
marker.marker.openInfoWindowHtml(obj.rmtcache[marker.rmt]);
}
else {
var uri = marker.rmt;
// If there was a callback, prefix that.
// (If there wasn't, marker.rmt was the FULL path.)
if (obj.vars.rmtcallback) {
uri = obj.vars.rmtcallback + '/' + marker.rmt;
}
// @Bevan: I think it makes more sense to do it in this order.
// @Bevan: I don't like your choice of variable btw, seems to me like
// @Bevan: it belongs in the map object, or at *least* somewhere in
// @Bevan: the gmap settings proper...
//if (!marker.text && Drupal.settings.loadingImage) {
// marker.marker.openInfoWindowHtml(Drupal.settings.loadingImage);
//}
$.get(uri, {}, function (data) {
obj.rmtcache[marker.rmt] = data;
marker.marker.openInfoWindowHtml(data);
});
}
// @Bevan: I think it makes more sense to do it in this order.
// @Bevan: I don't like your choice of variable btw, seems to me like
// @Bevan: it belongs in the map object, or at *least* somewhere in
// @Bevan: the gmap settings proper...
//if (!marker.text && Drupal.settings.loadingImage) {
// marker.marker.openInfoWindowHtml(Drupal.settings.loadingImage);
//}
$.get(uri, {}, function (data) {
marker.marker.openInfoWindowHtml(data);
});
}
// Tabbed content
else if (marker.tabs) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment