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

  • 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.
/*
  ==== funkcja insertTagsTo_ ====
; Author: phpBB Team, WikiMedia, Maciej Jaros [[:pl:User:Nux]]
</pre>
; Licence: [http://opensource.org/licenses/gpl-license.php GNU General Public License v2]
; Description: Apply tagOpen/tagClose to selection in given textarea/input, use sampleText instead of selection if there is none. Copied and adapted from phpBB
<pre>
*/
// outputid = 'some_id_of_a_textarea_or_a_text_input'
function insertTagsTo_(tagOpen, tagClose, sampleText, outputid) {
	var txtarea = document.getElementById(outputid);
	if (!txtarea)
		return
	;
 
	// IE
	if (document.selection  && !is_gecko) {
		var theSelection = document.selection.createRange().text;
		if (!theSelection)
			theSelection=sampleText;
		txtarea.focus();
		if (theSelection.charAt(theSelection.length - 1) == " ") { // exclude ending space char, if any
			theSelection = theSelection.substring(0, theSelection.length - 1);
			document.selection.createRange().text = tagOpen + theSelection + tagClose + " ";
		} else {
			document.selection.createRange().text = tagOpen + theSelection + tagClose;
		}
 
	// Mozilla
	} else if(txtarea.selectionStart || txtarea.selectionStart == '0') {
		var replaced = false;
		var startPos = txtarea.selectionStart;
		var endPos = txtarea.selectionEnd;
		if (endPos-startPos)
			replaced = true;
		var scrollTop = txtarea.scrollTop;
		var myText = (txtarea.value).substring(startPos, endPos);
		if (!myText)
			myText=sampleText;
		if (myText.charAt(myText.length - 1) == " ") { // exclude ending space char, if any
			subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + " ";
		} else {
			subst = tagOpen + myText + tagClose;
		}
		txtarea.value = txtarea.value.substring(0, startPos) + subst +
			txtarea.value.substring(endPos, txtarea.value.length);
		txtarea.focus();
		//set new selection
		if (replaced) {
			var cPos = startPos+(tagOpen.length+myText.length+tagClose.length);
			txtarea.selectionStart = cPos;
			txtarea.selectionEnd = cPos;
		} else {
			txtarea.selectionStart = startPos+tagOpen.length;
			txtarea.selectionEnd = startPos+tagOpen.length+myText.length;
		}
		txtarea.scrollTop = scrollTop;
	}
	// reposition cursor if possible
	if (txtarea.createTextRange)
		txtarea.caretPos = document.selection.createRange().duplicate();
}
/*
</pre>
*/

/*
==== кнопкі для кароткага апісаньня зьменаў па прыкладу польскай Вікіпэдыі ====
* Author: [[:pl:User:Adziura|Adam Dziura]]
* Fixes: [[:pl:User:Nux|Maciej Jaros]]
<pre>
*/
// main function
$(function ()
{
	// stop before starting
	if (window.autoSummariesDone)
		return;

	//
	// check if user is editing and if this is a summary field (not a section header field)
	var el = document.getElementById('wpSummary');
	if (el)
	{
		// Can’t catch why this for, but this check blocks summary buttons adding.
		// Не разумею, для чаго гэта, але праверка блякуе дадаваньне спісу кнопак для кароткага апісаньня зьменаў.
		// Удзельнік:Zedlik 

		// if (el.getAttribute('tabindex')==1) // hack! hopefully will not be changed
		// 	return	// stop
		// ;

		// no buttons if there is a new section adding form
		var wps = document.getElementById("editform");
		if (wps && wps.wpSection && (wps.wpSection.value == "new"))
			return;
	}
	else
	{
		return;	// stop
	}
	
	//
	// adding element that will hold buttons
	el = el.nextSibling;
	var parent = document.createElement('span');
	parent.id = 'userSummaryButtonsA';
	// el.parentNode.insertBefore(document.createElement('br'), el)
	el.parentNode.insertBefore(parent, el);
	
	//
	// adding summary buttons
	var cl = '';	// class is not needed (as on may style with the element above)
	// drobne różne
	addSummaryBtn(parent, 'правапіс', 'addSumm("правапіс")', cl,
		'правапіс (orthography)');
	addSummaryBtn(parent, 'артаграфія', 'addSumm("артаграфія")', cl,
		'артаграфія (orthography)');
	addSummaryBtn(parent, 'пунктуацыя', 'addSumm("пунктуацыя")', cl,
		'пунктуацыя (punctuation)');
	addSummaryBtn(parent, 'стыль', 'addSumm("стыль")', cl,
		'стыль (style)');
	addSummaryBtn(parent, 'спасылкі', 'addSumm("выпраўленьне спасылак")', cl,
		'спасылкі (linkfix)');
	addSummaryBtn(parent, 'пачатак', 'addSumm("пачатак")', cl,
		'пачатак (begin)');
	addSummaryBtn(parent, 'дапаўненьне', 'addSumm("дапаўненьне")', cl,
		'дапаўненьне (expand)');
	addSummaryBtn(parent, 'абнаўленьне', 'addSumm("абнаўленьне зьвестак")', cl,
		'абнаўленьне зьвестак (update)');
    addSummaryBtn(parent, 'вікізьвесткі', 'addSumm("[[Вікіпэдыя:Вікізьвесткі|вікізьвесткі]]")', cl,
		'вікізьвесткі (wikidata)');
    addSummaryBtn(parent, 'выява', 'addSumm("[[Вікіпэдыя:Выявы|выява]]")', cl,
		'выява (image)');
    addSummaryBtn(parent, 'катэгорыя', 'addSumm("[[Вікіпэдыя:Катэгорыя|катэгорыя]]")', cl,
		'катэгорыя (category)');
    addSummaryBtn(parent, 'шаблён', 'addSumm("[[Вікіпэдыя:Шаблёны|шаблён]]")', cl,
		'шаблён (template)');
    addSummaryBtn(parent, 'меркаваньне', 'addSumm("меркаваньне")', cl,
		'меркаваньне (commentary)');
});

/*
Params:
* el - parent element to hold buttons
* t - text to appear in the button
* a - action (as string) to be run after clicking a button; may be more then one function
* c - optional class name to be attached to the button
* d - a tooltip to be show when one highlights the button
*/
function addSummaryBtn(el, t, a, c, d) {
	var btn = document.createElement('a');

	btn.appendChild(document.createTextNode(t));
	btn.title = d;
	if (c!='')
		btn.className = c
	;
	btn.onclick = new Function(a);

	el.appendChild(btn);
}

function addSumm(txt) {
	var wpS = document.editform.wpSummary;
	if (wpS.value != '' && wpS.value.charAt(wpS.value.length-2) != '/')
		wpS.value += ', ' + txt;
	else
		wpS.value += txt
	;
}