MediaWiki:Common.js
Версия от 15:02, 6 февраля 2024; Administrator (обсуждение | вклад)
Замечание: Возможно, после сохранения вам придётся очистить кэш своего браузера, чтобы увидеть изменения.
- Firefox / Safari: Удерживая клавишу Shift, нажмите на панели инструментов Обновить либо нажмите Ctrl+F5 или Ctrl+R (⌘-R на Mac)
- Google Chrome: Нажмите Ctrl+Shift+R (⌘-Shift-R на Mac)
- Internet Explorer / Edge: Удерживая Ctrl, нажмите Обновить либо нажмите Ctrl+F5
- Opera: Нажмите Ctrl+F5.
/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */ (function($) { $(document).ready(function() { $('.mw-allpages-table-chunk a').filter(function() { var $text = $(this).text(); return $text.match(/^\d{1,3}:\d{1,3}/); }).closest('tr').css({'display': 'none'}); /* infoboxes */ $('<a class="infoboxtoggle" href="#">[Показать]</a>').appendTo( $('.infobox tr.header').filter(function(){ return $(this).attr('class').split(" ").length > 1 }).find("th") ); // toggle text on click //var counter = 1; $('.infoboxtoggle').on('click', function() { //counter++; var txt = $(this); /* if (counter % 2 === 0) { this.text('[Скрыть]'); } else { this.text('[Показать]'); } */ if (txt.text() == '[Показать]') { txt.text('[Скрыть]'); } else { txt.text('[Показать]'); } }); $(".infobox tr.header").each(function(){ var $this = $(this); if( $this.hasClass("hidden") ){ var firstclass = $this.attr("class").split(" ")[0]; $this.siblings("." + firstclass).addClass("hidden"); } }); // change commas to circles $('.infobox td').each(function() { var $com = $(this); var $dots = $com.html(); var $commas = $dots.replace(/,/g, '<strong> ·</strong>'); $com.html($commas); }); $('a.infoboxtoggle').click ( function (infoboxtoggle) { var parent = $(this).parent (); var grandparent = parent.parent (); var firstclass = grandparent.attr ('class').split(" ")[0]; infoboxtoggle.preventDefault(); grandparent.siblings ('.' + firstclass).has ('td').toggleClass ('hidden'); } ); // references popup $('.reference').each(function(n) { var refid = $(this).find('a').attr('href'); var content = $(refid + ' .reference-text').html(); $(this).append('<div class="popup">' + content + '</div>'); }); $('.reference').hover(function() { $(this).find('.popup').css({ display: "block", position: "absolute", left: ($(this).position().left) - ($(this).find('.popup').width() / 2) - 5 + "px", top: $(this).position().top - ($(this).find('.popup').height() / 2) - 35 + "px" }); }, function() { $(this).find('.popup').css({'display': 'none'}); }); $('.reference').on('click', function() { var $note = $(this).find('a').attr('href'); $('.references li').each(function() { $(this).css({'background-color': '#fff'}); }); $($note).css({'background-color': '#def'}); }); // favorite link $('a:contains("В закладки")').click(function(e) { e.preventDefault(); if (window.sidebar && window.sidebar.addPanel) { // Mozilla Firefox Bookmark window.sidebar.addPanel(document.title,window.location.href,''); } else if(window.external && ('AddFavorite' in window.external)) { // IE Favorite window.external.AddFavorite(location.href,document.title); } else if(window.opera && window.print) { // Opera Hotlist this.title=document.title; return true; } else { // webkit - safari/chrome alert('Нажмите ' + (navigator.userAgent.toLowerCase().indexOf('mac') != - 1 ? 'Command/Cmd' : 'CTRL') + ' + D для того, чтобы добавить в избранные.'); } }); // YouTube channel document.getElementById('n-youtube').innerHTML = '<a href="https://youtube.com/@user-nf1xf6lz9n?si=LikGOwYImT3FSgMK"><img src="/skins/common/images/youtube.jpg" /></a>'; // Аль Баккара document.getElementById('n-.D0.9A.D0.BE.D1.80.D0.BE.D0.B2.D0.B0-.28.22.D0.90.D0.BB.D1.8C-.D0.91.D0.B0.D0.BA.D0.B0.D1.80.D0.B0.22.29').innerHTML = '<a href="https://wikiquran.info/index.php/%D0%9A%D0%BE%D1%80%D0%BE%D0%B2%D0%B0_%28%22%D0%90%D0%BB%D1%8C-%D0%91%D0%B0%D0%BA%D0%B0%D1%80%D0%B0%22%29"><img src="/skins/common/images/banner1.jpg" /></a>'; // Семейство Имрана document.getElementById('n-.D0.A1.D0.B5.D0.BC.D0.B5.D0.B9.D1.81.D1.82.D0.B2.D0.BE-.D0.98.D0.BC.D1.80.D0.B0.D0.BD.D0.B0-.28.22.D0.90.D0.BB.D1.8C-.D0.98.D0.BC.D1.80.D0.B0.D0.BD.22.29').innerHTML = '<a href="https://wikiquran.info/index.php?title=%D0%A0%D0%BE%D0%B4_%D0%98%D0%BC%D1%80%D0%B0%D0%BD%D0%B0_(%22%D0%90%D0%BB%D0%B8-%D0%98%D0%BC%D1%80%D0%B0%D0%BD%22)"><img src="/skins/common/images/banner2.jpg" /></a>'; // Женщины document.getElementById('n-.D0.96.D0.B5.D0.BD.D1.89.D0.B8.D0.BD.D1.8B-.28.22.D0.90.D0.BD-.D0.9D.D0.B8.D1.81.D0.B0.22.29').innerHTML = '<a href="https://wikiquran.info/index.php?title=%D0%96%D0%B5%D0%BD%D1%89%D0%B8%D0%BD%D1%8B_(%22%D0%90%D0%BD-%D0%9D%D0%B8%D1%81%D0%B0%22)"><img src="/skins/common/images/banner3.jpg" /></a>'; // Трапеза (Аль-Маида) document.getElementById('n-.D0.A2.D1.80.D0.B0.D0.BF.D0.B5.D0.B7.D0.B0-.28.22.D0.90.D0.BB.D1.8C-.D0.9C.D0.B0.D0.B8.D0.B4.D0.B0.22.29').innerHTML = '<a href="https://wikiquran.info/index.php?title=%D0%A2%D1%80%D0%B0%D0%BF%D0%B5%D0%B7%D0%B0_(%22%D0%90%D0%BB%D1%8C-%D0%9C%D0%B0%D0%B8%D0%B4%D0%B0%22)"><img src="/skins/common/images/banner4.jpg" /></a>'; // Муравьи (Ан-Намль) document.getElementById('n-.D0.9C.D1.83.D1.80.D0.B0.D0.B2.D1.8C.D0.B8-.28.22.D0.90.D0.BD-.D0.9D.D0.B0.D0.BC.D0.BB.D1.8C.22.29').innerHTML = '<a href="https://wikiquran.info/index.php?title=%D0%9C%D1%83%D1%80%D0%B0%D0%B2%D1%8C%D0%B8_(%22%D0%90%D0%BD-%D0%9D%D0%B0%D0%BC%D0%BB%D1%8C%22)"><img src="/skins/common/images/banner5.jpg" /></a>'; // Избранные статьи document.getElementById('n-.D0.98.D0.B7.D0.B1.D1.80.D0.B0.D0.BD.D0.BD.D1.8B.D0.B5-.D1.81.D1.82.D0.B0.D1.82.D1.8C.D0.B8').innerHTML = '<a href="https://wikiquran.info/index.php?title=%D0%98%D0%B7%D0%B1%D1%80%D0%B0%D0%BD%D0%BD%D1%8B%D0%B5_%D1%81%D1%82%D0%B0%D1%82%D1%8C%D0%B8"><img src="/skins/common/images/banner6.jpg" /></a>'; }); const msg = 'Приветствую всех. Это Айдар. Я сейчас нахожусь в центральной городской больнице, в крайне тяжелом состоянии (как его оценили врачи). Болезнь оказалась быстротекущая. За 4 дня забравшая львиную долю моих жизненных сил. В связи с чем времени на аккумулирование финансовых ресурсов оказалось совершенно недостаточно. Обращаюсь к вам за помощью, буду благодарен анонимным и явным донатерам. Вот номер моей карты Виза, которая будет активна с 7 февраля.<br><br><img src="/skins/common/images/aidar_kaspi.jpg" width="600px" style="display: block; margin: 0 auto 30px auto;" />'; document.body.insertAdjacentHTML('afterbegin', '<div class="global-msg">' + msg + '<button style="display: block; margin: 0 auto">Понятно</button></div>'); })(jQuery);