mirror of
https://github.com/9001/copyparty.git
synced 2026-01-12 07:44:08 -07:00
rcm: add rename, some fixes (#1184)
Signed-off-by: stackxp <170874486+stackxp@users.noreply.github.com>
This commit is contained in:
parent
7357d46f43
commit
25a8b96fd1
|
|
@ -269,6 +269,7 @@ if (1)
|
|||
"cdt_ask": "when scrolling to the bottom,$Ninstead of loading more files,$Nask what to do",
|
||||
"cdt_hsort": "how many sorting rules (<code>,sorthref</code>) to include in media-URLs. Setting this to 0 will also ignore sorting-rules included in media links when clicking them",
|
||||
"cdt_ren": "enable custom right-click menu, you can still access the regular menu by pressing the shift key and right-clicking",
|
||||
"cdt_rdb": "show the regular right-click menu when the custom one is already open and right-clicking again",
|
||||
|
||||
"tt_entree": "show navpane (directory tree sidebar)$NHotkey: B",
|
||||
"tt_detree": "show breadcrumbs$NHotkey: B",
|
||||
|
|
@ -650,7 +651,7 @@ if (1)
|
|||
"rc_ply": "play",
|
||||
"rc_pla": "play as audio",
|
||||
"rc_txt": "open in textfile viewer",
|
||||
"rc_md": "open in text editor",
|
||||
"rc_md": "open in markdown viewer",
|
||||
"rc_dl": "download",
|
||||
"rc_zip": "download as archive",
|
||||
"rc_cpl": "copy link",
|
||||
|
|
@ -658,6 +659,7 @@ if (1)
|
|||
"rc_cut": "cut",
|
||||
"rc_cpy": "copy",
|
||||
"rc_pst": "paste",
|
||||
"rc_rnm": "rename",
|
||||
"rc_nfo": "new folder",
|
||||
"rc_nfi": "new file",
|
||||
"rc_sal": "select all",
|
||||
|
|
@ -990,7 +992,7 @@ ebi('op_cfg').innerHTML = (
|
|||
' </div>\n' +
|
||||
'</div>\n' +
|
||||
'<div><h3>' + L.cl_keytype + '</h3><div><select id="key_notation"></select></div></div>\n' +
|
||||
(!MOBILE ? '<div><h3>' + L.cl_rcm + '</h3><div><a id="ren" class="tgl btn" href="#" tt="' + L.cdt_ren + '">enable</a></div></div>' : '') +
|
||||
(!MOBILE ? '<div><h3>' + L.cl_rcm + '</h3><div><a id="ren" class="tgl btn" href="#" tt="' + L.cdt_ren + '">enable</a><a id="rdb" class="tgl btn" href="#" tt="' + L.cdt_rdb + '">double</a></div></div>' : '') +
|
||||
'<div><h3>' + L.cl_hiddenc + ' ' + (MOBILE ? '<a href="#" id="hcolsh">' + L.cl_hidec + '</a> / ' : '') + '<a href="#" id="hcolsr">' + L.cl_reset + '</a></h3><div id="hcols"></div></div>'
|
||||
);
|
||||
|
||||
|
|
@ -1034,13 +1036,12 @@ ebi('rcm').innerHTML = (
|
|||
'<a href="#" id="rzip">' + L.rc_zip + '</a>'
|
||||
: '') +
|
||||
'<div id="rs2" class="sep"></div>' +
|
||||
(has(perms, "move") ?
|
||||
'<a href="#" id="rdel">' + L.rc_del + '</a>' +
|
||||
'<a href="#" id="rcut">' + L.rc_cut + '</a>'
|
||||
: '') +
|
||||
(have_del ? '<a href="#" id="rdel">' + L.rc_del + '</a>' : '') +
|
||||
(have_mv ? '<a href="#" id="rcut">' + L.rc_cut + '</a>' : '') +
|
||||
'<a href="#" id="rcpy">' + L.rc_cpy + '</a>' +
|
||||
(has(perms, "write") ?
|
||||
'<a href="#" id="rpst">' + L.rc_pst + '</a>' +
|
||||
(have_mv ? '<a href="#" id="rrnm">' + L.rc_rnm + '</a>' : '') +
|
||||
'<div id="rs3" class="sep"></div>' +
|
||||
'<a href="#" id="rnfo">' + L.rc_nfo + '</a>' +
|
||||
'<a href="#" id="rnfi">' + L.rc_nfi + '</a>'
|
||||
|
|
@ -9480,9 +9481,11 @@ var rcm = (function () {
|
|||
return {enabled: false}
|
||||
|
||||
var r = {
|
||||
enabled: true
|
||||
enabled: true,
|
||||
double: false
|
||||
};
|
||||
bcfg_bind(r, 'enabled', 'ren', true);
|
||||
bcfg_bind(r, 'double', 'rdb', false);
|
||||
|
||||
var menu = ebi('rcm');
|
||||
var nsFile = {
|
||||
|
|
@ -9556,7 +9559,7 @@ var rcm = (function () {
|
|||
case 'ply': selFile.type == 'gf' ? thegrid.imshow(selFile.relpath) : play('f-' + selFile.id); break;
|
||||
case 'pla': play('f-' + selFile.id); break;
|
||||
case 'txt': location = '?doc=' + selFile.relpath; break;
|
||||
case 'md': location = selFile.path + '?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 'dl': ebi('seldl').click(); break;
|
||||
case 'zip': ebi('selzip').click(); break;
|
||||
|
|
@ -9567,6 +9570,7 @@ var rcm = (function () {
|
|||
fileman.paste();
|
||||
fileman.clip = [];
|
||||
break;
|
||||
case 'rnm': fileman.rename(); break;
|
||||
case 'nfo': mktemp(true); break;
|
||||
case 'nfi': mktemp(); break;
|
||||
case 'sal':
|
||||
|
|
@ -9593,8 +9597,8 @@ var rcm = (function () {
|
|||
selFile.elem = file;
|
||||
|
||||
selFile.url = file.children[1].firstChild.href;
|
||||
selFile.path = basenames(selFile.url).split('?')[0];
|
||||
selFile.relpath = selFile.path.split('/').slice(-1)[0];
|
||||
selFile.path = basenames(selFile.url).replace(/(&|\?)v/, '');
|
||||
selFile.relpath = selFile.path.split('/').slice(-1)[0].split("?")[0];
|
||||
if (noq_href(file.children[1].firstChild).endsWith("/"))
|
||||
selFile.type = "dir";
|
||||
else {
|
||||
|
|
@ -9604,6 +9608,7 @@ var rcm = (function () {
|
|||
}
|
||||
}
|
||||
}
|
||||
console.log(selFile);
|
||||
msel.selui();
|
||||
|
||||
var has_sel = msel.getsel().length;
|
||||
|
|
@ -9614,7 +9619,7 @@ var rcm = (function () {
|
|||
clmod(ebi('rpla'), 'hide', selFile.type != 'gf');
|
||||
clmod(ebi('rtxt'), 'hide', !selFile.id);
|
||||
clmod(ebi('rs1'), 'hide', !selFile.path);
|
||||
clmod(ebi('rmd'), 'hide', !selFile.id || selFile.path.slice(-3) != '.md');
|
||||
clmod(ebi('rmd'), 'hide', !selFile.id || selFile.relpath.slice(-3) != ".md");
|
||||
clmod(ebi('rcpl'), 'hide', !selFile.path);
|
||||
clmod(ebi('rdl'), 'hide', !has_sel);
|
||||
clmod(ebi('rzip'), 'hide', !has_sel);
|
||||
|
|
@ -9623,7 +9628,9 @@ var rcm = (function () {
|
|||
clmod(ebi('rdel'), 'hide', !has_sel);
|
||||
clmod(ebi('rcpy'), 'hide', !has_sel);
|
||||
clmod(ebi('rpst'), 'hide', !has_clip);
|
||||
clmod(ebi('rs3'), 'hide', !has_sel || !has_clip);
|
||||
clmod(ebi('rrnm'), 'hide', !has_sel);
|
||||
clmod(ebi('rs3'), 'hide', !has_sel);
|
||||
clmod(ebi('rs4'), 'hide', !has_sel && !has(perms, "write"));
|
||||
|
||||
menu.style.left = x + 5 + 'px';
|
||||
menu.style.top = y + 5 + 'px';
|
||||
|
|
@ -9643,10 +9650,14 @@ var rcm = (function () {
|
|||
}
|
||||
|
||||
ebi('wrap').oncontextmenu = function(e) {
|
||||
if (!r.enabled || e.shiftKey || menu.style.display) {
|
||||
r.hide(true);
|
||||
if (!r.enabled || e.shiftKey || (r.double && menu.style.display)) {
|
||||
return true;
|
||||
}
|
||||
if (selFile.elem && !selFile.no_dsel) {
|
||||
clmod(selFile.elem, "sel", false);
|
||||
msel.selui();
|
||||
}
|
||||
ev(e);
|
||||
var gfile = thegrid.en && e.target && e.target.closest('#ggrid > a');
|
||||
show(xscroll() + e.clientX, yscroll() + e.clientY, gfile || e.target, gfile);
|
||||
|
|
|
|||
Loading…
Reference in a new issue