Utente:Sanjilops/monobook.js: differenze tra le versioni
Vai alla navigazione
Vai alla ricerca
Contenuto aggiunto Contenuto cancellato
mNessun oggetto della modifica |
mNessun oggetto della modifica |
||
Riga 130: | Riga 130: | ||
if (ref.offsetLeft < document.getElementById('bodyContent').clientWidth/2) span.style.left = "0px"; |
if (ref.offsetLeft < document.getElementById('bodyContent').clientWidth/2) span.style.left = "0px"; |
||
else span.style.right = "0px"; |
else span.style.right = "0px"; |
||
/* |
|||
temp = getText(span); |
temp = getText(span); |
||
temp = temp.length * 12; |
temp = temp.length * 12; |
||
span.style.width = (temp < 400)? temp + 'px' : "400px"; |
span.style.width = (temp < 400)? temp + 'px' : "400px"; |
||
*/ |
|||
ref.appendChild(span); |
ref.appendChild(span); |
||
// ref.setAttribute('onMouseOver', "javascript:this.childNodes[1].scrollIntoView(true);"); |
// ref.setAttribute('onMouseOver', "javascript:this.childNodes[1].scrollIntoView(true);"); |
Versione delle 22:43, 3 ott 2009
//disablehideEdit=1;
disablealertLoad=1;
disableaprilfish = 1;
function Main() {
FastOpen();
if (document.getElementById('alert-load')) alert("alert onload presenti");
if (document.getElementById('alert-unload')) alert("alert onunload presenti");
/* Funzioni dell'editor */
if ((wgAction == "edit" || wgAction == "submit") && document.getElementById("toolbar")) {
hooks_user.push(sectionzero_editlink);
if (mwCustomEditButtons) {
mwCustomEditButtons[0] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",
"speedTip": "A capo",
"tagOpen": "<br />\n",
"tagClose": "",
"sampleText": ""};
mwCustomEditButtons[1] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/0/05/Button_Anf%C3%BChrung.png",
"speedTip": "Citazione",
"tagOpen": "{" + "{Cit|",
"tagClose": "}" + "}",
"sampleText": "..."};
mwCustomEditButtons[2] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/0/0c/Button_P_template.png",
"speedTip": "Template",
"tagOpen": "{{",
"tagClose": "}" + "}",
"sampleText": "Template"};
mwCustomEditButtons[3] = {
"imageFile": "http://images.wikia.com/nonciclopedia/images/f/f9/Button_box.png",
"speedTip": "Box",
"tagOpen": '{|width="100%" align="center" style="background: #FFFFFF; color: #000000; border: 1px solid #000000; text-align: left; margin-bottom: 0px; margin-top: 0px; padding-right: 4px; padding-left: 4px;"\n|',
"tagClose": "\n|}\n",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://images.wikia.com/nonciclopedia/images/0/0c/Button_Chuck.png",
"speedTip": "tag generico",
"tagOpen": "{{",
"tagClose": "||firma=~~" + "~~{{VF|" + wgCurRevisionId + "}" + "}" + "}" + "}\n\n",
"sampleText": ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://images2.wikia.nocookie.net/nonciclopedia/images/a/a5/Button_Samara.png",
"speedTip": "scadenza",
"tagOpen": "{" + "{scadenza|{" + "{subst:7g}" + "}|note=",
"tagClose": "|firma=~~" + "~~{{VF|" + wgCurRevisionId + "}" + "}" + "}" + "}\n\n",
"sampleText": ""};
}
if(wgCurRevisionId)
mwEditButtons[9].tagOpen = '--~~' + '~~{{VF|' + wgCurRevisionId + '}' + '}';
else
mwEditButtons[9].tagOpen = '--~~' + '~~{{VF|}' + '}';
if (getElementsByClass(document, "editpage-copywarn-tools", 'table')) collapseTable(1);
}
}
addOnloadHook(Main);
function FastOpen() {
var Box = document.getElementById("searchBody");
if (!Box) return;
var form = document.createElement("form");
Box.appendChild(form);
form.action = "/index.php";
form.target = "_blank";
var c = document.createElement("input");
form.appendChild(c);
c.type = "text";
c.setAttribute('name', "title");
c.size = "20";
var menu = document.createElement("select");
form.appendChild(menu);
menu.setAttribute('name', "action");
menu.options[menu.length] = new Option("Modifica", "edit", true);
menu.options[menu.length] = new Option("Cronol", "history");
menu.options[menu.length] = new Option("Elimina", "delete");
var p = document.createElement("input");
p.type = "submit";
p.value = "vai";
form.appendChild(p);
}
function sectionzero_editlink() {
if (wgNamespaceNumber == -1) return;
if (getElementsByClass(document.getElementById('bodyContent'), 'editsection', 'span').length == 0) return;
if (document.getElementById('no-sec0-edit')) return;
// var title = document.getElementById('firstHeading');
var subtitle = document.getElementById('siteSub');
var link = document.createElement('a');
link.rel = 'nofollow';
link.title = "Modifica la sezione introduttiva";
link.href = wgServer + wgScriptPath + '/index.php?title=' + encodeURI(wgPageName) + '&action=edit§ion=0&editintro=MediaWiki:Editintro';
link.innerHTML = "modifica";
var span = document.createElement('span');
span.className = "editsection";
subtitle.insertBefore(span,subtitle.firstChild);
span.appendChild(link);
span.innerHTML = '[' + span.innerHTML + ']';
return;
}
addOnloadHook(sectionzero_editlink);
function ref_tooltip () {
var refs = getElementsByClass(document.getElementById('bodyContent'), "reference", 'sup');
if (!refs) return;
for (var i = 0; i < refs.length; i++) Do(refs[i]);
return;
function Do (ref) {
var span = document.createElement('span');
var id = ref.id.substr('cite_ref-'.length);
span.className = "reference-tt";
span.id = "cite_tt-" + id;
var li = document.getElementById('cite_note-' + id.replace(/_(\d+)-\d+$/, '-$1'));
if (!li) return;
var temp = li.innerHTML;
temp = temp.split(/^.+a href=\"#cite_ref-.+\" title=\"\">.+<\/a>(<\/sup>)? /);
span.innerHTML = (temp.length > 1)? temp[2] : temp;
if (ref.offsetLeft < document.getElementById('bodyContent').clientWidth/2) span.style.left = "0px";
else span.style.right = "0px";
/*
temp = getText(span);
temp = temp.length * 12;
span.style.width = (temp < 400)? temp + 'px' : "400px";
*/
ref.appendChild(span);
// ref.setAttribute('onMouseOver', "javascript:this.childNodes[1].scrollIntoView(true);");
return;
}
}
addOnloadHook(ref_tooltip);
hooks_user.push(ref_tooltip);
/* addOnloadHook(function () {
var b = document.getElementById("quicksaveButton");
if (!b) return;
b.removeEventListener('click', quicksave, false);
b.addEventListener('click', quicksaveX, false);
return;
});
addOnloadHook(function () {
var b = document.getElementById("quickpreviewButton");
if (!b) return;
b.removeEventListener('click', quickpreview, false);
b.addEventListener('click', quickpreviewX, false);
return;
});
*/
function quicksaveX () {
var textbox = document.getElementById("wpTextbox1");
textbox.disabled = true;
document.getElementById("wpSave").disabled = true;
document.getElementById("quicksaveButton").disabled = true;
var temp = null;
temp = document.getElementById("quickpreviewButton");
if (temp) temp.disabled = true;
var Source = encodeURIComponent(textbox.value);
var msg_box = document.getElementById("quicksave_msgbox");
if (msg_box == null) {
msg_box = document.createElement('div');
msg_box.id = "quicksave_msgbox";
document.getElementById('content').insertBefore(msg_box, document.getElementById('firstHeading'));
}
else msg_box.innerHTML = '';
var httpRequest = createRequest();
var id = setTimeout(function() { httpRequest.abort(); msg_box.innerHTML = "Salvataggio fallito: il server non risponde.".fontcolor('Red'); Finish(false); }, 30000);
httpRequest.onreadystatechange = function () { Response(httpRequest, id); return;};
var url = wgServer + wgScriptPath + "/api.php";
var param = "action=edit&format=txt&title=" + encodeURIComponent(wgPageName);
param += "&token=" + document.getElementsByName("wpEditToken")[0].value.replace(/\+\\/, '%2' + "B%5" + 'C');
temp = document.getElementById("wpSummary");
if (temp) param += "&summary=" + encodeURIComponent(temp.value);
temp = document.getElementById("wpCaptchaId");
if (temp) param += "&captchaid=" + temp.value + "&captchaword=" + encodeURIComponent(document.getElementById("wpCaptchaWord").value);
temp = document.getElementById("wpMinoredit");
if (temp && temp.checked) param += "&minor=";
temp = document.getElementById("wpWatchthis");
if (temp) {
var Watched = temp.checked;
if (document.getElementById('ca-watch') && Watched) param += "&watch=";
if (document.getElementById('ca-unwatch') && !Watched) param += "&unwatch=";
}
param += "&basetimestamp=" + document.getElementsByName("wpEdittime")[0].value;
param += "&starttimestamp=" + document.getElementsByName("wpStarttime")[0].value;
param += "&text=" + Source;
param += "&md5=" + MD5(textbox.value);
httpRequest.open('POST', url, true);
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
httpRequest.setRequestHeader('Content-Length', param.length);
document.getElementsByTagName('body')[0].style.cursor = 'progress';
httpRequest.send(param);
return;
function Response (o, id) {
if (o.readyState != 4) return;
clearTimeout(id);
msg_box.scrollIntoView();
if (o.status != 200) {
if (o.status && (o.status < 199 || o.status > 300)) {
msg_box.innerHTML = "Salvataggio fallito. Risposta del server: ".fontcolor('Red') + o.status.fontcolor('Red');
Finish(false);
}
return;
}
msg_box.innerHTML = o.responseText;
Finish(true);
return;
}
function Finish(success) {
document.getElementById("wpSave").disabled = false;
document.getElementById("quicksaveButton").disabled = false;
document.getElementsByTagName('body')[0].style.cursor = 'auto';
textbox.disabled = false;
return;
}
} // <-quicksaveX()