Utilizator:Emily/monobook.js
De la Wikipedia, enciclopedia liberă
Notă: După salvare, trebuie să treceţi peste cache-ul browser-ului pentru a vedea modificările. Mozilla/Safari/Konqueror: ţineţi apăsat Shift în timp ce apăsaţi Reload (sau apăsaţi Ctrl-Shift-R), IE: apăsaţi Ctrl-F5, Opera: apăsaţi F5.
/* <nowiki> */
function addlilink(tabs, url, name, id, title, key){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
tabs.appendChild(li);
na.accesskey = key;
var pref = 'alt-';
if(((clientPC.indexOf('AppleWebKit')!=-1) && (clientPC.indexOf('spoofer')==-1)) || navigator.userAgent.toLowerCase().indexOf( 'mac' ) != -1 ) pref = 'control-';
if(clientPC.indexOf('opera')!=-1) pref = 'shift-esc-';
if(key && title) na.title = title + ' [' + pref + key + ']';
else if(title) na.title = title;
else if(key) na.title = '[' + pref + key + ']';
return li;
}
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tabs, url, name, id, title, key);
}
function getPname() {
z=document.getElementById("content").childNodes;
for (var n=0;n<z.length;n++) {
if (z[n].className=="firstHeading") return z[n].textContent;
};
}
// ========== Wikizare rapidă ==========
function doQwikizare() {
document.editform.wpTextbox1.value = '{' + '{' + 'Wikizare-dată|' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = 'Marcat pentru wikizare.';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}
function addQwikizare() {
addTab("javascript:doQwikizare()", "wikizare", "ca-wikizare", "Marcat pentru wikizare", "");
akeytt();
}
if (document.title.indexOf("Editing ") == 0) {
if (window.addEventListener) window.addEventListener("load", addQwikizare, false);
else if (window.attachEvent) window.attachEvent("onload", addQwikizare);
}
// ========== Edit Section 0 ==========
function addEditSection0() {
ta['ca-edit-0'] = ['', 'Modifică secţiunea zero a acestei pagini'];
if (!document.getElementById) return;
x = document.getElementById('ca-edit');
if(!x) return;
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';
}
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);
}
}
if (document.title.indexOf("Editing ") == -1) {
if (window.addEventListener) window.addEventListener("load", addEditSection0, false);
else if (window.attachEvent) window.attachEvent("onload", addEditSection0);
}
// ========== Add Last Diff ==========
function doLastDiff() {
var nurl="http://ro.wikipedia.org/w/index.php?title=" + getPname() + "&diff=cur&oldid=prev";
document.location=nurl
}
function addLastDiff() {
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
var l=addlilink(tabs, "javascript:doLastDiff()", 'last', '');
l.lastChild.title="Arată modificările cele mai recente";
}
if (window.addEventListener) window.addEventListener("load", addLastDiff, false);
else if (window.attachEvent) window.attachEvent("onload", addLastDiff);
/* </nowiki> */
/*<pre>*/
function addlilink(tabs, url, name, id, title, key){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
tabs.appendChild(li);
if(id)
{
if(key && title)
{
ta[id] = [key, title];
}
else if(key)
{
ta[id] = [key, ''];
}
else if(title)
{
ta[id] = ['', title];
}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
/*<pre>*/
function addTab(url, name, id, title, key){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
return addlilink(tabs, url, name, id, title, key)
};

