From f11550538f3bf2cc5bc65a795eb6be977809920a Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 16 Jul 2019 21:44:02 +0000 Subject: [PATCH] support old browsers --- copyparty/web/browser.js | 16 +++++++++++----- copyparty/web/up2k.js | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 97c4202f..2375998a 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -71,6 +71,12 @@ function dbg(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 var mp = (function () { @@ -152,7 +158,7 @@ var widget = (function () { }; ret.toggle = function (e) { ret.open() || ret.close(); - e.preventDefault(); + ev(e); return false; }; ret.paused = function (paused) { @@ -346,7 +352,7 @@ var vbar = (function () { play(0); }; o('bplay').onclick = function (e) { - e.preventDefault(); + ev(e); if (mp.au) { if (mp.au.paused) mp.au.play(); @@ -357,11 +363,11 @@ var vbar = (function () { play(0); }; o('bprev').onclick = function (e) { - e.preventDefault(); + ev(e); bskip(-1); }; o('bnext').onclick = function (e) { - e.preventDefault(); + ev(e); bskip(1); }; o('barpos').onclick = function (e) { @@ -432,7 +438,7 @@ var vbar = (function () { // event from play button next to a file in the list function ev_play(e) { - e.preventDefault(); + ev(e); play(parseInt(this.getAttribute('id').substr(3))); return false; } diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 626def8d..87de6c9b 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -293,7 +293,7 @@ function up2k_init(have_crypto) { } 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++) msg += '-- ' + bad_files[a][1] + '\n';