merge index.js with global.js
This commit is contained in:
parent
7c697f7529
commit
4b34a7d300
7 changed files with 63 additions and 68 deletions
|
@ -1,5 +1,8 @@
|
|||
import * as L from '../../vendors/leaflet/leaflet-src.esm.js'
|
||||
import URLs from './urls.js'
|
||||
// Import modules and export them to the global scope.
|
||||
// For the not yet module-compatible JS out there.
|
||||
|
||||
// Exposes the modules to the window global scope, it's expected by leaflet plugins
|
||||
// in a writeable form.
|
||||
// Copy the leaflet module, it's expected by leaflet plugins to be writeable.
|
||||
window.L = { ...L }
|
||||
window.umap = { URLs }
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import URLs from './urls.js'
|
||||
|
||||
// expose the modules to the window.umap global scope
|
||||
window.umap = { URLs }
|
||||
|
||||
export { URLs }
|
|
@ -29,7 +29,6 @@
|
|||
<script src="../vendors/iconlayers/iconLayers.js" defer></script>
|
||||
<script src="../vendors/simple-statistics/simple-statistics.min.js" defer></script>
|
||||
<script src="../vendors/colorbrewer/colorbrewer.js" defer></script>
|
||||
<script type="module" src="../js/modules/index.js" defer></script>
|
||||
<script src="../js/umap.core.js" defer></script>
|
||||
<script src="../js/umap.autocomplete.js" defer></script>
|
||||
<script src="../js/umap.popup.js" defer></script>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
{% block bottom_js %}
|
||||
{{ block.super }}
|
||||
<script type="text/javascript">
|
||||
window.addEventListener('load', (event => {
|
||||
window.addEventListener('DOMContentLoaded', (event => {
|
||||
|
||||
!(function () {
|
||||
const ui = new L.U.UI(document.querySelector('header'))
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
{% endcompress %}
|
||||
{% if locale %}<script src="{{ STATIC_URL }}umap/locale/{{ locale }}.js" defer></script>{% endif %}
|
||||
{% compress js %}
|
||||
<script type="module" src="{{ STATIC_URL }}umap/js/modules/index.js" defer></script>
|
||||
<script src="{{ STATIC_URL }}umap/js/umap.core.js" defer></script>
|
||||
<script src="{{ STATIC_URL }}umap/js/umap.autocomplete.js" defer></script>
|
||||
<script src="{{ STATIC_URL }}umap/js/umap.popup.js" defer></script>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<!-- djlint:off -->
|
||||
<script type="text/javascript">
|
||||
// Wait for JS modules to be loaded
|
||||
window.addEventListener('load', (event) => {
|
||||
window.addEventListener('DOMContentLoaded', (event) => {
|
||||
new L.U.Map("{{ unique_id }}", {{ map_settings|notag|safe }})
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div id="map"></div>
|
||||
<!-- djlint:off -->
|
||||
<script defer type="text/javascript">
|
||||
window.addEventListener('load', (event) => {
|
||||
window.addEventListener('DOMContentLoaded', (event) => {
|
||||
let MAP = new L.U.Map("map", {{ map_settings|notag|safe }});
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue