- Markers are now known as "Signs"

- map-markerpath is now map-signspath (YOU MUST SET THIS TO YOUR CURRENT FILE IF YOU HAVE ONE)
 - Commands have been renamed to: /addsign, /removesign, /listsigns, /tpsign (Update groups.txt if required)
 - New map-showmarkers server.property (comma separated list of options spawn,homes,warps,signs,players or you can set it to all or none; yes, can even hide players but still show warps, spawns, etc...)
 - map-showmarkers directly affects what output via the "up" directory so what you include in your options is included in the data, and ultimately the map
 - Internally, signs are now Warp based so no longer owner based
 - index.html updated to add divs around checkboxes
 - map.js updated to consolidate both players and markers into a single if statement
 - checkboxes dynamically show/hide from the map based on the number of items on the map (will hide if there are none, especially based on map-showmarkers)
 - Player list shows/hides based on number of players (or map-showmarkers setting)
This commit is contained in:
fescen9 2010-12-11 04:56:06 +00:00
parent 70cb6a5a7f
commit 7a2b1598eb
10 changed files with 281 additions and 199 deletions

View file

@ -20,15 +20,23 @@
<div id="lst">[Connecting]</div>
</div>
<div id="controls">
<form action="#" method="get">
<img src="warp.png" alt="Warps" title="Warps" />
<input type="checkbox" checked="checked" id="showWarps" /><br />
<img src="marker.png" alt="Markers" title="Markers" />
<input type="checkbox" checked="checked" id="showMarkers" /><br />
<img src="home.png" alt="Homes" title="Homes" />
<input type="checkbox" checked="checked" id="showHomes" /><br />
<img src="spawn.png" alt="Spawn" title="Spawn" />
<input type="checkbox" checked="checked" id="showSpawn" /><br />
<form action="#" method="get">
<div id="warpsDiv">
<img src="warp.png" alt="Warps" title="Warps" />
<input type="checkbox" checked="checked" id="showWarps" />
</div>
<div id="signsDiv">
<img src="sign.png" alt="Signs" title="Signs" />
<input type="checkbox" checked="checked" id="showSigns" /><br />
</div>
<div id="homesDiv">
<img src="home.png" alt="Homes" title="Homes" />
<input type="checkbox" checked="checked" id="showHomes" /><br />
</div>
<div id="spawnsDiv">
<img src="spawn.png" alt="Spawn" title="Spawn" />
<input type="checkbox" checked="checked" id="showSpawn" /><br />
</div>
</form>
</div>
<div id="link"></div>

View file

@ -565,7 +565,7 @@ function makeRequest(url, func, type, fail, post, contenttype)
var rows = res.split('\n');
var loggedin = new Array();
var showWarps = document.getElementById('showWarps').checked;
var showMarkers = document.getElementById('showMarkers').checked;
var showSigns = document.getElementById('showSigns').checked;
var showHomes = document.getElementById('showHomes').checked;
var showSpawn = document.getElementById('showSpawn').checked;
@ -573,55 +573,49 @@ function makeRequest(url, func, type, fail, post, contenttype)
delete rows[0];
var playerlst = ''
var numwarps = 0;
var numsigns = 0;
var numhomes = 0;
var numspawns = 0;
var numplayers = 0;
for(var line in rows) {
var p = rows[line].split(' ');
// Hack to keep duplicate markers/warps/players from conflicting with eachother
if(p.length == 6) {
if(p[0] == '') continue;
// Hack to keep duplicate markers from conflicting with eachother
if (p[1] != 'player') {
p[0] = p[0] + '<span style="display:none;">' + p[1] + '</span>';
}
loggedin[p[0]] = 1;
if(p[0] == '') continue;
if(p.length == 4) {
if (p[1] == 'player') {
if(playerlst != '') playerlst += '<br />';
playerlst += '<img id="icon_' + p[0] + '" class="plicon" src="' + (p[0] == followPlayer ? 'follow_on.png' : 'follow_off.png') + '" onclick="plfollow(' + "'" + p[0] + "'" + ')" alt="" /> <a href="#" onclick="plclick(' + "'" + p[0] + "'" + ')">' + p[0] + '</a>';
}
if(p[0] == followPlayer) {
map.setCenter(fromWorldToLatLng(p[1], p[2], p[3]));
}
if(p[0] in markers) {
var m = markers[p[0]];
var converted = fromWorldToLatLng(p[1], p[2], p[3]);
m.setPosition(converted);
} else {
var converted = fromWorldToLatLng(p[1], p[2], p[3]);
var marker = new MarkerWithLabel({
position: converted,
map: map,
labelContent: p[0],
labelAnchor: new google.maps.Point(-14, 10),
labelClass: "labels",
clickable: false,
flat: true,
icon: new google.maps.MarkerImage('player.png', new google.maps.Size(28, 28), new google.maps.Point(0, 0), new google.maps.Point(14, 14))
});
markers[p[0]] = marker;
}
} else if(p.length == 6) {
if(p.length == 5) {
var image = p[1] + '.png';
if (p[1] == 'warp') numwarps++;
if (p[1] == 'sign') numsigns++;
if (p[1] == 'home') numhomes++;
if (p[1] == 'spawn') numspawns++;
if (p[1] == 'player') numplayers++;
var hideMarker = (
(p[1] == 'warp' && showWarps == false) ||
(p[1] == 'marker' && showMarkers == false) ||
(p[1] == 'sign' && showSigns == false) ||
(p[1] == 'home' && showHomes == false) ||
(p[1] == 'spawn' && showSpawn == false)
);
if(p[0] == followPlayer) {
map.panTo(fromWorldToLatLng(p[2], p[3], p[4]));
}
if(p[0] in markers) {
var m = markers[p[0]];
@ -633,14 +627,14 @@ function makeRequest(url, func, type, fail, post, contenttype)
m.setMap(map);
}
var converted = fromWorldToLatLng(p[3], p[4], p[5]);
var converted = fromWorldToLatLng(p[2], p[3], p[4]);
m.setPosition(converted);
} else {
if (hideMarker) {
continue;
}
var converted = fromWorldToLatLng(p[3], p[4], p[5]);
var converted = fromWorldToLatLng(p[2], p[3], p[4]);
var marker = new MarkerWithLabel({
position: converted,
map: map,
@ -674,6 +668,15 @@ function makeRequest(url, func, type, fail, post, contenttype)
delete markers[m];
}
}
document.getElementById('warpsDiv').style.display = (numwarps == 0)?'none':'';
document.getElementById('signsDiv').style.display = (numsigns == 0)?'none':'';
document.getElementById('homesDiv').style.display = (numhomes == 0)?'none':'';
document.getElementById('spawnsDiv').style.display = (numspawns == 0)?'none':'';
document.getElementById('plist').style.display = (numplayers == 0)?'none':'';
document.getElementById('controls').style.display = ((numwarps + numsigns + numhomes + numspawns) == 0)?'none':'';
setTimeout(mapUpdate, config.updateRate);
}, 'text', function() { alert('failed to get update data'); } );

View file

Before

Width:  |  Height:  |  Size: 681 B

After

Width:  |  Height:  |  Size: 681 B

Before After
Before After