Wikisłownikarka:Ludmiła Pilecka/opisy.js
Uwaga: aby zobaczyć zmiany po opublikowaniu, może zajść potrzeba wyczyszczenia pamięci podręcznej przeglądarki.
- Firefox / Safari: Przytrzymaj Shift podczas klikania Odśwież bieżącą stronę, lub naciśnij klawisze Ctrl+F5, lub Ctrl+R (⌘-R na komputerze Mac)
- Google Chrome: Naciśnij Ctrl-Shift-R (⌘-Shift-R na komputerze Mac)
- Edge: Przytrzymaj Ctrl, jednocześnie klikając Odśwież, lub naciśnij klawisze Ctrl+F5.
- Opera: Naciśnij klawisze Ctrl+F5.
/*
==== Automatic summaries ====
* 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)
{
//if (el.getAttribute('tabindex')==1) // hack! hopefully will not be changed
// return // stop
//;
}
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, 'definicja', 'addSumm("poprawa definicji")', cl,
'poprawa definicji');
addSummaryBtn(parent, 'znaczenie', 'addSumm("dodatkowe znaczenie(a)")', cl,
'dodatkowe znaczenie');
parent.appendChild(document.createTextNode(' × ')); // odstęp
addSummaryBtn(parent, 'odmiana', 'addSumm("odmiana")', cl,
'odmiana');
addSummaryBtn(parent, 'przykłady', 'addSumm("przykłady/cytaty")', cl,
'przykłady');
parent.appendChild(document.createTextNode(' × ')); // odstęp
addSummaryBtn(parent, 'składnia', 'addSumm("składnia")', cl,
'składnia');
addSummaryBtn(parent, 'kolokacje', 'addSumm("kolokacje")', cl,
'kolokacje');
addSummaryBtn(parent, 'synonimy', 'addSumm("synonimy")', cl,
'synonimy');
addSummaryBtn(parent, 'pokrewne', 'addSumm("pokrewne")', cl,
'pokrewne');
addSummaryBtn(parent, 'frazeologia', 'addSumm("frazeol.")', cl,
'frazeologia');
addSummaryBtn(parent, 'etymologia', 'addSumm("etym.")', cl,
'etymologia');
addSummaryBtn(parent, 'uwagi', 'addSumm("uwagi")', cl,
'uwagi');
parent.appendChild(document.createElement('br')); // nowa linia
addSummaryBtn(parent, 'linkfix', 'addSumm("linkfix")', cl,
'linkfix');
addSummaryBtn(parent, 'kwalifikator/y', 'addSumm("kwalifikator(y)")', cl,
'Dodany kwalifikator/y');
addSummaryBtn(parent, 'interpunkcja', 'addSumm("interpunkcja")', cl,
'Poprawiono interpunkcję');
addSummaryBtn(parent, 'literówka', 'addSumm("literówka")', cl,
'Poprawiono literówkę');
addSummaryBtn(parent, 'ogonki', 'addSumm("polskie znaki")', cl,
'Poprawa polskich znaków');
addSummaryBtn(parent, 'dopracować', 'addSumm("{{dopracować}}")', cl,
'Dodany szablon dopracowania');
parent.appendChild(document.createTextNode(' × ')); // odstęp
addSummaryBtn(parent, 'zobteż', 'addSumm("zobacz też")', cl,
'Dodany szablon zobteż');
addSummaryBtn(parent, 'grafika', 'addSumm("+grafika")', cl,
'Dodano grafikę');
addSummaryBtn(parent, 'wikipedia', 'addSumm("+{{wikipedia}}")', cl,
'Dodano link do Wikipedii');
parent.appendChild(document.createTextNode(' × ')); // odstęp
addSummaryBtn(parent, 'redirect', 'addSumm("redirect")', cl,
'redirect');
addSummaryBtn(parent, 'strzałka →', 'addSumm("→")', cl,
'Strzałka');
});
/*
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
;
}
// </pre>