From 8c427cd00d1605e275df038865ffa85623171c13 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Sun, 8 Dec 2013 15:05:16 +0100 Subject: [PATCH 1/1] =?utf8?q?En=20fait,=20on=20a=20d=C3=A9j=C3=A0=20l?= =?utf8?q?=E2=80=99index=20de=20position=20des=20=C3=A9l=C3=A9ments=20?= =?utf8?q?=E2=80=93=20sauf=20qu=E2=80=99il=20=C3=A9tait=20cr=C3=A9=C3=A9?= =?utf8?q?=20en=20dehors=20du=20constructeur.=20On=20l=E2=80=99y=20met,=20?= =?utf8?q?c=E2=80=99est=20plus=20propre.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- skins/ajax_scripts/folder_contents_script.js | 24 ++++++++------------ skins/photo_theme/folder_contents_macros.pt | 6 +---- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/skins/ajax_scripts/folder_contents_script.js b/skins/ajax_scripts/folder_contents_script.js index 0351cde..89cca56 100644 --- a/skins/ajax_scripts/folder_contents_script.js +++ b/skins/ajax_scripts/folder_contents_script.js @@ -18,15 +18,15 @@ function getTargetRow(evt){ return target; } -FolderDDropControler = function(listing) { +FolderDDropControler = function(listing, firstItemPos) { this.folderUrl = document.getElementById("FolderUrl").innerHTML; this.targetRow = null; this.lastOverPosition = null; this.prevDirUp = null; this.noOver = true; this.listing = listing; - this.checkboxes = undefined; - this._updateCBIndex(); + this.firstItemPos = firstItemPos; + this._updatePositions(); var thisControler = this; this.listing.onmousedown = function(evt) {thisControler.drag(evt);}; this.listing.onmouseover = function(evt) {thisControler.moveRow(evt);}; @@ -39,18 +39,12 @@ FolderDDropControler = function(listing) { } }; -FolderDDropControler.prototype._updateCBIndex = function() { - var cbs = this.listing.getElementsByTagName('INPUT'); - var index = 0; - var cb, i; - this.checkboxes = []; - for (i=0 ; i < cbs.length ; i++) { - cb = cbs[i]; - if (cb.type === 'checkbox') { - cb.position = index++; - this.checkboxes[cb.position] = cb; - } - } +FolderDDropControler.prototype._updatePositions = function() { + var rows = this.listing.getElementsByTagName("TR"); + var i; + for (i=0 ; i < rows.length ; i++ ) { + rows[i].pos = i + this.firstItemPos; } + }; FolderDDropControler.prototype.drag = function(evt){ diff --git a/skins/photo_theme/folder_contents_macros.pt b/skins/photo_theme/folder_contents_macros.pt index 7d25a02..c2c3780 100644 --- a/skins/photo_theme/folder_contents_macros.pt +++ b/skins/photo_theme/folder_contents_macros.pt @@ -91,11 +91,7 @@ var listing = document.getElementById("FolderListingBody"); if (ddEnabled) { - var rows = listing.getElementsByTagName("TR") - for ( var i = 0 ; i < rows.length ; i++ ) - rows[i].pos = i + firstItemPos; - - var fDDcontroler = new FolderDDropControler(listing); + var fDDcontroler = new FolderDDropControler(listing, firstItemPos); var topNavBatchBar = document.getElementById("topNavBatchBar"); var bottomNavBatchBar = document.getElementById("bottomNavBatchBar"); if (topNavBatchBar && bottomNavBatchBar) { -- 2.20.1