Redaktor:Ra1n/common.js
Poznámka: Aby sa zmeny prejavili, po uložení musíte vymazať vyrovnávaciu pamäť vášho prehliadača. Mozilla / Firefox / Safari: držte stlačený Shift a kliknite na Reload alebo stlačte buď Ctrl-F5 alebo Ctrl-R (Command-R na Macintosh); Konqueror:: kliknite na tlačidlo Reload alebo stlačte F5; Opera vymazať vyrovnávaciu pamäť prehliadača v ponuke Tools→Preferences; Internet Explorer: držte Ctrl a kliknite na Refresh alebo stlačte Ctrl-F5;
/* <nowiki> */
function fixformat(){
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(/<\/?(b|strong)>/gi, "'''");
txt.value = txt.value.replace(/<\/?(i|em|var)>/gi, "''");
txt.value = txt.value.replace(/<\/?(h1)>/gi, "==");
txt.value = txt.value.replace(/<\/?(li)>/gi, "*");
document.editform.wpSummary.value += "wikify";
document.editform.wpMinoredit.checked = true;
}
function replace(){
var s = prompt("Hľadaný výraz?");
if(s){
var r = prompt("Nový výraz?");
if(!r && r != '') return;
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(new RegExp(s, "g"), r);
document.editform.wpSummary.value += "zámena "+r+" za "+s;
document.editform.wpMinoredit.checked = true;
}
}
function addlilink(tabs, url, name, id){
var na = document.createElement('a');
na.href = url;
na.id = id;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.appendChild(na);
tabs.appendChild(li);
return li;
}
function addPurge(){
ta['ca-purge'] = ['g', 'Vymaže internú cache pre túto stránku'];
if(!document.getElementById) return;
var x = document.getElementById('ca-history');
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if(!x) return;
if(x.children) x = x.children[0];
else x = x.childNodes[0];
addlilink(tabs, x.href.replace(/=history/, "=purge"), 'purge', 'ca-purge');
}
function addEditSection0(){
ta['ca-edit-0'] = ['0', 'Úprava hlavnej sekcie tejto stránky'];
if(!document.getElementById) return;
var x = document.getElementById('ca-edit');
if(!x) return;
var y = document.createElement('LI');
y.id = 'ca-edit-0';
if(x.className == 'selected'){
if(/&action=edit§ion=0$/.test(window.location.href)){
x.className = 'istalk';
y.className = 'selected';
} else {
x.className = 'selected istalk';
}
} else if(x.className == 'selected istalk'){
if(/&action=edit§ion=0$/.test(window.location.href)){
x.className = 'istalk';
y.className = 'selected istalk';
} else {
y.className = 'istalk';
}
} else {
y.className = x.className;
x.className = 'istalk';
}
var z = document.createElement('A');
if(x.children){
z.href = x.children[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);
}else{
z.href = x.childNodes[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
}
}
function addForceSummary(){
if(!/&action=edit/.test(window.location.href)) return;
if(/§ion=new/.test(window.location.href)) return;
if(!document.forms.editform) return;
document.forms.editform.wpSave.onclick = forceSummary;
}
function forceSummary(){
if(!document.forms.editform.wpSummary.value.replace(/^(\/\*.*\*\/)? *(.*) *$/,'$2')){
var r = prompt('Si si istý, že nechceš pridať žiadne zhrnutie?\nMôžeš tak urobiť sem:',document.forms.editform.wpSummary.value);
if(r == null) return false;
document.forms.editform.wpSummary.value = r;
}
return true;
}
function morelinks(){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if(document.title.indexOf("Úprava stránky Diskusia s redaktorom") == 0){
addlilink(tabs, 'javascript:vitajte()', 'vitaj', '');
}else if(document.title.indexOf("Úprava ") == 0){
addlilink(tabs, 'javascript:replace()', 'zameň', '');
addlilink(tabs, 'javascript:fixformat()', 'formátuj', '');
}
}
function addToolBoxLinks(){
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlilink(tb, "javascript:insertTags('{{ja|Ra1n}} ~~~~~','','')", 'Môj podpis', '');
addlilink(tb, '/wiki/Special:Newpages', 'Nové stránky', '');
addlilink(tb, '/wiki/Special:Shortpages', 'Krátke stránky', '');
addlilink(tb, '/wiki/Special:Newimages', 'Nové obrázky', '');
}
function myLoadFuncs(){
addPurge();
addEditSection0();
addForceSummary();
morelinks();
addToolBoxLinks();
}
//tt
/* function addmonobook ()
{
nodUpload = document.getElementById ("t-upload");
if (nodUpload)
{
var nodToolsList = nodUpload.parentNode;
var nodUploadCommons_li = document.createElement ("li");
var nodUploadCommons_a = document.createElement ("a");
nodUploadCommons_a.href = "/wiki/Redaktor:Ra1n/monobook.js";
nodUploadCommons_a.appendChild (document.createTextNode ("monobook.js"));
nodUploadCommons_li.appendChild (nodUploadCommons_a);
nodToolsList.insertBefore (nodUploadCommons_li, nodUpload.nextSibling);
}
}
addOnloadHook( addmonobook );
*/
//tt
//-----
function przyciskiOpis()
{
// stop before starting
if (window.przyciskiOpisDone)
return;
//
// sprawdzenie, czy to jest pole edycji z opisem zmian (nie jest takie jako nagłówek)
var el = document.getElementById('wpSummaryLabel');
if (el)
{
if (el.innerHTML.indexOf('Zhrnutie úprav')==-1)
return // stop
;
}
else
{
return; // stop
}
//
// dodanie elementu okalającego przyciski bezpośrednio za opisem zmian
var el = document.getElementById('userSummaryButtons');
var opisBtns = document.createElement('span');
opisBtns.id = 'userSummaryButtons'
el.parentNode.insertBefore(document.createElement('br'), el)
el.parentNode.insertBefore(opisBtns, el)
//
// dodawanie przycisków
//var kl = 'userButtonsStyle';
var kl = ''; // klasa jest niepotrzebna (wszystkie <a> w #userSummaryButtons ustawione poprzez CSS)
if (opisBtns)
{
przyciskiDodaj(opisBtns, 'ref', 'dodajOpis("referencie")', kl,
'Pridanie odkazov');
}
}
function przyciskiDodaj(elUserBtns, pTekst, pAkcja, pKlasa, pOpis)
{
var nowyBtn = document.createElement('a');
// atrybuty
nowyBtn.appendChild(document.createTextNode(pTekst));
nowyBtn.title = pOpis;
if (pKlasa != '')
nowyBtn.className = pKlasa
;
nowyBtn.onclick = new Function(pAkcja);
// dodanie przycisku
elUserBtns.appendChild(nowyBtn);
}
var clickedMinor = false;
function onMinorEditClick()
{
if (this.checked && !clickedMinor)
{
dodajOpis("drobne");
clickedMinor = true;
}
}
function dodajOpis(opis)
{
var wpS = document.editform.wpSummary;
if (wpS.value != '' && wpS.value.charAt(wpS.value.length-2) != '/')
{
wpS.value += ', ' + opis
}
else
{
wpS.value += opis
}
}
$(przyciskiOpis);
//-----
if (window.addEventListener) window.addEventListener("load",myLoadFuncs,false);
else if (window.attachEvent) window.attachEvent("onload",myLoadFuncs);
else{
window._old_ABCD_onload = window.onload;
window.onload = function(){
window._old_ABCD_onload();
myLoadFuncs();
}
}
// --------- toolbar ---------
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/79/Insert-signature.png",
"speedTip": "Podpis #2",
"tagOpen": "-- ~~~",
"tagClose": "",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/b4/Button_category03.png",
"speedTip": "Kategória",
"tagOpen": "[[Kategória:",
"tagClose": "]]",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/3/33/Button_exclamation.png",
"speedTip": "Copyvio",
"tagOpen": "\x7b\x7bCopyvio|",
"tagClose": "}}",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/4/42/Buttonsablona.png",
"speedTip": "Šablóna",
"tagOpen": "\x7b\x7bTl|",
"tagClose": "}}",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/b0/EXPBT1.png",
"speedTip": "Experimenty",
"tagOpen": "\x7b\x7bExperimenty}} --\x7E\x7E\x7E\x7E",
"tagClose": "",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/a/ae/EXPBT2.png",
"speedTip": "Experimenty2",
"tagOpen": "\x7b\x7bExperimenty2}} --\x7E\x7E\x7E\x7E",
"tagClose": "",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/e/ec/Button_aviso.png",
"speedTip": "Spam",
"tagOpen": "\x7b\x7bsubst:Spam}} --\x7E\x7E\x7E\x7E",
"tagClose": "",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/2/2e/Button_broom.png",
"speedTip": "Zmazať",
"tagOpen": "\x7b\x7bZL|",
"tagClose": "}}",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/a/a9/Button_tournesol.png",
"speedTip": "Vitajte",
"tagOpen": "\x7b\x7bVitajte|redaktor=Ra1n|reg=regáno}} --\x7E\x7E\x7E\x7E",
"tagClose": "",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/9/9f/Button_defaultsort.png",
"speedTip": "Defaultsort",
"tagOpen": "\x7b\x7bDEFAULTSORT:",
"tagClose": "}}",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/1/1b/Button_hide_wiki_tag.png",
"speedTip": "Skrytý text",
"tagOpen": "<!--",
"tagClose": "-->",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/4/41/Button_hr_halfwidth.png",
"speedTip": "Pomlčka",
"tagOpen": "–",
"tagClose": "",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/ba/Button_conserver.png",
"speedTip": "Hlasuj Za",
"tagOpen": "",
"tagClose": "",
"sampleText": "#{{za}} \~\~\~\~"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/f/fc/Button_supp.png",
"speedTip": "Hlasuj Proti",
"tagOpen": "",
"tagClose": "",
"sampleText": "#{{proti}} \~\~\~\~"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/4/4e/Button_neutre.png",
"speedTip": "Hlasuj Neutral",
"tagOpen": "",
"tagClose": "",
"sampleText": "#{{neutral}} \~\~\~\~"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/d/d1/Button_mysignature.png",
"speedTip": "nepodpísal",
"tagOpen": "\x7b\x7bnepodpísal|",
"tagClose": "}}",
"sampleText": ""};
};
/* </nowiki> */