search link

master
Thomas Rudin 2018-10-23 14:12:22 +02:00
parent 4d5de8ae3c
commit e8683365fb
6 changed files with 58 additions and 21 deletions

View File

@ -12,7 +12,7 @@ var proxy = httpProxy.createProxy({
var app = connect()
.use("/", function(req, res, next){
if (req.url.substring(0,3) == "/js" || req.url == "/"){
if (req.url.substring(0,3) == "/js" || req.url == "/" || req.url.substring(0,5) == "/pics"){
console.log("Local: " + req.url);
next();
return;

View File

@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="theme-color" content="#000">
<link rel="stylesheet" href="css/leaflet.css"/>
<title>Realtime Map</title>
<style>
body {
height: 100%;
@ -34,6 +35,7 @@
<script src="js/tileserver.js"></script>
<script src="js/map.js"></script>
<script src="js/coordinates-display.js"></script>
<script src="js/search-button.js"></script>
<script src="js/overlay.shop.js"></script>
<script src="js/overlay.poi.js"></script>

View File

@ -0,0 +1,34 @@
(function(){
L.Control.SearchButton = L.Control.extend({
onAdd: function(map) {
var div = L.DomUtil.create('div', 'leaflet-bar leaflet-custom-display');
function update(ev){
var center = map.getCenter();
div.innerHTML = "<a href='search.html#" +
center.lng + "/" +
tileserver.currentHeight.from +
"/" + center.lat +
"'><img src='pics/search.png'></a>";
}
map.on("moveend", update);
tileserver.mapLoadedCallbacks.push(update);
return div;
},
onRemove: function(map) {
}
});
L.control.searchButton = function(opts) {
return new L.Control.SearchButton(opts);
}
var el = L.control.searchButton({ position: 'topright' });
tileserver.mapElements.push(el);
})();

View File

@ -1,25 +1,5 @@
(function(){
L.Control.Search = L.Control.extend({
onAdd: function(map) {
var div = L.DomUtil.create('div', 'leaflet-bar leaflet-custom-display');
div.innerHTML = "<input type='text' placeholder='Search'/>";
return div;
},
onRemove: function(map) {
}
});
L.control.search = function(opts) {
return new L.Control.Search(opts);
}
var el = L.control.search({ position: 'bottomright' });
tileserver.mapElements.push(el);
})();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,21 @@
<!DOCTYPE HTML>
<html style="height: 100%">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="theme-color" content="#000">
<title>Map search</title>
<style>
body {
height: 100%;
}
</style>
</head>
<body>
<script src="js/lib/moment.min.js"></script>
<script src="js/lib/mithril.min.js"></script>
</body>
</html>