MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus FürthWiki

K
fix #36
K (fix #36)
K (fix #36)
Zeile 157: Zeile 157:
  * fixes #36
  * fixes #36
  */
  */
$( document ).ready(function() {
$(document).ready(function() {
  $('.tabs-label').click(function(e) {
$('.tabs-label').click(function(e) {
  console.log("[mapResize] click tabs-label");
console.log("[mapResize] click tabs-label");
    var mapExists = setInterval(function() {
var mapExists = setInterval(function() {
    var counter = 0;
var counter = 0;
    console.log("[mapResize] couter:", counter);
console.log("[mapResize] couter:", counter);
const mapsLeafletList = window.mapsLeafletList;
const mapsLeafletList = window.mapsLeafletList;
if (mapsLeafletList && mapsLeafletList.length) {
if (mapsLeafletList && mapsLeafletList.length) {
mapsLeafletList.forEach(l => {
mapsLeafletList.forEach(l => {
if (l.map) {
if (l.map) {
console.log("[mapResize] invalidateSize");
console.log("[mapResize] invalidateSize");
l.map.invalidateSize(false);
l.map.invalidateSize(false);
    clearInterval(mapExists);
clearInterval(mapExists);
    }
}
    });
});
    }
}
    if (counter++ > 10) {
if (counter++ > 10) {
    console.warn("[mapResize] watchdog exit, couter:", counter);
console.warn("[mapResize] watchdog exit, couter:", counter);
    clearInterval(mapExists);
clearInterval(mapExists);
    }
}
}, 100);
}, 100);
  });
});
});
});