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; padding: .35em .5em .2em .5em;
border-radius: 0 .3em .3em 0; border-radius: 0 .3em .3em 0;
box-shadow: .1em .1em .4em #222; box-shadow: .1em .1em .4em #222;
margin: 2em 0 1em 0; margin: 1.3em 0 0 0;
font-size: 1.4em; font-size: 1.4em;
} }
#files { #files {
border-collapse: collapse; border-collapse: collapse;
margin-top: 1em; margin-top: 2em;
} }
#files tbody a { #files tbody a {
display: block; display: block;

View file

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

View file

@ -67,7 +67,13 @@ function o(id) {
function opclick(ev) { function opclick(ev) {
ev.preventDefault(); ev.preventDefault();
goto(this.getAttribute('data-dest')); var dest = this.getAttribute('data-dest');
goto(dest);
try {
localStorage.opmode = dest;
}
catch { }
} }
@ -80,6 +86,7 @@ function goto(dest) {
for (var a = obj.length - 1; a >= 0; a--) for (var a = obj.length - 1; a >= 0; a--)
obj[a].setAttribute('class', ''); obj[a].setAttribute('class', '');
if (dest) {
document.querySelector('#ops>a[data-dest=' + dest + ']').setAttribute('class', 'act'); document.querySelector('#ops>a[data-dest=' + dest + ']').setAttribute('class', 'act');
document.getElementById('op_' + dest).setAttribute('class', 'opview act'); document.getElementById('op_' + dest).setAttribute('class', 'opview act');
@ -87,6 +94,7 @@ function goto(dest) {
if (fn) if (fn)
fn(); fn();
} }
}
function goto_up2k() { function goto_up2k() {
@ -97,6 +105,14 @@ function goto_up2k() {
} }
goto();
try {
var op = localStorage.opmode;
goto(op);
}
catch { }
// chrome requires https to use crypto.subtle, // chrome requires https to use crypto.subtle,
// usually it's undefined but some chromes throw on invoke // usually it's undefined but some chromes throw on invoke
var up2k = null; var up2k = null;

View file

@ -61,9 +61,8 @@
box-shadow: 0 0 1em #222 inset; box-shadow: 0 0 1em #222 inset;
} }
#ops { #ops {
display: inline-block;
background: #333; background: #333;
margin: 1em 1.5em; margin: 1.7em 1.5em 0 1.5em;
padding: .3em .6em; padding: .3em .6em;
border-radius: .3em; border-radius: .3em;
border-width: .15em 0; border-width: .15em 0;
@ -71,7 +70,7 @@
#op_bup, #op_bup,
#op_mkdir { #op_mkdir {
background: #2d2d2d; background: #2d2d2d;
margin: 1em 0 2em 0; margin: 1.5em 0 0 0;
padding: .5em; padding: .5em;
border-radius: 0 1em 1em 0; border-radius: 0 1em 1em 0;
border-width: .15em .3em .3em 0; border-width: .15em .3em .3em 0;

View file

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