MediaWiki:Common.js: Unterschied zwischen den Versionen
Aus Lost Dreams Of Tomorrow Wiki
Die Seite wurde neu angelegt: „→Das folgende JavaScript wird für alle Benutzer geladen.: // Collapsible Sidebar for Timeless skin $(document).ready(function() { // Add toggle buttons to sidebar sections $('#mw-site-navigation .sidebar-chunk').each(function() { var $chunk = $(this); var $header = $chunk.find('h3, label'); if ($header.length) { // Add collapse indicator $header.css('cursor', 'pointer').prepend('<span c…“ |
Keine Bearbeitungszusammenfassung |
||
| Zeile 2: | Zeile 2: | ||
// Collapsible Sidebar for Timeless skin | // Collapsible Sidebar for Timeless skin | ||
$(document).ready(function() { | $(document).ready(function() { | ||
$('#mw-site-navigation .sidebar-chunk').each(function() { | $('#mw-site-navigation .sidebar-chunk').each(function() { | ||
var $chunk = $(this); | var $chunk = $(this); | ||
var $header = $chunk.find('h3, label'); | var $header = $chunk.find('h3, label').first(); | ||
var $content = $chunk.find('.sidebar-inner, ul').first(); | |||
if ($header.length) { | if ($header.length && $content.length) { | ||
// Add | // Add toggle indicator | ||
$header.css('cursor', 'pointer').prepend('<span class="sidebar-toggle">[−] </span>'); | $header.css('cursor', 'pointer'); | ||
$header.prepend('<span class="sidebar-toggle">[−] </span>'); | |||
// | // Click handler for THIS specific section only | ||
$header.click(function() { | $header.off('click').on('click', function(e) { | ||
e.preventDefault(); | |||
e.stopPropagation(); | |||
if ($ | var $thisToggle = $(this).find('.sidebar-toggle'); | ||
$ | var $thisContent = $(this).siblings('.sidebar-inner, ul').first(); | ||
$ | |||
if (!$thisContent.length) { | |||
$thisContent = $(this).parent().find('.sidebar-inner, ul').first(); | |||
} | |||
if ($thisContent.is(':visible')) { | |||
$thisContent.slideUp(200); | |||
$thisToggle.text('[+] '); | |||
} else { | } else { | ||
$ | $thisContent.slideDown(200); | ||
$ | $thisToggle.text('[−] '); | ||
} | } | ||
}); | }); | ||
} | } | ||
}); | |||
// Optional: Start some sections collapsed | |||
$('#mw-site-navigation .sidebar-chunk').slice(3).each(function() { | |||
var $content = $(this).find('.sidebar-inner, ul').first(); | |||
var $toggle = $(this).find('.sidebar-toggle'); | |||
$content.hide(); | |||
$toggle.text('[+] '); | |||
}); | }); | ||
}); | }); | ||
Version vom 11. Januar 2026, 04:06 Uhr
/* Das folgende JavaScript wird für alle Benutzer geladen. */
// Collapsible Sidebar for Timeless skin
$(document).ready(function() {
$('#mw-site-navigation .sidebar-chunk').each(function() {
var $chunk = $(this);
var $header = $chunk.find('h3, label').first();
var $content = $chunk.find('.sidebar-inner, ul').first();
if ($header.length && $content.length) {
// Add toggle indicator
$header.css('cursor', 'pointer');
$header.prepend('<span class="sidebar-toggle">[−] </span>');
// Click handler for THIS specific section only
$header.off('click').on('click', function(e) {
e.preventDefault();
e.stopPropagation();
var $thisToggle = $(this).find('.sidebar-toggle');
var $thisContent = $(this).siblings('.sidebar-inner, ul').first();
if (!$thisContent.length) {
$thisContent = $(this).parent().find('.sidebar-inner, ul').first();
}
if ($thisContent.is(':visible')) {
$thisContent.slideUp(200);
$thisToggle.text('[+] ');
} else {
$thisContent.slideDown(200);
$thisToggle.text('[−] ');
}
});
}
});
// Optional: Start some sections collapsed
$('#mw-site-navigation .sidebar-chunk').slice(3).each(function() {
var $content = $(this).find('.sidebar-inner, ul').first();
var $toggle = $(this).find('.sidebar-toggle');
$content.hide();
$toggle.text('[+] ');
});
});