|
Tags: Blanking Manual revert |
| (18 intermediate revisions by 2 users not shown) |
| Line 1: |
Line 1: |
| // Load Leaflet JS and CSS
| |
| mw.loader.using(['mediawiki.util'], function () {
| |
| var leafletScript = mw.loader.getScript('https://unpkg.com/[email protected]/dist/leaflet.js'); | |
| | |
|
| |
|
| leafletScript.then(function () {
| |
| // Only runs after Leaflet (L) is defined
| |
| $('.medivia-map').each(function () {
| |
| const el = this;
| |
| const x = parseInt(el.dataset.x);
| |
| const y = parseInt(el.dataset.y);
| |
| const z = parseInt(el.dataset.z);
| |
| const zoom = parseInt(el.dataset.zoom);
| |
|
| |
| const map = L.map(el, {
| |
| crs: L.CRS.Simple,
| |
| minZoom: 0,
| |
| maxZoom: 7,
| |
| center: [y, x],
| |
| zoom: zoom
| |
| });
| |
|
| |
| L.tileLayer('https://tafonath.github.io/medivia-mapper/tiles/{z}/{x}/{y}.png', {
| |
| attribution: '© Medivia',
| |
| tileSize: 256,
| |
| noWrap: true
| |
| }).addTo(map);
| |
|
| |
| map.setView([y, x], zoom);
| |
| });
| |
| });
| |
| });
| |