parent
2b3662e337
commit
6064f44a62
@ -0,0 +1,14 @@ |
|||||||
|
const load = require('./load/load'); |
||||||
|
const sort = require('./load/sort'); |
||||||
|
const lightRefresh = require("./lightrefresh"); |
||||||
|
|
||||||
|
module.exports = () => { |
||||||
|
if (!window.kade.cpath.length || !window.kade.cdir.length) {return;} |
||||||
|
window.kade.chdir = []; |
||||||
|
load(true); |
||||||
|
sort(undefined, true); |
||||||
|
if (JSON.stringify(window.kade.cdir) !== JSON.stringify(window.kade.chdir)) { |
||||||
|
//console.log('Detected directory updates.', JSON.stringify(window.kade.cdir), JSON.stringify(window.kade.chdir));
|
||||||
|
lightRefresh(); |
||||||
|
} |
||||||
|
}; |
@ -0,0 +1,5 @@ |
|||||||
|
const refresh = require('./refresh'); |
||||||
|
|
||||||
|
module.exports = (newPath, customOptions) => { |
||||||
|
return refresh(newPath || window.kade.cpath, customOptions || {animate: false, resetNav: false, scroll: false}); |
||||||
|
}; |
@ -1,26 +1,27 @@ |
|||||||
module.exports = (mode) => { |
module.exports = (mode, check=false) => { |
||||||
mode = mode || window.kade.sort; |
mode = mode || window.kade.sort; |
||||||
|
let ts = check ? window.kade.chdir : window.kade.cdir; |
||||||
switch (mode) { |
switch (mode) { |
||||||
case 'Name': |
case 'Name': |
||||||
window.kade.cdir.sort((a, b) => { |
ts.sort((a, b) => { |
||||||
a = a.name.toLowerCase(); |
a = a.name.toLowerCase(); |
||||||
b = b.name.toLowerCase(); |
b = b.name.toLowerCase(); |
||||||
return a > b ? 1 : a < b ? -1 : 0; |
return a > b ? 1 : a < b ? -1 : 0; |
||||||
}); |
}); |
||||||
break; |
break; |
||||||
case 'Date': |
case 'Date': |
||||||
window.kade.cdir.sort((a, b) => a.lastModified - b.lastModified); |
ts.sort((a, b) => a.lastModified - b.lastModified); |
||||||
break; |
break; |
||||||
case 'Type': |
case 'Type': |
||||||
window.kade.cdir.sort((a, b) => { |
ts.sort((a, b) => { |
||||||
a = a.type.toLowerCase(); |
a = a.type.toLowerCase(); |
||||||
b = b.type.toLowerCase(); |
b = b.type.toLowerCase(); |
||||||
return a > b ? 1 : a < b ? -1 : 0; |
return a > b ? 1 : a < b ? -1 : 0; |
||||||
}); |
}); |
||||||
break; |
break; |
||||||
case 'Size': |
case 'Size': |
||||||
window.kade.cdir.sort((a, b) => a.size - b.size); |
ts.sort((a, b) => a.size - b.size); |
||||||
break; |
break; |
||||||
} |
} |
||||||
if (!window.kade.ascend) {window.kade.cdir.reverse();} |
if (!window.kade.ascend) {ts.reverse();} |
||||||
}; |
}; |
Loading…
Reference in new issue