MediaWiki: Common.js: Unterschied zwischen den Versionen
Aus Herrenhäuser
Admin (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
Admin (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| Zeile 15: | Zeile 15: | ||
$('a[data-toggle="tab"]').on("click", function() { | $('a[data-toggle="tab"]').on("click", function() { | ||
//window.location.hash = currentTab; | //window.location.hash = currentTab; | ||
var | var newTab = $(location).attr('hash'); | ||
history.replaceState(null, null, | history.replaceState(null, null, newTab); | ||
console.log(' | console.log('newTab', newTab); | ||
}); | }); | ||
}); | }); | ||
}); | }); | ||
Version vom 11. August 2025, 12:48 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 newTab = $(location).attr('hash');
history.replaceState(null, null, newTab);
console.log('newTab', newTab);
});
});
});