mirror of
https://github.com/filegator/filegator.git
synced 2025-08-06 17:46:33 +02:00
@@ -536,20 +536,18 @@ export default {
|
|||||||
return this.customSort(a, b, !order, 'time')
|
return this.customSort(a, b, !order, 'time')
|
||||||
},
|
},
|
||||||
customSort(a, b, order, param) {
|
customSort(a, b, order, param) {
|
||||||
// TODO: firefox is broken
|
|
||||||
if (b.type == 'back') return 1
|
|
||||||
if (a.type == 'back') return -1
|
if (a.type == 'back') return -1
|
||||||
if (b.type == 'dir' && a.type == 'dir') {
|
if (b.type == 'back') return 1
|
||||||
return (a[param] < b[param]) || order ? -1 : 1
|
|
||||||
} else if (b.type == 'dir') {
|
if (a.type == 'dir' && b.type != 'dir') return -1
|
||||||
return 1
|
if (b.type == 'dir' && a.type != 'dir') return 1
|
||||||
} else if (a.type == 'dir') {
|
|
||||||
return -1
|
if (b.type == a.type)
|
||||||
}
|
{
|
||||||
if (_.isString(a[param])) {
|
if (a[param] === b[param]) return this.customSort(a, b, false, 'name')
|
||||||
return (_.lowerCase(a[param]) < _.lowerCase(b[param])) || order ? -1 : 1
|
|
||||||
} else {
|
if (_.isString(a[param])) return (a[param].localeCompare(b[param])) * (order ? -1 : 1)
|
||||||
return (a[param] < b[param]) || order ? -1 : 1
|
else return ((a[param] < b[param]) ? -1 : 1) * (order ? -1 : 1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user