From: Benoît Pin Date: Sun, 8 Dec 2013 09:15:32 +0000 (+0100) Subject: Implémentation d’une méthode utilitaire pour indexer les cases à cocher. X-Git-Url: https://scm.cri.mines-paristech.fr/git/Plinn.git/commitdiff_plain/2e2304b15d0fd71d6ce99a009f30231f605295ec Implémentation d’une méthode utilitaire pour indexer les cases à cocher. --- diff --git a/skins/ajax_scripts/folder_contents_script.js b/skins/ajax_scripts/folder_contents_script.js index 00bdeb9..5033108 100644 --- a/skins/ajax_scripts/folder_contents_script.js +++ b/skins/ajax_scripts/folder_contents_script.js @@ -25,6 +25,8 @@ FolderDDropControler = function(listing) { this.prevDirUp = null; this.noOver = true; this.listing = listing; + this.checkboxes = undefined; + this._updateCBIndex; var thisControler = this; this.listing.onmousedown = function(evt) {thisControler.drag(evt);}; this.listing.onmouseover = function(evt) {thisControler.moveRow(evt);}; @@ -37,6 +39,20 @@ FolderDDropControler = function(listing) { } } +FolderDDropControler.prototype._updateCBIndex = function() { + var cbs = this.listing.getElementsByTagName('INPUT'); + var index = 0; + var cb; + this.checkboxes = []; + for (var i=0 ; i < cbs.length ; i++) { + cb = cbs[i]; + if (cb.type === 'checkbox') { + cb.position = index++; + this.checkboxes[cb.position] = cb; + } + } +}; + FolderDDropControler.prototype.drag = function(evt){ var target = getTargetedObject(evt); if (target.nodeName == "INPUT") return true;