Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions js/parking_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,23 @@ function getPaymentMethods(val) {
}
}

function renderLoader() {
let loader = document.createElement('div');
loader.className = 'loader';
document.body.insertBefore(loader, document.body.firstChild);
}

function removeLoader() {
let loader = document.querySelector('.loader');
if (loader) document.body.removeChild(loader);
}

let featuresLayerGroup

function queryArcGIS(map) {

let loader = document.querySelector('.loader');
if (!loader) renderLoader();
conditions = []

conditions.push('even_is_parking_available IS NOT NULL AND odd_is_parking_available IS NOT NULL')
Expand Down Expand Up @@ -120,18 +134,19 @@ function queryArcGIS(map) {

} else {
lines.push('No parking available')

}

return lines.join('<br>')

}).addTo(map)
}).addTo(map);

removeLoader();

}
})
}

$(document).ready(() => {

const map = L.map("parking-map").setView([39.743624, -75.549839], 15);

const parkingGarages = new L.GeoJSON.AJAX("https://gist.githubusercontent.com/trescube/14dc08c9fe1d115308176efe88fb05dd/raw/230791df013d36bac441048fecba79b03c0a6916/wilmington_parking_garages.geojson", {
Expand All @@ -146,7 +161,7 @@ $(document).ready(() => {
queryArcGIS(map)

parkingGarages.addTo(map);

parkingGarages.bindTooltip(parkingGarage => {
const properties = parkingGarage.feature.properties

Expand All @@ -160,12 +175,12 @@ $(document).ready(() => {
})

$('.leaflet-control-layers').css({ 'width': '100', 'float': 'right' });

$('#hasMeters').change(queryArcGIS.bind(null, map))
$('#acceptsCreditCards').change(queryArcGIS.bind(null, map))
$('#acceptsParkMobile').change(queryArcGIS.bind(null, map))
$('#acceptsCoins').change(queryArcGIS.bind(null, map))
$('#freeSaturdayParking').change(queryArcGIS.bind(null, map))
$('#freeSundayParking').change(queryArcGIS.bind(null, map))
})

});

2 changes: 1 addition & 1 deletion js/parking_map_data_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ L.Control.ParkingInput = L.Control.extend({

const inputPanel = L.DomUtil.create('div', 'panel panel-default', container)
inputPanel.innerHTML =
'<h3>Wilmington, DE</h3>' +
'<h4>Wilmington, DE</h4>' +
'<form id="filter-parking-form">' +
'<div>' +
'<label>' +
Expand Down
79 changes: 79 additions & 0 deletions parking_map.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
body {
margin:0;
padding:0;
}

#parking-map {
position: absolute;
top:0;
bottom:0;
right:0;
left:0;
z-index: 0;
}

#parking-map .container .panel.panel-default {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
padding: 5px;
max-width: 30vw;
max-height: 40vh;
min-width: 200px;
min-height: 200px;
float: right;
background-color: rgba(255,255,255,0.8);
box-shadow: 0px 2px 1px 0px;
}

#parking-map #filter-parking-form {
margin: 0px;
}

#parking-map #filter-parking-form input {
vertical-align: text-bottom;
}

#parking-map h4 {
font-weight: 900;
margin: 5px 0px 5px 0px
}

@keyframes spin {
0% { border: 16px solid rgba(0,0,0,0); border-top: 16px solid rgb(200,0,0); border-bottom: 16px solid rgb(200,0,0); transform: rotate(0deg); }
50% { border: 16px solid rgba(0,0,0,0); border-top: 16px solid rgb(0,0,200); border-bottom: 16px solid rgb(0,0,200); transform: rotate(180deg); }
100% { border: 16px solid rgba(0,0,0,0); border-top: 16px solid rgb(200,0,0); border-bottom: 16px solid rgb(200,0,0); transform: rotate(360deg); }
}

@-webkit-keyframes safarispin {
0% { border: 16px solid rgba(0,0,0,0); border-top: 16px solid rgb(200,0,0); border-bottom: 16px solid rgb(200,0,0); -webkit-transform: rotate(0deg); }
50% { border: 16px solid rgba(0,0,0,0); border-top: 16px solid rgb(0,0,200); border-bottom: 16px solid rgb(0,0,200); -webkit-transform: rotate(180deg); }
100% { border: 16px solid rgba(0,0,0,0); border-top: 16px solid rgb(200,0,0); border-bottom: 16px solid rgb(200,0,0); -webkit-transform: rotate(360deg); }
}

@-ms-keyframes msspin {
0% { border: 16px solid rgba(0,0,0,0); border-top: 16px solid rgb(200,0,0); border-bottom: 16px solid rgb(200,0,0); -webkit-transform: rotate(0deg); }
50% { border: 16px solid rgba(0,0,0,0); border-top: 16px solid rgb(0,0,200); border-bottom: 16px solid rgb(0,0,200); -webkit-transform: rotate(180deg); }
100% { border: 16px solid rgba(0,0,0,0); border-top: 16px solid rgb(200,0,0); border-bottom: 16px solid rgb(200,0,0); -webkit-transform: rotate(360deg); }
}

.loader {
position: absolute;
width: 100px;
height: 100px;
top: 25vh;
left: 25vw;
margin-top: calc(25vh - 50px);
margin-bottom: calc(25vh - 50px);
margin-left: calc(25vw - 50px);
margin-right: calc(25vw - 50px);
border-radius: 50%;
border: 16px solid rgba(0,0,0,0);
border-top: 16px solid rgb(0,0,0);
border-bottom: 16px solid rgb(0,0,0);
z-index: 100;
animation: spin 3s linear infinite;
-webkit-animation: safarispin 3s linear infinite;
-ms-animation: msspin 3s linear infinite;
}
11 changes: 2 additions & 9 deletions parking_map.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">

<link rel="stylesheet" href="parking_map.css" />

<!-- Load Leaflet from CDN -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css"
integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ=="
Expand All @@ -26,15 +28,6 @@
<script src="https://js.arcgis.com/4.7/"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-ajax/2.1.0/leaflet.ajax.js"></script>

<style>
body { margin:0; padding:0; }
#parking-map { position: absolute; top:0; bottom:0; right:0; left:0; }
#parking-map .container .panel.panel-default { display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
padding: 5px; max-width: 30vw; max-height: 40vh; min-width: 250px; min-height: 200px; float: right; }
#parking-map #filter-parking-form { margin: 0px; }
#parking-map #filter-parking-form input { vertical-align: text-bottom; }
#parking-map h3 { font-weight: 900; margin: 5px 0px 5px 0px }
</style>
</head>
<body>
<div id="parking-map"></div>
Expand Down