MediaWiki:Common.js: различия между версиями

Материал из ЮУГМУ Вики
Нет описания правки
Нет описания правки
Строка 9: Строка 9:
     content.append($('<li>').append($('<a>').attr('href', '/wiki/Контакты').attr('title', 'Заголовок 2').append($('<span>').text('Контакты'))));
     content.append($('<li>').append($('<a>').attr('href', '/wiki/Контакты').attr('title', 'Заголовок 2').append($('<span>').text('Контакты'))));
     node.before(content);
     node.before(content);
     var currentPageHref = window.location.href;
     var currentPageHref = encodeURIComponent(window.location.href);
     var links = document.querySelectorAll('.custom-top-menu a');
     var links = document.querySelectorAll('.custom-top-menu a');
     links.forEach(function(link) {
     links.forEach(function(link) {

Версия от 14:10, 14 мая 2024

$(document).ready(function() {
    var node = $('#content');
    var content = $('<ul>').addClass('custom-top-menu');
    content.append($('<li>').append($('<a>').attr('href', '/wiki/Вики-энциклопедия_университета').attr('title', 'Главная').append($('<span>').text('Главная'))));
    content.append($('<li>').append($('<a>').attr('href', '/wiki/Правила').attr('title', 'Правила').append($('<span>').text('Правила'))));
    content.append($('<li>').append($('<a>').attr('href', '/wiki/Служебная:Все_страницы').attr('title', 'Все страницы').append($('<span>').text('Статьи'))));
    content.append($('<li>').append($('<a>').attr('href', '/wiki/Служебная:Свежие_правки').attr('title', 'Свежие правки').append($('<span>').text('История правок'))));
    content.append($('<li>').append($('<a>').attr('href', '/wiki/Инструкции').attr('title', 'Инструкции').append($('<span>').text('Инструкции'))));
    content.append($('<li>').append($('<a>').attr('href', '/wiki/Контакты').attr('title', 'Заголовок 2').append($('<span>').text('Контакты'))));
    node.before(content);
    var currentPageHref = encodeURIComponent(window.location.href);
    var links = document.querySelectorAll('.custom-top-menu a');
    links.forEach(function(link) {
    var linkhref = link.getAttribute('href').trim();
    console.log(currentPageHref + '=' + linkhref);
    if (window.location.href.indexOf(linkhref) > -1) {
        link.closest('li').classList.add('a-current');
    }
});
});