MediaWiki:Common.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(29 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
/* Jedes JavaScript hier wird für alle Benutzer für jede Seite geladen. */ | /* Jedes JavaScript hier wird für alle Benutzer für jede Seite geladen. */ | ||
− | + | console.log('Greetings from MediaWiki:Common.js new one'); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | /* ************************************************* | |
− | + | * Reinitialize leaflet after each tab change. | |
− | + | * fixes #36 | |
− | |||
− | |||
− | |||
− | |||
− | * | ||
*/ | */ | ||
− | + | $(document).ready(function() { | |
− | + | $('.tabs-label').click(function(e) { | |
− | + | var mapExists = setInterval(function() { | |
− | + | var counter = 0; | |
− | + | var mapsLeafletList = window.mapsLeafletList; | |
− | + | if (mapsLeafletList && mapsLeafletList.length) { | |
− | + | mapsLeafletList.forEach(function(l) { | |
− | + | if (l.map) { | |
− | (function() { | + | l.map.invalidateSize(false); |
− | + | clearInterval(mapExists); | |
− | + | } | |
− | + | }); | |
− | + | } | |
− | + | if (counter++ > 10) clearInterval(mapExists); | |
− | + | }, 100); | |
− | + | }); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
}); | }); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Aktuelle Version vom 4. Februar 2024, 02:53 Uhr
/* Jedes JavaScript hier wird für alle Benutzer für jede Seite geladen. */
console.log('Greetings from MediaWiki:Common.js new one');
/* *************************************************
* Reinitialize leaflet after each tab change.
* fixes #36
*/
$(document).ready(function() {
$('.tabs-label').click(function(e) {
var mapExists = setInterval(function() {
var counter = 0;
var mapsLeafletList = window.mapsLeafletList;
if (mapsLeafletList && mapsLeafletList.length) {
mapsLeafletList.forEach(function(l) {
if (l.map) {
l.map.invalidateSize(false);
clearInterval(mapExists);
}
});
}
if (counter++ > 10) clearInterval(mapExists);
}, 100);
});
});