This commit is contained in:
ahaenggli
2020-10-28 09:23:16 +01:00
committed by GitHub
parent ccd935d001
commit 0b79931711

View File

@@ -536,21 +536,19 @@ 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)
} }
}, },
} }
} }