MediaWiki:Common.js: различия между версиями
User (обсуждение | вклад) Нет описания правки |
User (обсуждение | вклад) Нет описания правки |
||
| Строка 18: | Строка 18: | ||
links.forEach(function(link) { | links.forEach(function(link) { | ||
// Get the link title | // Get the link title | ||
var linkTitle = link.textContent.trim(); | var linkTitle = link.textContent.trim() + '— ЮУГМУ Вики'; | ||
console.log(currentPageTitle); | |||
console.log(linkTitle); | |||
// Check if the link title is equal to the current page title | // Check if the link title is equal to the current page title | ||
if (linkTitle === currentPageTitle) { | if (linkTitle === currentPageTitle) { | ||
Версия от 12:46, 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);
// Get the current page title
var currentPageTitle = document.title;
// Get all links on the page
var links = document.querySelectorAll('a');
// Loop through each link
links.forEach(function(link) {
// Get the link title
var linkTitle = link.textContent.trim() + '— ЮУГМУ Вики';
console.log(currentPageTitle);
console.log(linkTitle);
// Check if the link title is equal to the current page title
if (linkTitle === currentPageTitle) {
// Make the link bold
link.style.fontWeight = 'bold';
}
});
});