add version with sidebar (as if)

This commit is contained in:
Gandalf 2023-06-28 17:38:18 +02:00
parent 29ce681599
commit 09e9d27269
4 changed files with 372 additions and 175 deletions

View file

@ -10,7 +10,7 @@ server {
listen 1314;
server_name HambiMap;
location /leaflet/ {
alias /home/bernhardt/Entwicklung/HambiMap/leaflet/Leaflet-1.9.4/;
root /home/bernhardt/Entwicklung/HambiMap;
autoindex on;
}
location / {

View file

@ -1,180 +1,10 @@
<!DOCTYPE html>
<html>
<title>Sketch HambiMap</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="w3.css">
<link rel="stylesheet" href="style.css">
<!--leaflet from CDN
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>-->
<!--self-served leaflet-->
<link rel="stylesheet" href="leaflet/leaflet.css">
<!--integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="-->
<script src="leaflet/leaflet.js">
<!--integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="-->
</script>
<script>
var modals=document.getElementsByClassName('w3-modal');
window.onclick = function(event) {
for(var j = 0; j < modals.length; ++j){
if (event.target == modals[j]) {
modals[j].style.display = "none";
}
}
}
function switch_modal(id){
for(var i = 0; i < modals.length; ++i){
modals[i].style.display = 'none';
}
if (id!='none'){
document.getElementById(id).style.display='block';
}
}
</script>
<body>
<div id="modals">
<div id="modal_view_treehouse" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="treehouse_view.html"></iframe>
</div>
</div>
</div>
<!-- The Modals -->
<div id="modal_view_tree" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="tree_view.html"></iframe>
</div>
</div>
</div>
<div id="modal_view_barrio" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="barrio_view.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_treehouse" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="treehouse_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_tree" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="tree_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_barrio" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="barrio_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_story" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="story_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_photo" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="photo_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_comment" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="comment_form.html"></iframe>
</div>
</div>
<div id="modal_form_house" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="house_form.html"></iframe>
</div>
</div>
</div>
</div>
</div>
<div class="w3-container" id="site_body">
<h2>Stories of Hambi</h2>
<!-- Trigger/Open the Modals -->
<button onclick="switch_modal('modal_view_treehouse')" class="w3-button">View Treehouse</button>
<button onclick="switch_modal('modal_view_barrio')" class="w3-button">View Barrio</button>
<button onclick="switch_modal('modal_view_tree')" class="w3-button">View Tree</button>
<button onclick="switch_modal('modal_form_treehouse')" class="w3-button">Add Treehouse</button>
<button onclick="switch_modal('modal_form_barrio')" class="w3-button">Add Barrio</button>
<a href="user_form.html" class="w3-button">Register</a>
<a href="login_form.html" class="w3-button">Login</a>
<div id="map"></div>
</div>
<script>
var map = L.map('map').setView([50.880301, 6.560531], 13,);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { minZoom: 12, maxZoom: 19, attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' }).addTo(map);
var barrio_markers = L.layerGroup(); //overlay where all barrio markers will be added
var tree_markers = L.layerGroup(); //overlay where all tree(house) markers will be added
var test_tree_marker = L.marker([50.880301, 6.560531]).addTo(tree_markers);
map.addLayer(tree_markers);
function onMapClick(e){} //for adding a tree(house)
function onMapZoom(e){ //for deciding wether to show barrios or treehouses
if (map.getZoom() > 16) {
map.addLayer(barrio_markers);
map.removeLayer(tree_markers);
}
if (map.getZoom() <= 16) {
map.addLayer(tree_markers);
map.removeLayer(barrio_markers);
}
}
function onMapMouseDown(e){} //probably needed for Barrio creation
function onMapMouseUp(e){} //^^
function onMapContextMenu(e){}//probably neat for something
map.on('click', onMapClick);
map.on('zoom', onMapZoom);
map.on('mousedown', onMapMouseDown);
map.on('mouseup', onMapMouseUp);
map.on('contextMenu', onMapContextMenu);
</script>
<h2>Sketch HambiMap</h2>
<a href="main_with_title.html">Sketch with a title area above the map</a>
<br/>
<a href="main_with_sidebar.html">Sketch where I moved all the stuff from the title area to a sidebar</a>
</body>
</html>

View file

@ -0,0 +1,187 @@
<!DOCTYPE html>
<html>
<title>Sketch HambiMap</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="w3.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="leaflet/leaflet-sidebar-v2/css/leaflet-sidebar.css">
<!--leaflet from CDN
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>-->
<!--self-served leaflet-->
<link rel="stylesheet" href="leaflet/Leaflet-1.9.4/leaflet.css">
<!--integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="-->
<script src="leaflet/Leaflet-1.9.4/leaflet.js">
<!--integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="-->
</script>
<script href="leaflet/leaflet-sidebar-v2/js/leaflet-sidebar.js"></script>
<script>
var modals=document.getElementsByClassName('w3-modal');
window.onclick = function(event) {
for(var j = 0; j < modals.length; ++j){
if (event.target == modals[j]) {
modals[j].style.display = "none";
}
}
}
function switch_modal(id){
for(var i = 0; i < modals.length; ++i){
modals[i].style.display = 'none';
}
if (id!='none'){
document.getElementById(id).style.display='block';
}
}
</script>
<body>
<div id="modals">
<div id="modal_view_treehouse" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="treehouse_view.html"></iframe>
</div>
</div>
</div>
<!-- The Modals -->
<div id="modal_view_tree" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="tree_view.html"></iframe>
</div>
</div>
</div>
<div id="modal_view_barrio" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="barrio_view.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_treehouse" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="treehouse_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_tree" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="tree_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_barrio" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="barrio_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_story" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="story_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_photo" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="photo_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_comment" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="comment_form.html"></iframe>
</div>
</div>
<div id="modal_form_house" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="house_form.html"></iframe>
</div>
</div>
</div>
</div>
</div>
<div class="w3-container leaflet-sidebar collapsed" id="site_body">
<h2>Stories of Hambi</h2>
<!-- Trigger/Open the Modals -->
<button onclick="switch_modal('modal_view_treehouse')" class="w3-button">View Treehouse</button>
<button onclick="switch_modal('modal_view_barrio')" class="w3-button">View Barrio</button>
<button onclick="switch_modal('modal_view_tree')" class="w3-button">View Tree</button>
<button onclick="switch_modal('modal_form_treehouse')" class="w3-button">Add Treehouse</button>
<button onclick="switch_modal('modal_form_barrio')" class="w3-button">Add Barrio</button>
<a href="user_form.html" class="w3-button">Register</a>
<a href="login_form.html" class="w3-button">Login</a>
</div>
<div id="map" style="height: 100vh;"></div>
<script>
var map = L.map('map').setView([50.880301, 6.560531], 13,);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { minZoom: 12, maxZoom: 19, attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' }).addTo(map);
var barrio_markers = L.layerGroup(); //overlay where all barrio markers will be added
var tree_markers = L.layerGroup(); //overlay where all tree(house) markers will be added
var test_tree_marker = L.marker([50.880301, 6.560531]).addTo(tree_markers);
map.addLayer(tree_markers);
var sidebar = L.control.sidebar({
container: 'site_body', // the DOM container or #ID of a predefined sidebar container that should be used
}).addTo(map);
function onMapClick(e){} //for adding a tree(house)
function onMapZoom(e){ //for deciding wether to show barrios or treehouses
if (map.getZoom() > 16) {
map.addLayer(barrio_markers);
map.removeLayer(tree_markers);
}
if (map.getZoom() <= 16) {
map.addLayer(tree_markers);
map.removeLayer(barrio_markers);
}
}
function onMapMouseDown(e){} //probably needed for Barrio creation
function onMapMouseUp(e){} //^^
function onMapContextMenu(e){}//probably neat for something
map.on('click', onMapClick);
map.on('zoom', onMapZoom);
map.on('mousedown', onMapMouseDown);
map.on('mouseup', onMapMouseUp);
map.on('contextMenu', onMapContextMenu);
</script>
</body>
</html>

View file

@ -0,0 +1,180 @@
<!DOCTYPE html>
<html>
<title>Sketch HambiMap</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="w3.css">
<link rel="stylesheet" href="style.css">
<!--leaflet from CDN
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>-->
<!--self-served leaflet-->
<link rel="stylesheet" href="leaflet/Leaflet-1.9.4/leaflet.css">
<!--integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="-->
<script src="leaflet/Leaflet-1.9.4/leaflet.js">
<!--integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="-->
</script>
<script>
var modals=document.getElementsByClassName('w3-modal');
window.onclick = function(event) {
for(var j = 0; j < modals.length; ++j){
if (event.target == modals[j]) {
modals[j].style.display = "none";
}
}
}
function switch_modal(id){
for(var i = 0; i < modals.length; ++i){
modals[i].style.display = 'none';
}
if (id!='none'){
document.getElementById(id).style.display='block';
}
}
</script>
<body>
<div id="modals">
<div id="modal_view_treehouse" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="treehouse_view.html"></iframe>
</div>
</div>
</div>
<!-- The Modals -->
<div id="modal_view_tree" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="tree_view.html"></iframe>
</div>
</div>
</div>
<div id="modal_view_barrio" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="barrio_view.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_treehouse" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="treehouse_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_tree" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="tree_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_barrio" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="barrio_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_story" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="story_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_photo" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="photo_form.html"></iframe>
</div>
</div>
</div>
<div id="modal_form_comment" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="comment_form.html"></iframe>
</div>
</div>
<div id="modal_form_house" class="w3-modal">
<div class="w3-modal-content">
<div class="w3-container">
<span onclick="switch_modal('none');"
class="w3-button w3-display-topright">&times;</span>
<iframe src="house_form.html"></iframe>
</div>
</div>
</div>
</div>
</div>
<div class="w3-container" id="site_body">
<h2>Stories of Hambi</h2>
<!-- Trigger/Open the Modals -->
<button onclick="switch_modal('modal_view_treehouse')" class="w3-button">View Treehouse</button>
<button onclick="switch_modal('modal_view_barrio')" class="w3-button">View Barrio</button>
<button onclick="switch_modal('modal_view_tree')" class="w3-button">View Tree</button>
<button onclick="switch_modal('modal_form_treehouse')" class="w3-button">Add Treehouse</button>
<button onclick="switch_modal('modal_form_barrio')" class="w3-button">Add Barrio</button>
<a href="user_form.html" class="w3-button">Register</a>
<a href="login_form.html" class="w3-button">Login</a>
<div id="map"></div>
</div>
<script>
var map = L.map('map').setView([50.880301, 6.560531], 13,);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { minZoom: 12, maxZoom: 19, attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' }).addTo(map);
var barrio_markers = L.layerGroup(); //overlay where all barrio markers will be added
var tree_markers = L.layerGroup(); //overlay where all tree(house) markers will be added
var test_tree_marker = L.marker([50.880301, 6.560531]).addTo(tree_markers);
map.addLayer(tree_markers);
function onMapClick(e){} //for adding a tree(house)
function onMapZoom(e){ //for deciding wether to show barrios or treehouses
if (map.getZoom() > 16) {
map.addLayer(barrio_markers);
map.removeLayer(tree_markers);
}
if (map.getZoom() <= 16) {
map.addLayer(tree_markers);
map.removeLayer(barrio_markers);
}
}
function onMapMouseDown(e){} //probably needed for Barrio creation
function onMapMouseUp(e){} //^^
function onMapContextMenu(e){}//probably neat for something
map.on('click', onMapClick);
map.on('zoom', onMapZoom);
map.on('mousedown', onMapMouseDown);
map.on('mouseup', onMapMouseUp);
map.on('contextMenu', onMapContextMenu);
</script>
</body>
</html>