Mudanças entre as edições de "Predefinição:MapViewer"
Ir para navegação
Ir para pesquisar
(ajustando a predefinição) |
|||
| Linha 1: | Linha 1: | ||
<includeonly> | <includeonly><div id="map-container-{{{id|mapa1}}}" class="mapa-viewer" style="width:{{{largura|100%}}}; height:{{{altura|500px}}}; background:#0f172a; border-radius:12px; overflow:hidden; position:relative;"> | ||
<div id=" | <div style="position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); color:#64748b;"> | ||
⏳ Carregando mapa... | |||
</div> | |||
</div> | |||
<script> | <script> | ||
(function() { | (function() { | ||
// | // Configuração do mapa | ||
var configJSON = `{{{config}}}`; | |||
var containerId = 'map-container-{{{id|mapa1}}}'; | |||
var mapConfig = null; | |||
var | |||
try { | try { | ||
mapConfig = JSON.parse(configJSON); | |||
} catch(e) { | } catch(e) { | ||
console.error('Erro ao parsear | console.error('Erro ao parsear config:', e); | ||
document.getElementById(containerId).innerHTML = '<div style="padding:20px; text-align:center; color:#ef4444;">❌ Erro na configuração do mapa</div>'; | |||
return; | |||
} | |||
// Inicializar viewer quando a página carregar | |||
if (typeof window.MapViewer === 'undefined') { | |||
// Carregar o script do viewer | |||
var script = document.createElement('script'); | |||
script.src = 'https://cdn.jsdelivr.net/gh/seu-usuario/map-viewer@latest/viewer.min.js'; | |||
script.onload = function() { | |||
new window.MapViewer(containerId, mapConfig); | |||
}; | }; | ||
document.head.appendChild(script); | |||
} else { | |||
new window.MapViewer(containerId, mapConfig); | |||
} | } | ||
})(); | })(); | ||
</script> | </script></includeonly> | ||
</includeonly | |||