From f6561456f7968dbeed9a5bfdba028223e2e4e651 Mon Sep 17 00:00:00 2001 From: GarcaMan Date: Fri, 1 Oct 2021 05:47:52 +0000 Subject: [PATCH] New sort for Comic Reader --- cps/static/js/kthoom.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cps/static/js/kthoom.js b/cps/static/js/kthoom.js index 76e6a2e4..268fe9ec 100644 --- a/cps/static/js/kthoom.js +++ b/cps/static/js/kthoom.js @@ -180,13 +180,15 @@ function initProgressClick() { function loadFromArrayBuffer(ab) { var lastCompletion = 0; + const collator = new Intl.Collator('en', { numeric: true, sensitivity: 'base' }); loadArchiveFormats(['rar', 'zip', 'tar'], function() { // Open the file as an archive archiveOpenFile(ab, function (archive) { if (archive) { totalImages = archive.entries.length console.info('Uncompressing ' + archive.archive_type + ' ...'); - archive.entries.forEach(function(e, i) { + entries = archive.entries.sort((a,b) => collator.compare(a.name, b.name)); + entries.forEach(function(e, i) { updateProgress( (i + 1)/ totalImages * 100); if (e.is_file) { e.readData(function(d) {