|
|
| (не показаны 304 промежуточные версии 17 участников) |
| Строка 1: |
Строка 1: |
| /* <pre><nowiki> */ | | /* Нигилистические фокусы (см. шаблон {{tl|Нигилизм}}) */ |
| | | $(function () { |
| | | var nihilism = $('#nihilism'); |
| /* tooltips and access keys */
| | if (nihilism[0] && !document.location.href.match("diff")) { |
| ta = new Object();
| | var msg = nihilism.html(); |
| ta['pt-userpage'] = new Array('.','Моя страница пользователя');
| | if (!nihilism.hasClass('nihilism-no-white')) { |
| ta['pt-anonuserpage'] = new Array('.','Страница пользователя для моего IP');
| | $('body').css('background-color', 'white'); |
| ta['pt-mytalk'] = new Array('n','Моя страница обсуждений');
| | } |
| ta['pt-anontalk'] = new Array('n','Страница обсуждений для моего IP');
| | var scripts = $('script'); |
| ta['pt-preferences'] = new Array('','Мои настройки');
| | var bodyNihilism = $('body').html(''); |
| ta['pt-watchlist'] = new Array('l','Список страниц моего наблюдения');
| | var divNihilism = $('<div class="mw-parser-output"></div>').html(msg); |
| ta['pt-mycontris'] = new Array('y','Список страниц, которые я редактировал');
| | if (nihilism.css('top') == '0px') { |
| ta['pt-login'] = new Array('o','Здесь можно зарегистрироваться в системе, но это необязательно');
| | bodyNihilism.css('top', '0px').css('left', '0px'); |
| ta['pt-anonlogin'] = new Array('o','Здесь можно зарегистрироваться в системе, но это необязательно');
| | } |
| ta['pt-logout'] = new Array('o','Отказаться от регистрации');
| | bodyNihilism.append(divNihilism).append(scripts); |
| ta['ca-talk'] = new Array('t','Обсуждение статьи');
| | $(document).dblclick(function () { |
| ta['ca-edit'] = new Array('e','Эту статью можно изменять. Перед сохранением изменений, пожалуйста, нажмите кнопку предварительного просмотра для визуальной проверки результата');
| | window.location = mw.util.getUrl(null, {'action': 'edit'}); |
| 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','Страница категории');
| |
| | |
| function onPageInit() | |
| { | |
| document.getElementById('searchGoButton').style.display = 'none';
| |
| | |
| fillEditSummaries();
| |
| fillDeleteReasons();
| |
| do_nihilism();
| |
| do_edit_null();
| |
| | |
| if(typeof onPageLoad != "undefined")
| |
| {
| |
| onPageLoad(); | |
| } | | } |
| } | | }); |
| | |
| /* Обеспечиваем нигилистические фокусы (см., например, статью [[Google]]) */
| |
| function do_nihilism()
| |
| {
| |
| nhl = document.getElementById('nihilism');
| |
| if(nhl)
| |
| {
| |
| msg = nhl.innerHTML;
| |
| document.getElementById('globalWrapper').innerHTML = "<div id='nihilism_message'>" + msg + "</div>";
| |
| }
| |
| }
| |
|
| |
|
| /* Делаем ссылку «править» для нулевой секции — (C) Edward. */ | | /* Стирание памяти для [[MIB]] («Людей в чёрном») */ |
| function do_edit_null() | | $(function () { |
| { | | if ($("#erase_memory")[0]) |
| if(document.getElementById('bodyContent').innerHTML.match('class=\"editsection\"'))
| | setTimeout(function () { $("#erase_memory").hide(); }, 20000); |
| document.getElementById('bodyContent').innerHTML = "<div class=\"editsection\" id=\"ca-edit-0\">[<a href=\"http://absurdopedia.wikia.com/index.php?title=" + document.title.substr(0, document.title.lastIndexOf(" — ")) + "&action=edit§ion=0\">править</a>]</div>" + document.getElementById('bodyContent').innerHTML;
| | }); |
| } | |
|
| |
|
| function fillEditSummaries()
| | /* Ссылка «править» для нулевой секции */ |
| {
| | $(function () { |
| var label = document.getElementById("wpSummaryLabel"); | | var zeroSectionTip = "Править введение"; |
|
| |
|
| if(label == null) | | if (!mw.config.get("wgArticleId")) { |
| {
| |
| return; | | return; |
| } | | } |
|
| |
|
| var comboString = "Standard summaries: <select id='stdSummaries' onchange='onStdSummaryChange()'>"; | | var action = mw.config.get("wgAction"); |
| comboString += "</select><br />"; | | if (action != "view" && action != "purge") |
| label.innerHTML = comboString + label.innerHTML;
| | return; |
|
| |
|
| var request; | | mw.util.$content.find("h2").children(".mw-editsection:first").clone().prependTo("#bodyContent").css("float", "right").find("a").each(function (index) { |
| | | $(this).attr("title", zeroSectionTip); |
| try
| | if ($(this).attr("class") === "mw-editsection-visualeditor") { |
| {
| | $(this).attr("href", mw.config.get("wgScript") + "?title=" + mw.util.wikiUrlencode(mw.config.get("wgPageName")) + "&veaction=edit&vesection=0&summary=/*%20Преамбула%20*/%20"); |
| request = new XMLHttpRequest();
| | } else { |
| }
| | $(this).attr("href", mw.config.get("wgScript") + "?title=" + mw.util.wikiUrlencode(mw.config.get("wgPageName")) + "&action=edit§ion=0&summary=/*%20Преамбула%20*/%20"); |
| catch(e)
| |
| {
| |
| request = new ActiveXObject("Msxml2.XMLHTTP");
| |
| }
| |
| | |
| request.open("GET", "http://absurdopedia.wikia.com/index.php?title=Template:Stdsummaries&action=raw&ctype=text/plain");
| |
| | |
| request.onreadystatechange = function()
| |
| {
| |
| if(request.readyState == 4) | |
| {
| |
| var combo = document.getElementById("stdSummaries"); | |
| var lines = request.responseText.split("\n");
| |
| var i;
| |
| | |
| for(i = 0; i < lines.length; i++) | |
| {
| |
| var value = lines[i].indexOf("-- ") == 0 ? lines[i].substring(3) : "";
| |
| combo.innerHTML += "<option value='" + value + "'>" + lines[i] + "</option>";
| |
| }
| |
| } | | } |
| } | | }); |
| | | }); |
| request.send(null);
| |
| }
| |
|
| |
|
| function onStdSummaryChange()
| | /* Вставка юзернейма с помощью <span class="insertusername"></span> */ |
| {
| | $(function () { |
| var combo = document.getElementById("stdSummaries"); | | if ((typeof (disableUsernameReplace) == "undefined" || !disableUsernameReplace) && mw.config.get("wgUserName") !== null) { |
| var value = combo.options[combo.selectedIndex].value;
| | var username = mw.config.get("wgUserName"); |
| | | $("span.insertusername").text(username); |
| if(value != "")
| |
| document.getElementById("wpSummary").value = value;
| |
| }
| |
| | |
| function fillDeleteReasons()
| |
| {
| |
| var label = document.getElementById("wpReason");
| |
| | |
| if(label == null)
| |
| {
| |
| return;
| |
| } | | } |
| | }); |
|
| |
|
| label = document.getElementById("contentSub");
| |
|
| |
|
| if(label == null) | | /* Замена категорий для шаблона {{Cats}} */ |
| { | | $(function () { |
| return; | | var categoriesAlternative = $("#categories_alternative"); |
| | if (categoriesAlternative[0]) { |
| | $('#mw-normal-catlinks').html(categoriesAlternative.html()); |
| | categoriesAlternative.hide(); |
| } | | } |
| | }); |
|
| |
|
| var comboString = "<br /><select id='stdReasons' onchange='onStdReasonChange()'>";
| |
| comboString += "</select>";
| |
| label.innerHTML += comboString;
| |
|
| |
| var request;
| |
|
| |
|
| try | | /* Вставка VK-видео на страницу для шаблона {{VKVideo}} */ |
| { | | (function() { |
| request = new XMLHttpRequest(); | | 'use strict'; |
| }
| | |
| catch(e)
| | function initVKVideo() { |
| {
| | var containers = document.querySelectorAll('.vk-video-js'); |
| request = new ActiveXObject("Msxml2.XMLHTTP");
| | |
| }
| | for (var i = 0; i < containers.length; i++) { |
| | var container = containers[i]; |
| | 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'; |
|
| |
|
| request.open("GET", "http://absurdopedia.wikia.com/index.php?title=Template:Stdreasons&action=raw&ctype=text/plain");
| | errorDiv.textContent = 'Ошибка: неверные параметры видео'; |
| | | |
| request.onreadystatechange = function()
| | while (container.firstChild) { |
| {
| | container.removeChild(container.firstChild); |
| if(request.readyState == 4)
| | } |
| {
| | container.appendChild(errorDiv); |
| var combo = document.getElementById("stdReasons");
| |
| var lines = request.responseText.split("\n");
| |
| var i;
| |
| | |
| for(i = 0; i < lines.length; i++)
| |
| {
| |
| var value = lines[i].indexOf("-- ") == 0 ? lines[i].substring(3) : ""; | |
| combo.innerHTML += "<option value='" + value + "'>" + lines[i] + "</option>";
| |
| } | | } |
| } | | } |
| } | | } |
| | | |
| request.send(null); | | if (document.readyState === 'loading') { |
| }
| | document.addEventListener('DOMContentLoaded', initVKVideo); |
| | | } else { |
| function onStdReasonChange()
| | initVKVideo(); |
| {
| | } |
| var combo = document.getElementById("stdReasons");
| | })(); |
| var value = combo.options[combo.selectedIndex].value; | |
| | |
| if(value != "")
| |
| document.getElementById("wpReason").value = value; | |
| }
| |
| | |
| window.onload = onPageInit;
| |
| | |
| /* </nowiki></pre> */
| |