Sha256: b0d289f80a37d0e1f2e9dc946140c833e275890dc7239b8603f7fe440b3be8c5

Contents?: true

Size: 1.76 KB

Versions: 5

Compression:

Stored size: 1.76 KB

Contents

---
---

{% assign center = site.data.map.center | default: '47.788542883494856, 18.961139141737842' %}
{% assign zoom = site.data.map.zoom | default: 13 %}

var map = L.map("map").setView([{{ center }}], {{ zoom }});

L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);

{% if site.data.map.markers %}
{% for marker in site.data.map.markers %}
{% assign content = false %}
{% if marker.title %}
{% assign content = marker.title | prepend: '<strong>' | append: '</strong>' %}
{% endif %}
{% for line in marker.text %}
{% if content %}
{% assign content = content | append: '<br>' | append: line %}
{% else %}
{% assign content = line %}
{% endif %}
{% endfor %}
L.marker([{{ marker.latlng }}])
    {% if content %}
    .addTo(map)
    .bindTooltip("{{ content }}");
    {% else %}
    .addTo(map);
    {% endif %}
{% endfor %}
{% endif %}

{% if site.data.map.polygons %}
{% for polygon in site.data.map.polygons %}
{% assign latlng = polygon.latlng | join: '],[' | prepend: '[' | append: ']' %}
{% assign color = polygon.color | default: '#ff6b6b' %}
{% assign offset = polygon.offset | default: '0, 0' %}
{% assign x = offset | split: ', ' | first %}
{% assign y = offset | split: ', ' | last %}
{% assign content = false %}
{% if polygon.title %}
{% assign content = polygon.title | prepend: '<strong>' | append: '</strong>' %}
{% endif %}
{% for line in polygon.text %}
{% if content %}
{% assign content = content | append: '<br>' | append: line %}
{% else %}
{% assign content = line %}
{% endif %}
{% endfor %}
L.polygon([{{ latlng }}], {color: '{{ color }}'})
    {% if content %}
    .addTo(map)
    .bindTooltip("{{ content }}", {direction: 'center', offset: L.point({x: {{ x }}, y: {{ y }}})});
    {% else %}
    .addTo(map);
    {% endif %}
{% endfor %}
{% endif %}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jekyll-nagymaros-3.3.1 assets/js/leaflet-data.js
jekyll-nagymaros-3.3.0 assets/js/leaflet-data.js
jekyll-nagymaros-3.2.0 assets/js/leaflet-data.js
jekyll-nagymaros-3.1.0 assets/js/main.js
jekyll-nagymaros-3.0.0 assets/js/main.js