misc cleanup/unjank

This commit is contained in:
ed 2021-11-12 20:48:26 +01:00
parent 50e18ed8ff
commit deb8f20db6
3 changed files with 44 additions and 34 deletions

View file

@ -559,6 +559,11 @@ input[type="radio"]:checked+label,
input[type="checkbox"]:checked+label { input[type="checkbox"]:checked+label {
color: #fc5; color: #fc5;
} }
.opwide div>span>input+label {
padding: .3em 0 .3em .3em;
margin: 0 0 0 -.3em;
cursor: pointer;
}
.opview input.i { .opview input.i {
width: calc(100% - 16.2em); width: calc(100% - 16.2em);
} }

View file

@ -11,9 +11,9 @@ function dbg(msg) {
ebi('ops').innerHTML = ( ebi('ops').innerHTML = (
'<a href="#" data-dest="" tt="close submenu">--</a>\n' + '<a href="#" data-dest="" tt="close submenu">--</a>\n' +
(have_up2k_idx ? ( (have_up2k_idx ? (
'<a href="#" data-perm="read" data-dest="search" tt="search for files by attributes, path/name, music tags, or any combination of those.$N$N&lt;code&gt;foo bar&lt;/code&gt; = must contain both foo and bar,$N&lt;code&gt;foo -bar&lt;/code&gt; = must contain foo but not bar,$N&lt;code&gt;^yana .opus$&lt;/code&gt; = must start with yana and have the opus extension">🔎</a>\n' + '<a href="#" data-perm="read" data-dest="search" tt="search for files by attributes, path/name, music tags, or any combination of those$N$N&lt;code&gt;foo bar&lt;/code&gt; = must contain both foo and bar,$N&lt;code&gt;foo -bar&lt;/code&gt; = must contain foo but not bar,$N&lt;code&gt;^yana .opus$&lt;/code&gt; = must start with yana and have the opus extension">🔎</a>\n' +
(have_del && have_unpost ? '<a href="#" data-dest="unpost" tt="unpost: delete your recent uploads">🧯</a>\n' : '') + (have_del && have_unpost ? '<a href="#" data-dest="unpost" tt="unpost: delete your recent uploads">🧯</a>\n' : '') +
'<a href="#" data-dest="up2k" tt="up2k: upload files (if you have write-access) or toggle into the search-mode and drag files onto the search button to see if they exist somewhere on the server">🚀</a>\n' '<a href="#" data-dest="up2k" tt="up2k: upload files (if you have write-access) or toggle into the search-mode to see if they exist somewhere on the server">🚀</a>\n'
) : ( ) : (
'<a href="#" data-perm="write" data-dest="up2k" tt="up2k: upload files with resume support (close your browser and drop the same files in later)">🚀</a>\n' '<a href="#" data-perm="write" data-dest="up2k" tt="up2k: upload files with resume support (close your browser and drop the same files in later)">🚀</a>\n'
)) + )) +
@ -245,8 +245,7 @@ function goto(dest) {
clmod(obj[a], 'act'); clmod(obj[a], 'act');
if (dest) { if (dest) {
var ui = ebi('op_' + dest), var lnk = QS('#ops>a[data-dest=' + dest + ']'),
lnk = QS('#ops>a[data-dest=' + dest + ']'),
nps = lnk.getAttribute('data-perm'); nps = lnk.getAttribute('data-perm');
nps = nps && nps.length ? nps.split(' ') : []; nps = nps && nps.length ? nps.split(' ') : [];
@ -259,8 +258,8 @@ function goto(dest) {
if (!has(perms, 'read') && !has(perms, 'write') && (dest == 'up2k')) if (!has(perms, 'read') && !has(perms, 'write') && (dest == 'up2k'))
return; return;
clmod(ui, 'act', true); clmod(ebi('op_' + dest), 'act', 1);
lnk.className += " act"; clmod(lnk, 'act', 1);
var fn = window['goto_' + dest]; var fn = window['goto_' + dest];
if (fn) if (fn)
@ -334,7 +333,7 @@ var mpl = (function () {
) : '') + ) : '') +
'<div><h3>tint</h3><div>' + '<div><h3>tint</h3><div>' +
'<input type="text" id="pb_tint" size="3" value="0" tt="background level (0-100) on the seekbar$Nto make buffering less distracting" />' + '<input type="text" id="pb_tint" style="width:2.4em" value="0" tt="background level (0-100) on the seekbar$Nto make buffering less distracting" />' +
'</div></div>' + '</div></div>' +
'<div><h3>audio equalizer</h3><div id="audio_eq"></div></div>'); '<div><h3>audio equalizer</h3><div id="audio_eq"></div></div>');
@ -1147,11 +1146,6 @@ function ev_play(e) {
} }
function setclass(id, clas) {
ebi(id).setAttribute('class', clas);
}
var need_ogv = true; var need_ogv = true;
try { try {
need_ogv = new Audio().canPlayType('audio/ogg; codecs=opus') !== 'probably'; need_ogv = new Audio().canPlayType('audio/ogg; codecs=opus') !== 'probably';
@ -1261,12 +1255,15 @@ var audio_eq = (function () {
if (!Ctx) if (!Ctx)
bcfg_set('au_eq', false); bcfg_set('au_eq', false);
if (!Ctx || !mp.au || mp.au === mp.au_ogvjs) if (!Ctx || !mp.au)
return; return;
if (!r.en && !mp.ac) if (!r.en && !mp.ac)
return; return;
if (mp.au === mp.au_ogvjs)
return toast.warn(10, "apple devices can't equalize ogg/opus audio");
if (mp.ac) { if (mp.ac) {
for (var a = 0; a < r.filters.length; a++) for (var a = 0; a < r.filters.length; a++)
r.filters[a].disconnect(); r.filters[a].disconnect();
@ -1477,7 +1474,7 @@ function play(tid, is_ev, seek, call_depth) {
if (mp.au) { if (mp.au) {
mp.au.pause(); mp.au.pause();
setclass('a' + mp.au.tid, 'play'); clmod(ebi('a' + mp.au.tid), 'act');
} }
// ogv.js breaks on .play() unless directly user-triggered // ogv.js breaks on .play() unless directly user-triggered
@ -1556,13 +1553,13 @@ function play(tid, is_ev, seek, call_depth) {
mp.au.tid = tid; mp.au.tid = tid;
mp.au.volume = mp.expvol(mp.vol); mp.au.volume = mp.expvol(mp.vol);
var oid = 'a' + tid; var trs = QSA('#files tr.play');
setclass(oid, 'play act'); for (var a = 0, aa = trs.length; a < aa; a++)
var trs = ebi('files').getElementsByTagName('tbody')[0].getElementsByTagName('tr');
for (var a = 0, aa = trs.length; a < aa; a++) {
clmod(trs[a], 'play'); clmod(trs[a], 'play');
}
ebi(oid).parentElement.parentElement.className += ' play'; var oid = 'a' + tid;
clmod(ebi(oid), 'act', 1);
clmod(ebi(oid).closest('tr'), 'play', 1);
clmod(ebi('wtoggle'), 'np', mpl.clip); clmod(ebi('wtoggle'), 'np', mpl.clip);
if (window.thegrid) if (window.thegrid)
thegrid.loadsel(); thegrid.loadsel();
@ -1592,7 +1589,7 @@ function play(tid, is_ev, seek, call_depth) {
catch (ex) { catch (ex) {
toast.err(0, esc('playback failed: ' + basenames(ex))); toast.err(0, esc('playback failed: ' + basenames(ex)));
} }
setclass(oid, 'play'); clmod(ebi(oid), 'act');
setTimeout(next_song, 500); setTimeout(next_song, 500);
} }
@ -1648,7 +1645,11 @@ function autoplay_blocked(seek) {
play(tid, true, seek); play(tid, true, seek);
mp.fade_in(); mp.fade_in();
}, null); }, function () {
sethash('');
clmod(QS('#files tr.play'), 'play');
return reload_mp();
});
} }
@ -3047,16 +3048,19 @@ document.onkeydown = function (e) {
if (QS('#bbox-overlay.visible') || modal.busy) if (QS('#bbox-overlay.visible') || modal.busy)
return; return;
var k = e.code + '', var k = e.code + '', pos = -1, n,
pos = -1,
n,
ae = document.activeElement, ae = document.activeElement,
aet = ae && ae != document.body ? ae.nodeName.toLowerCase() : ''; aet = ae && ae != document.body ? ae.nodeName.toLowerCase() : '';
if (k == 'Escape') { if (k == 'Escape') {
ae && ae.blur();
if (QS('.opview.act')) if (QS('.opview.act'))
return QS('#ops>a').click(); return QS('#ops>a').click();
if (QS('#unsearch'))
return QS('#unsearch').click();
if (widget.is_open) if (widget.is_open)
return widget.close(); return widget.close();
@ -3202,28 +3206,28 @@ document.onkeydown = function (e) {
(function () { (function () {
var sconf = [ var sconf = [
["size", ["size",
["szl", "sz_min", "minimum MiB", "16"], ["szl", "sz_min", "minimum MiB", "14"],
["szu", "sz_max", "maximum MiB", "16"] ["szu", "sz_max", "maximum MiB", "14"]
], ],
["date", ["date",
["dtl", "dt_min", "min. iso8601", "16"], ["dtl", "dt_min", "min. iso8601", "14"],
["dtu", "dt_max", "max. iso8601", "16"] ["dtu", "dt_max", "max. iso8601", "14"]
], ],
["path", ["path",
["path", "path", "path contains &nbsp; (space-separated)", "34"] ["path", "path", "path contains &nbsp; (space-separated)", "30"]
], ],
["name", ["name",
["name", "name", "name contains &nbsp; (negate with -nope)", "34"] ["name", "name", "name contains &nbsp; (negate with -nope)", "30"]
] ]
]; ];
var oldcfg = []; var oldcfg = [];
if (QS('#srch_form.tags')) { if (QS('#srch_form.tags')) {
sconf.push(["tags", sconf.push(["tags",
["tags", "tags", "tags contains &nbsp; (^=start, end=$)", "34"] ["tags", "tags", "tags contains &nbsp; (^=start, end=$)", "30"]
]); ]);
sconf.push(["adv.", sconf.push(["adv.",
["adv", "adv", "key>=1A&nbsp; key<=2B&nbsp; .bpm>165", "34"] ["adv", "adv", "key>=1A&nbsp; key<=2B&nbsp; .bpm>165", "30"]
]); ]);
} }

View file

@ -133,7 +133,8 @@ html {
} }
#modalc code, #modalc code,
#tt code { #tt code {
background: #3c3c3c; color: #eee;
background: #444;
padding: .1em .3em; padding: .1em .3em;
border-top: 1px solid #777; border-top: 1px solid #777;
border-radius: .3em; border-radius: .3em;