Compare commits
3 Commits
6dfa8dad9b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| db040050c4 | |||
| 0bc592530b | |||
| c9ee674b2d |
@@ -2,9 +2,6 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
{{- partial "head.html" . -}}
|
{{- partial "head.html" . -}}
|
||||||
<body>
|
<body>
|
||||||
{{ if .HasShortcode "leaflet-map" }}
|
|
||||||
{{ partial "leaflet-loader" . }}
|
|
||||||
{{ end }}
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// Immediately set theme on page load
|
// Immediately set theme on page load
|
||||||
setThemeByUserPref();
|
setThemeByUserPref();
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
{{ if isset .Site.Params "showpostsonhomepage" }}
|
{{ if isset .Site.Params "showpostsonhomepage" }}
|
||||||
|
|
||||||
<div class="home-posts list-posts">
|
<div class="home-posts list-posts">
|
||||||
<h2>{{ .Site.Params.ShowPostsOnHomePage | humanize }} Posts</h2>
|
<h2>Prochaines Dates</h2>
|
||||||
|
|
||||||
{{ $posts := where .Site.Pages "Params.type" "post" }}
|
{{ $posts := where .Site.Pages "Params.type" "post" }}
|
||||||
|
|
||||||
@@ -40,7 +40,14 @@
|
|||||||
{{ range $posts.ByDate.Reverse | first 4 }}
|
{{ range $posts.ByDate.Reverse | first 4 }}
|
||||||
{{- partial "list-posts.html" . -}}
|
{{- partial "list-posts.html" . -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ else if eq .Site.Params.ShowPostsOnHomePage "future" }}
|
||||||
|
{{ range $posts.ByDate }}
|
||||||
|
{{ if ge .Params.Date.Unix now.Unix }}
|
||||||
|
{{- partial "list-posts.html" . -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
28
layouts/partials/leaflet-loader.html
Normal file
28
layouts/partials/leaflet-loader.html
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<!-- Leaflet (JS/CSS) -->
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
|
||||||
|
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
|
||||||
|
crossorigin=""/>
|
||||||
|
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"
|
||||||
|
integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
|
||||||
|
crossorigin=""></script>
|
||||||
|
|
||||||
|
<!-- leaflet-elevation -->
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/@raruto/leaflet-elevation@1.1.1/dist/leaflet-elevation.css" />
|
||||||
|
<script src="{{ .Site.BaseURL }}/js/leaflet.elevation.js"></script>
|
||||||
|
|
||||||
|
<!-- leaflet-hugo -->
|
||||||
|
<script src="{{ .Site.BaseURL }}/js/leaflet.hugo.js"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.fa-icon-marker {
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.download-track {
|
||||||
|
background-color: #e1e1e1;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
border-radius: 0 0 10px 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
23
layouts/partials/leaflet-map.html
Normal file
23
layouts/partials/leaflet-map.html
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{{ $mapLat := default "" .mapLat }}
|
||||||
|
{{ $mapLon := default "" .mapLon }}
|
||||||
|
{{ $zoom := default "13" .zoom }}
|
||||||
|
{{ $mapWidth := default "100%" .mapWidth }}
|
||||||
|
{{ $mapHeight := default "400px" .mapHeight }}
|
||||||
|
{{ $mapId := default (md5 (printf "%s%s" $mapLat $mapLon)) .mapId }}
|
||||||
|
{{ $scrollWheelZoom := default "true" .scrollWheelZoom }}
|
||||||
|
|
||||||
|
<!--Container-->
|
||||||
|
<div id='mapid_{{ $mapId }}' class="leaflet-map" width="{{ $mapWidth }}" style='height: {{ $mapHeight}};'></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
//Create Map
|
||||||
|
leafletMapsObj[{{ $mapId }}] = L.map('mapid_{{ $mapId }}').setView([{{ $mapLat }}, {{ $mapLon }}], {{ $zoom }});
|
||||||
|
{{ if eq $scrollWheelZoom "false" }}
|
||||||
|
leafletMapsObj[{{ $mapId }}].scrollWheelZoom.disable();
|
||||||
|
{{ end }}
|
||||||
|
//Add tiles
|
||||||
|
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||||
|
}).addTo(leafletMapsObj[{{ $mapId }}]);
|
||||||
|
|
||||||
|
</script>
|
||||||
12
layouts/partials/leaflet-marker.html
Normal file
12
layouts/partials/leaflet-marker.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{{ $markerLat := default "" .markerLat }}
|
||||||
|
{{ $markerLon := default "" .markerLon }}
|
||||||
|
{{ $mapId := default (md5 (printf "%s%s" $markerLat $markerLon)) .mapId }}
|
||||||
|
{{ $markerId := md5 (printf "%s%s%s" $mapId $markerLat $markerLon)}}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
//Marker
|
||||||
|
leafletMarkersObj[{{ $markerId }}] = L.marker([{{ $markerLat }}, {{ $markerLon }}]).addTo(leafletMapsObj[{{ $mapId }}]);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
{{ $Lat := $.Param "Latitude" }}
|
||||||
|
{{ $Lon := $.Param "Longitude" }}
|
||||||
|
|
||||||
<div class="post container">
|
<div class="post container">
|
||||||
|
|
||||||
<div class="post-header-section">
|
<div class="post-header-section">
|
||||||
@@ -18,6 +21,12 @@
|
|||||||
<p>
|
<p>
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
</p>
|
</p>
|
||||||
|
{{ if (and (isset .Params "longitude") (isset .Params "latitude")) }}
|
||||||
|
{{ partial "leaflet-loader" . }}
|
||||||
|
<h3>Map</h3>
|
||||||
|
{{ partial "leaflet-map" (dict "context" . "mapHeight" "200px" "mapLat" $Lat "mapLon" $Lon) }}
|
||||||
|
{{ partial "leaflet-marker" (dict "context" . "markerLat" $Lat "markerLon" $Lon) }}
|
||||||
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
8
static/css/leaflet.extra-markers.min.css
vendored
Executable file
8
static/css/leaflet.extra-markers.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
BIN
static/img/markers_default.png
Executable file
BIN
static/img/markers_default.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 117 KiB |
BIN
static/img/markers_default@2x.png
Executable file
BIN
static/img/markers_default@2x.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 248 KiB |
BIN
static/img/markers_shadow.png
Executable file
BIN
static/img/markers_shadow.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 535 B |
BIN
static/img/markers_shadow@2x.png
Executable file
BIN
static/img/markers_shadow@2x.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
1660
static/js/leaflet.elevation.js
Normal file
1660
static/js/leaflet.elevation.js
Normal file
File diff suppressed because it is too large
Load Diff
1
static/js/leaflet.extra-markers.js.map
Executable file
1
static/js/leaflet.extra-markers.js.map
Executable file
File diff suppressed because one or more lines are too long
10
static/js/leaflet.extra-markers.min.js
vendored
Executable file
10
static/js/leaflet.extra-markers.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
108
static/js/leaflet.hugo.js
Normal file
108
static/js/leaflet.hugo.js
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
let leafletMapsObj = {};
|
||||||
|
let leafletMarkersObj = {};
|
||||||
|
|
||||||
|
function drawTrack(trackOpts, elevationOpts, markerOpts) {
|
||||||
|
var opts = {
|
||||||
|
elevationControl: {
|
||||||
|
options: {
|
||||||
|
position: elevationOpts.graphPosition,
|
||||||
|
theme: elevationOpts.graphTheme,
|
||||||
|
width: elevationOpts.graphWidth,
|
||||||
|
height: elevationOpts.graphHeight,
|
||||||
|
margins: {
|
||||||
|
top: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 35,
|
||||||
|
left: 50
|
||||||
|
},
|
||||||
|
followMarker: elevationOpts.graphFollowMarker,
|
||||||
|
collapsed: elevationOpts.graphCollapsed,
|
||||||
|
detached: elevationOpts.graphDetached,
|
||||||
|
legend: false,
|
||||||
|
summary: false,
|
||||||
|
downloadLink: '',
|
||||||
|
gpxOptions: {
|
||||||
|
polyline_options: {
|
||||||
|
className: 'track-' + trackOpts.trackId + '-',
|
||||||
|
color: trackOpts.lineColor,
|
||||||
|
opacity: trackOpts.lineOpacity,
|
||||||
|
weight: trackOpts.lineWeight,
|
||||||
|
},
|
||||||
|
marker_options: {
|
||||||
|
startIcon: new L.ExtraMarkers.icon({
|
||||||
|
icon: markerOpts.iconStart,
|
||||||
|
markerColor: markerOpts.iconStartColor,
|
||||||
|
shape: markerOpts.iconStartShape,
|
||||||
|
prefix: 'fa',
|
||||||
|
extraClasses: markerOpts.iconStartClasses
|
||||||
|
}),
|
||||||
|
endIcon: new L.ExtraMarkers.icon({
|
||||||
|
icon: markerOpts.iconEnd,
|
||||||
|
markerColor: markerOpts.iconEndColor,
|
||||||
|
shape: markerOpts.iconEndShape,
|
||||||
|
prefix: 'fa',
|
||||||
|
extraClasses: markerOpts.iconEndClasses
|
||||||
|
}),
|
||||||
|
wptIcons: {
|
||||||
|
'': new L.ExtraMarkers.icon({
|
||||||
|
icon: markerOpts.icon,
|
||||||
|
markerColor: markerOpts.iconColor,
|
||||||
|
shape: markerOpts.iconShape,
|
||||||
|
prefix: 'fa',
|
||||||
|
extraClasses: markerOpts.iconClasses,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
L.control.elevation(opts.elevationControl.options).addTo(leafletMapsObj[trackOpts.mapId]).load(trackOpts.trackPath);
|
||||||
|
|
||||||
|
/*map.on('eledata_loaded', function(e) {
|
||||||
|
track = e.track_info;
|
||||||
|
});*/
|
||||||
|
}
|
||||||
|
|
||||||
|
window.downloadFile = function (sUrl) {
|
||||||
|
|
||||||
|
//iOS devices do not support downloading. We have to inform user about this.
|
||||||
|
if (/(iP)/g.test(navigator.userAgent)) {
|
||||||
|
alert('Your device does not support files downloading. Please try again in desktop browser.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//If in Chrome or Safari - download via virtual link click
|
||||||
|
if (window.downloadFile.isChrome || window.downloadFile.isSafari) {
|
||||||
|
//Creating new link node.
|
||||||
|
var link = document.createElement('a');
|
||||||
|
link.href = sUrl;
|
||||||
|
|
||||||
|
if (link.download !== undefined) {
|
||||||
|
//Set HTML5 download attribute. This will prevent file from opening if supported.
|
||||||
|
var fileName = sUrl.substring(sUrl.lastIndexOf('/') + 1, sUrl.length);
|
||||||
|
link.download = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Dispatching click event.
|
||||||
|
if (document.createEvent) {
|
||||||
|
var e = document.createEvent('MouseEvents');
|
||||||
|
e.initEvent('click', true, true);
|
||||||
|
link.dispatchEvent(e);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force file download (whether supported by server).
|
||||||
|
if (sUrl.indexOf('?') === -1) {
|
||||||
|
sUrl += '?download';
|
||||||
|
}
|
||||||
|
|
||||||
|
window.open(sUrl, '_self');
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
window.downloadFile.isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
|
||||||
|
window.downloadFile.isSafari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
|
||||||
Reference in New Issue
Block a user