Small fixes to chat-balloons.
This commit is contained in:
parent
f04185f8fc
commit
e0f249bf6f
1 changed files with 11 additions and 16 deletions
27
web/map.js
27
web/map.js
|
|
@ -274,7 +274,7 @@ DynMap.prototype = {
|
||||||
{
|
{
|
||||||
popup.infoWindow.close();
|
popup.infoWindow.close();
|
||||||
popup.infoWindow = null;
|
popup.infoWindow = null;
|
||||||
this.chatPopups[popupIndex] = popup;
|
delete this.chatPopups[popupIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -288,20 +288,11 @@ DynMap.prototype = {
|
||||||
if (playerMarker)
|
if (playerMarker)
|
||||||
{
|
{
|
||||||
var popup = chatPopups[playerName];
|
var popup = chatPopups[playerName];
|
||||||
if (popup == null)
|
if (!popup)
|
||||||
{
|
popup = { lines: [ message ] };
|
||||||
popup = new Object();
|
|
||||||
popup.lines = new Array();
|
|
||||||
popup.lines[0] = message;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (popup.infoWindow != null)
|
|
||||||
{
|
|
||||||
popup.infoWindow.close();
|
|
||||||
}
|
|
||||||
popup.lines[popup.lines.length] = message;
|
popup.lines[popup.lines.length] = message;
|
||||||
}
|
|
||||||
var MAX_LINES = 5;
|
var MAX_LINES = 5;
|
||||||
if (popup.lines.length > MAX_LINES)
|
if (popup.lines.length > MAX_LINES)
|
||||||
{
|
{
|
||||||
|
|
@ -315,9 +306,13 @@ DynMap.prototype = {
|
||||||
htmlMessage = htmlMessage + "</div>"
|
htmlMessage = htmlMessage + "</div>"
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
popup.popupTime = now.getTime();
|
popup.popupTime = now.getTime();
|
||||||
popup.infoWindow = new google.maps.InfoWindow({
|
if (!popup.infoWindow) {
|
||||||
content: htmlMessage
|
popup.infoWindow = new google.maps.InfoWindow({
|
||||||
});
|
content: htmlMessage
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
popup.infoWindow.setContent(htmlMessage);
|
||||||
|
}
|
||||||
popup.infoWindow.open(map, playerMarker);
|
popup.infoWindow.open(map, playerMarker);
|
||||||
this.chatPopups[playerName] = popup;
|
this.chatPopups[playerName] = popup;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue