From e39b6e46690622bc4e433d21d3e6554f300375e4 Mon Sep 17 00:00:00 2001 From: byun Date: Sat, 4 Oct 2025 17:34:20 +0000 Subject: [PATCH] =?UTF-8?q?00002=20=EB=A1=9C=EA=B7=B8=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=86=8C=ED=8C=85=EB=B0=A9=EB=B2=95=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 웹페이지의 log files 는 파일들 나열이 지금 canlog_00000.bin이 제일 윗 상단에 있는데 반대로 해당파일이 제일 밑으로 최신(파일명숫자가 높은) 파일이 윗상단에 표시하게 sorting 방법을 바꾸어줘 --- index.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/index.h b/index.h index 19a001d..9c252d2 100644 --- a/index.h +++ b/index.h @@ -396,6 +396,14 @@ const char index_html[] PROGMEM = R"rawliteral( return; } + // 파일명 기준으로 내림차순 정렬 (최신 파일이 위로) + files.sort((a, b) => { + // canlog_XXXXX.bin에서 숫자 부분 추출 + const numA = parseInt(a.name.match(/\d+/)?.[0] || '0'); + const numB = parseInt(b.name.match(/\d+/)?.[0] || '0'); + return numB - numA; // 내림차순 + }); + fileList.innerHTML = ''; files.forEach(file => { const fileItem = document.createElement('div'); @@ -410,7 +418,7 @@ const char index_html[] PROGMEM = R"rawliteral( fileList.appendChild(fileItem); }); - console.log(`파일 목록 업데이트: ${files.length}개`); + console.log(`파일 목록 업데이트: ${files.length}개 (최신순)`); } function formatBytes(bytes) {