MediaWiki:Mobile.js: Unterschied zwischen den Versionen

Aus FürthWiki

Keine Bearbeitungszusammenfassung
Markierungen: Mobile Bearbeitung Mobile Web-Bearbeitung
K (Reinitialize leaflet after each tab change. fixes #36)
Markierungen: Mobile Bearbeitung Mobile Web-Bearbeitung
Zeile 12: Zeile 12:


/* *************************************************
/* *************************************************
  * Reinitialize leaflet after page load
  * Reinitialize leaflet after each tab change.
  * Fixes #36 for mobile.
  * fixes #36
  */
  */
$( document ).ready(function() {
$( document ).ready(function() {
  $('.tabs-tabbox .tabs-header').click(function(e) {
     setTimeout(function() {
     setTimeout(function() {
       window.maps.leafletList.forEach(function(l) {
       window.maps.leafletList.forEach(function(l) {
Zeile 21: Zeile 22:
       });
       });
     }, 100);
     }, 100);
  });
});
});

Version vom 8. Oktober 2017, 21:34 Uhr

if ('serviceWorker' in navigator) {
  window.addEventListener('load', function() {
    navigator.serviceWorker.register('/wiki/serviceworker.js').then(function(registration) {
      // Registration was successful
      console.log('ServiceWorker registration successful with scope: ', registration.scope);
    }, function(err) {
      // registration failed :(
      console.log('ServiceWorker registration failed: ', err);
    });
  });
}

/* *************************************************
 * Reinitialize leaflet after each tab change.
 * fixes #36
 */
$( document ).ready(function() {
  $('.tabs-tabbox .tabs-header').click(function(e) {
    setTimeout(function() {
      window.maps.leafletList.forEach(function(l) {
        l.map.invalidateSize(false);
      });
    }, 100);
  });
});