You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
872 B
26 lines
872 B
module.exports = (mode) => {
|
|
mode = mode || window.kade.sort;
|
|
switch (mode) {
|
|
case 'Name':
|
|
window.kade.cdir.sort((a, b) => {
|
|
a = a.name.toLowerCase();
|
|
b = b.name.toLowerCase();
|
|
return a > b ? 1 : a < b ? -1 : 0;
|
|
});
|
|
break;
|
|
case 'Date':
|
|
window.kade.cdir.sort((a, b) => a.lastModified - b.lastModified);
|
|
break;
|
|
case 'Type':
|
|
window.kade.cdir.sort((a, b) => {
|
|
a = a.type.toLowerCase();
|
|
b = b.type.toLowerCase();
|
|
return a > b ? 1 : a < b ? -1 : 0;
|
|
});
|
|
break;
|
|
case 'Size':
|
|
window.kade.cdir.sort((a, b) => a.size - b.size);
|
|
break;
|
|
}
|
|
if (!window.kade.ascend) {window.kade.cdir.reverse();}
|
|
}; |