|
|
| Рядок 1: |
Рядок 1: |
| /* Per-page sidebar widgets */ | | /* Per-page widgets winder via templates, not JS */ |
| $(function () {
| |
| var pageName = mw.config.get('wgPageName') || '';
| |
| | |
| if (pageName === '🇷🇴_Румунія') {
| |
| var $toc = $('#mw-panel-toc');
| |
| if (!$toc.length) return;
| |
| | |
| var cities = [
| |
| { title: 'Бухарест', page: 'Румунія/Бухарест' },
| |
| { title: 'Клуж-Напока', page: 'Румунія/Клуж-Напока' },
| |
| { title: 'Тімішоара', page: 'Румунія/Тімішоара' },
| |
| { title: 'Брашов', page: 'Румунія/Брашов' },
| |
| { title: 'Ясси', page: 'Румунія/Ясси' },
| |
| { title: 'Сібіу', page: 'Румунія/Сібіу' }
| |
| ];
| |
| | |
| var $nav = $('<nav>')
| |
| .attr('id', 'mw-panel-cities')
| |
| .attr('aria-label', 'Міста')
| |
| .addClass('sidebar-cities-nav');
| |
| | |
| var $header = $('<div>').addClass('sidebar-cities-header')
| |
| .append($('<h2>').addClass('sidebar-cities-label').text('Міста'));
| |
| | |
| var $list = $('<ul>').addClass('sidebar-cities-list');
| |
| cities.forEach(function (city) {
| |
| var href = mw.util.getUrl(city.page);
| |
| var $li = $('<li>').addClass('sidebar-cities-item');
| |
| var $a = $('<a>').addClass('sidebar-cities-link').attr('href', href).text(city.title);
| |
| $li.append($a);
| |
| $list.append($li);
| |
| });
| |
| | |
| $nav.append($header).append($list);
| |
| | |
| // Insert AFTER the entire TOC container (not just nav) so it sits below it
| |
| var $tocContainer = $toc.closest('.mw-table-of-contents-container');
| |
| if ($tocContainer.length) {
| |
| $tocContainer.after($nav);
| |
| } else {
| |
| $toc.after($nav);
| |
| }
| |
| }
| |
| });
| |