nojs fixes + remember opmode

This commit is contained in:
ed 2020-04-19 01:37:03 +00:00
parent eec3efd683
commit 5cf49928b6
5 changed files with 33 additions and 17 deletions

View file

@ -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;

View file

@ -13,16 +13,16 @@
</head>
<body>
{%- if can_upload %}
{%- include 'upload.html' %}
{%- endif %}
<h1 id="path">
{%- for n in vpnodes %}
<a href="/{{ n[0] }}">{{ n[1] }}</a>
{%- endfor %}
</h1>
{%- if can_upload %}
{%- include 'upload.html' %}
{%- endif %}
{%- if can_read %}
{%- if prologue %}
<div id="pro" class="logue">{{ prologue }}</div>

View file

@ -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;

View file

@ -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;

View file

@ -1,9 +1,10 @@
<div id="ops"><a
href="#" data-dest="">---</a><i></i><a
href="#" data-dest="up2k">up2k</a><i></i><a
href="#" data-dest="bup">bup</a><i></i><a
href="#" data-dest="mkdir">mkdir</a></div>
<div id="op_bup" class="opview">
<div id="op_bup" class="opview act">
<div id="u2err"></div>
<form method="post" enctype="multipart/form-data" accept-charset="utf-8" action="/{{ vdir }}">
<input type="hidden" name="act" value="bput" />
@ -12,7 +13,7 @@
</form>
</div>
<div id="op_mkdir" class="opview">
<div id="op_mkdir" class="opview act">
<form method="post" enctype="multipart/form-data" accept-charset="utf-8" action="/{{ vdir }}">
<input type="hidden" name="act" value="mkdir" />
<input type="text" name="name" size="30">