Skip to content

Commit 288b693

Browse files
authored
Added Sorting
Decoration sorting from most to least amount of decors in a collection, (Thanks to k4lmaa for the idea)
1 parent 5a568df commit 288b693

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

index.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ <h1>Decoration Gallery</h1>
152152
<div id="grid" class="grid"></div>
153153

154154
<script>
155-
// Fetch logos and decorations from separate json files dynamically
155+
// Fetch logos and decorations from separate JSON files dynamically
156156
function loadGroupLogos() {
157157
return fetch('https://raw.githubusercontent.com/DiscoLook/discolook.github.io/refs/heads/main/group_logos.json?' + Date.now())
158158
.then(response => response.json())
@@ -194,7 +194,10 @@ <h1>Decoration Gallery</h1>
194194
const grid = document.getElementById('grid');
195195
grid.innerHTML = ''; // Clear any existing content
196196

197-
Object.entries(data.groups).forEach(([groupName, groupItems]) => {
197+
// Sort groups by the number of decorations (descending order)
198+
const sortedGroups = Object.entries(data.groups).sort((a, b) => b[1].length - a[1].length);
199+
200+
sortedGroups.forEach(([groupName, groupItems]) => {
198201
// Create and append group title
199202
const groupTitle = document.createElement('h2');
200203
groupTitle.className = 'group-title';

0 commit comments

Comments
 (0)