MediaWiki:AddSectionButtons-monobook.js

Зьвесткі зь Вікіпэдыі — вольнай энцыкляпэдыі

Заўвага: каб пабачыць зьмены пасьля публікацыі, Вам можа спатрэбіцца ачысьціць кэш Вашага браўзэра.

  • Firefox / Safari: трымайце Shift і націсьніце Reload, ці націсьніце Ctrl-F5 ці Ctrl-R (⌘-R на Mac)
  • Google Chrome: націсьніце Ctrl-Shift-R (⌘-Shift-R на Mac)
  • Internet Explorer / Edge: трымайце Ctrl і націсьніце Refresh, ці націсьніце Ctrl-F5
  • Opera: націсьніце Ctrl-F5.
/**
  * Дапаможная функцыя для дадаваньня кнопкі «Дадаць сэкцыю» ў адпаведных месцах (напрыклад [[ВП:Ф]]).
  * Аўтар: [[Удзельнік:zedlik]]
  */
function showAddSectionButton() {
 
    var currentAddSectionElement = document.getElementById("ca-addsection");
 
    // check whether the button already exists
    if (currentAddSectionElement) {
        return;
    }
 
    var historyElement = document.getElementById("ca-history");
 
    // check whether the element to insert before exists
    if (!historyElement) {
        return;
    }
 
    var newSectionElement = document.createElement('li');
    newSectionElement.id = "ca-addsection";
    newSectionElement.className = "";
    if (isCurrentPageNewSectionAdd()) {
        newSectionElement.className += "selected";
    }
 
    var newSectionElementLink = document.createElement('a');
    newSectionElementLink.href = mw.config.get('wgArticlePath').replace("$1", mw.config.get('wgPageName')) + "?action=edit&section=new";
 
    newSectionElementLink.title = "Пачаць новую сэкцыю [+]";
    newSectionElementLink.setAttribute("accesskey", "+");
    newSectionElementLink.innerHTML = "+";

    mw.loader.using('mediawiki.util').then(function () {
        $(newSectionElementLink).updateTooltipAccessKeys();
    });
 
    newSectionElement.appendChild(newSectionElementLink);

    var newSectionElementSpaceText = document.createElement('span');
    newSectionElementSpaceText.innerHTML = " ";
 
    historyElement.parentNode.insertBefore(newSectionElement, historyElement);
    historyElement.parentNode.insertBefore(newSectionElementSpaceText, historyElement);
}