Merge branch 'midgard-master'

This commit is contained in:
redfast00 2020-05-22 18:37:20 +02:00
commit 4aceb15174
No known key found for this signature in database
GPG Key ID: 5946E0E34FD0553C
47 changed files with 1010 additions and 784 deletions

19
.editorconfig Normal file
View File

@ -0,0 +1,19 @@
# https://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
quote_type = double
[*.html]
indent_size = 2
[*.svg]
indent_style = tab
indent_size = unset

View File

@ -2,7 +2,7 @@
A useful map that lists all the public study locations in Ghent.
We usually use data from [Stad Gent](https://stad.gent/studenten/studeren/bloklocaties) and emails sent by people..
Data is managed in a separate project, [Blokdata](https://github.com/ZeusWPI/Blokdata).
## Development
@ -11,5 +11,3 @@ You can easily run the site locally by spawning a simple static file server in t
```
(cd src/; python3 -m http.server)
```
You can also validate the JSON with `(cd src/; python -m json.tool data.json > /dev/null)`. If there are no errors, there will be no output.

View File

@ -13,9 +13,6 @@ echo "-> Pulling latest release"
# Apparently, some systems put "up to date", while others put "up-to-date"
git pull | grep 'Already up[- ]to[- ]date.' && echo "No updates, exiting..." && exit 20
echo "-> Checking validity of data.json"
python -m json.tool src/data.json > /dev/null
# Create release dir and copy sources to that dir
echo "-> This release will be stored in $release_dir"

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,29 @@
html, body {
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
}
#map {
width: 100%;
height: 100%;
width: 100%;
height: 100%;
}
.leaflet-popup-content-wrapper,
.leaflet-control-zoom {
border-radius: 0px;
border-radius: 0px;
}
.leaflet-popup-content-wrapper {
width: 600px;
max-height: 400px;
overflow-y:auto
width: 600px;
max-height: 400px;
overflow-y: auto;
overflow-wrap: anywhere;
}
.leaflet-popup-content {
width:auto !important;
width: auto !important;
}
a img {
@ -35,12 +36,20 @@ h4 {
margin-bottom: 5px;
}
.location, .period {
margin-bottom: 3px;
}
table {
padding-bottom: 10px;
border-spacing: 0;
width: 100%
}
td {
white-space: pre-line;
}
.desktop tr td {
padding-right: 5px;
width: 75;
@ -48,8 +57,8 @@ table {
}
.mobile tr td:first-child {
padding: 0;
padding-right: 10px;
padding: 0;
padding-right: 10px;
}
.mobile tr:nth-child(2n) {
@ -61,32 +70,53 @@ table {
font: 14px/16px Arial, Helvetica, sans-serif;
background: white;
background: rgba(255,255,255,0.0);
text-align: right;
}
#zeus {
padding-left: 10px;
.author-icon {
margin-left: 10px;
}
#GSR {
float: right;
.share {
background-color: rgba(255, 255, 255, 0.7);
padding-right: 5px;
margin-left: 10px;
}
.share img {
vertical-align: middle;
margin-left: -10px;
}
.share a {
text-decoration: none;
}
.share a:hover {
text-decoration: underline;
}
a.img-and-text-link:hover {
text-decoration: none;
}
a.img-and-text-link:hover span {
text-decoration: underline;
}
.legend {
height: 52px;
width: 130px;
background-color: #fff;
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
height: 52px;
width: 130px;
background-color: #fff;
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
}
.holiday-legend {
height: 72px;
width: 145px;
background-color: #fff;
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
height: 72px;
width: 145px;
background-color: #fff;
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
}
.legend .holiday {
display: none;
display: none;
}
.type {
@ -119,18 +149,14 @@ table {
width: 213px;
}
h3, .text {
max-width: 150px;
.location, .period {
margin-bottom: 8px;
}
}
@media screen and (max-width: 800px) {
.info {
max-width: 90px;s
}
#zeus {
width: 75px;
.author-icon {
display: block;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
src/img/Andere.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

61
src/img/facebook.svg Normal file
View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="20"
height="20"
version="1.1"
id="svg8"
sodipodi:docname="facebook.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata14">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs12" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1043"
id="namedview10"
showgrid="false"
inkscape:zoom="22.627417"
inkscape:cx="9.2776978"
inkscape:cy="-0.76716337"
inkscape:window-x="0"
inkscape:window-y="37"
inkscape:window-maximized="1"
inkscape:current-layer="svg8" />
<path
style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:18.33872604;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
d="M 11.571808,19.876973 C 11.059776,19.957939 10.534798,20 10,20 9.470853,20 8.9513195,19.958841 8.4444262,19.879533 -16.009211,-2.1035465 38.618255,-2.3039341 11.571808,19.877009 Z"
id="path821"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cscc" />
<path
d="M 20,10.001126 C 20,4.4780969 15.522407,0 10,0 4.4775931,0 0,4.4780969 0,10.001126 c 0,4.991368 3.6563075,9.129087 8.4376465,9.880155 V 12.892716 H 5.8978981 v -2.89159 H 8.4376465 V 7.7971424 c 0,-2.5061407 1.4934564,-3.8916303 3.7772645,-3.8916303 1.094081,0 2.238707,0.195555 2.238707,0.195555 v 2.4612498 h -1.26142 c -1.241735,0 -1.629862,0.7707181 -1.629862,1.5625655 v 1.8762246 h 2.773191 l -0.442965,2.891591 h -2.330281 v 6.988565 c 4.781339,-0.749661 8.437647,-4.887345 8.437647,-9.880336"
id="path4"
style="fill:#1877f2;fill-opacity:1;stroke-width:1.80274773"
inkscape:connector-curvature="0" />
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 KiB

After

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 KiB

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -1,11 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<html lang="nl">
<head>
<meta charset="utf-8">
<title>Bloklocaties in Vlaanderen</title>
<meta name="apple-itunes-app" content="app-id=602640924">
<meta name="google-play-app" content="app-id=be.ugent.zeus.hydra">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta property="og:site_name" content="Zeus WPI">
<meta property="og:type" content="article">
@ -20,123 +20,114 @@
<meta name="twitter:description" content="Heb je nood aan een plek om te blokken? Zeus en de Gentse Studentenraad maakten een overzicht van alle beschikbare bloklocaties op één kaart.">
<meta name="twitter:image" content="https://blok.ugent.be/img/share_square.png">
<link rel="stylesheet" href="css/leaflet.css" />
<link rel="stylesheet" href="css/map.css" />
<link rel="stylesheet" href="css/leaflet-1.6.0.css">
<link rel="stylesheet" href="css/map.css">
<script type="text/javascript" src="js/leaflet.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js"></script>
<script type="text/javascript" src="js/leaflet-1.6.0.js"></script>
<script type="text/javascript" src="js/jquery-1.11.0.js"></script>
<script type="text/javascript" src="js/handlebars-2.0.0.js"></script>
<script type="text/javascript" src="js/map.js"></script>
</head>
<body>
<div id="map"></div>
<script id="popup-template" type="text/x-handlebars-template">
<div id="resto-popup">
<h3>{{name}} ({{capacity}} pl.)</h3>
<img src="img/{{type}}.png" class="type">
<div class="text">Locatie: {{address}}<br />
{{#if period.start}}
Van {{period.start}} tot {{period.end}}
<div class="location">Locatie: {{address}}</div>
<div class="period">{{#if period.start}}
Periode: {{date period.start}} tot {{date period.end}}
{{else}}
Open gedurende het hele jaar.
Open gedurende het hele jaar.
{{/if}}
</div>
<h4>Openingsuren</h4>
<table class="desktop">
<tr>
<td>Maandag</td>
<td>Dinsdag</td>
<td>Woensdag</td>
<td>Donderdag</td>
<td>Vrijdag</td>
<td>Zaterdag</td>
<td>Zondag</td>
</tr>
<tr>
<td>{{#if hours.monday}}{{{hours.monday}}}{{else}}Gesloten{{/if}}</td>
<td>{{#if hours.tuesday}}{{{hours.tuesday}}}{{else}}Gesloten{{/if}}</td>
<td>{{#if hours.wednesday}}{{{hours.wednesday}}}{{else}}Gesloten{{/if}}</td>
<td>{{#if hours.thursday}}{{{hours.thursday}}}{{else}}Gesloten{{/if}}</td>
<td>{{#if hours.friday}}{{{hours.friday}}}{{else}}Gesloten{{/if}}</td>
<td>{{#if hours.saturday}}{{{hours.saturday}}}{{else}}Gesloten{{/if}}</td>
<td>{{#if hours.sunday}}{{{hours.sunday}}}{{else}}Gesloten{{/if}}</td>
</tr>
<tr>
<td>Maandag</td>
<td>Dinsdag</td>
<td>Woensdag</td>
<td>Donderdag</td>
<td>Vrijdag</td>
<td>Zaterdag</td>
<td>Zondag</td>
</tr><tr>
<td>{{#if hours.monday}}{{hours.monday}}{{else}}Gesloten{{/if}}</td>
<td>{{#if hours.tuesday}}{{hours.tuesday}}{{else}}Gesloten{{/if}}</td>
<td>{{#if hours.wednesday}}{{hours.wednesday}}{{else}}Gesloten{{/if}}</td>
<td>{{#if hours.thursday}}{{hours.thursday}}{{else}}Gesloten{{/if}}</td>
<td>{{#if hours.friday}}{{hours.friday}}{{else}}Gesloten{{/if}}</td>
<td>{{#if hours.saturday}}{{hours.saturday}}{{else}}Gesloten{{/if}}</td>
<td>{{#if hours.sunday}}{{hours.sunday}}{{else}}Gesloten{{/if}}</td>
</tr>
</table>
<table class="mobile">
<tr>
<td>Maandag</td>
<td>{{#if hours.monday}}{{{hours.monday}}}{{else}}Gesloten{{/if}}</td>
</tr>
<tr>
<td>Dinsdag</td>
<td>{{#if hours.tuesday}}{{{hours.tuesday}}}{{else}}Gesloten{{/if}}</td>
</tr>
<tr>
<td>Woensdag</td>
<td>{{#if hours.wednesday}}{{{hours.wednesday}}}{{else}}Gesloten{{/if}}</td>
</tr>
<tr>
<td>Donderdag</td>
<td>{{#if hours.thursday}}{{{hours.thursday}}}{{else}}Gesloten{{/if}}</td>
<td>{{#if hours.monday}}{{hours.monday}}{{else}}Gesloten{{/if}}</td>
</tr><tr>
<td>Vrijdag</td>
<td>{{#if hours.friday}}{{{hours.friday}}}{{else}}Gesloten{{/if}}</td>
</tr>
<tr>
<td>Zaterdag</td>
<td>{{#if hours.saturday}}{{{hours.saturday}}}{{else}}Gesloten{{/if}}</td>
</tr>
<tr>
<td>Zondag</td>
<td>{{#if hours.sunday}}{{{hours.sunday}}}{{else}}Gesloten{{/if}}</td>
<td>Dinsdag</td>
<td>{{#if hours.tuesday}}{{hours.tuesday}}{{else}}Gesloten{{/if}}</td>
</tr><tr>
<td>Woensdag</td>
<td>{{#if hours.wednesday}}{{hours.wednesday}}{{else}}Gesloten{{/if}}</td>
</tr><tr>
<td>Donderdag</td>
<td>{{#if hours.thursday}}{{hours.thursday}}{{else}}Gesloten{{/if}}</td>
</tr><tr>
<td>Vrijdag</td>
<td>{{#if hours.friday}}{{hours.friday}}{{else}}Gesloten{{/if}}</td>
</tr><tr>
<td>Zaterdag</td>
<td>{{#if hours.saturday}}{{hours.saturday}}{{else}}Gesloten{{/if}}</td>
</tr><tr>
<td>Zondag</td>
<td>{{#if hours.sunday}}{{hours.sunday}}{{else}}Gesloten{{/if}}</td>
</tr>
</table>
{{#if extra}}{{{extra}}}{{/if}}
</div>
</script>
<script id="info-template" type="text/x-handlebars-template">
<a href="http://zeus.ugent.be/"><img id="zeus" src="img/zeus.png"></a>
<a href="https://gentsestudentenraad.be/"><img id="GSR" src="img/GSR.png"></a>
<a href="https://zeus.gent/" class="author-icon"><img src="img/zeus.png" alt="Zeus WPI"></a>
<a href="https://gentsestudentenraad.be/" class="author-icon"><img src="img/GSR.png" alt="Gentse Studentenraad"></a>
</script>
<script id="share-template" type="text/x-handlebars-template">
<div class="fb-share-button" data-href="//blok.ugent.be" data-layout="button_count"></div>
</script>
<script id="legend-template" type="text/x-handlebars-template">
<div style="padding-top: 5px;">
<div style="width: 125px; height: 18px; padding-top: 5px; padding-left: 5px;">
<div style="height: 10px; width: 10px; background: rgb(209,39,35); margin-top: -1px; margin-left: 5px;"></div>
<span style="position: absolute; left: 25px; top: 5px;">Week en weekend</span>
</div>
<div style="width: 125px; height: 18px; padding-top: 5px; padding-left: 5px;">
<div style="height: 10px; width: 10px; background: rgb(36, 126, 202); margin-top: 1px; margin-left: 5px;"></div>
<span style="position: absolute; left: 25px; top: 30px;">Enkel week</span>
</div>
<div style="width: 140px; height: 18px; padding-top: 5px; padding-left: 5px;" class="holiday">
<div style="height: 10px; width: 10px; background: rgb(121, 230, 121); margin-top: 0px; margin-left: 5px;"></div>
<span style="position: absolute; left: 25px; top: 53px;">Tijdens kerstvakantie</span>
</div>
<div class="share">
<a href="https://www.facebook.com/Blokmap-Vlaanderen-105861927804347/" class="img-and-text-link"><img src="img/facebook.svg" alt=""> <span>Facebookpagina</span></a> |
<a href="https://docs.google.com/forms/d/e/1FAIpQLSeLlxXAr932j4SA-JUweKZYl-1mbx8wY-JCuBJ39xAYrDPo_A/viewform">Locatie melden</a>
</div>
</script>
<script id="legend-template" type="text/x-handlebars-template">
<div style="padding-top: 5px;">
<div style="width: 125px; height: 18px; padding-top: 5px; padding-left: 5px;">
<div style="height: 10px; width: 10px; background: rgb(209,39,35); margin-top: -1px; margin-left: 5px;"></div>
<span style="position: absolute; left: 25px; top: 5px;">Week en weekend</span>
</div>
<div style="width: 125px; height: 18px; padding-top: 5px; padding-left: 5px;">
<div style="height: 10px; width: 10px; background: rgb(36, 126, 202); margin-top: 1px; margin-left: 5px;"></div>
<span style="position: absolute; left: 25px; top: 30px;">Enkel week</span>
</div>
<div style="width: 140px; height: 18px; padding-top: 5px; padding-left: 5px;" class="holiday">
<div style="height: 10px; width: 10px; background: rgb(121, 230, 121); margin-top: 0px; margin-left: 5px;"></div>
<span style="position: absolute; left: 25px; top: 53px;">Tijdens kerstvakantie</span>
</div>
</div>
</script>
<!-- Facebook SDK -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=146947948791011&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- Google Analytics SDK -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-25444917-8', 'auto');
ga('send', 'pageview');
})(window,document,"script","//www.google-analytics.com/analytics.js","ga");
ga("create", "UA-25444917-8", "auto");
ga("send", "pageview");
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

4
src/js/jquery-1.11.0.js vendored Normal file

File diff suppressed because one or more lines are too long

5
src/js/leaflet-1.6.0.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,173 +1,162 @@
$(document).ready(function() {
/* change image path */
L.Icon.Default.imagePath = 'img';
L.Icon.Default.imagePath = "img/";
var popuptemplate = Handlebars.compile($("#popup-template").html());
var popuptemplate = Handlebars.compile($('#popup-template').html());
var RedIcon = L.Icon.Default.extend({
options: {
iconUrl: 'img/red-marker.png'
iconUrl: "red-marker.png"
}
});
var ChristmasIcon = L.Icon.Default.extend({
options: {
iconUrl: 'img/christmas-marker.png'
iconUrl: "christmas-marker.png"
}
});
var blueIcon = new L.Icon.Default();
var redIcon = new RedIcon();
var BlueIcon = L.Icon.Default.extend({});
var blueIcon = new BlueIcon();
var christmasIcon = new ChristmasIcon();
var christmasHoliday = Date.now() < new Date("2016-01-04").getTime();
var now = new Date();
var christmasSeason =
now.getTime() > new Date(now.getFullYear() + "-12-20").getTime() ||
now.getTime() < new Date(now.getFullYear() + "-01-04").getTime();
function onEachFeature(feature, layer) {
if (feature.properties) {
layer.bindPopup(popuptemplate(feature.properties), {
showOnMouseOver: true
showOnMouseOver: true
});
}
}
function pointToLayer(feature, latlng) {
var marker = new HoverMarker(latlng, { icon: redIcon, riseOnHover: true});
if (feature.properties) {
if (feature.properties.holidays && christmasHoliday) {
var marker = new HoverMarker(latlng, { icon: christmasIcon, riseOnHover: true});
var icon = redIcon;
if (feature.properties) {
if (feature.properties.holidays && christmasSeason) {
icon = christmasIcon;
} else if (!feature.properties.hours.saturday && !feature.properties.hours.sunday) {
icon = blueIcon;
}
}
if (!feature.properties.hours.saturday && !feature.properties.hours.sunday) {
var marker = new HoverMarker(latlng, { icon: blueIcon, riseOnHover: true});
}
}
return marker
return new HoverMarker(latlng, { icon: icon, riseOnHover: true});
}
var map = L.map('map').setView([50.702, 4.335], 9);
var osm = L.tileLayer('https://{s}.tiles.mapbox.com/v3/feliciaan.keoaj8d5/{z}/{x}/{y}{r}.png', {
attribution: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> | © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>-contributors | Made with ❤ by <a href="https://zeus.ugent.be">Zeus WPI</a>',
detectRetina: true
var map = L.map("map").setView([50.702, 4.335], 9);
var osm = L.tileLayer("https://{s}.tiles.mapbox.com/v3/feliciaan.keoaj8d5/{z}/{x}/{y}{r}.png", {
attribution: 'Achtergrondkaart © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>-bijdragers (data) en © <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> (stijl) | <span lang="en">Made with ❤ by <a href="https://zeus.gent/">Zeus WPI</a></span>',
detectRetina: true
}).addTo(map);
$.getJSON('https://blokdata.zeus.gent/data.json')
.done(function(data) {
var geojson = L.geoJson(data, {
onEachFeature: onEachFeature,
pointToLayer: pointToLayer
$.getJSON("https://blokdata.zeus.gent/data.json")
.done(function(data) {
var geojson = L.geoJson(data, {
onEachFeature: onEachFeature,
pointToLayer: pointToLayer
});
map.addLayer(geojson);
});
map.addLayer(geojson);
});
var SimpleControl = L.Control.extend({
initialize: function(templateId, divClass, options) {
this.template = Handlebars.compile($(templateId).html());
this.divClass = divClass;
L.Util.setOptions(this, options);
},
initialize: function(templateId, divClass, options) {
this.template = Handlebars.compile($(templateId).html());
this.divClass = divClass;
L.Util.setOptions(this, options);
},
onAdd: function (map) {
this._div = L.DomUtil.create('div', this.divClass);
this._div.innerHTML = this.template();
onAdd: function (map) {
this._div = L.DomUtil.create("div", this.divClass);
this._div.innerHTML = this.template();
return this._div;
}
return this._div;
}
});
// code copied from http://jsfiddle.net/sowelie/3JbNY/
var HoverMarker = L.Marker.extend({
bindPopup: function(htmlContent, options) {
if (options && options.showOnMouseOver) {
// call the super method
L.Marker.prototype.bindPopup.apply(this, [htmlContent, options]);
// unbind the click event
this.off("click", this.openPopup, this);
// bind to mouse over
this.on("mouseover", function(e) {
// get the element that the mouse hovered onto
var target = e.originalEvent.fromElement || e.originalEvent.relatedTarget;
var parent = this._getParent(target, "leaflet-popup");
// check to see if the element is a popup, and if it is this marker's popup
if (parent == this._popup._container)
return true;
// show the popup
this.openPopup();
}, this);
// and mouse out
this.on("mouseout", function(e) {
// get the element that the mouse hovered onto
var target = e.originalEvent.toElement || e.originalEvent.relatedTarget;
// check to see if the element is a popup
if (this._getParent(target, "leaflet-popup")) {
L.DomEvent.on(this._popup._container, "mouseout", this._popupMouseOut, this);
return true;
bindPopup: function(htmlContent, options) {
if (options && options.showOnMouseOver) {
L.Marker.prototype.bindPopup.apply(this, [htmlContent, options]);
this.off("click", this.openPopup, this);
this.on("mouseover", function(e) {
// get the element that the mouse hovered onto
var target = e.originalEvent.fromElement || e.originalEvent.relatedTarget;
var ancestor = this._findAncestorWithClass(target, "leaflet-popup");
// check to see if the element is a popup, and if it is this marker's popup
if (ancestor && ancestor === this._popup._container)
return true;
this.openPopup();
}, this);
this.on("mouseout", function(e) {
// get the element that the mouse hovered onto
var target = e.originalEvent.toElement || e.originalEvent.relatedTarget;
// check to see if the element is a popup
if (this._findAncestorWithClass(target, "leaflet-popup")) {
L.DomEvent.on(this._popup._container, "mouseout", this._popupMouseOut, this);
return true;
}
this.closePopup();
}, this);
}
// hide the popup
},
_popupMouseOut: function(e) {
// detach the event
L.DomEvent.off(this._popup, "mouseout", this._popupMouseOut, this);
// get the element that the mouse hovered onto
var target = e.toElement || e.relatedTarget;
// check to see if the element is a popup
if (this._findAncestorWithClass(target, "leaflet-popup"))
return true;
// check to see if the marker was hovered back onto
if (target === this._icon)
return true;
this.closePopup();
}, this);
},
_findAncestorWithClass: function(element, className) {
while (element) {
if (element.className && L.DomUtil.hasClass(element, className))
return element;
element = element.parentNode;
}
return null;
}
},
_popupMouseOut: function(e) {
// detach the event
L.DomEvent.off(this._popup, "mouseout", this._popupMouseOut, this);
// get the element that the mouse hovered onto
var target = e.toElement || e.relatedTarget;
// check to see if the element is a popup
if (this._getParent(target, "leaflet-popup"))
return true;
// check to see if the marker was hovered back onto
if (target == this._icon)
return true;
// hide the popup
this.closePopup();
},
_getParent: function(element, className) {
var parent = element.parentNode;
while (parent != null) {
if (parent.className && L.DomUtil.hasClass(parent, className))
return parent;
parent = parent.parentNode;
}
return false;
}
});
var info = new SimpleControl('#info-template', 'info', {
position: 'topright'
var info = new SimpleControl("#info-template", "info", {
position: "topright"
}).addTo(map);
var sharePane = new SimpleControl('#share-template', 'info', {
position: 'bottomleft'
var sharePane = new SimpleControl("#share-template", "info", {
position: "bottomleft"
}).addTo(map);
var legend = new SimpleControl('#legend-template', christmasHoliday ? "holiday-legend" : "legend", {
position: 'bottomright'
var legend = new SimpleControl("#legend-template", christmasSeason ? "holiday-legend" : "legend", {
position: "bottomright"
}).addTo(map);
Handlebars.registerHelper("date", function (ddmyyyy) {
return ddmyyyy.replace(/-/g, "/");
})
});