mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
up2k: upload-complete notification
This commit is contained in:
parent
df51e23639
commit
1c0017d763
|
@ -125,6 +125,8 @@ var Ls = {
|
|||
|
||||
"cut_az": "upload files in alphabetical order, rather than smallest-file-first$N$Nalphabetical order can make it easier to eyeball if something went wrong on the server, but it makes uploading slightly slower on fiber / LAN",
|
||||
|
||||
"cut_nag": "audible alert when upload completes",
|
||||
|
||||
"cut_mt": "use multithreading to accelerate file hashing$N$Nthis uses web-workers and requires$Nmore RAM (up to 512 MiB extra)$N$N30% faster https, 4.5x faster http,$Nand 5.3x faster on android phones",
|
||||
|
||||
"cft_text": "favicon text (blank and refresh to disable)",
|
||||
|
@ -491,6 +493,8 @@ var Ls = {
|
|||
|
||||
"cut_az": "last opp filer i alfabetisk rekkefølge, istedenfor minste-fil-først$N$Nalfabetisk kan gjøre det lettere å anslå om alt gikk bra, men er bittelitt tregere på fiber / LAN",
|
||||
|
||||
"cut_nag": "lydvarsel når opplastning er ferdig",
|
||||
|
||||
"cut_mt": "raskere befaring ved å bruke hele CPU'en$N$Ndenne funksjonen anvender web-workers$Nog krever mer RAM (opptil 512 MiB ekstra)$N$N30% raskere https, 4.5x raskere http,$Nog 5.3x raskere på android-telefoner",
|
||||
|
||||
"cft_text": "ikontekst (blank ut og last siden på nytt for å deaktivere)",
|
||||
|
@ -917,6 +921,7 @@ ebi('op_cfg').innerHTML = (
|
|||
' <a id="u2tdate" class="tgl btn ttb" href="#" tt="' + L.cut_datechk + '">date-chk</a>\n' +
|
||||
' <a id="flag_en" class="tgl btn" href="#" tt="' + L.cut_flag + '">💤</a>\n' +
|
||||
' <a id="u2sort" class="tgl btn" href="#" tt="' + L.cut_az + '">az</a>\n' +
|
||||
' <a id="upnag" class="tgl btn" href="#" tt="' + L.cut_nag + '">🔔</a>\n' +
|
||||
' </td>\n' +
|
||||
' </div>\n' +
|
||||
'</div>\n' +
|
||||
|
|
|
@ -615,6 +615,9 @@ function Donut(uc, st) {
|
|||
var r = this,
|
||||
el = null,
|
||||
psvg = null,
|
||||
tenstrobe = null,
|
||||
tstrober = null,
|
||||
strobes = [],
|
||||
o = 20 * 2 * Math.PI,
|
||||
optab = QS('#ops a[data-dest="up2k"]');
|
||||
|
||||
|
@ -664,11 +667,15 @@ function Donut(uc, st) {
|
|||
r.base = pos();
|
||||
optab.innerHTML = ya ? svg() : optab.getAttribute('ico');
|
||||
el = QS('#ops a .donut');
|
||||
clearTimeout(tenstrobe);
|
||||
if (!ya) {
|
||||
favico.upd();
|
||||
wintitle();
|
||||
if (document.visibilityState == 'hidden')
|
||||
tenstrobe = setTimeout(enstrobe, 500); //debounce
|
||||
}
|
||||
};
|
||||
|
||||
r.do = function () {
|
||||
if (!el)
|
||||
return;
|
||||
|
@ -701,6 +708,22 @@ function Donut(uc, st) {
|
|||
r.fc = 0;
|
||||
}
|
||||
};
|
||||
|
||||
function enstrobe() {
|
||||
strobes = ['████████████████', '________________', '████████████████'];
|
||||
tstrober = setInterval(strobe, 300);
|
||||
|
||||
// firefox may forget that filedrops are user-gestures so it can skip this:
|
||||
if (uc.upnag && window.Notification && Notification.permission == 'granted')
|
||||
new Notification(uc.nagtxt);
|
||||
}
|
||||
|
||||
function strobe() {
|
||||
var txt = strobes.pop();
|
||||
wintitle(txt);
|
||||
if (!txt)
|
||||
clearInterval(tstrober);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -810,6 +833,7 @@ function up2k_init(subtle) {
|
|||
bcfg_bind(uc, 'datechk', 'u2tdate', turbolvl < 3, null, false);
|
||||
bcfg_bind(uc, 'az', 'u2sort', u2sort.indexOf('n') + 1, set_u2sort, false);
|
||||
bcfg_bind(uc, 'hashw', 'hashw', !!window.WebAssembly && (!subtle || !CHROME || MOBILE), set_hashw, false);
|
||||
bcfg_bind(uc, 'upnag', 'upnag', false, set_upnag, false);
|
||||
|
||||
var st = {
|
||||
"files": [],
|
||||
|
@ -1625,15 +1649,15 @@ function up2k_init(subtle) {
|
|||
console.log('toast', ok, ng);
|
||||
|
||||
if (ok && ng)
|
||||
toast.warn(t, (sr ? L.ur_sm : L.ur_um).format(ok, ng));
|
||||
toast.warn(t, uc.nagtxt = (sr ? L.ur_sm : L.ur_um).format(ok, ng));
|
||||
else if (ok > 1)
|
||||
toast.ok(t, (sr ? L.ur_aso : L.ur_auo).format(ok));
|
||||
toast.ok(t, uc.nagtxt = (sr ? L.ur_aso : L.ur_auo).format(ok));
|
||||
else if (ok)
|
||||
toast.ok(t, sr ? L.ur_1so : L.ur_1uo);
|
||||
toast.ok(t, uc.nagtxt = sr ? L.ur_1so : L.ur_1uo);
|
||||
else if (ng > 1)
|
||||
toast.err(t, (sr ? L.ur_asn : L.ur_aun).format(ng));
|
||||
toast.err(t, uc.nagtxt = (sr ? L.ur_asn : L.ur_aun).format(ng));
|
||||
else if (ng)
|
||||
toast.err(t, sr ? L.ur_1sn : L.ur_1un);
|
||||
toast.err(t, uc.nagtxt = sr ? L.ur_1sn : L.ur_1un);
|
||||
|
||||
timer.rm(etafun);
|
||||
timer.rm(donut.do);
|
||||
|
@ -2614,6 +2638,15 @@ function up2k_init(subtle) {
|
|||
}
|
||||
}
|
||||
|
||||
function set_upnag(en) {
|
||||
if (!window.Notification) {
|
||||
bcfg_set('upnag', false);
|
||||
toast.err(10, "https only");
|
||||
}
|
||||
if (en && Notification.permission == 'default')
|
||||
Notification.requestPermission();
|
||||
}
|
||||
|
||||
ebi('nthread_add').onclick = function (e) {
|
||||
ev(e);
|
||||
bumpthread(1);
|
||||
|
|
Loading…
Reference in a new issue