Redaktor:Metju/monobook.js
Vzhľad
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 vitajte(){
var reg = prompt("Je redaktor registrovaný? áno/nie");
if(!reg) return;
document.editform.wpSummary.value = 'Vitajte ~ Welcome';
document.editform.wpWatchthis.checked = false;
document.editform.wpMinoredit.checked = true;
var txt = document.editform.wpTextbox1;
if(txt.value.length > 0) txt.value += '\n';
txt.value += '{{Vitajte|redaktor=Metju|reg=reg' + reg + '}}';
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 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|Metju}} ~~~~~','','')", 'Môj podpis', '');
addlilink(tb, "javascript:insertTags('{{Biografia2|meno = |priezvisko = |obrázok = Man silhouette.png|popis_obrázku = |dátum* = |rok* = |miesto* = , |dátum+ = |rok+ = |miesto+ = , |živý-mŕtvy = živý/mŕtvy|kategória = |}}','','')", 'Biografia', '');
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();
}
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> */