diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 19167e0e..81cf64f9 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -1536,7 +1536,8 @@ html.y #ops svg circle { } #pathBar input[type=text], .opview select, -.opview input[type=text] { +.opview input[type=text], +.opview input[type=date] { color: var(--fg); background: var(--txt-bg); border: none; diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 740ea764..a8574df3 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -6637,8 +6637,8 @@ var search_ui = (function () { ], [ L.s_dt, - ["dtl", "dt_min", L.s_d1, "14", "1997-08-15, 01:00"], - ["dtu", "dt_max", L.s_d2, "14", "2020"] + ["dtl", "dt_min", L.s_d1, "14", "1997-08-15, 01:00", "date"], + ["dtu", "dt_max", L.s_d2, "14", "2020", "date"] ], [ L.s_ta, @@ -6650,8 +6650,8 @@ var search_ui = (function () { ], [ L.s_ua, - ["utl", "ut_min", L.s_u1, "14", "2007-04-08"], - ["utu", "ut_max", L.s_u2, "14", "2038-01-19"] + ["utl", "ut_min", L.s_u1, "14", "2007-04-08", "date"], + ["utu", "ut_max", L.s_u2, "14", "2038-01-19", "date"] ] ]; @@ -6665,12 +6665,13 @@ var search_ui = (function () { var html = ['
' + sconf[a][0] + '']; for (var b = 1; b < 3; b++) { var hn = "srch_" + sconf[a][b][0], - csp = (sconf[a].length == 2) ? 2 : 1; + csp = (sconf[a].length == 2) ? 2 : 1, + type = sconf[a][b].length >= 6 ? sconf[a][b][5] : "text"; html.push( '\n' + '\n' + - '
'); if (csp == 2) break; @@ -6695,8 +6696,8 @@ var search_ui = (function () { folderSearch.placeholder = '🔎 ' + L.s_dir; folderSearch.onfocus = function(){ ebi('srch_pathc').checked = true; - var path = get_evpath(); - ebi('srch_pathv').value = path.slice(1, -1); + var path = decodeURI(get_evpath()); + ebi('srch_pathv').value = path.slice(1); } folderSearch.oninput = function(){ var v = unsmart(this.value) @@ -6779,8 +6780,21 @@ var search_ui = (function () { vs = unsmart(ebi('srch_' + k + 'v').value), tvs = []; - if (a == 1) - vs = vs.trim().replace(/ +/, 'T'); + if(k == 'path' && vs?.endsWith('/') && !vs?.includes('"')){ + vs = vs.slice(0, -1); + vs = `"${vs}${(recursive ? '*' : '')}"`; + } + + function onlyUnique(value, index, array) { + return array.indexOf(value) === index && value?.length > 0; + } + var immune = vs.match(/(([^\s]*|)"[^"]*"([^\s]*|))/)?.filter(onlyUnique) + for(var i=0; i 0){ + tvs.push(immune[i]); + vs = vs.replace(immune[i], '') + } + } while (vs) { vs = vs.trim(); @@ -6799,7 +6813,8 @@ var search_ui = (function () { } } else { - var vp = vs.split(/ +(.*)/); + // split at spaces + var vp = vs.split(/\s+(.*)/); v = vp[0].replace(/\\"/g, '"'); vs = vp[1] || ''; } @@ -6836,18 +6851,18 @@ var search_ui = (function () { if (tv.slice(0, 1) == '^') { tv = tv.slice(1); } - else if(!(k == 'path' && !recursive)) { + else if (!(tv.includes(' ') || tv.startsWith('"'))){ tv = '*' + tv; } if (tv.slice(-1) == '$') { tv = tv.slice(0, -1); } - else if(!(k == 'path' && !recursive)) { + else if(!(tv.includes(' ') || tv.endsWith('"'))){ tv += '*'; } - if (tv.indexOf(' ') + 1) { + if (tv.includes(' ') && !tv.includes('"')) { tv = '"' + tv + '"'; }