diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 4fc97813..2c5df4f4 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -159,6 +159,9 @@ var Ls = { "uct_q": "idle, pending", "utl_name": "filename", + "utl_ulist": "list", + "utl_ucopy": "copy", + "utl_links": "links", "utl_stat": "status", "utl_prog": "progress", @@ -573,8 +576,8 @@ var Ls = { "wt_selinv": "inverter utvalg", "wt_selzip": "last ned de valgte filene som et arkiv", "wt_seldl": "last ned de valgte filene$NSnarvei: Y", - "wt_npirc": "kopier sang-info (irc-formattert)", - "wt_nptxt": "kopier sang-info", + "wt_npirc": "kopiér sang-info (irc-formattert)", + "wt_nptxt": "kopiér sang-info", "wt_grid": "bytt mellom ikoner og listevisning$NSnarvei: G", "wt_prev": "forrige sang$NSnarvei: J", "wt_play": "play / pause$NSnarvei: P", @@ -606,6 +609,9 @@ var Ls = { "uct_q": "køen", "utl_name": "filnavn", + "utl_ulist": "vis", + "utl_ucopy": "kopiér", + "utl_links": "lenker", "utl_stat": "status", "utl_prog": "fremdrift", @@ -1016,7 +1022,7 @@ ebi('op_up2k').innerHTML = ( '
\n' + ' \n' + ' \n' + - ' \n' + + ' \n' + ' \n' + ' \n' + ' \n' + @@ -1713,29 +1719,9 @@ var widget = (function () { m += '[' + cv + s2ms(mp.au.currentTime) + ck + '/' + cv + s2ms(mp.au.duration) + ck + ']'; - var o = mknod('input'); - o.style.cssText = 'position:fixed;top:45%;left:48%;padding:1em;z-index:9'; - o.value = m; - document.body.appendChild(o); - - var cln = function () { - o.value = 'copied to clipboard '; - setTimeout(function () { - document.body.removeChild(o); - }, 500); - }; - var fb = function () { - console.log('fb'); - o.focus(); - o.select(); - document.execCommand("copy"); - cln(); - }; - try { - // https only - navigator.clipboard.writeText(m).then(cln, fb); - } - catch (ex) { fb(); } + cliptxt(m, function () { + toast.ok(1, 'copied to clipboard', null, 'top'); + }); }; r.set(sread('au_open') == 1); setTimeout(function () { diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 51c3f029..8109bb1e 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -1421,6 +1421,35 @@ function up2k_init(subtle) { } more_one_file(); + function linklist() { + var ret = [], + base = document.location.origin.replace(/\/$/, ''); + + for (var a = 0; a < st.files.length; a++) { + var t = st.files[a], + url = t.purl + uricom_enc(t.name); + + if (t.fk) + url += '?k=' + t.fk; + + ret.push(base + url); + } + return ret.join('\r\n'); + } + + ebi('luplinks').onclick = function (e) { + ev(e); + modal.alert(linklist()); + }; + + ebi('cuplinks').onclick = function (e) { + ev(e); + var txt = linklist(); + cliptxt(txt + '\n', function () { + toast.inf(5, txt.split('\n').length + ' links copied to clipboard'); + }); + }; + var etaref = 0, etaskip = 0, utw_minh = 0, utw_read = 0; function etafun() { var nhash = st.busy.head.length + st.busy.hash.length + st.todo.head.length + st.todo.hash.length, diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 2f525c5a..cc7e6500 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -978,6 +978,7 @@ function sethash(hv) { } } + function dl_file(url) { console.log('DL [%s]', url); var o = mknod('a'); @@ -987,6 +988,25 @@ function dl_file(url) { } +function cliptxt(txt, ok) { + var fb = function () { + console.log('fb'); + var o = mknod('input'); + o.value = txt; + document.body.appendChild(o); + o.focus(); + o.select(); + document.execCommand("copy"); + document.body.removeChild(o); + ok(); + }; + try { + navigator.clipboard.writeText(txt).then(ok, fb); + } + catch (ex) { fb(); } +} + + var timer = (function () { var r = {}; r.q = [];
' + L.utl_name + '' + L.utl_name + '  (' + L.utl_ulist + '/' + L.utl_ucopy + '' + L.utl_links + ')' + L.utl_stat + '' + L.utl_prog + '