|
|
| (не показаны 173 промежуточные версии 12 участников) |
| Строка 1: |
Строка 1: |
| /* <pre> */ | | /* Нигилистические фокусы (см. шаблон {{tl|Нигилизм}}) */ |
| | $(function () { |
| | var nihilism = $('#nihilism'); |
| | if (nihilism[0] && !document.location.href.match("diff")) { |
| | var msg = nihilism.html(); |
| | if (!nihilism.hasClass('nihilism-no-white')) { |
| | $('body').css('background-color', 'white'); |
| | } |
| | var scripts = $('script'); |
| | var bodyNihilism = $('body').html(''); |
| | var divNihilism = $('<div class="mw-parser-output"></div>').html(msg); |
| | if (nihilism.css('top') == '0px') { |
| | bodyNihilism.css('top', '0px').css('left', '0px'); |
| | } |
| | bodyNihilism.append(divNihilism).append(scripts); |
| | $(document).dblclick(function () { |
| | window.location = mw.util.getUrl(null, {'action': 'edit'}); |
| | }); |
| | } |
| | }); |
|
| |
|
| /* Счётчик Рамблера */ | | /* Стирание памяти для [[MIB]] («Людей в чёрном») */ |
| document.write('<div id="top100Counter"><img src="http://counter.rambler.ru/top100.cnt?2206359" /></div>');
| | $(function () { |
| | if ($("#erase_memory")[0]) |
| | setTimeout(function () { $("#erase_memory").hide(); }, 20000); |
| | }); |
|
| |
|
| var xhrSummaries, xhrReasons; | | /* Ссылка «править» для нулевой секции */ |
| | $(function () { |
| | var zeroSectionTip = "Править введение"; |
|
| |
|
| /* Импорт дополнительных скриптов. Взято с изменениями из рувики, автор Alex Smotrov */
| | if (!mw.config.get("wgArticleId")) { |
| function importScript(page) {
| | return; |
| var url = wgScriptPath + '/index.php?title='
| |
| + encodeURIComponent(page.replace(' ','_'))
| |
| + '&action=raw&ctype=text/javascript&dontcountme=s';
| |
| var s = document.createElement('script');
| |
| s.src = url;
| |
| s.type='text/javascript';
| |
| document.getElementsByTagName('head')[0].appendChild(s);
| |
| }
| |
| | |
| importScript("MediaWiki:Dynavbar.js");
| |
| if(wgAction)
| |
| {
| |
| if(wgAction == 'edit' || wgAction == 'submit')
| |
| {
| |
| importScript("MediaWiki:Edit.js"); | |
| } | | } |
| }
| |
|
| |
|
| importScript("MediaWiki:SHJS.js");
| | var action = mw.config.get("wgAction"); |
| | if (action != "view" && action != "purge") |
| | return; |
|
| |
|
| if(wgUserGroups)
| | mw.util.$content.find("h2").children(".mw-editsection:first").clone().prependTo("#bodyContent").css("float", "right").find("a").each(function (index) { |
| {
| | $(this).attr("title", zeroSectionTip); |
| if(wgUserGroups.indexOf('sysop') != -1)
| | if ($(this).attr("class") === "mw-editsection-visualeditor") { |
| importScript("MediaWiki:Sysop.js"); | | $(this).attr("href", mw.config.get("wgScript") + "?title=" + mw.util.wikiUrlencode(mw.config.get("wgPageName")) + "&veaction=edit&vesection=0&summary=/*%20Преамбула%20*/%20"); |
| } | | } else { |
| | $(this).attr("href", mw.config.get("wgScript") + "?title=" + mw.util.wikiUrlencode(mw.config.get("wgPageName")) + "&action=edit§ion=0&summary=/*%20Преамбула%20*/%20"); |
| | } |
| | }); |
| | }); |
|
| |
|
| function onPageInit() | | /* Вставка юзернейма с помощью <span class="insertusername"></span> */ |
| { | | $(function () { |
| do_nihilism(); | | if ((typeof (disableUsernameReplace) == "undefined" || !disableUsernameReplace) && mw.config.get("wgUserName") !== null) { |
| do_memory_eraser();
| | var username = mw.config.get("wgUserName"); |
| editZeroSection();
| | $("span.insertusername").text(username); |
| hide_bad_iwiki();
| | } |
| sysdep_init();
| | }); |
| fixSearch();
| |
| yandex_rating_banner();
| |
| rewrite_title();
| |
| UserNameReplace();
| |
| noLogo(); | |
| defaultUploadInfo();
| |
|
| |
|
| createNavigationBarToggleButton(); /* [[MediaWiki:Dynavbar.js]] */
| |
|
| |
|
| if(typeof onPageLoad != "undefined") | | /* Замена категорий для шаблона {{Cats}} */ |
| { | | $(function () { |
| onPageLoad(); | | var categoriesAlternative = $("#categories_alternative"); |
| | if (categoriesAlternative[0]) { |
| | $('#mw-normal-catlinks').html(categoriesAlternative.html()); |
| | categoriesAlternative.hide(); |
| } | | } |
| } | | }); |
| | |
| /* Маскируем неправильно настроенные интервики — Edward. */
| |
| function hide_bad_iwiki()
| |
| {
| |
| for(var i = 0; i < document.links.length; i ++)
| |
| {
| |
| if(document.links[i].href.match("title=(Km|Lo|Ms|Oc|Nn):"))
| |
| document.links[i].innerHTML = "";
| |
| }
| |
| }
| |
| | |
| /* Индекс цитирования (тИЦ) */
| |
| function yandex_rating_banner()
| |
| {
| |
| txt = document.getElementById('yandex_rating');
| |
| if(txt)
| |
| {
| |
| txt.innerHTML = '<a href="http://yaca.yandex.ru/yca/cat/Entertainment/Humor/Puns/"><img src="http://www.yandex.ru/cycounter?absurdopedia.wikia.com" title="Индекс цитирования (тИЦ) Абсурдопедии" /></a>';
| |
| }
| |
| }
| |
|
| |
|
| /* Обеспечиваем фокус с {{sysdep}} — Edward. */
| |
| function sysdep_init()
| |
| {
| |
| var lo = document.getElementById('linux_only');
| |
| var wo = document.getElementById('winds_only');
| |
| if(navigator.userAgent.match("Linux") || navigator.userAgent.match("X11"))
| |
| {
| |
| if(lo) lo.style.display = "block";
| |
| if(wo) wo.style.display = "none";
| |
| }
| |
| else
| |
| {
| |
| if(lo) lo.style.display = "none";
| |
| if(wo) wo.style.display = "block";
| |
| }
| |
| }
| |
|
| |
|
| /* Обеспечиваем нигилистические фокусы — Edward (см., например, статью [[Google]]) */ | | /* Вставка VK-видео на страницу для шаблона {{VKVideo}} */ |
| function do_nihilism()
| | (function() { |
| {
| | 'use strict'; |
| nhl = document.getElementById('nihilism');
| | |
| if(nhl && !document.location.href.match("diff"))
| | function initVKVideo() { |
| {
| | var containers = document.querySelectorAll('.vk-video-js'); |
| msg = nhl.innerHTML;
| | |
| var body = document.getElementsByTagName('body')[0];
| | for (var i = 0; i < containers.length; i++) { |
| body.style.backgroundColor = 'white';
| | var container = containers[i]; |
| body.innerHTML = "<div id='nihilism_message'" + (nhl.style.top == "0px" ? " style='top: 0px; left: 0px;'" : "") + ">" + msg + "</div>";
| | var oid = container.getAttribute('data-oid'); |
| }
| | var id = container.getAttribute('data-id'); |
| }
| | var width = container.getAttribute('data-width') || '560'; |
| | var height = container.getAttribute('data-height') || '315'; |
| | |
| | width = parseInt(width) || 560; |
| | height = parseInt(height) || 315; |
| | if (width > 1920) width = 1920; |
| | if (height < 100) height = 100; |
| | if (height > 1080) height = 1080; |
| | |
| | if (oid && id && oid !== 'null' && id !== 'null' && /^[a-zA-Z0-9_-]{1,100}$/.test(oid) && /^[-_a-zA-Z0-9]+$/.test(id)) { |
| | var iframe = document.createElement('iframe'); |
| | iframe.src = 'https://vk.com/video_ext.php?oid=' + encodeURIComponent(oid) + '&id=' + encodeURIComponent(id); |
| | iframe.width = width; |
| | iframe.height = height; |
| | iframe.frameBorder = '0'; |
| | iframe.allowFullscreen = true; |
| | |
| | iframe.sandbox = 'allow-scripts allow-same-origin allow-presentation allow-fullscreen'; |
| | iframe.allow = 'fullscreen'; |
| | iframe.referrerPolicy = 'no-referrer'; |
| | iframe.loading = 'lazy'; |
| | iframe.style.border = 'none'; |
| | |
| | while (container.firstChild) { |
| | container.removeChild(container.firstChild); |
| | } |
| | container.appendChild(iframe); |
| | } else { |
| | var errorDiv = document.createElement('div'); |
| | |
| | errorDiv.style.color = 'red'; |
| | errorDiv.style.padding = '10px'; |
| | errorDiv.style.textAlign = 'center'; |
| | errorDiv.style.border = '1px solid'; |
| | errorDiv.style.backgroundColor = '#fff'; |
| | errorDiv.style.fontFamily = 'Arial, sans-serif'; |
| | errorDiv.style.fontSize = '14px'; |
| | errorDiv.style.margin = '5px 0'; |
|
| |
|
| /* Заставляем работать шаблон {{title}} (удалить этот код, когда заработает {{DISPLAYTITLE}}) */
| | errorDiv.textContent = 'Ошибка: неверные параметры видео'; |
| function rewrite_title()
| | |
| {
| | while (container.firstChild) { |
| if(wgAction == "view")
| | container.removeChild(container.firstChild); |
| {
| | } |
| p = document.getElementById('correctTitle');
| | container.appendChild(errorDiv); |
| if(p)
| | } |
| {
| | } |
| document.getElementById('firstHeading').innerHTML = p.innerHTML;
| |
| document.getElementById('wrongTitle').style.display = "none";
| |
| } | | } |
| }
| | |
| }
| | if (document.readyState === 'loading') { |
| | | document.addEventListener('DOMContentLoaded', initVKVideo); |
| /* Обеспечиваем стирание памяти для «Людёй в чёрном» */
| | } else { |
| function do_memory_eraser()
| | initVKVideo(); |
| {
| |
| era = document.getElementById('erase_memory');
| |
| if(era)
| |
| {
| |
| setTimeout("era.style.display='none'", 5000);
| |
| }
| |
| }
| |
| | |
| /* + ссылка «править» для нулевой секции. */
| |
| function editZeroSection(){
| |
| var body = document.getElementById('bodyContent')
| |
| if (!body) return
| |
| var h2s = body.getElementsByTagName('H2')
| |
| var h2 = h2s[0]
| |
| if (!h2) return
| |
| if (h2.parentNode.id == 'toctitle') h2 = h2s[1]
| |
| if (!h2) return
| |
| var span = h2.firstChild
| |
| if (!span || span.className != 'editsection') return
| |
| var zero = span.cloneNode(true)
| |
| body.insertBefore(zero, body.firstChild)
| |
| var a = zero.getElementsByTagName('a')[0]
| |
| if (a.href.indexOf('§ion=T') == -1 ) a.title = a.title.replace(/:.*$/,': 0')
| |
| else a.title = 'Править секцию: 0'
| |
| a.setAttribute('href', wgScript + '?title='+encodeURIComponent(wgPageName) + '&action=edit§ion=0')
| |
| }
| |
| | |
| function fixSearch()
| |
| { | |
| var button = document.getElementById('searchSubmit');
| |
| | |
| if(button) | |
| button.name = 'go';
| |
| } | |
| | |
| /* Вставка юзернейма с помощью <span class="insertusername"></span> */
| |
| function UserNameReplace()
| |
| { | |
| if(typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName == null)
| |
| return;
| |
| var n = YAHOO.util.Dom.getElementsByClassName('insertusername', 'span', document.getElementById('bodyContent'));
| |
| for(var x in n)
| |
| { | |
| n[x].innerHTML = wgUserName;
| |
| }
| |
| }
| |
| | |
| addOnloadHook(UserNameReplace);
| |
| | |
| /* Прописываем для нужных страниц индивидуальные стили */
| |
| /* Записи имеют вид <имя страницы>:<имя стиля>. При этом должна существовать страница [[MediaWiki:Skin/<имя стиля>]], которая и будет включена. Записи разделяются через запятую.*/
| |
| reskin = {
| |
| "ААААААААА!": "Aaaa.css"
| |
| }
| |
| | |
| /* Применяем для нужных страниц индивидуальные стили. Код нагло стырен из Анциклопедии */
| |
| if (reskin[wgPageName] != undefined && wgIsArticle == true) {
| |
| skinName = (reskin[wgPageName].length > 0) ? reskin[wgPageName] : wgPageName + '.css';
| |
| document.write('<style type="text/css">/*<![CDATA[*/ @import "/index.php?title=MediaWiki:Skin/' + skinName + '&action=raw&ctype=text/css"; /*]]>*/</style>');
| |
| }
| |
| | |
| /* {{nologo}} */
| |
| function noLogo() { if(document.getElementById('nologo'))
| |
| document.getElementById('p-logo').style.display = 'none';
| |
| }
| |
| | |
| function defaultUploadInfo()
| |
| {
| |
| var d = document.getElementById('wpUploadDescription');
| |
| if(d) {
| |
| if(!d.value.match(/\[\[(Категория|Category):/)) {
| |
| d.value += "\n\n\n[[Категория:Некатегоризованные изображения]]";
| |
| } | | } |
| }
| | })(); |
| }
| |
| | |
| addOnloadHook(onPageInit);
| |
| | |
| /* tooltips and access keys */
| |
| ta = new Object();
| |
| ta['pt-userpage'] = new Array('.','Моя страница пользователя');
| |
| ta['pt-anonuserpage'] = new Array('.','Страница пользователя для моего IP');
| |
| ta['pt-mytalk'] = new Array('n','Моя страница обсуждений');
| |
| ta['pt-anontalk'] = new Array('n','Страница обсуждений для моего IP');
| |
| ta['pt-preferences'] = new Array('','Мои настройки');
| |
| ta['pt-watchlist'] = new Array('l','Список страниц моего наблюдения');
| |
| ta['pt-mycontris'] = new Array('y','Список страниц, которые я редактировал');
| |
| ta['pt-login'] = new Array('o','Здесь можно зарегистрироваться в системе, но это необязательно');
| |
| ta['pt-anonlogin'] = new Array('o','Здесь можно зарегистрироваться в системе, но это необязательно');
| |
| ta['pt-logout'] = new Array('o','Отказаться от регистрации');
| |
| ta['ca-talk'] = new Array('t','Обсуждение статьи');
| |
| ta['ca-edit'] = new Array('e','Эту статью можно изменять. Перед сохранением изменений, пожалуйста, нажмите кнопку предварительного просмотра для визуальной проверки результата');
| |
| ta['ca-addsection'] = new Array('+','Добавить комментарий к обсуждению');
| |
| ta['ca-viewsource'] = new Array('e','Эта страница защищена от изменений, но вы можете посмотреть и скопировать её исходный текст');
| |
| ta['ca-history'] = new Array('h','Журнал изменений страницы');
| |
| ta['ca-protect'] = new Array('=','Защитить страницу от изменений');
| |
| ta['ca-delete'] = new Array('d','Удалить эту страницу');
| |
| ta['ca-undelete'] = new Array('d','Восстановить исправления страницы, сделанные до того, как она была удалена');
| |
| ta['ca-move'] = new Array('m','Переименовать страницу');
| |
| ta['ca-watch'] = new Array('w','Добавить эту страницу в ваш список наблюдения');
| |
| ta['ca-unwatch'] = new Array('w','Удалить эту страницу из вашего списка наблюдения');
| |
| ta['search'] = new Array('f','Искать это слово');
| |
| ta['p-logo'] = new Array('','Заглавная страница');
| |
| ta['n-mainpage'] = new Array('z','Перейти на заглавную страницу');
| |
| ta['n-portal'] = new Array('','О проекте, о том, что вы можете сделать, где что находится');
| |
| ta['n-currentevents'] = new Array('','Список текущих событий');
| |
| ta['n-recentchanges'] = new Array('r','Список последних изменений');
| |
| ta['n-randompage'] = new Array('x','Посмотреть случайную страницу');
| |
| ta['n-help'] = new Array('','Справочник по проекту «{{SITENAME}}»');
| |
| ta['n-sitesupport'] = new Array('','Поддержите проект');
| |
| ta['t-whatlinkshere'] = new Array('j','Список всех страниц, которые ссылаются на эту страницу');
| |
| ta['t-recentchangeslinked'] = new Array('k','Последние изменения в страницах, которые ссылаются на эту страницу');
| |
| ta['feed-rss'] = new Array('','Трансляция в формате RSS для этой страницы');
| |
| ta['feed-atom'] = new Array('','Трансляция в формате Atom для этой страницы');
| |
| ta['t-contributions'] = new Array('','Список страниц, которые изменял этот участник');
| |
| ta['t-emailuser'] = new Array('','Отправить письмо этому участнику');
| |
| ta['t-upload'] = new Array('u','Загрузить изображения или мультимедиа-файлы');
| |
| ta['t-specialpages'] = new Array('q','Список служебных страниц');
| |
| ta['t-print']=new Array('', 'Версия без кнопок, пригодная для распечатки');
| |
| ta['t-permalink'] = new Array('', 'Ссылка на текущую версию этой статьи');
| |
| ta['ca-nstab-main'] = new Array('c','Содержание статьи');
| |
| ta['ca-nstab-user'] = new Array('c','Персональная страница участника');
| |
| ta['ca-nstab-media'] = new Array('c','Мультимедиа-файл');
| |
| ta['ca-nstab-special'] = new Array('','Это служебная страница, она недоступна для редактирования');
| |
| ta['ca-nstab-wp'] = new Array('a','Страница проекта');
| |
| ta['ca-nstab-image'] = new Array('c','Страница изображения');
| |
| ta['ca-nstab-mediawiki'] = new Array('c','Страница сообщения MediaWiki');
| |
| ta['ca-nstab-template'] = new Array('c','Страница шаблона');
| |
| ta['ca-nstab-help'] = new Array('c','Страница справки');
| |
| ta['ca-nstab-category'] = new Array('c','Страница категории');
| |
| | |
| /* </pre> */
| |