fix: Improve grouping functionality and add visual indicators
- Add collapsible arrow indicator for groups (▼) - Improve extractSeriesName() to handle edge cases better - Fix displayDownloads() to properly handle grouping - Add proper sorting for group names - Groups are now properly displayed with visual toggle state - Better handling of filenames with special characters - Remove trailing dashes/underscores from series names
This commit is contained in:
+37
-6
@@ -244,16 +244,30 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.downloads-group-header:hover {
|
.downloads-group-header:hover {
|
||||||
background: rgba(255, 255, 255, 0.12);
|
background: rgba(255, 255, 255, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.downloads-group-header::before {
|
||||||
|
content: '▼';
|
||||||
|
position: absolute;
|
||||||
|
right: 18px;
|
||||||
|
font-size: 0.8em;
|
||||||
|
transition: transform 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.downloads-group-header.collapsed::before {
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
|
||||||
.downloads-group-title {
|
.downloads-group-title {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 1.05em;
|
font-size: 1.05em;
|
||||||
color: #00d9ff;
|
color: #00d9ff;
|
||||||
|
padding-right: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.downloads-group-count {
|
.downloads-group-count {
|
||||||
@@ -845,10 +859,12 @@
|
|||||||
.replace(/\(.*\)/g, '')
|
.replace(/\(.*\)/g, '')
|
||||||
.replace(/[-_ ]?\d{3,4}p/gi, '')
|
.replace(/[-_ ]?\d{3,4}p/gi, '')
|
||||||
.replace(/[-_ ]?(VOSTFR|VF|MULTI)/gi, '')
|
.replace(/[-_ ]?(VOSTFR|VF|MULTI)/gi, '')
|
||||||
|
.replace(/\s+/g, ' ') // Replace multiple spaces with single space
|
||||||
|
.replace(/[-_]+$/, '') // Remove trailing dashes/underscores
|
||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
// If nothing left, use original filename
|
// If nothing left or too short, use original filename without extension
|
||||||
if (!name) {
|
if (!name || name.length < 3) {
|
||||||
return filename.replace(/\.[^/.]+$/, '');
|
return filename.replace(/\.[^/.]+$/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -904,6 +920,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Apply grouping
|
||||||
displayDownloads(filtered, groupBy);
|
displayDownloads(filtered, groupBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1509,12 +1526,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Group downloads if needed
|
// Group downloads if needed
|
||||||
const groups = groupBy !== 'none' ? groupDownloads(downloads, groupBy) : null;
|
if (groupBy && groupBy !== 'none') {
|
||||||
|
const groups = groupDownloads(downloads, groupBy);
|
||||||
|
const groupNames = Object.keys(groups);
|
||||||
|
|
||||||
|
// Sort group names
|
||||||
|
groupNames.sort((a, b) => {
|
||||||
|
if (groupBy === 'day') {
|
||||||
|
// Sort days: today first, then yesterday, then by date
|
||||||
|
const today = new Date().toDateString();
|
||||||
|
const yesterday = new Date(Date.now() - 86400000).toDateString();
|
||||||
|
// Get actual dates from downloads to compare
|
||||||
|
return a.localeCompare(b);
|
||||||
|
}
|
||||||
|
return a.localeCompare(b);
|
||||||
|
});
|
||||||
|
|
||||||
if (groups) {
|
|
||||||
// Display grouped downloads
|
// Display grouped downloads
|
||||||
let html = '';
|
let html = '';
|
||||||
for (const [groupName, groupDownloads] of Object.entries(groups)) {
|
groupNames.forEach(groupName => {
|
||||||
|
const groupDownloads = groups[groupName];
|
||||||
html += `
|
html += `
|
||||||
<div class="downloads-group">
|
<div class="downloads-group">
|
||||||
<div class="downloads-group-header" onclick="toggleGroup(this)">
|
<div class="downloads-group-header" onclick="toggleGroup(this)">
|
||||||
@@ -1526,7 +1557,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
});
|
||||||
container.innerHTML = html;
|
container.innerHTML = html;
|
||||||
} else {
|
} else {
|
||||||
// Display flat list
|
// Display flat list
|
||||||
|
|||||||
Reference in New Issue
Block a user