es6 with happy linter

This commit is contained in:
NatureFreshMilk 2019-06-11 15:01:16 +02:00
parent 67ea4d9e71
commit f26adb3dbf
33 changed files with 342 additions and 323 deletions

View File

@ -4,9 +4,7 @@
"esversion": 6,
"browser": true,
"globals": {
"debounce": true,
"L": true,
"m": true,
"api": true
"m": true
}
}

View File

@ -1,4 +1,3 @@
/* exported Hashroute */
export default {

View File

@ -1,77 +1,78 @@
/* exported LayerManager */
/* globals RealtimeTileLayer: true */
import RealtimeTileLayer from './RealtimeTileLayer.js';
function LayerManager(wsChannel, layers, map, currentLayerId){
this.listeners = [];
this.currentLayer = layers[0];
this.layers = layers;
this.map = map;
this.layerObjects = {};
class LayerManager {
var self = this;
setup(wsChannel, layers, map, currentLayerId){
this.listeners = [];
this.currentLayer = layers[0];
this.layers = layers;
this.map = map;
this.layerObjects = {};
//All layers
layers.forEach(function(layer){
var tileLayer = new RealtimeTileLayer(wsChannel, layer.id, map);
self.layerObjects[layer.name] = tileLayer;
if (layer.id == currentLayerId){
tileLayer.addTo(map);
self.currentLayer = layer;
}
});
var self = this;
map.on('baselayerchange', function (e) {
self.setLayerId(e.layer.layerId);
});
//All layers
layers.forEach(function(layer){
var tileLayer = new RealtimeTileLayer(wsChannel, layer.id, map);
self.layerObjects[layer.name] = tileLayer;
if (layer.id == currentLayerId){
tileLayer.addTo(map);
self.currentLayer = layer;
}
});
map.on('baselayerchange', function (e) {
self.setLayerId(e.layer.layerId);
});
}
switchLayer(layerId){
var self = this;
Object.keys(this.layerObjects).forEach(function(key){
var layerObj = self.layerObjects[key];
if (self.map.hasLayer(layerObj)){
self.map.removeLayer(layerObj);
}
});
Object.keys(this.layerObjects).forEach(function(key){
var layerObj = self.layerObjects[key];
if (layerObj.layerId == layerId){
self.map.addLayer(layerObj);
}
});
}
setLayerId(layerId){
var self = this;
this.layers.forEach(function(layer){
if (layer.id == layerId){
self.currentLayer = layer;
self.listeners.forEach(function(listener){
listener(layer);
});
return;
}
});
}
getLayerByY(y){
return this.layers.find(layer => (y >= (layer.from*16) && y <= (layer.to*16)));
}
addListener(listener){
this.listeners.push(listener);
}
removeListener(listener){
this.listeners = this.listeners.filter(function(el){
return el != listener;
});
}
getCurrentLayer(){
return this.currentLayer;
}
}
LayerManager.prototype.switchLayer = function(layerId){
var self = this;
Object.keys(this.layerObjects).forEach(function(key){
var layerObj = self.layerObjects[key];
if (self.map.hasLayer(layerObj)){
self.map.removeLayer(layerObj);
}
});
Object.keys(this.layerObjects).forEach(function(key){
var layerObj = self.layerObjects[key];
if (layerObj.layerId == layerId){
self.map.addLayer(layerObj);
}
});
};
LayerManager.prototype.setLayerId = function(layerId){
var self = this;
this.layers.forEach(function(layer){
if (layer.id == layerId){
self.currentLayer = layer;
self.listeners.forEach(function(listener){
listener(layer);
});
return;
}
});
};
LayerManager.prototype.getLayerByY = function(y){
return this.layers.find(function(layer){
return (y >= (layer.from*16) && y <= (layer.to*16));
});
};
LayerManager.prototype.addListener = function(listener){
this.listeners.push(listener);
};
LayerManager.prototype.removeListener = function(listener){
this.listeners = this.listeners.filter(function(el){
return el != listener;
});
};
LayerManager.prototype.getCurrentLayer = function(){
return this.currentLayer;
};
export default new LayerManager();

View File

@ -1,160 +1,184 @@
/* jshint undef: false */
/* exported Overlaysetup */
import PlayerOverlay from './overlays/PlayerOverlay.js';
import PoiOverlay from './overlays/PoiOverlay.js';
import ShopOverlay from './overlays/ShopOverlay.js';
import LabelOverlay from './overlays/LabelOverlay.js';
import TrainlineOverlay from './overlays/TrainlineOverlay.js';
import TravelnetOverlay from './overlays/TravelnetOverlay.js';
import BonesOverlay from './overlays/BonesOverlay.js';
import LcdOverlay from './overlays/LcdOverlay.js';
import DigitermOverlay from './overlays/DigitermOverlay.js';
import LuacontrollerOverlay from './overlays/LuacontrollerOverlay.js';
import TechnicAnchorOverlay from './overlays/TechnicAnchorOverlay.js';
import TechnicQuarryOverlay from './overlays/TechnicQuarryOverlay.js';
import TechnicSwitchOverlay from './overlays/TechnicSwitchOverlay.js';
import ProtectorOverlay from './overlays/ProtectorOverlay.js';
import XPProtectorOverlay from './overlays/XPProtectorOverlay.js';
import PrivProtectorOverlay from './overlays/PrivProtectorOverlay.js';
import MissionOverlay from './overlays/MissionOverlay.js';
import MinecartOverlay from './overlays/MinecartOverlay.js';
import ATMOverlay from './overlays/ATMOverlay.js';
import LocatorOverlay from './overlays/LocatorOverlay.js';
import BorderOverlay from './overlays/BorderOverlay.js';
import TrainOverlay from './overlays/TrainOverlay.js';
function Overlaysetup(cfg, map, overlays, wsChannel, layerMgr){
export default function(cfg, map, overlays, wsChannel, layerMgr){
if (cfg.mapobjects.mapserver_player) {
overlays.Player = new PlayerOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("mapserver_player") >= 0) {
map.addLayer(overlays.Player);
}
function isDefault(key){
return cfg.defaultoverlays.indexOf(key) >= 0;
}
if (cfg.mapobjects.mapserver_player) {
overlays.Player = new PlayerOverlay(wsChannel, layerMgr);
if (isDefault("mapserver_player")) {
map.addLayer(overlays.Player);
}
}
if (cfg.mapobjects.mapserver_poi) {
overlays.POI = new PoiOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("mapserver_poi") >= 0) {
map.addLayer(overlays.POI);
}
if (cfg.mapobjects.mapserver_poi) {
overlays.POI = new PoiOverlay(wsChannel, layerMgr);
if (isDefault("mapserver_poi")) {
map.addLayer(overlays.POI);
}
}
if (cfg.mapobjects.smartshop || cfg.mapobjects.fancyvend) {
overlays.Shop = new ShopOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("smartshop") >= 0 || cfg.defaultoverlays.indexOf("fancyvend") >= 0) {
map.addLayer(overlays.Shop);
}
if (cfg.mapobjects.smartshop || cfg.mapobjects.fancyvend) {
overlays.Shop = new ShopOverlay(wsChannel, layerMgr);
if (isDefault("smartshop") || isDefault("fancyvend")) {
map.addLayer(overlays.Shop);
}
}
if (cfg.mapobjects.mapserver_label) {
overlays.Label = new LabelOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("mapserver_label") >= 0) {
map.addLayer(overlays.Label);
}
if (cfg.mapobjects.mapserver_label) {
overlays.Label = new LabelOverlay(wsChannel, layerMgr);
if (isDefault("mapserver_label")) {
map.addLayer(overlays.Label);
}
}
if (cfg.mapobjects.mapserver_trainline) {
overlays.Trainlines = new TrainlineOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("mapserver_trainline") >= 0) {
map.addLayer(overlays.Trainlines);
}
if (cfg.mapobjects.mapserver_trainline) {
overlays.Trainlines = new TrainlineOverlay(wsChannel, layerMgr);
if (isDefault("mapserver_trainline")) {
map.addLayer(overlays.Trainlines);
}
}
if (cfg.mapobjects.mapserver_border) {
overlays.Border = new BorderOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("mapserver_border") >= 0) {
map.addLayer(overlays.Border);
}
if (cfg.mapobjects.mapserver_border) {
overlays.Border = new BorderOverlay(wsChannel, layerMgr);
if (isDefault("mapserver_border")) {
map.addLayer(overlays.Border);
}
}
if (cfg.mapobjects.travelnet) {
overlays.Travelnet = new TravelnetOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("travelnet") >= 0) {
map.addLayer(overlays.Travelnet);
}
if (cfg.mapobjects.travelnet) {
overlays.Travelnet = new TravelnetOverlay(wsChannel, layerMgr);
if (isDefault("travelnet")) {
map.addLayer(overlays.Travelnet);
}
}
if (cfg.mapobjects.bones) {
overlays.Bones = new BonesOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("bones") >= 0) {
map.addLayer(overlays.Bones);
}
if (cfg.mapobjects.bones) {
overlays.Bones = new BonesOverlay(wsChannel, layerMgr);
if (isDefault("bones")) {
map.addLayer(overlays.Bones);
}
}
if (cfg.mapobjects.digilines) {
overlays["Digilines LCD"] = new LcdOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("digilines") >= 0) {
map.addLayer(overlays["Digilines LCD"]);
}
if (cfg.mapobjects.digilines) {
overlays["Digilines LCD"] = new LcdOverlay(wsChannel, layerMgr);
if (isDefault("digilines")) {
map.addLayer(overlays["Digilines LCD"]);
}
}
if (cfg.mapobjects.digiterms) {
overlays.Digiterms = new DigitermOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("digiterms") >= 0) {
map.addLayer(overlays.Digiterms);
}
if (cfg.mapobjects.digiterms) {
overlays.Digiterms = new DigitermOverlay(wsChannel, layerMgr);
if (isDefault("digiterms")) {
map.addLayer(overlays.Digiterms);
}
}
if (cfg.mapobjects.luacontroller) {
overlays["Lua Controller"] = new LuacontrollerOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("luacontroller") >= 0) {
map.addLayer(overlays["Lua Controller"]);
}
if (cfg.mapobjects.luacontroller) {
overlays["Lua Controller"] = new LuacontrollerOverlay(wsChannel, layerMgr);
if (isDefault("luacontroller")) {
map.addLayer(overlays["Lua Controller"]);
}
}
if (cfg.mapobjects.technic_anchor) {
overlays["Technic Anchor"] = new TechnicAnchorOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("technic_anchor") >= 0) {
map.addLayer(overlays["Technic Anchor"]);
}
if (cfg.mapobjects.technic_anchor) {
overlays["Technic Anchor"] = new TechnicAnchorOverlay(wsChannel, layerMgr);
if (isDefault("technic_anchor")) {
map.addLayer(overlays["Technic Anchor"]);
}
}
if (cfg.mapobjects.technic_quarry) {
overlays["Technic Quarry"] = new TechnicQuarryOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("technic_quarry") >= 0) {
map.addLayer(overlays["Technic Quarry"]);
}
if (cfg.mapobjects.technic_quarry) {
overlays["Technic Quarry"] = new TechnicQuarryOverlay(wsChannel, layerMgr);
if (isDefault("technic_quarry")) {
map.addLayer(overlays["Technic Quarry"]);
}
}
if (cfg.mapobjects.technic_switch) {
overlays["Technic Switching station"] = new TechnicSwitchOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("technic_switch") >= 0) {
map.addLayer(overlays["Technic Switching station"]);
}
if (cfg.mapobjects.technic_switch) {
overlays["Technic Switching station"] = new TechnicSwitchOverlay(wsChannel, layerMgr);
if (isDefault("technic_switch")) {
map.addLayer(overlays["Technic Switching station"]);
}
}
if (cfg.mapobjects.protector) {
overlays.Protector = new ProtectorOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("protector") >= 0) {
map.addLayer(overlays.Protector);
}
if (cfg.mapobjects.protector) {
overlays.Protector = new ProtectorOverlay(wsChannel, layerMgr);
if (isDefault("protector")) {
map.addLayer(overlays.Protector);
}
}
if (cfg.mapobjects.xpprotector) {
overlays["XP Protector"] = new XPProtectorOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("xpprotector") >= 0) {
map.addLayer(overlays["XP Protector"]);
}
if (cfg.mapobjects.xpprotector) {
overlays["XP Protector"] = new XPProtectorOverlay(wsChannel, layerMgr);
if (isDefault("xpprotector")) {
map.addLayer(overlays["XP Protector"]);
}
}
if (cfg.mapobjects.privprotector) {
overlays["Priv Protector"] = new PrivProtectorOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("privprotector") >= 0) {
map.addLayer(overlays["Priv Protector"]);
}
if (cfg.mapobjects.privprotector) {
overlays["Priv Protector"] = new PrivProtectorOverlay(wsChannel, layerMgr);
if (isDefault("privprotector")) {
map.addLayer(overlays["Priv Protector"]);
}
}
if (cfg.mapobjects.mission) {
overlays.Missions = new MissionOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("mission") >= 0) {
map.addLayer(overlays.Missions);
}
if (cfg.mapobjects.mission) {
overlays.Missions = new MissionOverlay(wsChannel, layerMgr);
if (isDefault("mission")) {
map.addLayer(overlays.Missions);
}
}
if (cfg.mapobjects.train) {
overlays.Trains = new TrainOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("train") >= 0) {
map.addLayer(overlays.Trains);
}
if (cfg.mapobjects.train) {
overlays.Trains = new TrainOverlay(wsChannel, layerMgr);
if (isDefault("train")) {
map.addLayer(overlays.Trains);
}
}
if (cfg.mapobjects.minecart) {
overlays.Minecart = new MinecartOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("minecart") >= 0) {
map.addLayer(overlays.Minecart);
}
if (cfg.mapobjects.minecart) {
overlays.Minecart = new MinecartOverlay(wsChannel, layerMgr);
if (isDefault("minecart")) {
map.addLayer(overlays.Minecart);
}
}
if (cfg.mapobjects.atm) {
overlays.ATM = new ATMOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("atm") >= 0) {
map.addLayer(overlays.ATM);
}
if (cfg.mapobjects.atm) {
overlays.ATM = new ATMOverlay(wsChannel, layerMgr);
if (isDefault("atm")) {
map.addLayer(overlays.ATM);
}
}
if (cfg.mapobjects.locator) {
overlays.Locator = new LocatorOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("locator") >= 0) {
map.addLayer(overlays.Locator);
}
if (cfg.mapobjects.locator) {
overlays.Locator = new LocatorOverlay(wsChannel, layerMgr);
if (isDefault("locator")) {
map.addLayer(overlays.Locator);
}
}
}

View File

@ -1,3 +1,5 @@
import SearchMenu from './search/SearchMenu.js';
import SearchInput from './search/SearchInput.js';
export default L.Control.extend({
initialize: function(wsChannel, opts) {
@ -8,9 +10,7 @@ export default L.Control.extend({
var div = L.DomUtil.create('div');
m.mount(div, SearchInput);
m.mount(document.getElementById("search-content"), {
view: function () {
return m(SearchMenu, {map: map});
}
view: () => m(SearchMenu, {map: map})
});
return div;

View File

@ -1,53 +1,54 @@
/* exported WebSocketChannel */
function WebSocketChannel(){
this.wsUrl = window.location.protocol.replace("http", "ws") +
"//" + window.location.host +
window.location.pathname.substring(0, window.location.pathname.lastIndexOf("/")) +
"/api/ws";
class WebSocketChannel {
constructor(){
this.wsUrl = window.location.protocol.replace("http", "ws") +
"//" + window.location.host +
window.location.pathname.substring(0, window.location.pathname.lastIndexOf("/")) +
"/api/ws";
this.listenerMap = {/* type -> [listeners] */};
this.listenerMap = {/* type -> [listeners] */};
}
addListener(type, listener){
var list = this.listenerMap[type];
if (!list){
list = [];
this.listenerMap[type] = list;
}
list.push(listener);
}
removeListener(type, listener){
var list = this.listenerMap[type];
if (!list){
return;
}
this.listenerMap[type] = list.filter(l => l != listener);
}
connect(){
var ws = new WebSocket(this.wsUrl);
var self = this;
ws.onmessage = function(e){
var event = JSON.parse(e.data);
//rendered-tile, mapobject-created, mapobjects-cleared
var listeners = self.listenerMap[event.type];
if (listeners){
listeners.forEach(function(listener){
listener(event.data);
});
}
};
ws.onerror = function(){
//reconnect after some time
setTimeout(self.connect.bind(self), 1000);
};
}
}
WebSocketChannel.prototype.addListener = function(type, listener){
var list = this.listenerMap[type];
if (!list){
list = [];
this.listenerMap[type] = list;
}
list.push(listener);
};
WebSocketChannel.prototype.removeListener = function(type, listener){
var list = this.listenerMap[type];
if (!list){
return;
}
this.listenerMap[type] = list.filter(function(l){
return l != listener;
});
};
WebSocketChannel.prototype.connect = function(){
var ws = new WebSocket(this.wsUrl);
var self = this;
ws.onmessage = function(e){
var event = JSON.parse(e.data);
//rendered-tile, mapobject-created, mapobjects-cleared
var listeners = self.listenerMap[event.type];
if (listeners){
listeners.forEach(function(listener){
listener(event.data);
});
}
};
ws.onerror = function(){
//reconnect after some time
setTimeout(self.connect.bind(self), 1000);
};
};
export default new WebSocketChannel();

View File

@ -1,5 +1,5 @@
export getMapObjects(query){
export function getMapObjects(query){
return m.request({
method: "POST",
url: "api/mapobjects/",
@ -7,6 +7,6 @@ export getMapObjects(query){
});
}
export getConfig(){
export function getConfig(){
return m.request("api/config");
}

View File

@ -0,0 +1,5 @@
import { getConfig } from './api.js';
import { setup } from './map.js';
getConfig().then(setup);

View File

@ -1,6 +1,14 @@
import wsChannel from './WebSocketChannel.js';
import Hashroute from './Hashroute.js';
import SimpleCRS from './SimpleCRS.js';
import CoordinatesDisplay from './CoordinatesDisplay.js';
import WorldInfoDisplay from './WorldInfoDisplay.js';
import SearchControl from './SearchControl.js';
import Overlaysetup from './Overlaysetup.js';
import layerManager from './LayerManager.js';
export function setup(cfg){
var wsChannel = new WebSocketChannel();
wsChannel.connect();
var map = L.map('image-map', {
@ -15,11 +23,10 @@ export function setup(cfg){
var overlays = {};
window.layerMgr = new LayerManager(wsChannel, cfg.layers, map, Hashroute.getLayerId());
layerManager.setup(wsChannel, cfg.layers, map, Hashroute.getLayerId());
//All overlays
Overlaysetup(cfg, map, overlays, wsChannel, layerMgr);
Overlaysetup(cfg, map, overlays, wsChannel, layerManager);
new CoordinatesDisplay({ position: 'bottomleft' }).addTo(map);
new WorldInfoDisplay(wsChannel, { position: 'bottomright' }).addTo(map);
@ -29,7 +36,7 @@ export function setup(cfg){
}
//layer control
L.control.layers(layerMgr.layerObjects, overlays, { position: "topright" }).addTo(map);
L.control.layers(layerManager.layerObjects, overlays, { position: "topright" }).addTo(map);
Hashroute.setup(map, layerMgr);
Hashroute.setup(map, layerManager);
}

View File

@ -0,0 +1,2 @@
//TODO

View File

@ -1,3 +1,5 @@
import debounce from '../util/debounce.js';
import { getMapObjects } from '../api.js';
export default L.LayerGroup.extend({
initialize: function(wsChannel, layerMgr, type) {
@ -11,7 +13,7 @@ export default L.LayerGroup.extend({
this.onMapMove = debounce(this.onMapMove.bind(this), 50);
},
onLayerChange: function(layer){
onLayerChange: function(){
this.reDraw();
},
@ -19,7 +21,7 @@ export default L.LayerGroup.extend({
this.reDraw();
},
createStyle: function(feature){
createStyle: function(){
//TODO: default style
},
@ -70,7 +72,7 @@ export default L.LayerGroup.extend({
var z1 = parseInt(min.lat/16);
var z2 = parseInt(max.lat/16);
api.getMapObjects({
getMapObjects({
pos1: { x:x1, y:y1, z:z1 },
pos2: { x:x2, y:y2, z:z2 },
type: this.type

View File

@ -1,3 +1,5 @@
import debounce from '../util/debounce.js';
import { getMapObjects } from '../api.js';
export default L.LayerGroup.extend({
initialize: function(wsChannel, layerMgr, type, icon) {
@ -34,7 +36,7 @@ export default L.LayerGroup.extend({
return x + "/" + y + "/" + z;
},
onLayerChange: function(layer){
onLayerChange: function(/*layer*/){
this.reDraw(true);
},
@ -42,7 +44,7 @@ export default L.LayerGroup.extend({
this.reDraw(false);
},
getIcon: function(obj){
getIcon: function(/*ob*/){
return this.icon;
},
@ -75,7 +77,7 @@ export default L.LayerGroup.extend({
var z1 = parseInt(min.lat/16);
var z2 = parseInt(max.lat/16);
api.getMapObjects({
getMapObjects({
pos1: { x:x1, y:y1, z:z1 },
pos2: { x:x2, y:y2, z:z2 },
type: this.type

View File

@ -1,6 +1,6 @@
import AbstractIconOverlay from './AbstractIconOverlay.js';
export default L.icon({
var BonesIcon = L.icon({
iconUrl: 'pics/bones_top.png',
iconSize: [16, 16],
@ -8,7 +8,7 @@ export default L.icon({
popupAnchor: [0, -16]
});
var BonesOverlay = AbstractIconOverlay.extend({
export default AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "bones", BonesIcon);
},

View File

@ -1,8 +1,6 @@
/* exported LabelOverlay */
/* globals AbstractIconOverlay: true */
import AbstractIconOverlay from './AbstractIconOverlay.js';
var LabelOverlay = AbstractIconOverlay.extend({
export default AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "label");
},

View File

@ -1,5 +1,4 @@
/* exported LcdOverlay */
/* globals AbstractIconOverlay: true */
import AbstractIconOverlay from './AbstractIconOverlay.js';
var LcdIcon = L.icon({
iconUrl: 'pics/lcd_lcd.png',
@ -9,7 +8,7 @@ var LcdIcon = L.icon({
popupAnchor: [0, -16]
});
var LcdOverlay = AbstractIconOverlay.extend({
export default AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "digilinelcd", LcdIcon);
},

View File

@ -1,8 +1,6 @@
/* exported LocatorOverlay */
/* globals AbstractIconOverlay: true */
import AbstractIconOverlay from './AbstractIconOverlay.js';
var LocatorOverlay = AbstractIconOverlay.extend({
export default AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "locator");
},

View File

@ -1,5 +1,4 @@
/* exported LuacontrollerOverlay */
/* globals AbstractIconOverlay: true */
import AbstractIconOverlay from './AbstractIconOverlay.js';
var LuacontrollerIcon = L.icon({
iconUrl: 'pics/jeija_luacontroller_top.png',
@ -17,7 +16,7 @@ var LuacontrollerBurntIcon = L.icon({
popupAnchor: [0, -16]
});
var LuacontrollerOverlay = AbstractIconOverlay.extend({
export default AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "luacontroller");
},

View File

@ -1,8 +1,5 @@
/* exported MinecartOverlay */
/* globals AbstractIconOverlay: true */
/* jshint unused: false */
var MinecartOverlay = L.LayerGroup.extend({
export default L.LayerGroup.extend({
initialize: function(wsChannel, layerMgr) {
L.LayerGroup.prototype.initialize.call(this);
@ -47,7 +44,7 @@ var MinecartOverlay = L.LayerGroup.extend({
},
onMinetestUpdate: function(info){
onMinetestUpdate: function(/*info*/){
var self = this;
this.minecarts.forEach(function(cart){
@ -110,13 +107,13 @@ var MinecartOverlay = L.LayerGroup.extend({
},
onAdd: function(map) {
onAdd: function(/*map*/) {
this.layerMgr.addListener(this.reDraw);
this.wsChannel.addListener("minetest-info", this.onMinetestUpdate);
this.reDraw();
},
onRemove: function(map) {
onRemove: function(/*map*/) {
this.clearLayers();
this.layerMgr.removeListener(this.reDraw);
this.wsChannel.removeListener("minetest-info", this.onMinetestUpdate);

View File

@ -1,5 +1,4 @@
/* exported MissionOverlay */
/* globals AbstractIconOverlay: true */
import AbstractIconOverlay from './AbstractIconOverlay.js';
var MissionIcon = L.icon({
iconUrl: 'pics/mission_32px.png',
@ -9,7 +8,7 @@ var MissionIcon = L.icon({
popupAnchor: [0, -32]
});
var MissionOverlay = AbstractIconOverlay.extend({
export default AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "mission", MissionIcon);
},

View File

@ -1,6 +1,3 @@
/* exported PlayerOverlay */
/* globals AbstractIconOverlay: true */
/* jshint unused: false */
var PlayerIcon = L.icon({
iconUrl: 'pics/sam.png',
@ -10,7 +7,7 @@ var PlayerIcon = L.icon({
popupAnchor: [0, -16]
});
var PlayerOverlay = L.LayerGroup.extend({
export default L.LayerGroup.extend({
initialize: function(wsChannel, layerMgr) {
L.LayerGroup.prototype.initialize.call(this);
@ -61,7 +58,7 @@ var PlayerOverlay = L.LayerGroup.extend({
return (player.pos.y >= (mapLayer.from*16) && player.pos.y <= (mapLayer.to*16));
},
onMinetestUpdate: function(info){
onMinetestUpdate: function(/*info*/){
var self = this;
this.players.forEach(function(player){
@ -125,13 +122,13 @@ var PlayerOverlay = L.LayerGroup.extend({
},
onAdd: function(map) {
onAdd: function(/*map*/) {
this.layerMgr.addListener(this.reDraw);
this.wsChannel.addListener("minetest-info", this.onMinetestUpdate);
this.reDraw();
},
onRemove: function(map) {
onRemove: function(/*map*/) {
this.clearLayers();
this.layerMgr.removeListener(this.reDraw);
this.wsChannel.removeListener("minetest-info", this.onMinetestUpdate);

View File

@ -1,7 +1,6 @@
/* exported PoiOverlay */
/* globals AbstractIconOverlay: true */
import AbstractIconOverlay from './AbstractIconOverlay.js';
var PoiOverlay = AbstractIconOverlay.extend({
export default AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "poi");
},

View File

@ -1,7 +1,6 @@
/* exported PrivProtectorOverlay */
/* globals AbstractGeoJsonOverlay: true */
import AbstractGeoJsonOverlay from './AbstractGeoJsonOverlay.js';
var PrivProtectorOverlay = AbstractGeoJsonOverlay.extend({
export default AbstractGeoJsonOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractGeoJsonOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "privprotector");
},

View File

@ -1,7 +1,6 @@
/* exported ProtectorOverlay */
/* globals AbstractGeoJsonOverlay: true */
import AbstractGeoJsonOverlay from './AbstractGeoJsonOverlay.js';
var ProtectorOverlay = AbstractGeoJsonOverlay.extend({
export default AbstractGeoJsonOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractGeoJsonOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "protector");
},

View File

@ -1,5 +1,4 @@
/* exported ShopOverlay */
/* globals AbstractIconOverlay: true */
import AbstractIconOverlay from './AbstractIconOverlay.js';
var ShopIcon = L.icon({
iconUrl: 'pics/shop.png',
@ -16,7 +15,7 @@ var ShopEmptyIcon = L.icon({
});
var ShopOverlay = AbstractIconOverlay.extend({
export default AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "shop");
},

View File

@ -1,5 +1,4 @@
/* exported TechnicAnchorOverlay */
/* globals AbstractIconOverlay: true */
import AbstractIconOverlay from './AbstractIconOverlay.js';
var TechnicAnchorIcon = L.icon({
iconUrl: 'pics/technic_admin_anchor.png',
@ -9,7 +8,7 @@ var TechnicAnchorIcon = L.icon({
popupAnchor: [0, -32]
});
var TechnicAnchorOverlay = AbstractIconOverlay.extend({
export default AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "technicanchor", TechnicAnchorIcon);
},

View File

@ -1,5 +1,4 @@
/* exported TechnicQuarryOverlay */
/* globals AbstractIconOverlay: true */
import AbstractIconOverlay from './AbstractIconOverlay.js';
var TechnicQuarryIcon = L.icon({
iconUrl: 'pics/default_tool_mesepick.png',
@ -9,7 +8,7 @@ var TechnicQuarryIcon = L.icon({
popupAnchor: [0, -16]
});
var TechnicQuarryOverlay = AbstractIconOverlay.extend({
export default AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "technicquarry", TechnicQuarryIcon);
},

View File

@ -1,5 +1,4 @@
/* exported TechnicSwitchOverlay */
/* globals AbstractIconOverlay: true */
import AbstractIconOverlay from './AbstractIconOverlay.js';
var TechnicSwitchIcon = L.icon({
iconUrl: 'pics/technic_water_mill_top_active.png',
@ -9,7 +8,7 @@ var TechnicSwitchIcon = L.icon({
popupAnchor: [0, -16]
});
var TechnicSwitchOverlay = AbstractIconOverlay.extend({
export default AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "technicswitch", TechnicSwitchIcon);
},

View File

@ -1,6 +1,3 @@
/* exported TrainOverlay */
/* globals AbstractIconOverlay: true */
/* jshint unused: false */
function getTrainImageUrlForType(type){
switch(type){
@ -32,7 +29,7 @@ function getTrainImageUrlForType(type){
}
}
var TrainOverlay = L.LayerGroup.extend({
export default L.LayerGroup.extend({
initialize: function(wsChannel, layerMgr) {
L.LayerGroup.prototype.initialize.call(this);
@ -101,7 +98,7 @@ var TrainOverlay = L.LayerGroup.extend({
},
onMinetestUpdate: function(info){
onMinetestUpdate: function(/*info*/){
var self = this;
this.trains.forEach(function(train){
@ -165,13 +162,13 @@ var TrainOverlay = L.LayerGroup.extend({
},
onAdd: function(map) {
onAdd: function(/*map*/) {
this.layerMgr.addListener(this.reDraw);
this.wsChannel.addListener("minetest-info", this.onMinetestUpdate);
this.reDraw();
},
onRemove: function(map) {
onRemove: function(/*map*/) {
this.clearLayers();
this.layerMgr.removeListener(this.reDraw);
this.wsChannel.removeListener("minetest-info", this.onMinetestUpdate);

View File

@ -1,7 +1,6 @@
/* exported TrainlineOverlay */
/* globals AbstractGeoJsonOverlay: true */
import AbstractGeoJsonOverlay from './AbstractGeoJsonOverlay.js';
var TrainlineOverlay = AbstractGeoJsonOverlay.extend({
export default AbstractGeoJsonOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractGeoJsonOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "train");
},

View File

@ -1,5 +1,4 @@
/* exported TravelnetOverlay */
/* globals AbstractIconOverlay: true */
import AbstractIconOverlay from './AbstractIconOverlay.js';
var TravelnetIcon = L.icon({
iconUrl: 'pics/travelnet_inv.png',
@ -9,7 +8,7 @@ var TravelnetIcon = L.icon({
popupAnchor: [0, -32]
});
var TravelnetOverlay = AbstractIconOverlay.extend({
export default AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "travelnet", TravelnetIcon);
},

View File

@ -1,7 +1,6 @@
/* exported XPProtectorOverlay */
/* globals AbstractGeoJsonOverlay: true */
import AbstractGeoJsonOverlay from './AbstractGeoJsonOverlay.js';
var XPProtectorOverlay = AbstractGeoJsonOverlay.extend({
export default AbstractGeoJsonOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractGeoJsonOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "xpprotector");
},

View File

@ -1,3 +1,6 @@
import SearchStore from './SearchStore.js';
import SearchService from './SearchService.js';
export default {
view: function(){
function handleInput(e){

View File

@ -1,4 +1,5 @@
import SearchStore from './SearchStore.js';
import layerMgr from '../LayerManager.js';
export default {
view: function(vnode){