rcm: fixes;

* reload with ?ls
* menu positioning
* close with ESC
This commit is contained in:
ed 2026-01-01 14:33:56 +01:00
parent 82c496092f
commit 05a4472075
2 changed files with 26 additions and 11 deletions

View file

@ -6022,6 +6022,9 @@ var ahotkeys = function (e) {
if (ebi('hkhelp'))
return qsr('#hkhelp');
if (ebi('rcm').style.display)
return rcm.hide();
if (toast.visible)
return toast.hide();
@ -9484,8 +9487,7 @@ var rcm = (function () {
return toast.err(3, "a " + (is_dir ? "folder" : "file") + " with that name already exists.");
if (req.status < 200 || req.status > 399)
return toast.err(3, "couldn't create " + (is_dir ? "folder" : "file") + ": <br><code>" + esc(req.responseText) + '</code>');
location.reload();
treectl.goto();
};
req.send(data);
}
@ -9570,7 +9572,7 @@ var rcm = (function () {
default:
console.warn('Invalid rcm option "' + e.target.id + '"');
}
hide(true);
r.hide(true);
};
}
@ -9621,7 +9623,7 @@ var rcm = (function () {
menu.focus();
}
function hide(force) {
r.hide = function (force) {
if (!menu.style.display || (!force && menu.contains(document.activeElement)))
return;
if (selFile.elem && !selFile.no_dsel)
@ -9633,16 +9635,16 @@ var rcm = (function () {
ebi('wrap').oncontextmenu = function(e) {
if (thegrid.en || !r.enabled || e.shiftKey || menu.style.display) {
hide(true);
r.hide(true);
return true;
}
else {
ev(e);
show(e.clientX, e.clientY, e.target);
show(xscroll() + e.clientX, yscroll() + e.clientY, e.target);
return false;
}
};
menu.onblur = function() {setTimeout(hide)};
menu.onblur = function() {setTimeout(r.hide)};
return r;
})();

View file

@ -594,6 +594,19 @@ function yscroll() {
}
return 0;
}
function xscroll() {
if (document.documentElement.scrollLeft) {
return (window.xscroll = function () {
return document.documentElement.scrollLeft;
})();
}
if (window.pageXOffset) {
return (window.xscroll = function () {
return window.pageXOffset;
})();
}
return 0;
}
function showsort(tab) {