fix: make right-click menu work in search view

This commit is contained in:
hackysphere 2026-01-13 01:43:31 -06:00
parent 8240ef6151
commit 6d70acb433
No known key found for this signature in database

View file

@ -9566,7 +9566,7 @@ var rcm = (function () {
break; break;
case 'ply': selFile.type == 'gf' ? thegrid.imshow(selFile.relpath) : play('f-' + selFile.id); break; case 'ply': selFile.type == 'gf' ? thegrid.imshow(selFile.relpath) : play('f-' + selFile.id); break;
case 'pla': play('f-' + selFile.id); break; case 'pla': play('f-' + selFile.id); break;
case 'txt': location = '?doc=' + selFile.relpath; break; case 'txt': location = selFile.basepath + '?doc=' + selFile.relpath; break;
case 'md': location = selFile.path + (has(selFile.path, '?') ? '&v' : '?v'); break; case 'md': location = selFile.path + (has(selFile.path, '?') ? '&v' : '?v'); break;
case 'cpl': cliptxt(selFile.url, function() {toast.ok(2, L.clipped)}); break; case 'cpl': cliptxt(selFile.url, function() {toast.ok(2, L.clipped)}); break;
case 'dl': ebi('seldl').click(); break; case 'dl': ebi('seldl').click(); break;
@ -9604,18 +9604,25 @@ var rcm = (function () {
clmod(file, "sel", true); clmod(file, "sel", true);
selFile.elem = file; selFile.elem = file;
selFile.url = file.children[1].firstChild.href; var isSearchView = file.children[1].firstChild.tagName === "DIV";
selFile.url = isSearchView ? file.children[1].firstChild.lastChild.href : file.children[1].firstChild.href;
selFile.path = basenames(selFile.url).replace(/(&|\?)v/, ''); selFile.path = basenames(selFile.url).replace(/(&|\?)v/, '');
selFile.basepath = selFile.path.lastIndexOf("/") === 0 ? "/" : selFile.path.slice(0, selFile.path.lastIndexOf("/"));
selFile.relpath = selFile.path.split('/').slice(-1)[0].split("?")[0]; selFile.relpath = selFile.path.split('/').slice(-1)[0].split("?")[0];
if (noq_href(file.children[1].firstChild).endsWith("/")) if (!isSearchView && noq_href(file.children[1].firstChild).endsWith("/"))
selFile.type = "dir"; selFile.type = "dir";
else { else {
var lead = file.firstChild.firstChild; var lead = file.firstChild.firstChild;
if (lead.id === undefined)
selFile.type = "tf";
else {
selFile.id = lead.id.split('-')[1]; selFile.id = lead.id.split('-')[1];
selFile.type = lead.innerHTML[0] == '(' ? 'gf' : lead.id.split('-')[0]; selFile.type = lead.innerHTML[0] == '(' ? 'gf' : lead.id.split('-')[0];
} }
} }
} }
}
console.log(selFile); console.log(selFile);
msel.selui(); msel.selui();