Utente:Twice25/monobook.js
Da Wikipedia, l'enciclopedia libera.
Per un aiuto sull'uso di questa pagina vedi Aiuto:Preferenze.
Nota: dopo aver salvato, devi pulire la cache del tuo browser per vedere i cambiamenti: Mozilla: clicca su reload (oppure ctrl-r), IE / Opera: ctrl-f5, Safari: cmd-r, Konqueror ctrl-r.
/* <nowiki> */ function fixformat(){ var form = document.editform; var txt = form.wpTextbox1; txt.value = txt.value .replace(/\’/g, "'") .replace(/\‘/g, "'") .replace(/E' /g, "È ") .replace(/E’ /g, "È ") .replace(/É /g, "È ") .replace(/ e'/g, " è") .replace(/ e’/g, " è") .replace(/ é/g, " è") .replace(/ pò/g, " po'") .replace(/perchè/g, "perché") .replace(/poichè/g, "poiché") .replace(/affinchè/g, "affinché") .replace(/quà/g, " qua") .replace(/<\/?(b|strong)>/gi, "'''") .replace(/<\/?(i|em|var)>/gi, "''") //.replace(/\{\{([Ss]u[bp])\|([^}]+)\}\}/g, "{{subst:$1|$2}}") //.replace(/<\/div +>/gi, "</div>"); form.wpSummary.value += "formattazione"; 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 moveprotect(){ document.getElementById('wpReasonProtect').value = "Protect from moves only"; document.getElementById('wpMoveOnly').checked = true; } function welcome(){ var form = document.editform; var txt = form.wpTextbox1; if(txt.value.length > 0) txt.value += '\n'; txt.value += '{{subst:utente:Twice25/Benvtwice25}}'; form.wpSummary.value = 'Benvenut*'; form.wpMinoredit.checked = true; } function cancella(){ var form = document.editform; var txt = form.wpTextbox1; if(txt.value.lenght < 200) form.wpSummary.value = 'Cancella subito (Contenuto: "' + txt.value + '")'; txt.value = '{{cancella subito}}\n' + txt.value; form.wpSummary.value = 'cancella subito'; form.wpMinoredit.checked = true; } function aiutare(){ var form = document.editform; var txt = form.wpTextbox1; txt.value = '{{a|motivo|argomento|mese anno|~~~}}\n' + txt.value; form.wpSummary.value = 'aiutare'; form.wpMinoredit.checked = true; } function wikificare(){ var form = document.editform; var txt = form.wpTextbox1; txt.value = '{{w|argomento|mese anno|~~~}}\n' + txt.value; form.wpSummary.value = 'wikificare'; form.wpMinoredit.checked = true; } function controllare(){ var form = document.editform; var txt = form.wpTextbox1; txt.value = '{{c|motivo|mese anno|~~~}}\n' + txt.value; form.wpSummary.value = 'controllare'; form.wpMinoredit.checked = true; } function npov(){ var form = document.editform; var txt = form.wpTextbox1; txt.value = '{{p|motivo|argomento|~~~}}\n' + txt.value; form.wpSummary.value = 'npov'; form.wpMinoredit.checked = true; } function vote_plus(){ var form = document.editform; var txt = form.wpTextbox1; txt.value += '*+1 --~~~~'; form.wpSummary.value = '+1'; form.wpMinoredit.checked = true; } function vote_minus(){ var form = document.editform; var txt = form.wpTextbox1; txt.value += '*-1 --~~~~'; form.wpSummary.value = '-1'; form.wpMinoredit.checked = true; } function addlilink(tabs, url, name, id, title, key){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); 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 + ']'; var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); tabs.appendChild(li); 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 addPurge(){ var x = document.getElementById('ca-history'); if(!x) return; if(x.children) x = x.children[0].href; else x = x.childNodes[0].href; addTab(x.replace(/=history/, "=purge"), 'aggiorna', 'ca-purge', 'Aggiorna la cache per questa pagina', 'g'); } function addEditSection0(){ 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); } z.title = 'Modifica la sezione zero di questa pagina'; akeytt(); } function changeLinks(){ if(!document.getElementById) return; document.getElementById('pt-mytalk').firstChild.innerHTML = 'Le mie discussioni'; document.getElementById('pt-preferences').firstChild.innerHTML = 'Preferenze'; document.getElementById('pt-watchlist').firstChild.innerHTML = 'Osservati speciali'; document.getElementById('pt-mycontris').firstChild.innerHTML = 'Contributi'; document.getElementById('pt-logout').firstChild.innerHTML = 'Esci'; if(document.getElementById('ca-talk')) document.getElementById('ca-talk').firstChild.innerHTML = 'Discussione'; if(document.getElementById('ca-edit')) document.getElementById('ca-edit').firstChild.innerHTML = 'Modifica'; if(document.getElementById('ca-nstab-wp')) document.getElementById('ca-nstab-wp').firstChild.innerHTML = 'Articolo'; } 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(){ var form = document.forms.editform; if(!form.wpSummary.value.replace(/^(\/\*.*\*\/)? *(.*) *$/,'$2')){ var r = prompt('Salvi senza scrivere nulla nel campo oggetto?\nPer inserire un testo scrivi qui sotto:',form.wpSummary.value); if(r == null) return false; form.wpSummary.value = r; } return true; } function morelinks(){ if(document.title.indexOf("Modifica di Discussioni utente:") == 0){ addTab('javascript:replace()', 'Sostituisci'); addTab('javascript:welcome()', 'Benvenuto'); }else if(document.title.indexOf("Modifica ") == 0){ if(document.title.indexOf("Modifica di Wikipedia:Pagine da cancellare/") == 0){ addTab('javascript:vote_plus()', '+1'); addTab('javascript:vote_minus()', '-1'); } else { addTab('javascript:replace()', 'Sostituisci'); addTab('javascript:fixformat()', 'Formatta'); addTab('javascript:cancella()', 'Cancella'); addTab('javascript:aiutare()', 'Aiutare'); addTab('javascript:wikificare()', 'Wikificare'); addTab('javascript:controllare()', 'Controllare'); addTab('javascript:npov()', 'Npov'); //}else if(document.title.indexOf("Confirm delete - Delete") == 0){ // addTab('javascript:vfddelete()', 'VFD'); //}else if(document.title.indexOf("Confirm protection - Protect") == 0){ // addTab('javascript:moveprotect()', 'MV'); } } } function addToolBoxLinks(){ var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tb, '/wiki/Speciale:Newpages', 'Pagine nuove', 't-newpages'); addlilink(tb, '/wiki/Speciale:Shortpages', 'Pagine brevi', 't-shortpages'); // addlilink(tb, '/wiki/Wikipedia:Ultime_modifiche', 'Ultime modifiche', 'open issues'); } function strip_namespace(target){ var colon = target.indexOf(':'); if(colon != -1){ var spaces = ['Utente', 'Wikipedia', 'Immagine', 'MediaWiki', 'Template', 'Aiuto', 'Categoria']; var ns = target.substring(0, colon); if(ns == '' || ns == 'Talk') return target.substring(colon + 1); else for(var i = 0; i < spaces.length; ++i) if(ns == spaces[i] || ns == spaces[i] + '_talk') return target.substring(colon + 1); } return target; } // Adds a "blocklog" tab and fills in the username field on Special:Blockip, if a "&ip=username" is present. function do_blockip_stuff(){ var form = document.getElementById('blockip'); // focus on Reason field form.wpBlockReason.focus(); var target = getParam('ip'); if(target == '') return; // add "blocklog" tab addTab('/wiki/Speciale:Log/block?page=Utente:' + target, 'blocklog', 'ca-blocklog'); } // Adds "block" and "blocklog" tabs to User: and User talk: pages. function add_block_tab(){ var c1 = document.getElementById('column-one'); var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; // use the "edit this page" tab to get already-tidied url var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href; // cut everything up to "title=" from the start and everything past "&action=edit" from the end editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit')); editlk = editlk.substring(editlk.indexOf(':') + 1); var slloc = editlk.indexOf('/'); if(slloc > 0) editlk = editlk.substring(0, slloc); // add "block" tab addTab('/wiki/Speciale:Blockip?ip=' + editlk, 'block', 'ca-block'); // add "blocklog" tab addTab('/wiki/Speciale:Log/block?page=Utente:' + editlk, 'blocklog', 'ca-blocklog'); } function blockip() { if(document.title.indexOf('Utente:') == 0 || document.title.indexOf('Discussioni utente:') == 0) add_block_tab(); else if(document.title.indexOf('Block user') == 0) // could stand to be more robust do_blockip_stuff(); } function getParam(name){ if(location.search){ for(var x in location.search.substring(1).split('&')){ var eq = x.indexOf('='); if(x.substring(0, eq) == name) return x.substring(eq + 1); } } return ''; } function myLoadFuncs(){ addPurge(); //addEditSection0(); changeLinks(); //addForceSummary(); morelinks(); addToolBoxLinks(); //blockip(); } 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> */ /***** Ricerca con Google e Yahoo *****/ // Amélioration de la page de recherche // Auteur : Dake // Sous licence GFDL. function SpecialSearchEnhanced() { if (wgPageName == "Speciale:Search") { var mainNode = document.getElementsByTagName("form"); if (!mainNode) return; var searchValue = document.getElementById("lsearchbox").value var firstForm = mainNode[0]; var node = document.createElement('center'); var googleSearch = '<FORM method=GET action="http://www.google.it/search">'; googleSearch += '<TABLE bgcolor="#FFFFFF"><tr><td>'; googleSearch += '<A HREF="http://www.google.it">'; googleSearch += '<IMG SRC="http://www.google.com/logos/Logo_25wht.gif" border="0" ' googleSearch += 'ALT="Google" align="absmiddle"></A> ' googleSearch += '<INPUT TYPE=text name=q size=25 maxlength=255 value="' + searchValue + '">' googleSearch += '<INPUT TYPE=hidden name=hl value=it>' googleSearch += '<INPUT TYPE=hidden name=as_sitesearch value=it.wikipedia.org>' googleSearch += '<INPUT type=submit name=btnG VALUE="Cerca su it.wiki">' googleSearch += '</td></tr></TABLE>' googleSearch += '</FORM>' var yahooSearch = '<FORM method=GET action="http://it.search.yahoo.com/search">'; yahooSearch += '<TABLE bgcolor="#FFFFFF"><tr><td>'; yahooSearch += '<A HREF="http://it.yahoo.com">'; yahooSearch += '<IMG SRC="http://us.yimg.com/i/yahootogo/y88red2.gif" alt="Yahoo!" border="0" ' yahooSearch += 'align="absmiddle"></A> ' yahooSearch += '<INPUT TYPE=text name=p size=25 maxlength=255 value="' + searchValue + '">' yahooSearch += '<INPUT TYPE=hidden name=vs value=it.wikipedia.org>' yahooSearch += '<INPUT type=submit name=btnG VALUE="Cerca su it.wiki">' yahooSearch += '</td></tr></TABLE>' yahooSearch += '</FORM>' node.innerHTML = node.innerHTML + '<div id="enhancedSearch">' + googleSearch + yahooSearch + '</div>'; firstForm.parentNode.insertBefore(node, firstForm.nextSibling); } } addOnloadHook(SpecialSearchEnhanced); //Commandline. // Vedi [[Utente:Salvatore_Ingala/scripts/Commandline]] // document.writeln('<script type="text/javascript" src="/w/index.php?title=Utente:Salvatore_Ingala/commandline.js&action=raw&ctype=text/javascript&dontcountme=s"></script>'); fixformat_list = new Array( [/ anzich(è|e')/g, "anziché"], [/ affinch(è|e')/g, "affinché"], [/ bench(è|e')/g, " benché"], [/ cioé/g, " cioè"], [/ nonch(è|e')/g, " nonché"], [/ perch(è|e')/g, " perché"], [/ poich(è|e') /g, " poiché "], [/ quì /gi, " qui "], [/ quà /gi, " qua "], [/ qual'è /gi, " qual è"], [/ sè /gi, " sé "], [/si' /g, "sì"], [/ tr(è|e'|é) /g, " tre "] ); /*<pre>*/ /* * * * * * * * * * * * * * * * * * * MediaWiki QuickEdit 2 by ASM * - beta - * Version: Jan 2007 * * * * * * * * * * * * * * * * * * * * How to use * * Insert into your monobook.js: * * document.write('<script src="' * + 'http://de.wikipedia.org/w/index.php?title=Benutzer:ASM/quickedit.js' * + '&action=raw&ctype=text/javascript"></script>'); * * And (optionally) these variables: * * var qeEnabled = true; // Activate Script? * var qeEnableSection0 = true; // Enable QuickEdit link for section 0 (introduction)? * var qeEnableAccessKeys = true; // Activate access keys? * var qeTextboxHeight = 20; // Height of the textbox * * * * * * * * * * * * * * * * * * */ /////////// Einstellungen /////////// // -> Standardeinstellungen zuweisen if (typeof(qeEnabled) == 'undefined') qeEnabled = true; if (typeof(qeEnableSection0) == 'undefined') qeEnableSection0 = true; if (typeof(qeTextboxHeight) == 'undefined') qeTextboxHeight = 20; if (typeof(qeEnableAccessKeys) == 'undefined') qeEnableAccessKeys = true; /*if (typeof(qeShowErrors) == 'undefined')*/ qeShowErrors = false; //////// Ende Einstellungen //////// // only initialize once var qeIsInit = false; // 2D-Array mit allen Sections und den jeweiligen Unterknoten var qeSections = new Array(); // Aktuell bearbeitete Section var qeEdit = -1; // Aktuell im Vorschau-Modus? var qePreviewMode = false; var qePreviewDisabled = false; // Link zum Bearbeiten der Abschnitte var qeEditLink = false; // Knoten var qeParent = false; var qeForm = false; var qePreview = false; // Form action var qeFormAction = false; // XmlHttpRequest var qeRequest = false; // 0 = idle 1 = receive 2 = submit var qeRequestState = 0; // ondblclick var qeOnDoubleClick = null; ////// Start Script ////// addOnloadHook(qeInit); function qeInit() { if (!qeEnabled || qeIsInit) return; qeIsInit = true; // check if page is editable if (!document.getElementById('ca-edit')) return; // check if there is no other action than view var pos = document.location.href.indexOf('action='); if (pos != -1 && document.location.href.substr(pos+7, 4) != 'view') return; qeSetLang(); if (!qeInitAjax()) return; qeChangeSectionLinks(); } function qeContentSub(text) { var cs = document.getElementById('contentSub'); if (cs.innerHTML) cs.innerHTML += ' - ' + text; else cs.innerHTML = text; } function qeShowError(err) { if (qeShowErrors) qeContentSub(qePhrase('quickedit') + ' ' + qePhrase('error') + ': ' + err); } function qeAlert(err) { alert(qePhrase('quickedit') + ' ' + qePhrase('error') + ': ' + err); } function qeGetElementsByClassName(tagname, classname) { var ret = new Array(); var tags = document.getElementsByTagName(tagname); for (i = 0; i < tags.length; i++) if (tags[i].className == classname) ret.push(tags[i]); return ret; } function qeChangeSectionLinks() { qeEditLink = document.getElementById('ca-edit').firstChild.href + '§ion='; // get all sections var sections = qeGetElementsByClassName('span', 'editsection'); var jumptonav = document.getElementById('jump-to-nav'); // Hauptabschnitt if (qeEnableSection0) { var heading = qeGetElementsByClassName('h1', 'firstHeading')[0]; if (!heading || !jumptonav) qeShowError('Section 0 nicht gefunden.'); else { // id verpassen heading.id = 'section-0'; // Knoten ins Array packen qeSections[0] = new Array(); var nosections = (sections.length == 0); var node = jumptonav.nextSibling; while (node != null && node.className != 'editsection' && node.className != 'printfooter' && (nosections|| !/^H[1-6]$/.test(node.nodeName))) { if (node.nodeName.charAt(0) != '#') qeSections[0].push(node); node = node.nextSibling; } // Link hinzufügen var newspan = document.createElement('span'); newspan.style.fontSize = '8pt'; newspan.style.marginLeft = '10px'; newspan.appendChild(document.createTextNode('[')); var newlink = document.createElement('a'); newlink.href = 'javascript:qeEditSection(0)'; newlink.id = 'sectionlink-0'; newlink.className = 'sectionlink'; newlink.appendChild(document.createTextNode(qePhrase('quickedit'))); newspan.appendChild(newlink); newspan.appendChild(document.createTextNode(']')); heading.appendChild(newspan); } } // qeEnableSection0 // Abschnitte for (i = 0; i < sections.length; i++) { // Section-Link suchen var link = sections[i].childNodes[1].href; var section = null, match = null; if (match = /section=([0-9]+)/.exec(link)) var section = +match[1]; else break; if (!section) continue; sections[i].style.fontSize = '8pt'; // QuickEdit-Link erstellen var newnode = document.createElement('a'); newnode.href = 'javascript:qeEditSection(' + section + ')'; newnode.title = 'QuickEdit Section ' + section; newnode.id = 'sectionlink-' + section; newnode.className = 'sectionlink'; newnode.appendChild(document.createTextNode(qePhrase('quickedit'))); var where = sections[i].childNodes[2]; sections[i].insertBefore(document.createTextNode('/'), where); sections[i].insertBefore(newnode, where); //// // dem div eine ID verpassen sections[i].id = 'editsection-' + section; // zugehörige hX Überschrift suchen var hx = sections[i].parentNode; hx.id = 'section-' + section; //// // alle zu dieser Section gehörigen Knoten suchen und ins Array packen qeSections[section] = new Array(); var node = hx.nextSibling; while (node != null && node.className != 'editsection' && node.className != 'printfooter' && !/^H[1-6]$/.test(node.nodeName)) { if (node.nodeType == 1) qeSections[section].push(node); node = node.nextSibling; } } } function qeEditSection(section) { if (qeRequestState || !qeEditLink) return; section = parseInt(section); // es wird bereits ein Abschnitt bearbeitet // wenn es der aktuelle ist -> Bearbeiten abbrechen, sonst nichts tun if (qeEdit != -1) { if (qeEdit == section) qeAbortEdit(section); return; } qeEdit = section; // save body.ondblclick if (document.getElementsByTagName('body')[0].getAttribute('ondblclick')) { qeOnDoubleClick = document.getElementsByTagName('body')[0].getAttribute('ondblclick'); document.getElementsByTagName('body')[0].setAttribute('ondblclick', null); } // Inhalt des Abschnitts ausblenden var nodes = qeSections[section]; for (i = 0; i < nodes.length; i++) nodes[i].style.display = 'none'; //// // andere Links ändern var links = qeGetElementsByClassName('a', 'sectionlink'); for (i = 0; i < links.length; i++) { if (links[i].id != 'sectionlink-' + qeEdit) links[i].style.color = '#bfbfbf'; } // Form anzeigen qeMakeForm(); var hx = document.getElementById('section-' + section); hx.parentNode.insertBefore(qeParent, hx.nextSibling); qeForm.firstChild.childNodes[4].value = qePhrase('loading') + '...'; //// // make sure the QuickEdit tab is activated qeSwitch(0); qeGetSection(); } function qeAbortEdit() { if (qeEdit == -1 || qeRequestState) return; // Inhalt des Abschnitts wieder einblenden var nodes = qeSections[qeEdit]; for (i = 0; i < nodes.length; i++) nodes[i].style.display = is_gecko?null:'block'; var links = qeGetElementsByClassName('a', 'sectionlink'); for (i = 0; i < links.length; i++) { if (links[i].id != 'sectionlink-' + qeEdit) links[i].style.color = null; } qeParent.parentNode.removeChild(qeParent); qeForm.firstChild.childNodes[4].value = ''; qeEdit = -1; qeRequest.abort(); // restore body.ondblclick if (qeOnDoubleClick) document.getElementsByTagName('body')[0].setAttribute('ondblclick', qeOnDoubleClick); } function qeMakeForm() { if (qeForm) return; if (qeSections.length == 1) qeTextboxHeight += 5; // higher textbox for the main section only // create parent div qeParent = document.createElement('div'); qeParent.style.clear = 'both'; // create tabs var ul = document.createElement('ul'); ul.style.listStyle = 'none'; ul.style.whiteSpace = 'nowrap'; ul.style.fontSize = '11.3px'; ul.style.position = 'relative'; ul.style.bottom = '0px'; ul.style.borderCollapse = 'collapse'; var li1 = document.createElement('li'); var a = document.createElement('a'); a.href = 'javascript:qeSwitch(0)'; a.style.textDecoration = 'none'; a.style.padding = '0 8px'; a.appendChild(document.createTextNode(qePhrase('quickedit'))); li1.appendChild(a); li1.id = 'qeTabEdit'; li1.title = qePhrase('tQuickEdit'); li1.style.border = '1px solid #aaa'; li1.style.borderBottom = 'none'; li1.style.marginRight = '6px'; li1.style.display = 'inline'; li1.style.backgroundColor = '#fafafa'; li1.setAttribute('onmouseover', 'qeTabMouseOverOut(this, 0)'); li1.setAttribute('onmouseout', 'qeTabMouseOverOut(this, 1)'); var li2 = li1.cloneNode(true); li2.id = 'qeTabPreview'; li2.title = qePhrase('tLivePrev'); li2.firstChild.href = 'javascript:qeSwitch(1)'; li2.firstChild.firstChild.nodeValue = qePhrase('liveprev'); // make li1 look selected li1.style.borderColor = '#888'; li1.style.borderBottom = 'none'; li1.style.fontWeight = 'bold'; // tab 3 var li4 = li2.cloneNode(true); li4.id = null; li4.style.marginLeft = '16px'; li4.title = qePhrase('tSubmit'); li4.firstChild.href = 'javascript:qeSubmit(0)'; li4.firstChild.firstChild.nodeValue = qePhrase('submit'); if (qeEnableAccessKeys) li4.firstChild.accessKey = 's'; // tab 4 var li5 = li2.cloneNode(true); li5.id = null; li5.title = qePhrase('tPreview'); li5.firstChild.href = 'javascript:qeSubmit(1)'; li5.firstChild.firstChild.nodeValue = qePhrase('preview'); // tab 5 var li6 = li2.cloneNode(true); li6.id = null; li6.title = qePhrase('tCancel'); li6.firstChild.href = 'javascript:qeAbortEdit()'; li6.firstChild.firstChild.nodeValue = qePhrase('cancel'); if (qeEnableAccessKeys) { li6.firstChild.accessKey = 'a'; // cancel li1.firstChild.accessKey = 'e'; // quickedit li2.firstChild.accessKey = 'p'; // live prev } var li3 = document.createElement('li'); li3.style.cssFloat = 'right'; li3.style.marginRight = '10px'; li3.style.color = '#aaa'; li3.style.fontSize = '8pt'; li3.style.display = 'inline'; var a = document.createElement('a'); a.style.color = '#aaa'; a.href = 'http://de.wikipedia.org/wiki/Benutzer_Diskussion:ASM#QuickEdit_2'; a.appendChild(document.createTextNode('ASM')); li3.appendChild(document.createTextNode(qePhrase('header'))); li3.appendChild(a); ul.appendChild(li3); ul.appendChild(li1); ul.appendChild(li2); ul.appendChild(li4); ul.appendChild(li5); ul.appendChild(li6); qeParent.appendChild(ul); // create frame div var framediv = document.createElement('div'); framediv.style.border = '1px solid #aaa'; framediv.style.padding = '6px'; framediv.style.overflow = 'hidden'; framediv.style.clear = 'both'; framediv.style.backgroundColor = '#fafafa'; qeParent.appendChild(framediv); // create form qeForm = document.createElement('form'); qeForm.method = 'post'; qeForm.onsubmit = qeSubmitByReturn; // create preview div qePreview = document.createElement('div'); qePreview.style.display = 'none'; qePreview.style.width = '98%'; qePreview.style.overflow= 'hidden'; qePreview.style.clear = 'both'; qePreview.style.padding = '5px'; qePreview.style.border = '1px dotted #aaa'; qePreview.style.backgroundColor = qeGetBGColor(); // preview message var div = document.createElement('div'); div.style.padding = '100px 0'; div.style.textAlign = 'center'; div.style.color = '#aaa'; div.style.cursor = 'default'; div.appendChild(document.createTextNode(qePhrase('loadprev') + '...')); qePreview.appendChild(div); framediv.appendChild(qePreview); framediv.appendChild(qeForm); //// // add form div qeForm.appendChild(document.createElement('div')); var elements = new Array( // subject type name new Array('input', 'hidden', 'wpSection'), new Array('input', 'hidden', 'wpStarttime'), new Array('input', 'hidden', 'wpEdittime'), new Array('input', 'hidden', 'wpSummary'), new Array('textarea', 'wpTextbox1'), new Array('input', 'hidden', 'wpEditToken'), new Array('input', 'hidden', 'wpAutoSummary') ); for (i = 0; i < elements.length; i++) { var e = elements[i]; var newnode = document.createElement(e[0]); if (e[0] == 'input') { newnode.type = e[1]; newnode.name = e[2]; } else if (e[0] == 'textarea') { newnode.id = e[1]; newnode.name = e[1]; newnode.appendChild(document.createTextNode('')); newnode.rows = qeTextboxHeight; newnode.style.width = '99%'; } qeForm.firstChild.appendChild(newnode); } if (qeEnableAccessKeys) qeForm.firstChild.childNodes[4].accessKey = ','; qeForm.firstChild.childNodes[4].tabIndex = 1; newnode = document.createElement('div'); newnode.style.marginTop = '5px'; newnode.style.paddingTop = '5px'; newnode.style.borderTop = '1px dotted #aaa'; // Speichern newnode.appendChild(document.createElement('a')); newnode.firstChild.href = 'javascript:qeSubmit(0)'; newnode.firstChild.title = qePhrase('tSubmit'); newnode.firstChild.style.cursor = 'pointer'; newnode.firstChild.appendChild(document.createTextNode(qePhrase('submit'))); // Vorschau newnode.appendChild(document.createTextNode(' ')); newnode.appendChild(document.createElement('a')); newnode.childNodes[2].href = 'javascript:qeSubmit(1)'; newnode.childNodes[2].title = qePhrase('tPreview'); newnode.childNodes[2].style.marginLeft = '5px'; newnode.childNodes[2].style.cursor = 'pointer'; newnode.childNodes[2].appendChild(document.createTextNode(qePhrase('preview'))); /* Abbrechen // entfernt newnode.appendChild(document.createTextNode(' ')); newnode.appendChild(document.createElement('a')); newnode.childNodes[4].href = 'javascript:qeAbortEdit()'; newnode.childNodes[4].style.marginLeft = '5px'; newnode.childNodes[4].style.cursor = 'pointer'; newnode.childNodes[4].appendChild(document.createTextNode(qePhrase('cancel'))); */ // Zusammenfassung newnode.appendChild(document.createTextNode(' ')); newnode.appendChild(document.createElement('input')); newnode.childNodes[4].type = 'text'; newnode.childNodes[4].size = '70'; newnode.childNodes[4].id = 'qeSummary'; newnode.childNodes[4].maxLength = '200'; newnode.childNodes[4].style.marginLeft = '5px'; newnode.childNodes[4].tabIndex = 2; // Kleine Änderung newnode.appendChild(document.createTextNode(' ')); var checkboxes = document.createElement('span'); checkboxes.style.whiteSpace = 'nowrap'; checkboxes.appendChild(document.createElement('input')); checkboxes.childNodes[0].type = 'checkbox'; checkboxes.childNodes[0].id = 'wpMinoredit'; checkboxes.childNodes[0].name = 'wpMinoredit'; checkboxes.childNodes[0].value = '1'; checkboxes.childNodes[0].style.marginLeft = '5px'; checkboxes.childNodes[0].tabIndex = 3; checkboxes.childNodes[0].title = qePhrase('tMinor'); if (qeEnableAccessKeys) checkboxes.childNodes[0].accessKey = 'i'; checkboxes.appendChild(document.createElement('label')); checkboxes.childNodes[1].htmlFor = 'wpMinoredit'; checkboxes.childNodes[1].style.fontWeight = 'bold'; checkboxes.childNodes[1].style.fontSize = '8pt'; checkboxes.childNodes[1].style.position = 'relative'; checkboxes.childNodes[1].style.bottom = '2px'; checkboxes.childNodes[1].title = qePhrase('tMinor'); checkboxes.childNodes[1].appendChild(document.createTextNode(qePhrase('k'))); // Beobachten checkboxes.appendChild(document.createTextNode(' ')); checkboxes.appendChild(document.createElement('input')); checkboxes.childNodes[3].type = 'checkbox'; checkboxes.childNodes[3].id = 'wpWatchthis'; checkboxes.childNodes[3].name = 'wpWatchthis'; checkboxes.childNodes[3].value = '1'; checkboxes.childNodes[3].style.marginLeft = '5px'; checkboxes.childNodes[3].tabIndex = 4; checkboxes.childNodes[3].title = qePhrase('tWatch'); if (qeEnableAccessKeys) checkboxes.childNodes[3].accessKey = 'w'; checkboxes.appendChild(document.createElement('label')); checkboxes.childNodes[4].htmlFor = 'wpWatchthis'; checkboxes.childNodes[4].style.fontWeight = 'bold'; checkboxes.childNodes[4].style.fontSize = '8pt'; checkboxes.childNodes[4].style.position = 'relative'; checkboxes.childNodes[4].style.bottom = '2px'; checkboxes.childNodes[4].title = qePhrase('tWatch'); checkboxes.childNodes[4].appendChild(document.createTextNode(qePhrase('b'))); newnode.appendChild(checkboxes); qeForm.appendChild(newnode); } function qeFillForm(formaction, wpStarttime, wpEdittime, wpSummary, wpTextbox1, wpEditToken, wpAutoSummary, wpWatchthis) { if (!qeForm) return; // save form action since we need it for preview qeFormAction = formaction; qeForm.firstChild.childNodes[0].value = qeEdit; qeForm.firstChild.childNodes[1].value = wpStarttime; qeForm.firstChild.childNodes[2].value = wpEdittime; qeForm.firstChild.childNodes[3].value = wpSummary; qeForm.firstChild.childNodes[4].value = wpTextbox1; qeForm.firstChild.childNodes[5].value = wpEditToken; qeForm.firstChild.childNodes[6].value = wpAutoSummary; document.getElementById('wpWatchthis').checked = wpWatchthis; qeForm.action = formaction; document.getElementById('qeSummary').value = wpSummary; } // QuickEdit 2: Preview stuff function qeSwitch(type) { if (qeEdit == -1 || qeRequestState) return; type = parseInt(type); if ((type == 0 && !qePreviewMode) || (type == 1 && qePreviewMode) || (qePreviewDisabled && type == 1)) return; qePreviewMode = !qePreviewMode; // switch tab styles var lia = qePreviewMode?document.getElementById('qeTabEdit'): document.getElementById('qeTabPreview'); var lid = qePreviewMode?document.getElementById('qeTabPreview'): document.getElementById('qeTabEdit'); lid.style.border = '1px solid #888'; lid.style.fontWeight = 'bold'; lia.style.border = '1px solid #aaa'; lia.style.fontWeight = 'normal'; lia.style.borderBottom = lid.style.borderBottom = 'none'; // switch to preview if (qePreviewMode) { qeForm.firstChild.style.display = 'none'; qePreview.style.display = 'block'; qePreview.firstChild.style.display = 'block'; // remove all child nodes from previous previews, if any for (var i = 1; i < qePreview.childNodes.length; i++) qePreview.removeChild(qePreview.childNodes[i]); qeLoadPreview(); } else { qePreview.style.display = 'none'; qeForm.firstChild.style.display = 'block'; } } function qeLoadPreview() { if (qeEdit == -1 || qeRequestState || !qeEditLink || !qePreviewMode || !qeFormAction) return; var link = qeEditLink + qeEdit; qeRequestState = 2; qeRequest.onreadystatechange = qeAjaxResponse; qeRequest.open('POST', qeFormAction, true); var send = qeMakeFormRequest(); qeRequest.overrideMimeType('text/xml'); qeRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); qeRequest.setRequestHeader('Content-length', send.length); qeRequest.setRequestHeader('Content', send.length); qeRequest.send(send); } function qeMakeFormRequest() { if (!qeForm) return null; var str = ''; var inputs = qeForm.getElementsByTagName('input'); for (var i = 0; i < inputs.length; i++) if (inputs[i].value && inputs[i].value.length > 0) str += '&' + inputs[i].name + '=' + encodeURI(inputs[i].value); str += '&wpPreview=Preview' + '&wpTextbox1=' + encodeURIComponent(document.getElementById('wpTextbox1').value); return str.substr(1); } function qeTabMouseOverOut(obj, out) { var coloronly = false; if (obj.id == 'qeTabEdit' || obj.id == 'qeTabPreview') { if ((qePreviewMode && obj.id == 'qeTabPreview') || (!qePreviewMode && obj.id == 'qeTabEdit')) coloronly = true; } obj.style.backgroundColor = out?'#fafafa':'#fff'; if (!coloronly) obj.style.borderColor = out?'#aaa':'#888'; } // Ajax stuff function qeInitAjax() { try { if (window.XMLHttpRequest) { qeRequest = new XMLHttpRequest(); qeRequest.overrideMimeType('text/xml'); } else if (window.ActiveXObject) qeRequest = new ActiveXObject('Microsoft.XMLHTTP'); else throw 'Kein AJAX-Objekt vorhanden'; } catch (e) { qeShowError(e); return false; } if (!qeRequest) { qeShowError('AJAX-Objekt konnte nicht erstellt werden'); return false; } return true; } function qeGetSection() { if (qeEdit == -1 || !qeForm || !qeRequest || !qeEditLink || qeRequestState) return; var link = qeEditLink + qeEdit; qeRequestState = 1; qeRequest.onreadystatechange = qeAjaxResponse; qeRequest.open('GET', link, true); qeRequest.send(null); } function qeAjaxResponse() { if (!qeRequestState) { alert('QuickEdit Fehler: qeAjaxResponse'); return; } // receive if (qeRequestState == 1 && qeEdit != -1) { if (qeRequest.readyState != 4 || qeRequest.status != 200) return; qeRequestState = 0; var xml = qeRequest.responseXML; try // MediaWiki bug 6986 workaround { var wpTextbox1 = xml.getElementById('wpTextbox1').value; } catch (e) { xml = qeFixXML(qeRequest.responseText); if (!xml) { qeShowError('XML parsing fehlgeschlagen.'); return; } var wpTextbox1 = xml.getElementById('wpTextbox1').value; } var inputs = xml.getElementsByTagName('input'); for (i = 0; i < inputs.length; i++) { if (inputs[i].name == 'wpSection') wpSection = inputs[i].value; else if (inputs[i].name == 'wpStarttime') wpStarttime = inputs[i].value; else if (inputs[i].name == 'wpEdittime') wpEdittime = inputs[i].value; else if (inputs[i].name == 'wpSummary') wpSummary = inputs[i].value; else if (inputs[i].name == 'wpEditToken') wpEditToken = inputs[i].value; else if (inputs[i].name == 'wpAutoSummary') wpAutoSummary = inputs[i].value; else if (inputs[i].name == 'wpWatchthis') wpWatchthis = inputs[i].checked; } var formaction = xml.getElementById('editform').action; // sollte nie passieren, wenn doch -> fatal error if (wpSection != qeEdit) { qeAlert(qePhrase('varmismatch')); qeRequestState = 0; qeAbortEdit(); return; } qeFillForm(formaction, wpStarttime, wpEdittime, wpSummary, wpTextbox1, wpEditToken, wpAutoSummary, wpWatchthis); return; } // preview (submit) if (qeRequestState == 2 && qeEdit != -1) { if (qeRequest.readyState != 4 || qeRequest.status != 200) return; qeRequestState = 0; try { var xml = qeRequest.responseXML; var prev = xml.getElementById('wikiPreview').cloneNode(true); } catch (e) { qePreviewDisabled = true; qePreview.firstChild.firstChild.nodeValue = qePhrase('noprev'); var tab = document.getElementById('qeTabPreview'); tab.firstChild.style.color = '#888'; return; } qePreview.firstChild.style.display = 'none'; while (prev.childNodes.length > 0 && prev.firstChild.className != 'previewnote') prev.removeChild(prev.firstChild); prev.removeChild(prev.firstChild); qePreview.appendChild(prev); return; } } function qeSubmitByReturn() { qeSubmit(0); return false; } function qeSubmit(preview) { if (qeEdit == -1 || !qeRequest || !qeForm || qeRequestState) return; qeForm.firstChild.childNodes[3].value = document.getElementById('qeSummary').value; if (preview == 1) { var prev = document.createElement('input'); prev.name = 'wpPreview'; prev.value = 'Preview'; prev.type = 'hidden'; qeForm.appendChild(prev); } qeForm.submit(); } // MediaWiki bug 6986 workaround function qeFixXML(text) { var pos = text.indexOf('<h1 class="firstHeading">'); var pos2 = text.indexOf('</h1>'); if (pos == -1 || pos2 == -1) return null; text = text.substring(0, pos) + text.substring(pos2+5); var parser = new DOMParser(); var newdoc = parser.parseFromString(text, "text/xml"); return newdoc; } // Workaround for JavaScript // don't ask me why the hell JS throws an error at '/*' function qeFixXMLPreview(text) { // another MediaWiki bug: backslashes are stripped out when saving a page... regex = eval('/' + String.fromCharCode(92) + '/' + String.fromCharCode(92) + '*/g'); text = text.replace(regex, '/*'); var parser = new DOMParser(); var newdoc = parser.parseFromString(text, "text/xml"); return newdoc; } // Language stuff function qeGetBGColor() { var ret = qeGetStyle(document.getElementById('content'), 'background-color'); return ret?ret:'#fff'; } function qeGetStyle(elem, style) { return document.defaultView.getComputedStyle(elem, null).getPropertyValue(style); } function qeSetLang() { switch (wgUserLanguage) { case 'de': qeLang = 1; break; case 'en': qeLang = 2; break; // case 'xx': ... default: qeLang = 2; } qeSetPrefix(); } function qePhrase(name) { for (var i = 0; i < qePhrases.length; i++) if (qePhrases[i][0] == name) return qePhrases[i][qeLang]; return 'UNDEFINED PHRASE: ' + name; } function qeSetPrefix() { // ausgeliehen vom Wikipedia-Script var pref = 'Alt'; if (is_safari || navigator.userAgent.toLowerCase().indexOf('mac') + 1 || navigator.userAgent.toLowerCase().indexOf('konqueror') + 1 ) pref = qePhrase('strg'); else if (is_opera) pref = qePhrase('shift') + '-Esc'; else if (is_ff2_x11) pref = qePhrase('strg') + '-' + qePhrase('shift'); else if (is_ff2_win) pref = 'Alt-' + qePhrase('shift'); pref += '-'; for (var i = 0; i < qePhrases.length; i++) if (qePhrases[i][0].charAt(0) == 't') for (var j = 1; j < qePhrases[i].length; j++) qePhrases[i][j] = qePhrases[i][j].replace(/KEY:(.)/, pref + '$1'); } var qePhrases = new Array( new Array('quickedit', 'QuickEdit', 'QuickEdit'), new Array('submit', 'Speichern', 'Submit'), new Array('preview', 'Vorschau', 'Preview'), new Array('cancel', 'Abbrechen', 'Cancel'), new Array('k', 'Kleine Änderungen', 'minor'), new Array('b', 'Beobachten', 'watch'), new Array('error', 'Fehler', 'error'), new Array('nolinksfound', 'Keine Links gefunden', 'No links found'), new Array('loading', 'Lade Daten', 'Loading data'), new Array('liveprev', 'Live Vorschau', 'Live Preview'), new Array('loadprev', 'Lade Vorschau', 'Loading preview'), new Array('noprev', 'Fehler: Vorschau nicht verfügbar (Seite konnte von JavaScript nicht gelesen werden)', 'Error: preview not available (page could not be read by JavaScript)'), new Array('header', 'MediaWiki QuickEdit 2 beta / Fehler/Kritik/Anregungen bitte da posten: ', 'MediaWiki QuickEdit 2 beta / post any bugs/crititcs/suggestions there: '), new Array('tQuickEdit','QuickEdit Ansicht (KEY:E)', 'QuickEdit view (KEY:E)'), new Array('tLivePrev', 'Live Vorschau (KEY:P)', 'Live preview (KEY:P)'), new Array('tSubmit', 'Änderungen Speichern (KEY:S)','Submit changes (KEY:S)'), new Array('tPreview', 'Normale Vorschau', 'Normal preview'), new Array('tCancel', 'Abbrechen (KEY:A)', 'Cancel (KEY:A)'), new Array('tWatch', 'Beobachten (KEY:W)', 'Watch (KEY:W)'), new Array('tMinor', 'Kleine Änderungen (KEY:I)', 'Minor edit (KEY:I)'), new Array('strg', 'Strg', 'Ctrl'), new Array('shift', 'Umschalt', 'Shift') ); /*</pre>*/ /***** Fine Ricerca *****/ /*<pre><nowiki>*/ //=== inizio RICERCA IN NAMESPACE === //Aggiunge un combo box in cui scegliere il "namespace" per la ricerca addOnloadHook(function () { var searchGoButton = document.getElementById('searchGoButton'); if (!searchGoButton) return; var searchNsHidden = document.createElement('input'); searchNsHidden.id = 'searchNsHidden'; searchNsHidden.type = 'hidden'; searchNsHidden.name = 'ns0'; searchNsHidden.value = '1'; var searchNsMenu = document.createElement('select'); searchNsMenu.id = 'searchNsMenu'; searchNsMenu.name = 'ns'; searchNsMenu.options[searchNsMenu.options.length] = new Option('(Principale)', 0); searchNsMenu.options[searchNsMenu.options.length] = new Option('Discussione', 1); searchNsMenu.options[searchNsMenu.options.length] = new Option('Utente', 2); searchNsMenu.options[searchNsMenu.options.length] = new Option('Discussioni utente', 3); searchNsMenu.options[searchNsMenu.options.length] = new Option('Wikipedia', 4); searchNsMenu.options[searchNsMenu.options.length] = new Option('Discussioni Wikipedia', 5); searchNsMenu.options[searchNsMenu.options.length] = new Option('Immagine', 6); searchNsMenu.options[searchNsMenu.options.length] = new Option('Discussione immagine', 7); searchNsMenu.options[searchNsMenu.options.length] = new Option('MediaWiki', 8); searchNsMenu.options[searchNsMenu.options.length] = new Option('Discussioni MediaWiki', 9); searchNsMenu.options[searchNsMenu.options.length] = new Option('Template', 10); searchNsMenu.options[searchNsMenu.options.length] = new Option('Discussioni Template', 11); searchNsMenu.options[searchNsMenu.options.length] = new Option('Aiuto', 12); searchNsMenu.options[searchNsMenu.options.length] = new Option('Discussioni Aiuto', 13); searchNsMenu.options[searchNsMenu.options.length] = new Option('Categoria', 14); searchNsMenu.options[searchNsMenu.options.length] = new Option('Discussioni Categoria', 15); searchNsMenu.options[searchNsMenu.options.length] = new Option('Portale', 100); searchNsMenu.options[searchNsMenu.options.length] = new Option('Discussioni portale', 101); searchNsMenu.options[searchNsMenu.options.length] = new Option('Progetto', 102); searchNsMenu.options[searchNsMenu.options.length] = new Option('Discussioni progetto', 103); searchNsMenu.onchange = function () { searchNsHidden.name = 'ns' + (this.selectedIndex < 0 ? '0' : this.options[this.selectedIndex].value); } searchNsMenu.style.width = '10.9em'; searchNsMenu.style.margin = '0'; searchNsMenu.style.fontSize = '95%'; searchGoButton.parentNode.insertBefore(searchNsHidden, searchGoButton); searchGoButton.parentNode.insertBefore(searchNsMenu, searchGoButton); }); //=== fine RICERCA IN NAMESPACE === //</nowiki></pre>