« MediaWiki:Gadget-RestaurationDeluxe.js » : différence entre les versions

Un livre de Wikilivres.
Contenu supprimé Contenu ajouté
Création
 
correction d'un bug en prévisualisation
Ligne 1 : Ligne 1 :

/*
/*
* Restauration Deluxe
* Restauration Deluxe
Ligne 5 : Ligne 4 :
* Cocher/Décocher rapidement les cases pour restaurer un article
* Cocher/Décocher rapidement les cases pour restaurer un article
*
*
* Auteur : GôTô
* Auteur : GôTô, DavidL
* Dernière révision : 3 novembre 2006
* Dernière révision : 24 septembre 2011
*/
*/


function UndeleteSelectAll()
function UndeleteSelectAll()
{
{
var title2 = document.getElementsByTagName("h2");
if (wgCanonicalSpecialPageName != 'Undelete') return;
var title2 = document.getElementsByTagName("h2");
if (!title2 || title2.length==0) return;
var all = document.createElement("input");
var all = document.createElement("input");
all.setAttribute("type", "checkbox");
all.setAttribute("type", "checkbox");
if (all.attachEvent)
if (all.attachEvent)
all.attachEvent("onclick", function () { SelectAllInputs(document.getElementById("checkAll").checked) });
all.attachEvent("onclick", function () { SelectAllInputs(document.getElementById("checkAll").checked) });
else
else
all.setAttribute("onclick", "javascript: SelectAllInputs(this.checked)");
all.setAttribute("onclick", "javascript: SelectAllInputs(this.checked)");
all.setAttribute("title", "Sélectionner/Désélectionner tous");
all.setAttribute("title", "Sélectionner/Désélectionner toutes les versions");
title2[title2.length -1].appendChild(all);
title2[title2.length -1].appendChild(all);
all.click();
all.click();
}
}


function SelectAllInputs(bool)
function SelectAllInputs(bool)
{
{
var inputs = document.getElementById("undelete").getElementsByTagName("input");
var inputs = document.getElementById("undelete").getElementsByTagName("input");
for (var cpt = 0 ; cpt < inputs.length ; cpt++)
for (var cpt = 0 ; cpt < inputs.length ; cpt++)
{
inputs[cpt].checked = bool;
inputs[cpt].checked = bool;
}
}
}


if ((wgNamespaceNumber==-1)&&(wgCanonicalSpecialPageName=="Undelete")&&(wgAction=="view"))
addOnloadHook(UndeleteSelectAll);
addOnloadHook(UndeleteSelectAll);

Version du 24 septembre 2011 à 19:59

/*
 * Restauration Deluxe
 *
 * Cocher/Décocher rapidement les cases pour restaurer un article
 *
 * Auteur : GôTô, DavidL
 * Dernière révision : 24 septembre 2011
 */

function UndeleteSelectAll()
{
    var title2 = document.getElementsByTagName("h2");
    if (!title2 || title2.length==0) return;
    var all = document.createElement("input");
    all.setAttribute("type", "checkbox");
    if (all.attachEvent)
        all.attachEvent("onclick", function () { SelectAllInputs(document.getElementById("checkAll").checked) });
    else
        all.setAttribute("onclick", "javascript: SelectAllInputs(this.checked)");
    all.setAttribute("title", "Sélectionner/Désélectionner toutes les versions");
    title2[title2.length -1].appendChild(all);
    all.click();
}

function SelectAllInputs(bool)
{
    var inputs = document.getElementById("undelete").getElementsByTagName("input");
    for (var cpt = 0 ; cpt < inputs.length ; cpt++)
        inputs[cpt].checked = bool;
}

if ((wgNamespaceNumber==-1)&&(wgCanonicalSpecialPageName=="Undelete")&&(wgAction=="view"))
    addOnloadHook(UndeleteSelectAll);