From e5319bfbe3fcf3d752f8c20c466374a1cfc041f3 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 6 Jun 2015 21:22:37 +0200 Subject: [PATCH] [ticket/578] Correctly assign classes to element upon deleting modules B3P-578 --- adm/style/portal/ajax.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/adm/style/portal/ajax.js b/adm/style/portal/ajax.js index e38c6157..29f0ad4d 100644 --- a/adm/style/portal/ajax.js +++ b/adm/style/portal/ajax.js @@ -83,16 +83,20 @@ phpbb.addAjaxCallback('b3p_delete_module', function(res) { return; } - var el = $(this).parents('tr:first'), - nextEl = el.next(); + var $deletedRow = $(this).parents('tr:first'), + $nextRow = $deletedRow.next(); - el.remove(); + $deletedRow.remove(); // Fix classes of next elements - while (nextEl !== undefined && nextEl.is('tr')) { - var nextElClass = (nextEl.attr('class') === 'row1') ? 'row2' : 'row1'; - nextEl.attr('class', nextElClass); - nextEl = nextEl.next(); + while ($nextRow !== undefined && $nextRow.is('tr')) { + var nextRowClass = ($nextRow.attr('class') === 'row1') ? 'row2' : 'row1'; + + if ($nextRow.attr('class') !== 'row3') { + $nextRow.attr('class', nextRowClass); + } + + $nextRow = $nextRow.next(); } });