|
Tags: Blanking Manual revert |
| (17 intermediate revisions by 2 users not shown) |
| Line 1: |
Line 1: |
| $(document).ready(function () {
| |
| const maps = document.querySelectorAll('.medivia-map');
| |
| if (!maps.length) return;
| |
|
| |
|
| // Load Leaflet CSS
| |
| | |
|
| |
| // Load Leaflet JS
| |
| | |
| maps.forEach(function (el) {
| |
| const x = parseInt(el.dataset.x || 2048, 10);
| |
| const y = parseInt(el.dataset.y || -2047, 10);
| |
| const z = parseInt(el.dataset.z || 7, 10);
| |
| const zoom = parseInt(el.dataset.zoom || 2, 10);
| |
|
| |
| const map = L.map(el, {
| |
| crs: L.CRS.Simple,
| |
| zoomSnap: 1,
| |
| minZoom: 0,
| |
| maxZoom: 5
| |
| });
| |
|
| |
| const bounds = [[0, 0], [4096, 4096]];
| |
| map.setView([x, y], zoom);
| |
|
| |
| L.tileLayer('https://tafonath.github.io/medivia-mapper/tiles/{z}/{x}/{y}.png', {
| |
| tileSize: 256,
| |
| noWrap: true,
| |
| bounds: bounds,
| |
| maxZoom: 5,
| |
| minZoom: 0,
| |
| attribution: '© Tafonath'
| |
| }).addTo(map);
| |
| });
| |
| });
| |
| });
| |