Wikibooks:Monobook.js/spostamento.js

Wikibooks, manuali e libri di testo liberi.

//

/***** tool x gli spostamenti pagina *****/
   if ((toLoad.indexOf("movetxt")!=-1))
function cancel_movetext()
{
  var f = document.getElementById("movepage");
  if (f)
  {
    var input = document.getElementById("wpReason");
    input.value="";
  }
}
 
function setup_move_text()
{
  if (document.title.indexOf("Spostamento di pagina") == 0)
  {
    var f = document.getElementById("movepage");
    if (f)
    {
      var h2 = f.getElementsByTagName("input")[0];
      if (h2)
      {
        var button = document.createElement('input');
        button.type = "button";
        button.value = "Cancella motivazione";
        button.setAttribute('onClick', 'cancel_movetext()');
        f.appendChild(button, h2);
      }
    }
  }
}
 
$(setup_move_text);
 
function setup_move_motivazione() {
    if (document.title.indexOf("Spostamento di pagina") == 0)
    {
        var p = document.getElementById("movepage");
        if (p)
        {
            var h2 = p.getElementsByTagName("input")[0];
            if (h2)
            {
                var i;
                var linkCdn = "[[Aiuto:Convenzioni di nomenclatura|convenzioni di nomenclatura]]";
                arrayMotivation = new Array(linkCdn + " (i nomi dei libri non devono avere le iniziali maiuscole)", linkCdn + " (non si abbrevia il titolo del libro quando si creano le sottopagine)", linkCdn + " (i nomi dei libri devono essere brevi e descrittivi)", linkCdn + " (sottopagino correttamente)", linkCdn + " (rendo un libro a sé stante)", linkCdn + " (i nomi dei moduli iniziano sempre con una lettera maiuscola)", linkCdn + " (la struttura gerachica è deprecata)", "sposto nel corretto [[Aiuto:Namespaces|namespace]]", "[[Aiuto:Sposta|il titolo non rappresenta più il contenuto della voce]]", "[[Aiuto:Sposta|il titolo contiene errori di ortografia o di battitura]]");
 
                var motivazione = document.createElement('select');
                motivazione.name = 'popupSelect';
                motivazione.id = 'motivazione';
                motivazione.size = 1;
                var option;
                // Carica nel combo box il contenuto della variabile globale
                for (i = 0; i < arrayMotivation.length; i++){
                    option = new Option(arrayMotivation[i],' ');
                    option.value = arrayMotivation[i];
                    motivazione.options[motivazione.length] = option;
                }
                p.appendChild(motivazione);
                var button = document.createElement('input');
                button.type = "button";
                button.value = "OK";
                button.setAttribute('onClick', 'inserisci_move_motivazione()');
                p.appendChild(button);
            }
        }
    }
 
}
 
function inserisci_move_motivazione() {
    motivazione = document.getElementById('motivazione').value;
    var f = document.getElementById("movepage");
    if (f)
    {
        var input = document.getElementById("wpReason");
        input.value=motivazione;
    }
}
 
$(setup_move_motivazione);
//