Changeset 251 for binary-improvements/webserver
- Timestamp:
- Oct 28, 2015, 7:51:20 PM (9 years ago)
- Location:
- binary-improvements/webserver
- Files:
-
- 9 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/webserver/index.html
r250 r251 3 3 <head> 4 4 <meta charset="UTF-8"> 5 <title>7 dtd map browser</title>5 <title>7 Days to Die Map</title> 6 6 7 7 <!-- jQuery --> … … 59 59 <div id="serverstats"> 60 60 <span id="stats_time">-</span><br/> 61 <span id="stats_players">-</span> Players 61 <span id="stats_players">-</span> Players<br /> 62 <span id="stats_hostiles">-</span> Hostiles<br /> 63 <span id="stats_animals">-</span> Animals 62 64 </div> 63 65 … … 87 89 </div> 88 90 <div id="admincontent"> 89 <h1 id="nopermissionwarning" style="display:none">An error occured or you do not have any permissions on this WebPanel. Log in with the link on the lower left!</h1>91 <h1 id="nopermissionwarning" style="display:none">An error occured or you have not logged in. Try logging in with the Steam login in the lower left!</h1> 90 92 <div id="tab_map" class="adminmap"></div> 91 93 <div id="tab_log" class="adminlog"> -
binary-improvements/webserver/js/inventory_dialog.js
r250 r251 19 19 20 20 if (itemdata !== null) { 21 cell.attr("style", "background-image: url(" + ITEMICONBASEURL + itemdata. name+ ".png);");21 cell.attr("style", "background-image: url(" + ITEMICONBASEURL + itemdata.icon + "@@" + itemdata.iconcolor + ".png);"); 22 22 if (itemdata.quality >= 0) { 23 23 cell.attr("title", itemdata.name + " (quality: " + itemdata.quality + ")"); -
binary-improvements/webserver/js/map.js
r250 r251 48 48 var tileLayerMiniMap = GetSdtdTileLayer (mapinfo, initTime, true); 49 49 50 50 // player icon 51 var playerIcon = L.icon({ 52 iconUrl: '/static/leaflet/images/marker-survivor.png', 53 iconRetinaUrl: '/static/leaflet/images/marker-survivor-2x.png', 54 iconSize: [25, 48], 55 iconAnchor: [12, 24], 56 popupAnchor: [0, -20] 57 }); 58 59 // hostile icon 60 var hostileIcon = L.icon({ 61 iconUrl: '/static/leaflet/images/marker-zombie.png', 62 iconRetinaUrl: '/static/leaflet/images/marker-zombie-2x.png', 63 iconSize: [25, 33], 64 iconAnchor: [12, 16], 65 popupAnchor: [0, -10] 66 }); 67 68 // animal icon 69 var animalIcon = L.icon({ 70 iconUrl: '/static/leaflet/images/marker-animal.png', 71 iconRetinaUrl: '/static/leaflet/images/marker-animal-2x.png', 72 iconSize: [25, 26], 73 iconAnchor: [12, 13], 74 popupAnchor: [0, -10] 75 }); 76 51 77 52 78 … … 58 84 }); 59 85 var playersOfflineMarkerGroup = L.markerClusterGroup({ 86 maxClusterRadius: function(zoom) { return zoom == mapinfo.maxzoom ? 10 : 50; } 87 }); 88 var hostilesMarkerGroup = L.markerClusterGroup({ 89 maxClusterRadius: function(zoom) { return zoom == mapinfo.maxzoom ? 10 : 50; } 90 }); 91 var animalsMarkerGroup = L.markerClusterGroup({ 60 92 maxClusterRadius: function(zoom) { return zoom == mapinfo.maxzoom ? 10 : 50; } 61 93 }); … … 107 139 } 108 140 141 if (HasPermission ("webapi.gethostilelocation")) { 142 layerControl.addOverlay (hostilesMarkerGroup, "Hostiles (<span id='mapControlHostileCount'>0</span>)"); 143 layerCount++; 144 } 145 146 if (HasPermission ("webapi.getanimalslocation")) { 147 layerControl.addOverlay (animalsMarkerGroup, "Animals (<span id='mapControlAnimalsCount'>0</span>)"); 148 layerCount++; 149 } 150 109 151 if (HasPermission ("webapi.getplayerslocation")) { 110 152 layerControl.addOverlay (playersOfflineMarkerGroup, "Players (offline) (<span id='mapControlOfflineCount'>0</span>)"); … … 120 162 121 163 164 var hostilesMappingList = {}; 165 var animalsMappingList = {}; 122 166 var playersMappingList = {}; 123 167 124 168 125 169 126 170 // =============================================================================================== … … 155 199 marker = playersMappingList[val.steamid].currentPosMarker; 156 200 } else { 157 marker = L.marker([val.position.x, val.position.z] ).bindPopup(201 marker = L.marker([val.position.x, val.position.z], {icon: playerIcon}).bindPopup( 158 202 "Player: " + val.name + 159 203 (HasPermission ("webapi.getplayerinventory") ? … … 226 270 227 271 272 273 274 // =============================================================================================== 275 // Hostiles markers 276 277 var setHostileMarkers = function(data) { 278 updatingMarkersHostile = true; 279 280 var hostileCount = 0; 281 282 hostilesMarkerGroup.clearLayers(); 283 284 $.each( data, function( key, val ) { 285 var marker; 286 if (hostilesMappingList.hasOwnProperty(val.id)) { 287 marker = hostilesMappingList[val.id].currentPosMarker; 288 } else { 289 marker = L.marker([val.position.x, val.position.z], {icon: hostileIcon}).bindPopup( 290 "Hostile: " + val.name 291 ); 292 //hostilesMappingList[val.id] = { }; 293 hostilesMarkerGroup.addLayer(marker); 294 } 295 296 var bAbort = false; 297 298 oldpos = marker.getLatLng (); 299 300 //if ( oldpos.lat != val.position.x || oldpos.lng != val.position.z ) { 301 // hostilesMarkerGroup.removeLayer(marker); 302 marker.setLatLng([val.position.x, val.position.z]); 303 marker.setOpacity(1.0); 304 hostilesMarkerGroup.addLayer(marker); 305 //} 306 307 val.currentPosMarker = marker; 308 hostilesMappingList[val.id] = val; 309 310 hostileCount++; 311 }); 312 313 $( "#mapControlHostileCount" ).text( hostileCount ); 314 315 updatingMarkersHostile = false; 316 } 317 318 var updateHostileTimeout; 319 var updateHostileEvent = function() { 320 $.getJSON( "../api/gethostilelocation") 321 .done(setHostileMarkers) 322 .fail(function(jqxhr, textStatus, error) { 323 console.log("Error fetching hostile list"); 324 }) 325 .always(function() { 326 updateHostileTimeout = window.setTimeout(updateHostileEvent, 4000); 327 }); 328 } 329 330 tabs.on ("tabbedcontenttabopened", function (event, data) { 331 if (data.newTab === "#tab_map") { 332 if (HasPermission ("webapi.gethostilelocation")) { 333 updateHostileEvent (); 334 } 335 } else { 336 window.clearTimeout (updateHostileTimeout); 337 } 338 }); 339 340 if (tabs.tabbedContent ("isTabOpen", "tab_map")) { 341 if (HasPermission ("webapi.gethostilelocation")) { 342 updateHostileEvent (); 343 } 344 } 345 346 347 348 // =============================================================================================== 349 // Animals markers 350 351 var setAnimalMarkers = function(data) { 352 updatingMarkersAnimals = true; 353 354 var animalsCount = 0; 355 356 animalsMarkerGroup.clearLayers(); 357 358 $.each( data, function( key, val ) { 359 var marker; 360 if (animalsMappingList.hasOwnProperty(val.id)) { 361 marker = animalsMappingList[val.id].currentPosMarker; 362 } else { 363 marker = L.marker([val.position.x, val.position.z], {icon: animalIcon}).bindPopup( 364 "Animal: " + val.name 365 ); 366 //animalsMappingList[val.id] = { }; 367 animalsMarkerGroup.addLayer(marker); 368 } 369 370 var bAbort = false; 371 372 oldpos = marker.getLatLng (); 373 374 //if ( oldpos.lat != val.position.x || oldpos.lng != val.position.z ) { 375 // animalsMarkerGroup.removeLayer(marker); 376 marker.setLatLng([val.position.x, val.position.z]); 377 marker.setOpacity(1.0); 378 animalsMarkerGroup.addLayer(marker); 379 //} 380 381 val.currentPosMarker = marker; 382 animalsMappingList[val.id] = val; 383 384 animalsCount++; 385 }); 386 387 $( "#mapControlAnimalsCount" ).text( animalsCount ); 388 389 updatingMarkersAnimals = false; 390 } 391 392 var updateAnimalsTimeout; 393 var updateAnimalsEvent = function() { 394 $.getJSON( "../api/getanimalslocation") 395 .done(setAnimalMarkers) 396 .fail(function(jqxhr, textStatus, error) { 397 console.log("Error fetching animals list"); 398 }) 399 .always(function() { 400 updateAnimalsTimeout = window.setTimeout(updateAnimalsEvent, 4000); 401 }); 402 } 403 404 tabs.on ("tabbedcontenttabopened", function (event, data) { 405 if (data.newTab === "#tab_map") { 406 if (HasPermission ("webapi.getanimalslocation")) { 407 updateAnimalsEvent (); 408 } 409 } else { 410 window.clearTimeout (updateAnimalsTimeout); 411 } 412 }); 413 414 if (tabs.tabbedContent ("isTabOpen", "tab_map")) { 415 if (HasPermission ("webapi.getanimalslocation")) { 416 updateAnimalsEvent (); 417 } 418 } 419 228 420 } 229 421 -
binary-improvements/webserver/js/stats.js
r250 r251 14 14 $("#stats_time").html (time); 15 15 $("#stats_players").html (data.players); 16 $("#stats_hostiles").html (data.hostiles); 17 $("#stats_animals").html (data.animals); 16 18 }) 17 19 .fail(function(jqxhr, textStatus, error) { … … 40 42 $("#stats_time").html (time); 41 43 $("#stats_players").html (data.players); 44 $("#stats_hostiles").html (data.hostiles); 45 $("#stats_animals").html (data.animals); 42 46 $("#newlogcount").html (data.newlogs); 43 47 if (data.newlogs > 0) { -
binary-improvements/webserver/sessionheader.tmpl
r244 r251 3 3 <head> 4 4 <meta charset="UTF-8"> 5 <title>7 dtd map browser</title>5 <title>7 Days to Die Map</title> 6 6 7 7 <!-- Own stylesheet -->
Note:
See TracChangeset
for help on using the changeset viewer.