There was two problems.
the original problem came from the width calculation of "p.message"
elements. In the timeline, first elements have width > 0, after
switching to conversation view their width to pass to 0;
The switching view needs add a timeout before add open street's map's
image.
This commit is contained in:
dblugeon 2013-05-10 23:07:11 +02:00
parent dc908a35b3
commit 84d019dfa4

View file

@ -945,18 +945,21 @@ function(jQuery, Paths, URI, HostApp, Cache) {
} }
Core.prototype.mapSrc = function(lat, lng) { Core.prototype.mapSrc = function(lat, lng) {
var width = $("p.message").width(); var width = $("div:visible p.message").width();
return "http://staticmap.openstreetmap.de/staticmap.php?center=" + lat + "," + lng + "&zoom=3&size=" + width + "x75&markers=" + lat + "," + lng + ",red-pushpin"; return "http://staticmap.openstreetmap.de/staticmap.php?center=" + lat + "," + lng + "&zoom=3&size=" + width + "x75&markers=" + lat + "," + lng + ",red-pushpin";
} }
Core.prototype.addMap = function(lat, lng, images) { Core.prototype.addMap = function(lat, lng, images) {
var a = document.createElement("a"); var self = this;
a.className = "map"; setTimeout(function(){
a.href = this.mapHref(lat, lng); var a = document.createElement("a");
var img = document.createElement("img"); a.className = "map";
img.src = this.mapSrc(lat, lng); a.href = self.mapHref(lat, lng);
a.appendChild(img); var img = document.createElement("img");
images.appendChild(a); img.src = self.mapSrc(lat, lng);
a.appendChild(img);
images.appendChild(a);
}, 200);
} }
Core.prototype.addYouTube = function(id, images) { Core.prototype.addYouTube = function(id, images) {