Redaktor:Palica/monobook.js
Z Wikipédie
Poznámka: Aby sa zmeny prejavili, po uložení musíte vymazať vyrovnávaciu pamäť vášho prehliadača: Mozilla: Ctrl-Shift-R, IE: Ctrl-F5, Safari: Cmd-Shift-R, Konqueror: F5.
/* <nowiki> */
// Live Preview customization,
// edit this to your own liking.
wpUserName = 'Palica'; // User name to display in signatures
wpShowImages = true; // Enable downloading and displaying of images
// Include Live Preview...
document.write('<script type="text/javascript" src="http://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// Now set everything up
window.onload = Main;
function Main()
{
LivePreviewInstall();
// You may include here other "extensions"
}
/* This is to keep track of who is using the Live Preview: [[en:User:Pilaf/livepreview.js]] */
/* Inspired by [[en:User:ABCD/monobook.js]] */
function closevfd(bold, notbold){
var txt = document.editform.wpTextbox1;
txt.value = "{{subst:vt}} '''" + bold + "'''" + notbold + ". – ~~~~\n" + txt.value + "\n{{subst:vb}}\n";
txt = document.editform.wpSummary;
txt.value = "close discussion: " + bold + notbold;
document.editform.wpWatchthis.checked = false;
}
function fixformat(){
var replacements = [
[/<\/?(b|strong)>/gi, "'''"],
[/<\/?(i|em|var)>/gi, "''"],
[/\{\{([Ss]u[bp])\|([^}]+)\}\}/g, "{{subst:$1|$2}}"],
[/<\/div +>/gi, "</div>"],
[/¡/g, "¡"],
[/¢/g, "¢"],
[/£/g, "£"],
[/¤/g, "¤"],
[/¥/g, "¥"],
[/¦/g, "¦"],
[/§/g, "§"],
[/¨/g, "¨"],
[/©/g, "©"],
[/ª/g, "ª"],
[/«/g, "«"],
[/¬/g, "¬"],
[/®/g, "®"],
[/¯/g, "¯"],
[/°/g, "°"],
[/±/g, "±"],
[/²/g, "²"],
[/³/g, "³"],
[/´/g, "´"],
[/µ/g, "µ"],
[/¶/g, "¶"],
[/·/g, "·"],
[/¸/g, "¸"],
[/¹/g, "¹"],
[/º/g, "º"],
[/»/g, "»"],
[/¼/g, "¼"],
[/½/g, "½"],
[/¾/g, "¾"],
[/¿/g, "¿"],
[/À/g, "À"],
[/Á/g, "Á"],
[/Â/g, "Â"],
[/Ã/g, "Ã"],
[/Ä/g, "Ä"],
[/Å/g, "Å"],
[/Æ/g, "Æ"],
[/Ç/g, "Ç"],
[/È/g, "È"],
[/É/g, "É"],
[/Ê/g, "Ê"],
[/Ë/g, "Ë"],
[/Ì/g, "Ì"],
[/Í/g, "Í"],
[/Î/g, "Î"],
[/Ï/g, "Ï"],
[/Ð/g, "Ð"],
[/Ñ/g, "Ñ"],
[/Ò/g, "Ò"],
[/Ó/g, "Ó"],
[/Ô/g, "Ô"],
[/Õ/g, "Õ"],
[/Ö/g, "Ö"],
[/×/g, "×"],
[/Ø/g, "Ø"],
[/Ù/g, "Ù"],
[/Ú/g, "Ú"],
[/Û/g, "Û"],
[/Ü/g, "Ü"],
[/Ý/g, "Ý"],
[/Þ/g, "Þ"],
[/ß/g, "ß"],
[/à/g, "à"],
[/á/g, "á"],
[/â/g, "â"],
[/ã/g, "ã"],
[/ä/g, "ä"],
[/å/g, "å"],
[/æ/g, "æ"],
[/ç/g, "ç"],
[/è/g, "è"],
[/é/g, "é"],
[/ê/g, "ê"],
[/ë/g, "ë"],
[/ì/g, "ì"],
[/í/g, "í"],
[/î/g, "î"],
[/ï/g, "ï"],
[/ð/g, "ð"],
[/ñ/g, "ñ"],
[/ò/g, "ò"],
[/ó/g, "ó"],
[/ô/g, "ô"],
[/õ/g, "õ"],
[/ö/g, "ö"],
[/÷/g, "÷"],
[/ø/g, "ø"],
[/ù/g, "ù"],
[/ú/g, "ú"],
[/û/g, "û"],
[/ü/g, "ü"],
[/ý/g, "ý"],
[/þ/g, "þ"],
[/ÿ/g, "ÿ"],
[/ƒ/g, "ƒ"],
[/Α/g, "Α"],
[/Β/g, "Β"],
[/Γ/g, "Γ"],
[/Δ/g, "Δ"],
[/Ε/g, "Ε"],
[/Ζ/g, "Ζ"],
[/Η/g, "Η"],
[/Θ/g, "Θ"],
[/Ι/g, "Ι"],
[/Κ/g, "Κ"],
[/Λ/g, "Λ"],
[/Μ/g, "Μ"],
[/Ν/g, "Ν"],
[/Ξ/g, "Ξ"],
[/Ο/g, "Ο"],
[/Π/g, "Π"],
[/Ρ/g, "Ρ"],
[/Σ/g, "Σ"],
[/Τ/g, "Τ"],
[/Υ/g, "Υ"],
[/Φ/g, "Φ"],
[/Χ/g, "Χ"],
[/Ψ/g, "Ψ"],
[/Ω/g, "Ω"],
[/α/g, "α"],
[/β/g, "β"],
[/γ/g, "γ"],
[/δ/g, "δ"],
[/ε/g, "ε"],
[/ζ/g, "ζ"],
[/η/g, "η"],
[/θ/g, "θ"],
[/ι/g, "ι"],
[/κ/g, "κ"],
[/λ/g, "λ"],
[/μ/g, "μ"],
[/ν/g, "ν"],
[/ξ/g, "ξ"],
[/ο/g, "ο"],
[/π/g, "π"],
[/ρ/g, "ρ"],
[/ς/g, "ς"],
[/σ/g, "σ"],
[/τ/g, "τ"],
[/υ/g, "υ"],
[/φ/g, "φ"],
[/χ/g, "χ"],
[/ψ/g, "ψ"],
[/ω/g, "ω"],
[/ϑ/g, "ϑ"],
[/ϒ/g, "ϒ"],
[/ϖ/g, "ϖ"],
[/•/g, "•"],
[/…/g, "…"],
[/′/g, "′"],
[/″/g, "″"],
[/‾/g, "‾"],
[/⁄/g, "⁄"],
[/℘/g, "℘"],
[/ℑ/g, "ℑ"],
[/ℜ/g, "ℜ"],
[/™/g, "™"],
[/ℵ/g, "ℵ"],
[/←/g, "←"],
[/↑/g, "↑"],
[/→/g, "→"],
[/↓/g, "↓"],
[/↔/g, "↔"],
[/↵/g, "↵"],
[/⇐/g, "⇐"],
[/⇑/g, "⇑"],
[/⇒/g, "⇒"],
[/⇓/g, "⇓"],
[/⇔/g, "⇔"],
[/∀/g, "∀"],
[/∂/g, "∂"],
[/∃/g, "∃"],
[/∅/g, "∅"],
[/∇/g, "∇"],
[/∈/g, "∈"],
[/∉/g, "∉"],
[/∋/g, "∋"],
[/∏/g, "∏"],
[/∑/g, "∑"],
[/∗/g, "∗"],
[/√/g, "√"],
[/∝/g, "∝"],
[/∞/g, "∞"],
[/∠/g, "∠"],
[/∧/g, "∧"],
[/∨/g, "∨"],
[/∩/g, "∩"],
[/∪/g, "∪"],
[/∫/g, "∫"],
[/∴/g, "∴"],
[/∼/g, "∼"],
[/≅/g, "≅"],
[/≈/g, "≈"],
[/≠/g, "≠"],
[/≡/g, "≡"],
[/≤/g, "≤"],
[/≥/g, "≥"],
[/⊂/g, "⊂"],
[/⊃/g, "⊃"],
[/⊄/g, "⊄"],
[/⊆/g, "⊆"],
[/⊇/g, "⊇"],
[/⊕/g, "⊕"],
[/⊗/g, "⊗"],
[/⊥/g, "⊥"],
[/⋅/g, "⋅"],
[/⌈/g, "⌈"],
[/⌉/g, "⌉"],
[/⌊/g, "⌊"],
[/⌋/g, "⌋"],
[/⟨/g, "〈"],
[/⟩/g, "〉"],
[/◊/g, "◊"],
[/♠/g, "♠"],
[/♣/g, "♣"],
[/♥/g, "♥"],
[/♦/g, "♦"],
[/Œ/g, "Œ"],
[/œ/g, "œ"],
[/Š/g, "Š"],
[/š/g, "š"],
[/Ÿ/g, "Ÿ"],
[/ˆ/g, "ˆ"],
[/˜/g, "˜"],
[/‘/g, "‘"],
[/’/g, "’"],
[/‚/g, "‚"],
[/“/g, "“"],
[/”/g, "”"],
[/„/g, "„"],
[/†/g, "†"],
[/‡/g, "‡"],
[/‰/g, "‰"],
[/‹/g, "‹"],
[/›/g, "›"],
[/€/g, "€"]
];
var form = document.editform;
var txt = form.wpTextbox1;
var val = txt.value;
for(var i in replacements) val = val.replace(replacements[i][0], replacements[i][1]);
txt.value = val;
form.wpSummary.value += "formatting";
form.wpMinoredit.checked = true;
}
function replace(){
var s = prompt("Search regexp?");
if(s){
var r = prompt("Replace regexp?");
if(!r && r != '') return;
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(new RegExp(s, "g"), r);
}
}
function pdedit(){
var reason = prompt("Dôvod?");
if(!reason) return;
document.editform.wpWatchthis.checked = false;
document.editform.wpSummary.value = 'zmazat lebo: ' + reason;
var txt = document.editform.wpTextbox1;
txt.value = '{{zmazať lebo|' + reason + '}}';
txt.focus();
}
function peedit(){
document.editform.wpSummary.value = 'na úpravu';
var txt = document.editform.wpTextbox1;
if(txt.value.length > 0) txt.value += '\n';
txt.value += '{{na úpravu}}';
txt.focus();
}
function pdprotect(){
document.getElementById('wpReasonProtect').value = "pending delete";
document.getElementById('wpConfirmProtect').checked = true;
}
function vfdresult(){
var res = prompt("Result?");
if(!res) return;
document.editform.wpSummary.value = 'VFD result - ' + res.replace(/'/g, '');
var txt = document.editform.wpTextbox1;
if(txt.value.length > 0) txt.value += '\n';
txt.value += '==VFD==\nOn [[DAY MONTH]] [[2005]], this article was nominated for deletion. The result was ' + res + '. See [[Wikipedia:Votes for deletion/{{subst:PAGENAME}}]] for a record of the discussion. – ~~~~';
txt.focus();
}
function vitajte(){
var reg = prompt("Reg?");
if(!reg) return;
document.editform.wpSummary.value = 'Vitajte/Welcome ';
var txt = document.editform.wpTextbox1;
if(txt.value.length > 0) txt.value += '\n';
txt.value += '{{Vitajte|redaktor=Palica|reg=reg' + reg + '}}';
txt.focus();
}
function hidevfd(){
var divs = document.getElementsByTagName("div");
for(var x = 0; x < divs.length; ++x)
if(divs[x].className.indexOf("vfd") != -1)
divs[x].style.display = "none";
document.getElementById('footer').style.display = 'none';
}
function showvfd(){
var divs = document.getElementsByTagName("div");
for(var x = 0; x < divs.length; ++x)
if(divs[x].className.indexOf("vfd") != -1)
divs[x].style.display = "";
document.getElementById('footer').style.display = '';
}
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'] = new Array('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 addDiff(){
ta['ca-diff'] = new Array('d', 'Show last diff');
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(/action=history/, "diff=0"), 'diff', 'ca-diff');
}
function addEditSection0(){
ta['ca-edit-0'] = new Array ('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§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 changeLinks(){
if(!document.getElementById) return;
document.getElementById('pt-mytalk').firstChild.innerHTML = 'moja diskusia';
document.getElementById('pt-preferences').firstChild.innerHTML = 'nastavenia';
document.getElementById('pt-watchlist').firstChild.innerHTML = 'sledované články';
document.getElementById('pt-mycontris').firstChild.innerHTML = 'moje príspevky';
document.getElementById('pt-logout').firstChild.innerHTML = 'odhlásenie';
if(document.getElementById('ca-talk'))
document.getElementById('ca-talk').firstChild.innerHTML = 'diskusia';
if(document.getElementById('ca-edit'))
document.getElementById('ca-edit').firstChild.innerHTML = 'upravuj';
if(document.getElementById('ca-history'))
document.getElementById('ca-history').firstChild.innerHTML = 'história';
if(document.getElementById('ca-move'))
document.getElementById('ca-move').firstChild.innerHTML = 'presuň';
if(document.getElementById('ca-watch'))
document.getElementById('ca-watch').firstChild.innerHTML = 'sleduj';
if(document.getElementById('ca-nstab-wp'))
document.getElementById('ca-nstab-wp').firstChild.innerHTML = 'About';
}
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('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value);
if(r == null) return false;
document.forms.editform.wpSummary.value = r;
}
return true;
}
function vfddelete(){
var form = document.forms.deleteconfirm;
form.wpReason.value = '[[Wikipedia:Votes for deletion/' + unescape(window.location.href.replace(/^.*\?title=([^&]+)&action=delete.*$/, '$1').replace(/_/g, ' ')) + ']]';
form.wpConfirm.checked = true;
}
function morelinks(){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if(document.title.indexOf("Editing Wikipedia:Votes for deletion") == 0){
addlilink(tabs, 'javascript:closevfd("keep", "")', 'k', '');
addlilink(tabs, 'javascript:closevfd("merge and redirect", " to [[" + prompt("Merge and redirect to?") + "]]")', 'm&r', '');
addlilink(tabs, 'javascript:closevfd("redirect", " to [[" + prompt("Redirect to?") + "]]")', 'r', '');
addlilink(tabs, 'javascript:closevfd("transwiki", " to " + prompt("Transwiki to?"))', 'trans', '');
addlilink(tabs, 'javascript:closevfd("transwiki", " to Wiktionary")', 'wikt', '');
addlilink(tabs, 'javascript:closevfd("speedy delete", "")', 'sd', '');
addlilink(tabs, 'javascript:closevfd("delete", "")', 'd', '');
addlilink(tabs, 'javascript:closevfd(prompt("Result?"), "")', 'other', '');
}else if(document.title.indexOf("Úprava stránky Diskusia s redaktorom") == 0){
addlilink(tabs, 'javascript:vitajte()', 'vitajte', '');
}else if(document.title.indexOf("Úprava ") == 0){
addlilink(tabs, 'javascript:replace()', 'r', '');
addlilink(tabs, 'javascript:fixformat()', 'f', '');
addlilink(tabs, 'javascript:vfdresult()', 'vfd', '');
addlilink(tabs, 'javascript:pdedit()', 'pd', '');
addlilink(tabs, 'javascript:peedit()', 'pe', '');
}else if(document.title.indexOf("Confirm delete - Delete") == 0){
addlilink(tabs, 'javascript:vfddelete()', 'vfd', '');
}else if(document.title.indexOf("Confirm protection - Protect") == 0){
addlilink(tabs, 'javascript:pdprotect()', 'pend del', '');
}else if(document.title.indexOf("Wikipedia:Votes for deletion") == 0){
addlilink(tabs, 'javascript:hidevfd()', 'hide', 'ca-hide');
addlilink(tabs, 'javascript:showvfd()', 'show', 'ca-show');
}
}
function addToolBoxLinks(){
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlilink(tb, '/wiki/Special:Newpages', 'Nové stránky', '');
addlilink(tb, '/wiki/Special:Shortpages', 'Krátke stránky', '');
addlilink(tb, '/wiki/Special:Allpages', 'Všetky stránky', '');
addlilink(tb, '/wiki/Special:Allmessages', 'All messages', '');
addlilink(tb, '/wiki/Special:Log', 'Logs', '');
}
function myLoadFuncs(){
addPurge();
addDiff();
addEditSection0();
changeLinks();
addForceSummary();
morelinks();
addToolBoxLinks();
}
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();
}
}
/* </nowiki> */
//--------------------------------------------------------------------------------
// [[User:Lupin/popups.js]] - please include this line
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
popupAdminLinks=true;
popupShortcutKeys=true;

