MediaWiki:Common.js: различия между версиями
Перейти к навигации
Перейти к поиску
Строка 106: | Строка 106: | ||
}); | }); | ||
// | // Аль Баккара | ||
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.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>'; | |||
})(jQuery); | })(jQuery); |
Версия 09:54, 26 сентября 2021
/* Размещённый здесь код JavaScript будет загружаться пользователям при обращении к каждой странице */ (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 для того, чтобы добавить в избранные.'); } }); // Аль Баккара 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>'; })(jQuery);