X-Git-Url: http://git.euphorik.ch/?p=pompage.git;a=blobdiff_plain;f=xpi%2Fchrome%2Fcontent%2Fsettings.js;fp=xpi%2Fchrome%2Fcontent%2Fsettings.js;h=c7139a0560bcaad4030af3cc084a6a39a1c31adc;hp=9eab518aba9ae00b332484348b6a54d1ebbc906a;hb=360b03e976f53bd285b4f88e41bedf72e644898b;hpb=14d8b43a06d6c0bd18c40d79509b6afe2047af0d diff --git a/xpi/chrome/content/settings.js b/xpi/chrome/content/settings.js index 9eab518..c7139a0 100644 --- a/xpi/chrome/content/settings.js +++ b/xpi/chrome/content/settings.js @@ -1,13 +1,103 @@ -function doAnnuler(event) +/*** Evénements ***/ +function divxlistOnOk() { + divxlistSauverParametres(); } -function doOK(event) +function divxlistOnLoad() { + divxlistChargerParametres(); } +function divxlistChargerParametres() +{ + var root = divxlistGetRoot(); + document.getElementById("dossierDivx").value = root; + + var commandes = divxlistGetCommandes(); + + var listeAppli = document.getElementById("listeAppli"); + + for (var i = 0; i < commandes.length; i += 1) + { + var item = listeAppli.appendItem("", "") + var textMotif = document.createElement("textbox") + textMotif.setAttribute("value",commandes[i][0]) + item.appendChild(textMotif); + var textCommande = document.createElement("textbox") + textCommande.setAttribute("value",commandes[i][1]) + item.appendChild(textCommande); + } +} + +function divxlistSauverParametres() +{ + var listeAppli = document.getElementById("listeAppli"); + var items = listeAppli.childNodes; + + var commandes = new Array(); + + for (var i = 2; i < items.length; i++) + { + var motifCommande = new Array(2); + motifCommande[0] = items[i].firstChild.value + motifCommande[1] = items[i].firstChild.nextSibling.value + commandes.push(motifCommande) + } + + divxlistSetCommandes(commandes); + divxlistSetRoot(document.getElementById("dossierDivx").value); +} +function divxlistAjouterCommande() +{ + var listeAppli = document.getElementById("listeAppli"); + var ligne = document.createElement("listitem"); + ligne.appendChild(document.createElement("textbox")); + ligne.appendChild(document.createElement("textbox")); + listeAppli.appendChild(ligne); +} + +function divxlistEnleverCommande() +{ + var listeAppli = document.getElementById("listeAppli"); + var ligne = listeAppli.selectedItem; + ligne.parentNode.removeChild(ligne); +} + +function divxlistMonterCommande() +{ + var listeAppli = document.getElementById("listeAppli"); + var ligne = listeAppli.selectedItem; + var motif = ligne.firstChild.value + var commande = ligne.firstChild.nextSibling.value + var ligneAvant = ligne.previousSibling + if (ligneAvant.nodeName == 'listitem') + { + ligneAvant.parentNode.insertBefore(ligne, ligneAvant) + } + ligne.firstChild.value = motif; + ligne.firstChild.nextSibling.value = commande +} + +function divxlistDescendreCommande() +{ + var listeAppli = document.getElementById("listeAppli"); + var ligne = listeAppli.selectedItem; + var motif = ligne.firstChild.value + var commande = ligne.firstChild.nextSibling.value + var ligneApres = ligne.nextSibling.nextSibling + if (ligneApres == null) + ligne.parentNode.appendChild(ligne) + else + ligneApres.parentNode.insertBefore(ligne, ligneApres) + ligne.firstChild.value = motif; + ligne.firstChild.nextSibling.value = commande +} // Les événements -$(hbox > button[@label=Annuler]).addEventListener('command', doAnnuler, true); -$(hbox > button[@label=OK]).addEventListener('command', doOK, true); \ No newline at end of file +//$("dialog").addEventListener('load', onLoad, true); +//$("dialog").bind("load", divxlistOnLoad); +//$(hbox > button[@label=OK]).addEventListener('command', onOK, true); +//var poulpe = document.getElementById("yopyop-settings"); +//.addEventListener('load', divxlistOnLoad, true);yxc