Redaktor:Magy357/common.js

z Wikipédie, slobodnej encyklopédie

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;

/** Tlačidlá */
mw.loader.using('mediawiki.action.edit', function () {
	

 
var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/2/23/Button_code.png',
                       speedTip: 'code',
                       tagOpen: '<code>',
                       tagClose: '</code>',
                       sampleText: 'text'
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/3/3c/Button_pre.png',
                       speedTip: 'preformátovaný text',
                       tagOpen: '<pre>',
                       tagClose: '</pre>',
                       sampleText: 'preformátovaný text'
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
 
var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/a/a5/Buttonexperimenty.png',
                       speedTip: 'experimenty',
                       tagOpen: '\x7b\x7bexperimenty}} \x7E\x7E\x7E\x7E',
                       tagClose: '',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
 
var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/1/16/Buttonexperimenty2.png',
                       speedTip: 'experimenty2',
                       tagOpen: '\x7b\x7bexperimenty2}} \x7E\x7E\x7E\x7E',
                       tagClose: '',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
 
 var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/6/66/Button_mort.png',
                       speedTip: 'Zmazať lebo',
                       tagOpen: '\x7b\x7bZmazať lebo|Experimenty}} \x7E\x7E\x7E\x7E',
                       tagClose: '',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
 
var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/7/72/Button_copy_vio_plagio.png',
                       speedTip: 'Copyvio',
                       tagOpen: '\x7b\x7bcopyvio|url=',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/3/37/Button_no_neutral.png',
                       speedTip: 'neutralita',
                       tagOpen: '\x7b\x7bneutralita',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/d/d1/Button_mysignature.png',
                       speedTip: 'nepodpísal',
                       tagOpen: '\x7b\x7bnepodpísal|',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/a/a4/Spam1.png',
                       speedTip: 'Reklama',
                       tagOpen: '\x7b\x7bReklama',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/e/eb/Button_plantilla.png',
                       speedTip: 'Šablóna',
                       tagOpen: '\x7b\x7bŠablóna|',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/e/e1/Button_smiley.png',
                       speedTip: 'Úsmev',
                       tagOpen: '\x7b\x7bÚsmev',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png',
                       speedTip: 'Úsmev ;',
                       tagOpen: '\x7b\x7bÚsmev|;)',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/7/71/TableCell.png',
                       speedTip: 'Zvislá čiara',
                       tagOpen: '|',
                       tagClose: '',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/0/02/Button_fuente_primaria.png',
                       speedTip: 'bez citácie',
                       tagOpen: '\x7b\x7bbez citácie',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/3/33/Button_unreferenced.png',
                       speedTip: 'bez zdroja',
                       tagOpen: '\x7b\x7bbez zdroja',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/4/4f/Button_sig_(zh).png',
                       speedTip: 'Preklad',
                       tagOpen: '* \x7b\x7bPreklad|en|to|00',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/b/ba/Jadernyhrib-button.png',
                       speedTip: 'urgentne upraviť',
                       tagOpen: '\x7b\x7burgentne upraviť|2013MMDD',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/0/09/Warncreate3.png',
                       speedTip: 'na revíziu',
                       tagOpen: '\x7b\x7bna revíziu',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/6/6c/Button_commons.png',
                       speedTip: 'Commons',
                       tagOpen: '\x7b\x7bprojekt|commons=Category:',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/7/77/Button_Nuvola_apps_edu_phi.png',
                       speedTip: 'Zdieľaná IP školy',
                       tagOpen: '\x7b\x7bZdieľaná IP školy|názov školy',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/a/a9/Button_tournesol.png',
                       speedTip: 'Vitajte',
                       tagOpen: '\x7b\x7bVitajte|redaktor=Magy357|reg=regáno',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/0/06/Smilies_Alien_big_eyes.png',
                       speedTip: 'Vitajte neregistrovaný',
                       tagOpen: '\x7b\x7bVitajte|redaktor=Magy357|reg=regnie',
                       tagClose: '}}',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/9/91/Button_cite_web.png',
                       speedTip: 'Citácia elektronického dokumentu',
                       tagOpen: '<ref>\x7b\x7bCitácia elektronického dokumentu\n | priezvisko = \n | meno = \n | odkaz na autora = \n | vydavateľ = \n | titul = \n | url = \n | dátum vydania = 2012-00-0 \n | dátum prístupu = ' + (y = new Date().getFullYear ()) + '-' + (m = new Date ().getMonth () + 1) + '-' + (d = new Date ().getDate ()) + '\n | miesto = \n | jazyk = \n}}</ref>',
                       tagClose: '',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
                       imageFile: '//upload.wikimedia.org/wikipedia/commons/e/ef/Button_cite_book.png',
                       speedTip: 'Citácia knihy',
                       tagOpen: '<ref>\x7b\x7bCitácia knihy\n | priezvisko = \n | meno = \n | odkaz na autora = \n | titul = \n | vydavateľ = \n | miesto = \n | rok = \n | isbn = \n | strany = \n | počet strán = \n | url = \n | jazyk = \n}}</ref>',
                       tagClose: '',
                       sampleText: ''
        };
        mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);

var button = { id: 'button-comment',
    imageFile: '//upload.wikimedia.org/wikipedia/commons/5/59/Button_sekcje.png',
    speedTip: 'Koncové sekcie (Referencie, Pozri aj, Iné projekty, Externé odkazy, Zdroj)',
    tagOpen: '== Referencie =='+
'\n \x7b\x7bReferencie}}', 
    'tagClose':
'\n'+
'\n== Pozri aj =='+   
'\n* [[]]'+
'\n'+
'\n== Iné projekty =='+
'\n \x7b\x7bprojekt|commons=Category:}}'+   
'\n'+
'\n== Externé odkazy =='+
'\n* []'+
'\n'+
'\n== Zdroj =='+
'\n* \x7b\x7bPreklad|en|to|00}}'+
'\n',
    sampleText: ''
      };
      mw.toolbar.addButton(button.imageFile, button.speedTip, button.tagOpen, button.tagClose, button.sampleText, button.id, button.id);
 
});


/*
=== Odkaz na pieskovisko ===
*/
 
var disableSandboxLink = 0;	// ustawienie tego na 1 lub true w swoim monobook.js pozwoli wyłączyć tę funkcjonalność
 
$(function()
{
	if (wgUserName != null && disableSandboxLink == 0)
	{
		var caption = 'P1'
		if (wgUserLanguage != 'sk')
			caption = 'My sandbox';
 
		mw.util.addPortletLink('p-personal', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Mypage/Pieskovisko', caption, 'pt-sandbox', caption, '', document.getElementById('pt-preferences'));
	}
});
 
 
var disableSandboxLink = 0;	// ustawienie tego na 1 lub true w swoim monobook.js pozwoli wyłączyć tę funkcjonalność
 
$(function()
{
	if (wgUserName != null && disableSandboxLink == 0)
	{
		var caption = 'P2'
		if (wgUserLanguage != 'sk')
			caption = 'My sandbox';
 
		mw.util.addPortletLink('p-personal', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Mypage/Pieskovisko 2', caption, 'pt-sandbox', caption, '', document.getElementById('pt-preferences'));
	}
});
 
var disableSandboxLink = 0;	// ustawienie tego na 1 lub true w swoim monobook.js pozwoli wyłączyć tę funkcjonalność
 
$(function()
{
	if (wgUserName != null && disableSandboxLink == 0)
	{
		var caption = 'P3'
		if (wgUserLanguage != 'sk')
			caption = 'My sandbox';
 
		mw.util.addPortletLink('p-personal', mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Mypage/Pieskovisko 3', caption, 'pt-sandbox', caption, '', document.getElementById('pt-preferences'));
	}
});

function loadScript(url)
{
   var e = document.createElement("script");
   e.src = url;
   e.type="text/javascript";
   document.getElementsByTagName("head")[0].appendChild(e);
}
 
loadScript("http://cs.wikipedia.org/w/index.php?title=Wikipedista:Mormegil/tools.js&action=raw&ctype=text/javascript&dontcountme=s");
 
$(function() { addSummaryToolbar(["drobná úprava ", "na úpravu ", "wikify", "", "doplnenie ", "nový článok ", "oprava ", "", "experimenty", "fix", "commons", "", "presmerovanie  ",]); });
$(function() { addFindAndReplaceToolbar() });


function vitajte(){
    var reg = confirm("Reg?");
    document.editform.wpSummary.value = 'Vitajte/Welcome ';
    var txt = document.editform.wpTextbox1;
    if(txt.value.length > 0) txt.value += '\n';
    if(reg)
        txt.value += '{{Vitajte|redaktor=Magy357|reg=regáno}}';
    else
        txt.value += '{{Vitajte|redaktor=Magy357|reg=regnie}}';
    txt.focus();
}

function experimenty(){
    var dva = confirm("Druhýkrát?");
    var txt = document.editform.wpTextbox1;
    if(txt.value.length > 0) txt.value += '\n';
    if (dva) {
      txt.value += '{{experimenty2}}\n--~~'+'~~';
      document.editform.wpSummary.value = '{{experimenty2}}';
    } else {
      txt.value += '{{experimenty}}\n--~~'+'~~';
      document.editform.wpSummary.value = '{{experimenty}}';
    }
    txt.focus();
}

function vandalizmus(){
    document.editform.wpSummary.value = '{{vandalizmus}}';
    var txt = document.editform.wpTextbox1;
    if(txt.value.length > 0) txt.value += '\n';
    txt.value += '{{vandalizmus}}\n--~~'+'~~';
    txt.focus();
}

function zaregistrujsa(){
    document.editform.wpSummary.value = '{{zaregistruj sa}}';
    var txt = document.editform.wpTextbox1;
    if(txt.value.length > 0) txt.value += '\n';
    txt.value += '{{zaregistruj sa}}\n--~~'+'~~';
    txt.focus();
}
  
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 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()', 'vitajte', '');
        addlilink(tabs, 'javascript:experimenty()', 'exp', '');
        addlilink(tabs, 'javascript:vandalizmus()', 'vandal', '');
        addlilink(tabs, 'javascript:zaregistrujsa()', 'reg', '');
    }
}


function myLoadFuncs(){
if (!window.ta) window.ta = {};

//    addEditSection0();
    morelinks();
}

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();
    }
}

 // [[:en:User:Lupin/popups.js]] - please include this line, prosím nemažte tento riadok
 // [[Redaktor:jsimlo/popups.js]] - please include this line, prosím nemažte tento riadok
 
 document.write('<script type="text/javascript" src="' 
   + 'http://sk.wikipedia.org/w/index.php?title=User:jsimlo/popups.js' 
   + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');