mirror of
https://github.com/filegator/filegator.git
synced 2025-04-21 23:31:52 +02:00
parent
ccd935d001
commit
0b79931711
@ -536,21 +536,19 @@ export default {
|
||||
return this.customSort(a, b, !order, 'time')
|
||||
},
|
||||
customSort(a, b, order, param) {
|
||||
// TODO: firefox is broken
|
||||
if (b.type == 'back') return 1
|
||||
if (a.type == 'back') return -1
|
||||
if (b.type == 'dir' && a.type == 'dir') {
|
||||
return (a[param] < b[param]) || order ? -1 : 1
|
||||
} else if (b.type == 'dir') {
|
||||
return 1
|
||||
} else if (a.type == 'dir') {
|
||||
return -1
|
||||
}
|
||||
if (_.isString(a[param])) {
|
||||
return (_.lowerCase(a[param]) < _.lowerCase(b[param])) || order ? -1 : 1
|
||||
} else {
|
||||
return (a[param] < b[param]) || order ? -1 : 1
|
||||
}
|
||||
if (b.type == 'back') return 1
|
||||
|
||||
if (a.type == 'dir' && b.type != 'dir') return -1
|
||||
if (b.type == 'dir' && a.type != 'dir') return 1
|
||||
|
||||
if (b.type == a.type)
|
||||
{
|
||||
if (a[param] === b[param]) return this.customSort(a, b, false, 'name')
|
||||
|
||||
if (_.isString(a[param])) return (a[param].localeCompare(b[param])) * (order ? -1 : 1)
|
||||
else return ((a[param] < b[param]) ? -1 : 1) * (order ? -1 : 1)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user