From 5cf49928b6071ed8c532957140cf4408f405439c Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 19 Apr 2020 01:37:03 +0000 Subject: [PATCH] nojs fixes + remember opmode --- copyparty/web/browser.css | 4 ++-- copyparty/web/browser.html | 8 ++++---- copyparty/web/up2k.js | 28 ++++++++++++++++++++++------ copyparty/web/upload.css | 5 ++--- copyparty/web/upload.html | 5 +++-- 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 007a5d2f..67cb207b 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -36,12 +36,12 @@ body { padding: .35em .5em .2em .5em; border-radius: 0 .3em .3em 0; box-shadow: .1em .1em .4em #222; - margin: 2em 0 1em 0; + margin: 1.3em 0 0 0; font-size: 1.4em; } #files { border-collapse: collapse; - margin-top: 1em; + margin-top: 2em; } #files tbody a { display: block; diff --git a/copyparty/web/browser.html b/copyparty/web/browser.html index eaf4f6b4..117a6799 100644 --- a/copyparty/web/browser.html +++ b/copyparty/web/browser.html @@ -13,16 +13,16 @@ + {%- if can_upload %} + {%- include 'upload.html' %} + {%- endif %} +

{%- for n in vpnodes %} {{ n[1] }} {%- endfor %}

- {%- if can_upload %} - {%- include 'upload.html' %} - {%- endif %} - {%- if can_read %} {%- if prologue %}
{{ prologue }}
diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index ebe6a12c..86c37ee7 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -67,7 +67,13 @@ function o(id) { function opclick(ev) { ev.preventDefault(); - goto(this.getAttribute('data-dest')); + var dest = this.getAttribute('data-dest'); + goto(dest); + + try { + localStorage.opmode = dest; + } + catch { } } @@ -80,12 +86,14 @@ function goto(dest) { for (var a = obj.length - 1; a >= 0; a--) obj[a].setAttribute('class', ''); - document.querySelector('#ops>a[data-dest=' + dest + ']').setAttribute('class', 'act'); - document.getElementById('op_' + dest).setAttribute('class', 'opview act'); + if (dest) { + document.querySelector('#ops>a[data-dest=' + dest + ']').setAttribute('class', 'act'); + document.getElementById('op_' + dest).setAttribute('class', 'opview act'); - var fn = window['goto_' + dest]; - if (fn) - fn(); + var fn = window['goto_' + dest]; + if (fn) + fn(); + } } @@ -97,6 +105,14 @@ function goto_up2k() { } +goto(); +try { + var op = localStorage.opmode; + goto(op); +} +catch { } + + // chrome requires https to use crypto.subtle, // usually it's undefined but some chromes throw on invoke var up2k = null; diff --git a/copyparty/web/upload.css b/copyparty/web/upload.css index 202782ac..db9c57fb 100644 --- a/copyparty/web/upload.css +++ b/copyparty/web/upload.css @@ -61,9 +61,8 @@ box-shadow: 0 0 1em #222 inset; } #ops { - display: inline-block; background: #333; - margin: 1em 1.5em; + margin: 1.7em 1.5em 0 1.5em; padding: .3em .6em; border-radius: .3em; border-width: .15em 0; @@ -71,7 +70,7 @@ #op_bup, #op_mkdir { background: #2d2d2d; - margin: 1em 0 2em 0; + margin: 1.5em 0 0 0; padding: .5em; border-radius: 0 1em 1em 0; border-width: .15em .3em .3em 0; diff --git a/copyparty/web/upload.html b/copyparty/web/upload.html index 5abaca42..64110ff8 100644 --- a/copyparty/web/upload.html +++ b/copyparty/web/upload.html @@ -1,9 +1,10 @@
---up2kbupmkdir
-
+
@@ -12,7 +13,7 @@
-
+