MediaWiki:AddSectionButtons-vector.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 = "collapsible ";
if (isCurrentPageNewSectionAdd()) {
newSectionElement.className += "selected";
}
var newSectionElementSpan = document.createElement('span');
var newSectionElementLink = document.createElement('a');
newSectionElementLink.href = mw.config.get('wgArticlePath').replace("$1", mw.config.get('wgPageName')) + "?action=edit§ion=new";
newSectionElementLink.title = "Пачаць новую сэкцыю [+]";
newSectionElementLink.setAttribute("accesskey", "+");
newSectionElementLink.innerHTML = "Дадаць тэму";
mw.loader.using('mediawiki.util').then(function () {
$(newSectionElementLink).updateTooltipAccessKeys();
});
newSectionElementSpan.appendChild(newSectionElementLink);
newSectionElement.appendChild(newSectionElementSpan);
historyElement.parentNode.insertBefore(newSectionElement, historyElement);
}