HambiMap/sketch/html/index.html

181 lines
6.1 KiB
HTML

<!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>
</body>
</html>