This commit is contained in:
ed 2019-06-18 21:55:14 +00:00
parent a25a6946a7
commit c4e190f8bb
5 changed files with 39 additions and 9 deletions

View file

@ -426,9 +426,16 @@ class HttpCli(object):
else: else:
files.append(item) files.append(item)
ts = ""
# ts = "?{}".format(time.time())
dirs.extend(files) dirs.extend(files)
html = self.conn.tpl_browser.render( html = self.conn.tpl_browser.render(
vdir=self.vpath, vpnodes=vpnodes, files=dirs, can_upload=self.writable vdir=self.vpath,
vpnodes=vpnodes,
files=dirs,
can_upload=self.writable,
ts=ts,
) )
self.reply(html.encode("utf-8", "replace")) self.reply(html.encode("utf-8", "replace"))
return True return True

View file

@ -11,6 +11,7 @@ html {
background: #333; background: #333;
font-family: sans-serif; font-family: sans-serif;
text-shadow: 1px 1px 0px #000; text-shadow: 1px 1px 0px #000;
line-height: 1.3em;
} }
html, body { html, body {
margin: 0; margin: 0;
@ -19,6 +20,11 @@ html, body {
body { body {
padding-bottom: 5em; padding-bottom: 5em;
} }
#path,
#path * {
font-size: 1em;
line-height: 1em;
}
#path { #path {
color: #aca; color: #aca;
text-shadow: 1px 1px 0 #000; text-shadow: 1px 1px 0 #000;
@ -26,7 +32,7 @@ body {
font-weight: normal; font-weight: normal;
background: #4c4c4c; background: #4c4c4c;
display: inline-block; display: inline-block;
padding: .2em .5em .2em 1em; padding: .35em .5em .2em 1em;
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: 1em 0; margin: 1em 0;
@ -191,7 +197,7 @@ a.play.act {
} }
#wtoggle { #wtoggle {
position: absolute; position: absolute;
top: -1em; top: -1.2em;
right: 0; right: 0;
width: 1.2em; width: 1.2em;
height: 1em; height: 1em;
@ -202,7 +208,7 @@ a.play.act {
background: #3c3c3c; background: #3c3c3c;
box-shadow: 0 0 .5em #222; box-shadow: 0 0 .5em #222;
border-radius: .3em 0 0 0; border-radius: .3em 0 0 0;
padding-left: .07em; padding: .2em 0 0 .07em;
color: #fff; color: #fff;
} }
#barpos, #barpos,

View file

@ -48,7 +48,7 @@
<h2><a href="?h">control-panel</a></h2> <h2><a href="?h">control-panel</a></h2>
<div id="widget"> <div id="widget">
<div id="wtoggle">=</div> <div id="wtoggle"></div>
<div id="widgeti"> <div id="widgeti">
<div id="pctl"><a href="#" id="bprev"></a><a href="#" id="bplay"></a><a href="#" id="bnext"></a></div> <div id="pctl"><a href="#" id="bprev"></a><a href="#" id="bplay"></a><a href="#" id="bnext"></a></div>
<canvas id="pvol" width="288" height="38"></canvas> <canvas id="pvol" width="288" height="38"></canvas>
@ -56,7 +56,7 @@
<canvas id="barbuf"></canvas> <canvas id="barbuf"></canvas>
</div> </div>
</div> </div>
<script src="/.cpr/browser.js"></script> <script src="/.cpr/browser.js{{ ts }}"></script>
</body> </body>
</html> </html>

View file

@ -65,6 +65,10 @@ function ebi(id) {
return document.getElementById(id); return document.getElementById(id);
} }
function dbg(msg) {
ebi('path').innerHTML = msg;
}
// extract songs + add play column // extract songs + add play column
var mp = (function () { var mp = (function () {
@ -359,13 +363,26 @@ var vbar = (function () {
bskip(1); bskip(1);
}; };
ebi('barpos').onclick = function (e) { ebi('barpos').onclick = function (e) {
if (!mp.au) if (!mp.au) {
//dbg((new Date()).getTime());
return play(0); return play(0);
}
var rect = pbar.pcan.getBoundingClientRect(); var rect = pbar.pcan.getBoundingClientRect();
var x = e.clientX - rect.left; var x = e.clientX - rect.left;
var mul = x * 1.0 / rect.width; var mul = x * 1.0 / rect.width;
mp.au.currentTime = mp.au.duration * mul;
/*
dbg(//Math.round(rect.width) + 'x' + Math.round(rect.height) + '+' +
//Math.round(rect.left) + '+' + Math.round(rect.top) + ', ' +
//Math.round(e.clientX) + 'x' + Math.round(e.clientY) + ', ' +
Math.round(mp.au.currentTime * 10) / 10 + ', ' +
Math.round(mp.au.duration * 10) / 10 + '*' +
Math.round(mul * 1000) / 1000);
*/
mp.au.currentTime = Math.round(mp.au.duration * mul);
if (mp.au === mp.au_native) if (mp.au === mp.au_native)
// hack: ogv.js breaks on .play() during playback // hack: ogv.js breaks on .play() during playback
mp.au.play(); mp.au.play();

View file

@ -37,7 +37,7 @@
<script> <script>
setTimeout(function() { setTimeout(function() {
window.location.replace("{{ redir }}"); window.location.replace("{{ redir }}");
}, 500); }, 1000);
</script> </script>
{%- endif %} {%- endif %}
</body> </body>