diff --git a/application-interactive-maps-ui/src/main/resources/Maps/Code/MapSheet.xml b/application-interactive-maps-ui/src/main/resources/Maps/Code/MapSheet.xml
index 8404bc6..3ec348f 100644
--- a/application-interactive-maps-ui/src/main/resources/Maps/Code/MapSheet.xml
+++ b/application-interactive-maps-ui/src/main/resources/Maps/Code/MapSheet.xml
@@ -191,7 +191,7 @@
//Make sure to include Maps.Code.LeafletUtils before using this
require(['jquery', 'leaflet', 'leaflet-commons', 'leaflet-indoor', 'bootstrap'], function ($, leaflet, leafletCommons) {
'use strict';
- function init()
+ var init = function ()
{
var map;
@@ -459,13 +459,9 @@ require(['jquery', 'leaflet', 'leaflet-commons', 'leaflet-indoor', 'bootstrap'],
$('.map-search-filter').removeClass('open');
leafletCommons.updateURLWithMapState();
});
-
+ $(init).on('xwiki:dom:updated', init);
}
- //Run the init() function when dom is loaded or updated
- (XWiki && XWiki.domIsLoaded && init()) || document.observe("xwiki:dom:loaded", init);
- (XWiki && XWiki.domIsUpdated && init()) || document.observe("xwiki:dom:updated", init);
-
});