Compare commits

..

6 Commits

Author SHA1 Message Date
db040050c4 Ajoutes les prochaine date sur la page d'accueil 2024-02-14 13:42:19 +01:00
0bc592530b Fix Map Width 2022-10-12 12:30:53 +02:00
c9ee674b2d Add Map in Posts 2022-10-07 18:31:03 +02:00
6dfa8dad9b Add Leaflet 2022-10-07 16:58:52 +02:00
9ed7c5a582 Add License Name to Params 2022-04-20 13:51:25 +02:00
Gabriel
dad6bc2570 Modify licence text 2022-04-20 12:27:39 +02:00
15 changed files with 1870 additions and 2 deletions

View File

@@ -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 }}

View File

@@ -1,5 +1,7 @@
<footer class="footer"> <footer class="footer">
<span>Ce site est sous licence <a target="_blank" href="https://fr.wikipedia.org/wiki/Beerware">BeerWare &#127866;</a>. N'héstitez pas à nous payer une bière quand vous nous croisez !</span> {{ if .Site.Params.LicenseName }}
<span>Ce site est sous licence <a target="_blank" href="https://fr.wikipedia.org/wiki/Beerware">{{ .Site.Params.LicenseName }}</a>. {{ .Site.Params.LicenseDescription }}</span>
{{ end }}
<span>&copy; {{ now.Year }} {{ .Site.Params.Footer}}</span> <span>&copy; {{ now.Year }} {{ .Site.Params.Footer}}</span>
<span> <span>
Made with &#129416; using <a target="_blank" href="https://github.com/526avijitgupta/gokarna">Gokarna</a> Made with &#129416; using <a target="_blank" href="https://github.com/526avijitgupta/gokarna">Gokarna</a>

View 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>

View 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: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(leafletMapsObj[{{ $mapId }}]);
</script>

View 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>

View File

@@ -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

File diff suppressed because one or more lines are too long

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

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
View 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;