From 84d019dfa475eda38bd0a766a69e4eabbe7217bb Mon Sep 17 00:00:00 2001 From: dblugeon Date: Fri, 10 May 2013 23:07:11 +0200 Subject: [PATCH] close #218 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. --- WebKit/scripts/helper/Core.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/WebKit/scripts/helper/Core.js b/WebKit/scripts/helper/Core.js index 3904231..7f3b350 100644 --- a/WebKit/scripts/helper/Core.js +++ b/WebKit/scripts/helper/Core.js @@ -945,18 +945,21 @@ function(jQuery, Paths, URI, HostApp, Cache) { } 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"; } Core.prototype.addMap = function(lat, lng, images) { - var a = document.createElement("a"); - a.className = "map"; - a.href = this.mapHref(lat, lng); - var img = document.createElement("img"); - img.src = this.mapSrc(lat, lng); - a.appendChild(img); - images.appendChild(a); + var self = this; + setTimeout(function(){ + var a = document.createElement("a"); + a.className = "map"; + a.href = self.mapHref(lat, lng); + var img = document.createElement("img"); + img.src = self.mapSrc(lat, lng); + a.appendChild(img); + images.appendChild(a); + }, 200); } Core.prototype.addYouTube = function(id, images) {