From 6eef44f21217fd71c837cc1f4554e3ada97fd16f Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 24 Oct 2021 02:57:19 +0200 Subject: [PATCH] ie --- README.md | 3 +-- copyparty/web/browser.css | 2 +- copyparty/web/browser.js | 39 ++++++++++++++++++++++++--------------- copyparty/web/up2k.js | 1 - copyparty/web/util.js | 6 ++++-- 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 52f32b72..3b7e37b1 100644 --- a/README.md +++ b/README.md @@ -747,7 +747,7 @@ TLDR: yes | zip selection | - | yep | yep | yep | yep | yep | yep | yep | | file rename | - | yep | yep | yep | yep | yep | yep | yep | | file cut/paste | - | yep | yep | yep | yep | yep | yep | yep | -| navpane | - | `*2` | yep | yep | yep | yep | yep | yep | +| navpane | - | yep | yep | yep | yep | yep | yep | yep | | image viewer | - | yep | yep | yep | yep | yep | yep | yep | | video player | - | yep | yep | yep | yep | yep | yep | yep | | markdown editor | - | - | yep | yep | yep | yep | yep | yep | @@ -759,7 +759,6 @@ TLDR: yes * internet explorer 6 to 8 behave the same * firefox 52 and chrome 49 are the final winxp versions * `*1` yes, but extremely slow (ie10: `1 MiB/s`, ie11: `270 KiB/s`) -* `*2` causes a full-page refresh on each navigation * `*3` using a wasm decoder which consumes a bit more power quick summary of more eccentric web-browsers trying to view a directory index: diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index c985f7ba..d5900178 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -667,7 +667,7 @@ input.eq_gain { border-radius: 0 .3em 0 0; } .np_open #thx_ff { - padding: 2.5em 0; + padding: 4.5em 0; /* widget */ } #tree::-webkit-scrollbar-track, diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index a9b20df9..2327918b 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -286,6 +286,24 @@ var have_webp = sread('have_webp'); })(); +function set_files_html(html) { + var files = ebi('files'); + try { + files.innerHTML = html; + return files; + } + catch (e) { + var par = files.parentNode; + par.removeChild(files); + files = mknod('div'); + files.innerHTML = '' + html + '
'; + par.insertBefore(files.childNodes[0], ebi('epi')); + files = ebi('files'); + return files; + } +} + + var mpl = (function () { var have_mctl = 'mediaSession' in navigator && window.MediaMetadata; @@ -1053,8 +1071,8 @@ var need_ogv = true; try { need_ogv = new Audio().canPlayType('audio/ogg; codecs=opus') !== 'probably'; - if (/ Edge\//.exec(navigator.userAgent + '')) - need_ogv = true; + if (document.documentMode) + need_ogv = false; // ie8-11 } catch (ex) { } @@ -2983,7 +3001,7 @@ document.onkeydown = function (e) { orig_url = get_evpath(); } - ofiles.innerHTML = html.join('\n'); + ofiles = set_files_html(html.join('\n')); ofiles.setAttribute("ts", this.ts); ofiles.setAttribute("q_raw", this.q_raw); set_vq(); @@ -2998,7 +3016,7 @@ document.onkeydown = function (e) { function unsearch(e) { ev(e); treectl.show(); - ebi('files').innerHTML = orig_html; + set_files_html(orig_html); ebi('files').removeAttribute('q_raw'); orig_html = null; sethash(''); @@ -3372,13 +3390,7 @@ var treectl = (function () { } html.push(''); html = html.join('\n'); - try { - ebi('files').innerHTML = html; - } - catch (ex) { //ie9 - window.location.href = this.top; - return; - } + set_files_html(html); if (this.hpush) hist_push(this.top); @@ -3468,10 +3480,7 @@ var treectl = (function () { treectl.goto(url.pathname); }; - if (window.history && history.pushState) { - hist_replace(get_evpath() + window.location.hash); - } - + hist_replace(get_evpath() + window.location.hash); treectl.onscroll = onscroll; return treectl; })(); diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index a48851e3..71b109d0 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -1863,7 +1863,6 @@ function up2k_init(subtle) { var o = QSA('#u2conf .c *[tt]'); for (var a = o.length - 1; a >= 0; a--) { - console.log(o[a]); o[a].parentNode.getElementsByTagName('input')[0].setAttribute('tt', o[a].getAttribute('tt')); } tt.att(QS('#u2conf')); diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 3996958d..54878cfd 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -715,12 +715,14 @@ function scfg_bind(obj, oname, cname, defval, cb) { function hist_push(url) { console.log("h-push " + url); - history.pushState(url, url, url); + if (window.history && history.pushState) + history.pushState(url, url, url); } function hist_replace(url) { console.log("h-repl " + url); - history.replaceState(url, url, url); + if (window.history && history.replaceState) + history.replaceState(url, url, url); } function sethash(hv) {