fix jshint errors
This commit is contained in:
parent
3adb10ca6c
commit
c97e8f8c4f
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported AbstractIconOverlay */
|
||||
/* jshint unused: false */
|
||||
|
||||
var AbstractIconOverlay = L.LayerGroup.extend({
|
||||
initialize: function(wsChannel, layerMgr, type, icon) {
|
||||
@ -65,7 +66,7 @@ var AbstractIconOverlay = L.LayerGroup.extend({
|
||||
this.currentObjects = {};
|
||||
}
|
||||
|
||||
var mapLayer = this.layerMgr.getCurrentLayer()
|
||||
var mapLayer = this.layerMgr.getCurrentLayer();
|
||||
var min = this.map.getBounds().getSouthWest();
|
||||
var max = this.map.getBounds().getNorthEast();
|
||||
|
||||
@ -87,12 +88,13 @@ var AbstractIconOverlay = L.LayerGroup.extend({
|
||||
objects.forEach(function(obj){
|
||||
var hash = self.hashPos(obj.x, obj.y, obj.z);
|
||||
var marker = self.currentObjects[hash];
|
||||
var popup;
|
||||
|
||||
if (marker) {
|
||||
//marker exists
|
||||
|
||||
//set popup, if changed
|
||||
var popup = self.createPopup(obj);
|
||||
popup = self.createPopup(obj);
|
||||
if (popup)
|
||||
marker.setPopupContent(popup);
|
||||
|
||||
@ -102,7 +104,7 @@ var AbstractIconOverlay = L.LayerGroup.extend({
|
||||
} else {
|
||||
//marker does not exist
|
||||
marker = L.marker([obj.z, obj.x], {icon: self.getIcon(obj)});
|
||||
var popup = self.createPopup(obj);
|
||||
popup = self.createPopup(obj);
|
||||
if (popup)
|
||||
marker.bindPopup(popup);
|
||||
marker.addTo(self);
|
||||
@ -111,7 +113,7 @@ var AbstractIconOverlay = L.LayerGroup.extend({
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
@ -121,7 +123,7 @@ var AbstractIconOverlay = L.LayerGroup.extend({
|
||||
map.on("moveend", this.onMapMove);
|
||||
this.layerMgr.addListener(this.onLayerChange);
|
||||
this.wsChannel.addListener("mapobject-created", this.onMapObjectUpdated);
|
||||
this.reDraw(true)
|
||||
this.reDraw(true);
|
||||
},
|
||||
|
||||
onRemove: function(map) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported BonesOverlay */
|
||||
/* globals AbstractIconOverlay: true */
|
||||
|
||||
var BonesIcon = L.icon({
|
||||
iconUrl: 'pics/bones_top.png',
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported BorderOverlay */
|
||||
/* globals AbstractGeoJsonOverlay: true */
|
||||
|
||||
var BorderOverlay = AbstractGeoJsonOverlay.extend({
|
||||
initialize: function(wsChannel, layerMgr) {
|
||||
@ -6,8 +7,6 @@ var BorderOverlay = AbstractGeoJsonOverlay.extend({
|
||||
},
|
||||
|
||||
createGeoJson: function(objects){
|
||||
var self = this;
|
||||
|
||||
var geoJsonLayer = L.geoJSON([], {
|
||||
onEachFeature: function(feature, layer){
|
||||
if (feature.properties && feature.properties.popupContent) {
|
||||
@ -20,7 +19,7 @@ var BorderOverlay = AbstractGeoJsonOverlay.extend({
|
||||
|
||||
objects.forEach(function(obj){
|
||||
if (!obj.attributes.name)
|
||||
return
|
||||
return;
|
||||
|
||||
var border = borders[obj.attributes.name];
|
||||
if (!border){
|
||||
@ -51,10 +50,10 @@ var BorderOverlay = AbstractGeoJsonOverlay.extend({
|
||||
"coordinates":coords
|
||||
},
|
||||
"properties":{
|
||||
"name": linename,
|
||||
"name": bordername,
|
||||
"popupContent": "<b>Border (" + bordername + ")</b>"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//line-points
|
||||
geoJsonLayer.addData(feature);
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported DigitermOverlay */
|
||||
/* globals AbstractIconOverlay: true */
|
||||
|
||||
var DigitermIcon = L.icon({
|
||||
iconUrl: 'pics/digiterms_beige_front.png',
|
||||
|
@ -1,11 +1,12 @@
|
||||
'use strict';
|
||||
/* exported LabelOverlay */
|
||||
/* globals AbstractIconOverlay: true */
|
||||
|
||||
var LabelIcon = L.Icon.extend({
|
||||
initialize: function(options) {
|
||||
L.Icon.prototype.initialize.call(this, options);
|
||||
},
|
||||
|
||||
createIcon: function (oldIcon) {
|
||||
createIcon: function() {
|
||||
var div = document.createElement('div'),
|
||||
options = this.options;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported LcdOverlay */
|
||||
/* globals AbstractIconOverlay: true */
|
||||
|
||||
var LcdIcon = L.icon({
|
||||
iconUrl: 'pics/lcd_lcd.png',
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported LuacontrollerOverlay */
|
||||
/* globals AbstractIconOverlay: true */
|
||||
|
||||
var LuacontrollerIcon = L.icon({
|
||||
iconUrl: 'pics/jeija_luacontroller_top.png',
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported MissionOverlay */
|
||||
/* globals AbstractIconOverlay: true */
|
||||
|
||||
var MissionIcon = L.icon({
|
||||
iconUrl: 'pics/mission_32px.png',
|
||||
|
@ -1,4 +1,6 @@
|
||||
'use strict';
|
||||
/* exported PlayerOverlay */
|
||||
/* globals AbstractIconOverlay: true */
|
||||
/* jshint unused: false */
|
||||
|
||||
var PlayerIcon = L.icon({
|
||||
iconUrl: 'pics/sam.png',
|
||||
@ -29,11 +31,12 @@ var PlayerOverlay = L.LayerGroup.extend({
|
||||
|
||||
createMarker: function(player){
|
||||
var marker = L.marker([player.pos.z, player.pos.x], {icon: PlayerIcon});
|
||||
var i;
|
||||
|
||||
var html = "<b>" + player.name + "</b>";
|
||||
html += "<hr>";
|
||||
|
||||
for (var i=0; i<Math.floor(player.hp / 2); i++)
|
||||
for (i=0; i<Math.floor(player.hp / 2); i++)
|
||||
html += "<img src='pics/heart.png'>";
|
||||
|
||||
if (player.hp % 2 == 1)
|
||||
@ -41,7 +44,7 @@ var PlayerOverlay = L.LayerGroup.extend({
|
||||
|
||||
html += "<br>";
|
||||
|
||||
for (var i=0; i<Math.floor(player.breath / 2); i++)
|
||||
for (i=0; i<Math.floor(player.breath / 2); i++)
|
||||
html += "<img src='pics/bubble.png'>";
|
||||
|
||||
if (player.breath % 2 == 1)
|
||||
@ -53,9 +56,9 @@ var PlayerOverlay = L.LayerGroup.extend({
|
||||
},
|
||||
|
||||
isPlayerInCurrentLayer: function(player){
|
||||
var mapLayer = this.layerMgr.getCurrentLayer()
|
||||
var mapLayer = this.layerMgr.getCurrentLayer();
|
||||
|
||||
return (player.pos.y >= (mapLayer.from*16) && player.pos.y <= (mapLayer.to*16))
|
||||
return (player.pos.y >= (mapLayer.from*16) && player.pos.y <= (mapLayer.to*16));
|
||||
},
|
||||
|
||||
onMinetestUpdate: function(info){
|
||||
@ -107,7 +110,7 @@ var PlayerOverlay = L.LayerGroup.extend({
|
||||
this.currentObjects = {};
|
||||
this.clearLayers();
|
||||
|
||||
var mapLayer = this.layerMgr.getCurrentLayer()
|
||||
var mapLayer = this.layerMgr.getCurrentLayer();
|
||||
|
||||
this.players.forEach(function(player){
|
||||
if (!self.isPlayerInCurrentLayer(player)){
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported PoiOverlay */
|
||||
/* globals AbstractIconOverlay: true */
|
||||
|
||||
var PoiIcon = L.icon({
|
||||
iconUrl: 'css/images/marker-icon.png',
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported PrivProtectorOverlay */
|
||||
/* globals AbstractGeoJsonOverlay: true */
|
||||
|
||||
var PrivProtectorOverlay = AbstractGeoJsonOverlay.extend({
|
||||
initialize: function(wsChannel, layerMgr) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported ProtectorOverlay */
|
||||
/* globals AbstractGeoJsonOverlay: true */
|
||||
|
||||
var ProtectorOverlay = AbstractGeoJsonOverlay.extend({
|
||||
initialize: function(wsChannel, layerMgr) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported TechnicAnchorOverlay */
|
||||
/* globals AbstractIconOverlay: true */
|
||||
|
||||
var TechnicAnchorIcon = L.icon({
|
||||
iconUrl: 'pics/technic_admin_anchor.png',
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported TechnicQuarryOverlay */
|
||||
/* globals AbstractIconOverlay: true */
|
||||
|
||||
var TechnicQuarryIcon = L.icon({
|
||||
iconUrl: 'pics/default_tool_mesepick.png',
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported TechnicSwitchOverlay */
|
||||
/* globals AbstractIconOverlay: true */
|
||||
|
||||
var TechnicSwitchIcon = L.icon({
|
||||
iconUrl: 'pics/technic_water_mill_top_active.png',
|
||||
|
@ -1,4 +1,6 @@
|
||||
'use strict';
|
||||
/* exported TrainOverlay */
|
||||
/* globals AbstractIconOverlay: true */
|
||||
/* jshint unused: false */
|
||||
|
||||
function getTrainImageUrlForType(type){
|
||||
switch(type){
|
||||
@ -79,9 +81,9 @@ var TrainOverlay = L.LayerGroup.extend({
|
||||
},
|
||||
|
||||
isTrainInCurrentLayer: function(train){
|
||||
var mapLayer = this.layerMgr.getCurrentLayer()
|
||||
var mapLayer = this.layerMgr.getCurrentLayer();
|
||||
|
||||
return (train.pos.y >= (mapLayer.from*16) && train.pos.y <= (mapLayer.to*16))
|
||||
return (train.pos.y >= (mapLayer.from*16) && train.pos.y <= (mapLayer.to*16));
|
||||
},
|
||||
|
||||
|
||||
@ -134,7 +136,7 @@ var TrainOverlay = L.LayerGroup.extend({
|
||||
this.currentObjects = {};
|
||||
this.clearLayers();
|
||||
|
||||
var mapLayer = this.layerMgr.getCurrentLayer()
|
||||
var mapLayer = this.layerMgr.getCurrentLayer();
|
||||
|
||||
this.trains.forEach(function(train){
|
||||
if (!self.isTrainInCurrentLayer(train)){
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported TrainlineOverlay */
|
||||
/* globals AbstractGeoJsonOverlay: true */
|
||||
|
||||
var TrainlineOverlay = AbstractGeoJsonOverlay.extend({
|
||||
initialize: function(wsChannel, layerMgr) {
|
||||
@ -6,7 +7,6 @@ var TrainlineOverlay = AbstractGeoJsonOverlay.extend({
|
||||
},
|
||||
|
||||
createGeoJson: function(objects){
|
||||
var self = this;
|
||||
|
||||
var geoJsonLayer = L.geoJSON([], {
|
||||
onEachFeature: function(feature, layer){
|
||||
@ -24,7 +24,7 @@ var TrainlineOverlay = AbstractGeoJsonOverlay.extend({
|
||||
opacity: 1,
|
||||
fillOpacity: 0.8
|
||||
};
|
||||
|
||||
|
||||
return L.circleMarker(latlng, geojsonMarkerOptions);
|
||||
}
|
||||
});
|
||||
@ -34,7 +34,7 @@ var TrainlineOverlay = AbstractGeoJsonOverlay.extend({
|
||||
//Sort and add lines
|
||||
objects.forEach(function(obj){
|
||||
if (!obj.attributes.line)
|
||||
return
|
||||
return;
|
||||
|
||||
var line = lines[obj.attributes.line];
|
||||
if (!line){
|
||||
@ -84,7 +84,8 @@ var TrainlineOverlay = AbstractGeoJsonOverlay.extend({
|
||||
"name": linename,
|
||||
"popupContent": "<b>Train-line (" + linename + ")</b>"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//line-points
|
||||
geoJsonLayer.addData(feature);
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported TravelnetOverlay */
|
||||
/* globals AbstractIconOverlay: true */
|
||||
|
||||
var TravelnetIcon = L.icon({
|
||||
iconUrl: 'pics/travelnet_inv.png',
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
/* exported XPProtectorOverlay */
|
||||
/* globals AbstractGeoJsonOverlay: true */
|
||||
|
||||
var XPProtectorOverlay = AbstractGeoJsonOverlay.extend({
|
||||
initialize: function(wsChannel, layerMgr) {
|
||||
|
Loading…
Reference in New Issue
Block a user