MediaWiki: Common.js: Unterschied zwischen den Versionen

Aus Herrenhäuser
Wechseln zu: Navigation, Suche
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 12: Zeile 12:
var currentTab = $(location).attr('hash');
var currentTab = $(location).attr('hash');
$('.nav-item a[href="' +currentTab + '"]').tab('show');
$('.nav-item a[href="' +currentTab + '"]').tab('show');
$('a[data-toggle="tab"]').on("click", function() {
//window.location.hash = currentTab;
//window.location.hash = currentTab;
history.replaceState(null, null, currentTab);
var currentTab = $(location).attr('hash');
console.log('currentTab', currentTab);
  history.replaceState(null, null, currentTab);
  console.log('currentTab', currentTab);
});
 
});
});
});
});

Version vom 11. August 2025, 11:22 Uhr

/* Das folgende JavaScript wird für alle Benutzer geladen. */

// stelle sicher, das externe links in neuem Tab geöffnet werden (ohne dass dies per LocalSettings.php konfiguriert wurde)
    var links = document.querySelectorAll(".external");
    Array.prototype.forEach.call(links, function(a) {
        a.setAttribute("target", "_blank");
    });

mw.loader.using(['mediawiki.util']).done(function() {
$( document ).ready(function() {
    console.log( "ready!" );
var currentTab = $(location).attr('hash');
$('.nav-item a[href="' +currentTab + '"]').tab('show');

$('a[data-toggle="tab"]').on("click", function() {
//window.location.hash = currentTab;
var currentTab = $(location).attr('hash');
  history.replaceState(null, null, currentTab);
  console.log('currentTab', currentTab);
});

});
});