MediaWiki:Common.js: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung Markierung: Zurückgesetzt |
Keine Bearbeitungszusammenfassung Markierung: Zurückgesetzt |
||
| Zeile 163: | Zeile 163: | ||
// Template LoginStatus: conditional text depending on login status | // Template LoginStatus: conditional text depending on login status | ||
// | // v250921r3 | ||
$(function() { | $(function() { | ||
| Zeile 169: | Zeile 169: | ||
if (mw.user.isAnon()) { | if (mw.user.isAnon()) { | ||
$('.logged-out-only').show(); | $('.logged-out-only').show(); | ||
$('.logged-in-only').hide(); | $('.logged-in-only').hide(); | ||
} else { | } else { | ||
$('.logged-in-only').show(); | $('.logged-in-only').show(); | ||
$('.logged-out-only').hide(); | $('.logged-out-only').hide(); | ||
} | } | ||
// | // Clean TOC by matching heading text | ||
$('.logged-out-only:hidden, .logged-in-only:hidden').each(function() { | $('.logged-out-only:hidden, .logged-in-only:hidden').each(function() { | ||
$(this).find('h1, h2, h3, h4, h5, h6').each(function() { | $(this).find('h1, h2, h3, h4, h5, h6').each(function() { | ||
var | var headingText = $(this).find('.mw-headline').text() || $(this).text(); | ||
headingText = headingText.trim(); | |||
if ( | if (headingText) { | ||
// | // Find matching TOC entry by text | ||
$('#toc a | $('#toc a, .toc a').each(function() { | ||
var tocText = $(this).find('.toctext').text() || $(this).text(); | |||
if (tocText.trim() === headingText) { | |||
$(this).closest('li').hide(); | |||
} | |||
}); | |||
} | } | ||
}); | }); | ||
}); | }); | ||
}); | }); | ||