diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-11-03 12:40:10 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-11-03 12:40:10 +0900 |
| commit | acde3f18aad0b59c4740cd7d36ed667b10ee55ff (patch) | |
| tree | c8e9a8cf48f0276d0044ac16dba471399f2a6b4d | |
| parent | 1c148fd00c04143d3fa47e50506158acc172b9c6 (diff) | |
modified recordings/recordings-plain.html
| -rw-r--r-- | layouts/recordings/recordings-plain.html | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/layouts/recordings/recordings-plain.html b/layouts/recordings/recordings-plain.html index fde8318..590f44c 100644 --- a/layouts/recordings/recordings-plain.html +++ b/layouts/recordings/recordings-plain.html @@ -201,7 +201,9 @@ {{ $vid := $p.Resources.GetMatch "*.{mp4,mov}" }} {{ $img := $p.Resources.GetMatch "*.{jpg,jpeg,png,gif,webp,svg}" }} {{ $heic := $p.Resources.GetMatch "*.{heic,HEIC}" }} - <li> + {{ $folderBase := path.Base $p.File.Dir }} + {{ $dateKey := $p.Date.Format "2006-01-02" }} + <li data-date="{{ $dateKey }}" data-folder="{{ $folderBase }}"> {{ if $vid }} <a href="{{ $vid.RelPermalink }}" @@ -260,6 +262,56 @@ } }); + // 같은 날짜 내에서 폴더명 역순 정렬 + const listEl = document.getElementById('list'); + if (listEl) { + const items = Array.from(listEl.querySelectorAll('li[data-date][data-folder]')); + const groupedByDate = {}; + + items.forEach(item => { + const date = item.getAttribute('data-date'); + if (!groupedByDate[date]) { + groupedByDate[date] = []; + } + groupedByDate[date].push(item); + }); + + // 날짜별로 그룹을 처리하되, 원래 순서를 유지하면서 같은 날짜 내에서만 재정렬 + const dateKeys = Object.keys(groupedByDate).sort().reverse(); + dateKeys.forEach(date => { + const group = groupedByDate[date]; + // 폴더명 역순 정렬 + group.sort((a, b) => { + const folderA = a.getAttribute('data-folder') || ''; + const folderB = b.getAttribute('data-folder') || ''; + return folderB.localeCompare(folderA); + }); + + // 그룹 내 첫 항목의 다음 형제를 기준점으로 사용 + if (group.length > 1) { + const firstItem = group[0]; + const parent = firstItem.parentNode; + const insertBefore = firstItem.nextSibling; + + // 모든 항목을 fragment에 추가 + const fragment = document.createDocumentFragment(); + group.forEach(item => { + if (item.parentNode) { + parent.removeChild(item); + } + fragment.appendChild(item); + }); + + // 정렬된 항목들을 원래 위치에 삽입 + if (insertBefore) { + parent.insertBefore(fragment, insertBefore); + } else { + parent.appendChild(fragment); + } + } + }); + } + // BGM 토글 버튼 및 자동재생 시도 const bgm = document.getElementById('bgm'); const toggle = document.getElementById('bgm-toggle'); |
