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 * 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
|
// Copy the leaflet module, it's expected by leaflet plugins to be writeable.
|
||||||
// in a writeable form.
|
|
||||||
window.L = { ...L }
|
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/iconlayers/iconLayers.js" defer></script>
|
||||||
<script src="../vendors/simple-statistics/simple-statistics.min.js" defer></script>
|
<script src="../vendors/simple-statistics/simple-statistics.min.js" defer></script>
|
||||||
<script src="../vendors/colorbrewer/colorbrewer.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.core.js" defer></script>
|
||||||
<script src="../js/umap.autocomplete.js" defer></script>
|
<script src="../js/umap.autocomplete.js" defer></script>
|
||||||
<script src="../js/umap.popup.js" defer></script>
|
<script src="../js/umap.popup.js" defer></script>
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
{% block bottom_js %}
|
{% block bottom_js %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.addEventListener('load', (event => {
|
window.addEventListener('DOMContentLoaded', (event => {
|
||||||
|
|
||||||
!(function () {
|
!(function () {
|
||||||
const ui = new L.U.UI(document.querySelector('header'))
|
const ui = new L.U.UI(document.querySelector('header'))
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
{% endcompress %}
|
{% endcompress %}
|
||||||
{% if locale %}<script src="{{ STATIC_URL }}umap/locale/{{ locale }}.js" defer></script>{% endif %}
|
{% if locale %}<script src="{{ STATIC_URL }}umap/locale/{{ locale }}.js" defer></script>{% endif %}
|
||||||
{% compress js %}
|
{% 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.core.js" defer></script>
|
||||||
<script src="{{ STATIC_URL }}umap/js/umap.autocomplete.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>
|
<script src="{{ STATIC_URL }}umap/js/umap.popup.js" defer></script>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<!-- djlint:off -->
|
<!-- djlint:off -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// Wait for JS modules to be loaded
|
// 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 }})
|
new L.U.Map("{{ unique_id }}", {{ map_settings|notag|safe }})
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
<!-- djlint:off -->
|
<!-- djlint:off -->
|
||||||
<script defer type="text/javascript">
|
<script defer type="text/javascript">
|
||||||
window.addEventListener('load', (event) => {
|
window.addEventListener('DOMContentLoaded', (event) => {
|
||||||
let MAP = new L.U.Map("map", {{ map_settings|notag|safe }});
|
let MAP = new L.U.Map("map", {{ map_settings|notag|safe }});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue