modified player tracker. show leaflet popup instead of tooltip on mobile

This commit is contained in:
Philipp Schaefer 2013-11-06 00:24:31 +01:00
parent 9a998b7a94
commit 154bf3c6ab

View File

@ -295,16 +295,16 @@ window.plugin.playerTracker.drawData = function() {
}
}
title += '\n'
+ ago(last.time, now) + ' ago\n'
title += '<br>'
+ ago(last.time, now) + ' ago<br>'
+ window.chat.getChatPortalName(last);
// show previous data in tooltip
var minsAgo = '\t<span style="white-space: nowrap;"> ago</span>\t';
if(evtsLength >= 2)
title += '\n&nbsp;\nprevious locations:\n';
title += '<br>&nbsp;<br>previous locations:<br>';
for(var i = evtsLength - 2; i >= 0 && i >= evtsLength - 10; i--) {
var ev = playerData.events[i];
title += ago(ev.time, now) + minsAgo + window.chat.getChatPortalName(ev) + '\n';
title += ago(ev.time, now) + minsAgo + window.chat.getChatPortalName(ev) + '<br>';
}
// calculate the closest portal to the player
@ -330,6 +330,8 @@ window.plugin.playerTracker.drawData = function() {
// marker itself
var icon = playerData.team === 'RESISTANCE' ? new plugin.playerTracker.iconRes() : new plugin.playerTracker.iconEnl();
var m = L.marker(gllfe(last), {title: title, icon: icon, referenceToPortal: closestPortal, opacity: absOpacity});
if (typeof android !== 'undefined' && android)
m.bindPopup(title);
// ensure tooltips are closed, sometimes they linger
m.on('mouseout', function() { $(this._icon).tooltip('close'); });
m.addTo(playerData.team === 'RESISTANCE' ? plugin.playerTracker.drawnTracesRes : plugin.playerTracker.drawnTracesEnl);