diff --git a/templates/index.html b/templates/index.html index 6e4667c..ba9a3ac 100644 --- a/templates/index.html +++ b/templates/index.html @@ -244,16 +244,30 @@ cursor: pointer; user-select: none; transition: all 0.3s; + position: relative; } .downloads-group-header:hover { 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 { font-weight: 600; font-size: 1.05em; color: #00d9ff; + padding-right: 30px; } .downloads-group-count { @@ -845,10 +859,12 @@ .replace(/\(.*\)/g, '') .replace(/[-_ ]?\d{3,4}p/gi, '') .replace(/[-_ ]?(VOSTFR|VF|MULTI)/gi, '') + .replace(/\s+/g, ' ') // Replace multiple spaces with single space + .replace(/[-_]+$/, '') // Remove trailing dashes/underscores .trim(); - // If nothing left, use original filename - if (!name) { + // If nothing left or too short, use original filename without extension + if (!name || name.length < 3) { return filename.replace(/\.[^/.]+$/, ''); } @@ -904,6 +920,7 @@ } }); + // Apply grouping displayDownloads(filtered, groupBy); } @@ -1509,12 +1526,26 @@ } // 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 let html = ''; - for (const [groupName, groupDownloads] of Object.entries(groups)) { + groupNames.forEach(groupName => { + const groupDownloads = groups[groupName]; html += `