Some additional info.
I've made some inspection on code from two installatons.
js.php are identical but js.php produced in debugger console in FireFox differ.
the error: "m is undefined" happens there:
function olovAddToMap() {
if (olEnable) {
for (var key in olMapOverlays) {
var overlay = olMapOverlays[key];
var m = olMaps[overlay.id];
....
}
var olMapOverlays = new Object();
jQuery(olovAddToMap);
olMaps is Object {olmap: initialize} //on working installation
olMaps is Object {} // on not working installation
Looks like olMaps is not properly initialized.
The init code is identical on both installations:
function olInit() {
if (olEnable) {
var _i = 0;
...
}
var olEnable = false
, olMapData = []
, olMaps = new Object()
, stamenEnable = false
, gEnable = false
, bEnable = false
, bApiKey = ''
, gApiKey = ''
, osmEnable = true
, olCSSEnable = true;
jQuery(olInit);
But there is a differnece in two installations:
On working install the sequence is:
function olInit() {...}
jQuery(olInit);
function olovAddToMap() {...}
var olMapOverlays = new Object();
jQuery(olovAddToMap);
On NON-working installations the sequence is reverse:
function olovAddToMap() {...}
var olMapOverlays = new Object();
jQuery(olovAddToMap);
function olInit() {...}
jQuery(olInit);
So the layer is added to the map before initialisation.
I think this is the cause of error.
But why the order of calls is opposite?
If I call manually from console
olInit()
and then
olovAddToMap()
Everything begins to work as intended