support old browsers

This commit is contained in:
ed 2019-07-16 21:44:02 +00:00
parent e679d1f5f8
commit f11550538f
2 changed files with 12 additions and 6 deletions

View file

@ -71,6 +71,12 @@ function dbg(msg) {
o('path').innerHTML = msg; o('path').innerHTML = msg;
} }
function ev(e) {
e = e || window.event;
e.preventDefault ? e.preventDefault() : (e.returnValue = false);
return e;
}
// extract songs + add play column // extract songs + add play column
var mp = (function () { var mp = (function () {
@ -152,7 +158,7 @@ var widget = (function () {
}; };
ret.toggle = function (e) { ret.toggle = function (e) {
ret.open() || ret.close(); ret.open() || ret.close();
e.preventDefault(); ev(e);
return false; return false;
}; };
ret.paused = function (paused) { ret.paused = function (paused) {
@ -346,7 +352,7 @@ var vbar = (function () {
play(0); play(0);
}; };
o('bplay').onclick = function (e) { o('bplay').onclick = function (e) {
e.preventDefault(); ev(e);
if (mp.au) { if (mp.au) {
if (mp.au.paused) if (mp.au.paused)
mp.au.play(); mp.au.play();
@ -357,11 +363,11 @@ var vbar = (function () {
play(0); play(0);
}; };
o('bprev').onclick = function (e) { o('bprev').onclick = function (e) {
e.preventDefault(); ev(e);
bskip(-1); bskip(-1);
}; };
o('bnext').onclick = function (e) { o('bnext').onclick = function (e) {
e.preventDefault(); ev(e);
bskip(1); bskip(1);
}; };
o('barpos').onclick = function (e) { o('barpos').onclick = function (e) {
@ -432,7 +438,7 @@ var vbar = (function () {
// event from play button next to a file in the list // event from play button next to a file in the list
function ev_play(e) { function ev_play(e) {
e.preventDefault(); ev(e);
play(parseInt(this.getAttribute('id').substr(3))); play(parseInt(this.getAttribute('id').substr(3)));
return false; return false;
} }

View file

@ -293,7 +293,7 @@ function up2k_init(have_crypto) {
} }
if (bad_files.length > 0) { if (bad_files.length > 0) {
var msg = 'These files were skipped because they are empty:\n'; var msg = 'These {0} files (of {1} total) were skipped because they are empty:\n'.format(bad_files.length, files.length);
for (var a = 0; a < bad_files.length; a++) for (var a = 0; a < bad_files.length; a++)
msg += '-- ' + bad_files[a][1] + '\n'; msg += '-- ' + bad_files[a][1] + '\n';