MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 92: | Line 92: | ||
topnav.append(secondMenu); | topnav.append(secondMenu); | ||
$(' | $('body').append(topnav); | ||
}); | }); | ||
}); | }); | ||
Revision as of 17:00, 9 May 2026
mw.loader.using('mediawiki.util', function () {
$(function () {
if ($('#handwiki-topnav').length) {
return;
}
var sidebarLinks = [];
$('#mw-panel a').each(function () {
var text = $(this).text().trim();
var href = $(this).attr('href');
if (text && href) {
sidebarLinks.push({
text: text,
href: href
});
}
});
var topnav = $('<div>', {
id: 'handwiki-topnav'
});
var sidebarMenu = $('<div>', {
class: 'handwiki-dropdown'
});
var sidebarButton = $('<div>', {
class: 'handwiki-dropdown-button',
text: 'Sidebar ▾'
});
var sidebarContent = $('<div>', {
class: 'handwiki-dropdown-content'
});
sidebarLinks.forEach(function (link) {
sidebarContent.append(
$('<a>', {
href: link.href,
text: link.text
})
);
});
sidebarMenu.append(sidebarButton);
sidebarMenu.append(sidebarContent);
var secondMenu = $('<div>', {
class: 'handwiki-dropdown'
});
var secondButton = $('<div>', {
class: 'handwiki-dropdown-button',
text: 'Quantum ▾'
});
var secondContent = $('<div>', {
class: 'handwiki-dropdown-content'
});
secondContent.append($('<a>', {
href: '/index.php/Book:Quantum_Collection',
text: 'Quantum Collection'
}));
secondContent.append($('<a>', {
href: '/index.php/Book:Quantum_Collection/Matter_(by_scale)',
text: 'Matter by scale'
}));
secondContent.append($('<a>', {
href: '/index.php/Book:Quantum_Collection/Methods_and_tools',
text: 'Methods and tools'
}));
secondContent.append($('<a>', {
href: '/index.php/Special:RecentChanges',
text: 'Recent changes'
}));
secondContent.append($('<a>', {
href: '/index.php/Special:SpecialPages',
text: 'Special pages'
}));
secondMenu.append(secondButton);
secondMenu.append(secondContent);
topnav.append(sidebarMenu);
topnav.append(secondMenu);
$('body').append(topnav);
});
});