From a26a2df198a44f0e9140a33af0118edca46e2c6e Mon Sep 17 00:00:00 2001 From: Captain ALM Date: Wed, 17 Aug 2022 18:35:43 +0100 Subject: [PATCH] Try fix nav arrangement. --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 1ccae03..8f07fd6 100644 --- a/index.js +++ b/index.js @@ -305,14 +305,15 @@ function PerformNavResize() { var mensz = 0 var menc = [] var imenc = 0 - for (vmeni = 0; vmeni < vmen.childNodes.length; vmeni++) { + for (vmeni = vmen.childNodes.length - 1; vmeni >= 0; vmeni--) { if (vmen.childNodes[vmeni].nodeType === Node.ELEMENT_NODE) { if (mensz+vmen.childNodes[vmeni].clientWidth > maxbarsz) {menc[imenc] = vmen.childNodes[vmeni]; imenc++;} mensz += vmen.childNodes[vmeni].clientWidth } } if (menc.length > 0) { - for (vmeni = 0; vmeni < menc.length; vmeni++) {men.appendChild(men.removeChild(menc[vmeni]));} + for (vmeni = 0; vmeni < menc.length; vmeni++) {vmen.removeChild(menc[vmeni]);} + for (vmeni = menc.length - 1; vmeni >= 0; vmeni--) {InsertBefore(men, menc[vmeni]);} } else { for (vmeni = 0; vmeni < men.childNodes.length; vmeni++) { if (men.childNodes[vmeni].nodeType === Node.ELEMENT_NODE) { @@ -322,8 +323,7 @@ function PerformNavResize() { mensz += menaw } } - for (vmeni = 0; vmeni < menc.length; vmeni++) {men.removeChild(menc[vmeni]);} - for (vmeni = menc.length - 1; vmeni >= 0; vmeni--) {InsertBefore(vmen, menc[vmeni]);} + for (vmeni = 0; vmeni < menc.length; vmeni++) {vmen.appendChild(men.removeChild(menc[vmeni]));} } } }