MediaWiki:Common.js: Porovnání verzí
Skočit na navigaci
Skočit na vyhledávání
Bez shrnutí editace |
Bez shrnutí editace |
||
| Řádek 6: | Řádek 6: | ||
if (settings.url.indexOf('action=parse') !== -1) { | if (settings.url.indexOf('action=parse') !== -1) { | ||
// Najde všechny zavřené šipky a "klikne" na ně | // Najde všechny zavřené šipky a "klikne" na ně | ||
$('.CategoryTreeToggle | $('.CategoryTreeToggle').click(); | ||
} | } | ||
}); | }); | ||
Verze z 17. 2. 2026, 09:46
/* Zde uvedený JavaScript bude použit pro všechny uživatele při načtení každé stránky */
/* mw.loader.using( ['ext.categoryTree'] ); */
$('.CategoryTreeToggle').click();
// Počkej, až se data dotáhnou, a pak rozbal vše, co má šipku
$(document).ajaxComplete(function(event, xhr, settings) {
if (settings.url.indexOf('action=parse') !== -1) {
// Najde všechny zavřené šipky a "klikne" na ně
$('.CategoryTreeToggle').click();
}
});
/*$(function() {
// 1. Najdeme kontejner pro navigaci (v novém Vectoru je to id 'mw-panel-navigation')
var $target = $('#mw-panel-navigation, #mw-panel');
if ($target.length) {
// Vytvoříme hezčí kontejner, který zapadne do designu
var $customNav = $('<nav class="vector-menu vector-menu-portal portal" id="p-manuals-tree">' +
'<label class="vector-menu-heading"><span>Manuals</span></label>' +
'<div class="vector-menu-content"><ul class="vector-menu-content-list" id="manuals-target"></ul></div>' +
'</nav>');
$target.append($customNav);
// Načteme strom
$.get(mw.util.wikiScript('api'), {
action: 'parse',
text: '<categorytree mode="all" depth="20" hideroot="on">Manuals</categorytree>',
format: 'json'
}).done(function(data) {
if (data.parse && data.parse.text) {
$('#manuals-target').html(data.parse.text['*']);
}
});
}
});
*/