From 81abd5a101a52f7ca9c803af879815dacae028b1 Mon Sep 17 00:00:00 2001 From: ulrich Date: Thu, 28 Jan 2021 12:24:56 +0000 Subject: [PATCH] Sortieren aufgeraeumt --- web/ui2/js/app.js | 132 +++++--------------------------------------- 1 files changed, 15 insertions(+), 117 deletions(-) diff --git a/web/ui2/js/app.js b/web/ui2/js/app.js index ee0e407..ebabf3a 100644 --- a/web/ui2/js/app.js +++ b/web/ui2/js/app.js @@ -794,145 +794,44 @@ suedDiv.style.height = '0'; }; - /* - function descending(a, b) - { - if (a < b) - { - return 1; - } - - if (a > b) - { - return -1; - } - - return 0; - } - */ - // FileRef Vergleicher - this.name_vergleicher_asc = function(a, b) { - if (a.fileName() > b.fileName()) - { - return 1; - } - - if (a.fileName() < b.fileName()) - { - return -1; - } - + this.fm_vergleichen_asc = function(av, bv) { + if (av > bv) { return 1; } + if (av < bv) { return -1; } return 0; + }; + + this.name_vergleicher_asc = function(a, b) { + return self.fm_vergleichen_asc(a.fileName().small(), b.fileName().small()); }; this.name_vergleicher_desc = function(a, b) { - //console.log('name_vergleicher_desc - a.fileName: ' + - // a.fileName() + ', b.fileName: ' + b.fileName()); - if (a.fileName() < b.fileName()) - { - return 1; - } - - if (a.fileName() > b.fileName()) - { - return -1; - } - - return 0; + return self.fm_vergleichen_asc(b.fileName().small(), a.fileName().small()); }; - // groesse fileSize, art fr.mimetype, geaendert fileDate - this.type_vergleicher_asc = function(a, b) { - if (a.fr.mimetype > b.fr.mimetype) - { - return 1; - } - - if (a.fr.mimetype < b.fr.mimetype) - { - return -1; - } - - return 0; + return self.fm_vergleichen_asc(a.fr.mimetype.small(), b.fr.mimetype.small()); }; this.type_vergleicher_desc = function(a, b) { - //console.log('name_vergleicher_desc - a.fileName: ' + - // a.fileName() + ', b.fileName: ' + b.fileName()); - if (a.fr.mimetype < b.fr.mimetype) - { - return 1; - } - - if (a.fr.mimetype > b.fr.mimetype) - { - return -1; - } - - return 0; + return self.fm_vergleichen_asc(b.fr.mimetype.small(), a.fr.mimetype.small()); }; this.size_vergleicher_asc = function(a, b) { - if (a.fileSize() > b.fileSize()) - { - return 1; - } - - if (a.fileSize() < b.fileSize()) - { - return -1; - } - - return 0; + return self.fm_vergleichen_asc(a.fileSize(), b.fileSize()); }; this.size_vergleicher_desc = function(a, b) { - //console.log('name_vergleicher_desc - a.fileName: ' + - // a.fileName() + ', b.fileName: ' + b.fileName()); - if (a.fileSize() < b.fileSize()) - { - return 1; - } - - if (a.fileSize() > b.fileSize()) - { - return -1; - } - - return 0; + return self.fm_vergleichen_asc(b.fileSize(), a.fileSize()); }; this.date_vergleicher_asc = function(a, b) { - if (a.fileDate() > b.fileDate()) - { - return 1; - } - - if (a.fileDate() < b.fileDate()) - { - return -1; - } - - return 0; + return self.fm_vergleichen_asc(a.fileDate(), b.fileDate()); }; this.date_vergleicher_desc = function(a, b) { - //console.log('name_vergleicher_desc - a.fileName: ' + - // a.fileName() + ', b.fileName: ' + b.fileName()); - if (a.fileDate() < b.fileDate()) - { - return 1; - } - - if (a.fileDate() > b.fileDate()) - { - return -1; - } - - return 0; + return self.fm_vergleichen_asc(b.fileDate(), a.fileDate()); }; this.fm_toggle_order = function () { @@ -1025,8 +924,7 @@ } } var fl = new FileList(files); - self.fm_render_list(fl); - + self.fm_render_list(fl); } else { // #dateien leeren var elem = document.querySelector("#dateien"); -- Gitblit v1.9.3