copy link action in wtoggle

This commit is contained in:
Til Schmitter 2026-06-20 00:05:19 +02:00
parent 1bec09cea8
commit 9ef7d4bb86
2 changed files with 39 additions and 16 deletions

View file

@ -1466,10 +1466,10 @@ html:not(.e) #ggrid>a.thumbed.dir:before {
white-space: nowrap; white-space: nowrap;
text-align: center; text-align: center;
max-width: 79vw; max-width: 79vw;
max-width: calc(100% - 3.5em); max-width: calc(100% - 3.4em);
overflow-x: auto; overflow-x: auto;
overflow-y: hidden; overflow-y: hidden;
margin: 0 .1em .1em .2em; margin: 0 .1em .1em .1em;
box-shadow: 0 0 .5em var(--mp-sh); box-shadow: 0 0 .5em var(--mp-sh);
border-radius: 5px; border-radius: 5px;
border-radius: var(--radius); border-radius: var(--radius);
@ -1605,7 +1605,7 @@ html:not(.e):not(.d) #up_quick .btn.on {
#wtoggle a { #wtoggle a {
font-size: .5em; font-size: .5em;
padding: .5em .5em; padding: .5em .5em;
margin: 0em .1em -.3em .1em; margin: 0em .1em -.23em .1em;
display: inline-block; display: inline-block;
} }
#wtoggle #zip1 { #wtoggle #zip1 {
@ -4293,7 +4293,6 @@ html.e #wrap.thin .ghead {
#wtoggle.sel { #wtoggle.sel {
display: block; display: block;
max-width: 100%; max-width: 100%;
margin: 0 .1em .1em .1em;
} }
#wstack.sel #up_quick, #wstack.sel #up_quick,
#wstack.sel #wtico { #wstack.sel #wtico {

View file

@ -978,6 +978,7 @@ ebi('widget').innerHTML = (
'<span id="wfm"><a' + '<span id="wfm"><a' +
' href="#" id="fclr"><span class="x">×</span><span>cancel</span></a><a' + ' href="#" id="fclr"><span class="x">×</span><span>cancel</span></a><a' +
' href="#" id="fshr" tt="' + L.wt_shr + '">📨<span>share</span></a><a' + ' href="#" id="fshr" tt="' + L.wt_shr + '">📨<span>share</span></a><a' +
' href="#" id="fcpl" tt="' + L.rc_cpl + '">🔗<span>link</span></a><a' +
' href="#" id="fren" tt="' + L.wt_ren + '">' + (fun_tgl ? '✏️' : '✎') + '<span>name</span></a><a' + ' href="#" id="fren" tt="' + L.wt_ren + '">' + (fun_tgl ? '✏️' : '✎') + '<span>name</span></a><a' +
' href="#" id="fdel" tt="' + L.wt_del + '">🗑️<span>del.</span></a><a' + ' href="#" id="fdel" tt="' + L.wt_del + '">🗑️<span>del.</span></a><a' +
' href="#" id="fcut" tt="' + L.wt_cut + '">' + (fun_tgl ? '✂️' : '✂') + '<span>cut</span></a><a' + ' href="#" id="fcut" tt="' + L.wt_cut + '">' + (fun_tgl ? '✂️' : '✂') + '<span>cut</span></a><a' +
@ -4599,6 +4600,7 @@ var fileman = (function () {
bcpy = ebi('fcpy'), bcpy = ebi('fcpy'),
bpst = ebi('fpst'), bpst = ebi('fpst'),
bshr = ebi('fshr'), bshr = ebi('fshr'),
bcpl = ebi('fcpl'),
bclr = ebi('fclr'), bclr = ebi('fclr'),
t_paste, t_paste,
r = {}; r = {};
@ -4631,6 +4633,7 @@ var fileman = (function () {
hcut = !(have_mv && has(perms, 'move')) || !nsel, hcut = !(have_mv && has(perms, 'move')) || !nsel,
hpst = !(have_mv && has(perms, 'write')) || !enpst, hpst = !(have_mv && has(perms, 'write')) || !enpst,
hshr = !can_shr || !get_evpath().indexOf(have_shr), hshr = !can_shr || !get_evpath().indexOf(have_shr),
hcpl = !nsel,
enclr = enpst || nsel; enclr = enpst || nsel;
if (!(enren || endel || encut || enpst)) if (!(enren || endel || encut || enpst))
@ -4642,6 +4645,7 @@ var fileman = (function () {
clmod(bcpy, 'en', encpy); clmod(bcpy, 'en', encpy);
clmod(bpst, 'en', enpst); clmod(bpst, 'en', enpst);
clmod(bshr, 'en', 1); clmod(bshr, 'en', 1);
clmod(bcpl, 'en', 1);
clmod(bclr, 'en', 1); clmod(bclr, 'en', 1);
clmod(bren, 'hide', hren); clmod(bren, 'hide', hren);
@ -4650,6 +4654,7 @@ var fileman = (function () {
clmod(bcpy, 'hide', !encpy); clmod(bcpy, 'hide', !encpy);
clmod(bpst, 'hide', !enpst); clmod(bpst, 'hide', !enpst);
clmod(bshr, 'hide', hshr); clmod(bshr, 'hide', hshr);
clmod(bcpl, 'hide', hcpl);
clmod(bclr, 'hide', !enclr); clmod(bclr, 'hide', !enclr);
clmod(ebi('wfm'), 'act', QS('#wfm a.en:not(.hide)')); clmod(ebi('wfm'), 'act', QS('#wfm a.en:not(.hide)'));
@ -4894,6 +4899,35 @@ var fileman = (function () {
setTimeout(sh_pw.focus.bind(sh_pw), 1); setTimeout(sh_pw.focus.bind(sh_pw), 1);
}; };
r.link = function (e) {
var sel = msel.getsel(),
vps = [];
for (var a = 0; a < sel.length; a++)
vps.push(ebi(sel[a].id).href);
if (!sel.length)
return toast.err(3, L.fd_emore);
ev(e);
let shareData = {
title: (sel.length > 1 ? 'Sharing files from ' : 'Sharing a file from ') +
ebi('srv_name').textContent,
url: vps.join('\n'),
};
if(navigator.canShare && (MOBILE || !FIREFOX)){
//desktop firefox CAN technically use this, but it sucks :P
// within 2min of testing on KDE i encountered the share being broken until browser restart
// + FF copying the "file", which can't be pasted depending on get perms, with no fallback,
// so for example pasting in discord didn't work ~Til 2026-06-19
if(navigator.canShare(shareData))
navigator.share(shareData)
}
else
cliptxt(shareData.url, function () { toast.ok(2, L.clipped) });
}
r.rename = function (e) { r.rename = function (e) {
ev(e); ev(e);
var sel = msel.getsel(), var sel = msel.getsel(),
@ -5717,6 +5751,7 @@ var fileman = (function () {
bcpy.onclick = r.cpy; bcpy.onclick = r.cpy;
bpst.onclick = r.paste; bpst.onclick = r.paste;
bshr.onclick = r.share; bshr.onclick = r.share;
bcpl.onclick = r.link;
bclr.onclick = r.clear; bclr.onclick = r.clear;
return r; return r;
@ -10918,18 +10953,7 @@ var rcm = (function () {
case 'pla': play('f-' + selFile.id); break; case 'pla': play('f-' + selFile.id); break;
case 'txt': showfile.show(selFile.name); break; case 'txt': showfile.show(selFile.name); 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': case 'cpl': fileman.link(); break;
if(navigator.canShare){
let shareData = {
title: selFile.name,
url: selFile.url,
};
if(navigator.canShare(shareData))
navigator.share(shareData)
}
else
cliptxt(selFile.url, function () { toast.ok(2, L.clipped) });
break;
case 'dl': ebi('seldl').click(); break; case 'dl': ebi('seldl').click(); break;
case 'zip': ebi('selzip').click(); break; case 'zip': ebi('selzip').click(); break;
case 'del': fileman.delete(); break; case 'del': fileman.delete(); break;