Preskočiť na obsah

Redaktor:Jonesy/modern.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;

if (mwCustomEditButtons) {
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/f/f8/Button_suppr.png",
    "speedTip": "Kandidát na rýchle zmazanie",
    "tagOpen": "\x7b\x7bzmazať lebo|",
    "tagClose": "}}",
    "sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/b/ba/Jadernyhrib-button.png",
    "speedTip": "Urgentne upraviť",
    "tagOpen": "\x7b\x7burgentne upraviť|",
    "tagClose": "}}",
    "sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/2/2e/Button_broom.png",
    "speedTip": "Na úpravu",
    "tagOpen": "\x7b\x7bna úpravu",
    "tagClose": "}}",
    "sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/e/e9/Button_preview.png",
    "speedTip": "Na rozšírenie",
    "tagOpen": "\x7b\x7bna rozšírenie",
    "tagClose": "}}",
    "sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/3/33/Button_unreferenced.png",
    "speedTip": "Na revíziu",
    "tagOpen": "\x7b\x7bna revíziu",
    "tagClose": "}}",
    "sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/3/37/Button_no_neutral.png",
    "speedTip": "Neutralita",
    "tagOpen": "\x7b\x7bneutralita",
    "tagClose": "}}",
    "sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/0/0b/Button_fuente.png",
    "speedTip": "Bez zdroja",
    "tagOpen": "\x7b\x7bbezzdroja",
    "tagClose": "}}",
    "sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/72/Button_copy_vio_plagio.png",
    "speedTip": "Copyvio",
    "tagOpen": "\x7b\x7bcopyvio|url=",
    "tagClose": "}}",
    "sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/d/d1/Button_mysignature.png",
    "speedTip": "Nepodpísal",
    "tagOpen": "\x7b\x7bnepodpísal|",
    "tagClose": "}}",
    "sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://upload.wikimedia.org/wikipedia/commons/1/1c/Button_smiley_face_smile.png",
    "speedTip": "Smajlík",
    "tagOpen": "\x7b\x7bÚsmev",
    "tagClose": "}}",
    "sampleText": ""};
};

function addPurge(){
    ta['ca-purge'] = ['g', 'Purge the internal cache for this page'];
    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'] = ['', 'Edit the zeroth section of this page'];
    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&section=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&section=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 + '&section=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 + '&section=0';
        z.appendChild(document.createTextNode('0'));
        y.appendChild(z);
        document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
    }
}

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=Jonesy|reg=regáno}}';
    else
        txt.value += '{{Vitajte|redaktor=Jonesy|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}}\~\~\~\~';
      document.editform.wpSummary.value = '{{experimenty2}}';
    } else {
      txt.value += '{{experimenty}}\~\~\~\~';
      document.editform.wpSummary.value = '{{experimenty}}';
    }
    txt.focus();
}

function reklama(){
    var dva = confirm("Druhýkrát?");
    var txt = document.editform.wpTextbox1;
    if(txt.value.length > 0) txt.value += '\n';
    if (dva) {
      txt.value += '{{reklama2}}\~\~\~\~';
      document.editform.wpSummary.value = '{{reklama2}}';
    } else {
      txt.value += '{{reklama}}\~\~\~\~';
      document.editform.wpSummary.value = '{{reklama}}';
    }
    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")
== 0){
        addlilink(tabs, 'javascript:vitajte()', 'vitajte', '');
        addlilink(tabs, 'javascript:experimenty()', 'experimenty', '');
        addlilink(tabs, 'javascript:reklama()', 'reklama', '');
    }
}

function LinkFA() 
{
   // iterate over all <span>-elements
   for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
      // if found a FA span
      if(a.className == "FA") {
         // iterate over all <li>-elements
         for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
            // if found a FA link
            if(b.className == "interwiki-" + a.id) {
               b.style.padding = "0 0 0 16px";
               b.style.backgroundImage = "url('http://upload.wikimedia.org/wikipedia/en/6/60/LinkFA-star.png')";
               b.style.backgroundRepeat = "no-repeat";
               b.title = "This article has gained featured status";
            }
         }
      }
   }
}

function myLoadFuncs(){
if (!window.ta) window.ta = {};
    addPurge();
//    addEditSection0();
    morelinks();
    LinkFA();
}

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

// install the Slovenian translation for [[:en:User:Cacycle/wikEd]]
document.write('<script type="text/javascript" src="'
 + 'http://en.wikipedia.org/w/index.php?title=User:Helix84/wikEd_international_sk.js'
 + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

var anchor = "t-cite";

var nazov = "Hlavná stránka";
rexp = /http:\/\/sk\.wikipedia\.org\/wiki\/(.*)$/
if (rexp.exec(document.URL)) {
   var match = rexp.exec(document.URL);
   if (match)    nazov = match[1];
}
 
  function addCommonsLink ()
 {
  nodAnchor = document.getElementById (anchor);
 
  if (nodAnchor)
  {
    var nodToolsList = nodAnchor.parentNode;
    var nodLinkCommons_li = document.createElement ("li");
    var nodLinkCommons_a = document.createElement ("a");
 
    nodLinkCommons_li.id = "t-link-commons";
 
    nodLinkCommons_a.href = "http://commons.wikimedia.org/wiki/Hlavná_stránka";
    nodLinkCommons_a.target = "_blank";
 
    nodLinkCommons_a.appendChild (document.createTextNode ("Wikimedia Commons"));
    nodLinkCommons_li.appendChild (nodLinkCommons_a);
 
    nodToolsList.insertBefore (nodLinkCommons_li, nodAnchor.nextSibling);
 
    var nodSeparator_hr = document.createElement ("hr");
    nodToolsList.insertBefore (nodSeparator_hr, nodAnchor.nextSibling);
    }
  }
 
function addCommonsGalLink ()
 {
  nodAnchor = document.getElementById (anchor);
 
  if (nodAnchor)
  {
    var nodToolsList = nodAnchor.parentNode;
    var nodGalLinkCommons_li = document.createElement ("li");
    var nodGalLinkCommons_a = document.createElement ("a");
 
    nodGalLinkCommons_li.id = "t-img-link-commons";
 
    nodGalLinkCommons_a.href = "http://commons.wikimedia.org/wiki/"+nazov;
    nodGalLinkCommons_a.target = "_blank";
    nodGalLinkCommons_a.appendChild (document.createTextNode ("Commons/galéria"));
    nodGalLinkCommons_li.appendChild (nodGalLinkCommons_a);
 
    nodToolsList.insertBefore (nodGalLinkCommons_li, nodAnchor.nextSibling);
    }
  }
 
 function addCommonsCatLink ()
 {
  nodAnchor = document.getElementById (anchor);
 
  if (nodAnchor)
  {
    var nodToolsList = nodAnchor.parentNode;
    var nodCatLinkCommons_li = document.createElement ("li");
    var nodCatLinkCommons_a = document.createElement ("a");
 
    nodCatLinkCommons_li.id = "t-cat-link-commons";
 
    nodCatLinkCommons_a.href = "http://commons.wikimedia.org/wiki/Category:"+nazov;
    nodCatLinkCommons_a.target = "_blank";
    nodCatLinkCommons_a.appendChild (document.createTextNode ("Commons/kategória"));
    nodCatLinkCommons_li.appendChild (nodCatLinkCommons_a);
 
    nodToolsList.insertBefore (nodCatLinkCommons_li, nodAnchor.nextSibling);
    }
  }
 
 addOnloadHook( addCommonsCatLink );
 addOnloadHook( addCommonsGalLink );
 addOnloadHook( addCommonsLink );

//-----
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, 'typografia', 'dodajOpis("typografia")', kl,
			'Oprava preklepov');
			przyciskiDodaj(opisBtns, 'referencie', '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);