Update JS

This commit is contained in:
bohwaz 2022-11-14 23:12:42 +01:00
parent 8a604fb915
commit 70e2abc3c4

View file

@ -1766,10 +1766,10 @@ namespace {
if ($relative_uri == 'webdav.js') { if ($relative_uri == 'webdav.js') {
fseek($fp, 49434, SEEK_SET); fseek($fp, 49434, SEEK_SET);
echo fread($fp, 24077); echo fread($fp, 24229);
} }
else { else {
fseek($fp, 49434 + 24077, SEEK_SET); fseek($fp, 49434 + 24229, SEEK_SET);
echo fread($fp, 6728); echo fread($fp, 6728);
} }
@ -2160,8 +2160,9 @@ const WebDAVNavigator = (url, options) => {
} }
var is_dir = node.querySelector('resourcetype collection') ? true : false; var is_dir = node.querySelector('resourcetype collection') ? true : false;
var index = sort_order == 'name' && is_dir ? 0 : 1;
items[is_dir ? 0 : 1].push({ items[index].push({
'uri': item_uri, 'uri': item_uri,
'name': name, 'name': name,
'size': !is_dir && (prop = node.querySelector('getcontentlength')) ? parseInt(prop.textContent, 10) : null, 'size': !is_dir && (prop = node.querySelector('getcontentlength')) ? parseInt(prop.textContent, 10) : null,
@ -2171,7 +2172,10 @@ const WebDAVNavigator = (url, options) => {
}); });
}); });
if (sort_order == 'name') {
items[0].sort((a, b) => a.name.localeCompare(b.name)); items[0].sort((a, b) => a.name.localeCompare(b.name));
}
items[1].sort((a, b) => { items[1].sort((a, b) => {
if (sort_order == 'date') { if (sort_order == 'date') {
return b.modified - a.modified; return b.modified - a.modified;
@ -2184,8 +2188,13 @@ const WebDAVNavigator = (url, options) => {
} }
}); });
if (sort_order == 'name') {
// Sort with directories first // Sort with directories first
items = items[0].concat(items[1]); items = items[0].concat(items[1]);
}
else {
items = items[1];
}
var table = ''; var table = '';
var parent = uri.replace(/\/+$/, '').split('/').slice(0, -1).join('/') + '/'; var parent = uri.replace(/\/+$/, '').split('/').slice(0, -1).join('/') + '/';