From 38593a039485e20f1220c583d01517cbe17f3e47 Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 3 Sep 2021 20:19:17 +0200 Subject: [PATCH] move column hider buttons above the header --- copyparty/web/browser.css | 2 -- copyparty/web/browser.js | 1 + copyparty/web/util.js | 31 +++++++++++++++++-------------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 483eebfb..ed9133bc 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -815,8 +815,6 @@ input.eq_gain { width: 1em; border-radius: .2em; margin: -1.2em auto 0 auto; - top: 2em; - position: relative; background: #444; } #files th span { diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index e3e04702..04c167d4 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -3587,6 +3587,7 @@ var filecols = (function () { if (ttv) { th.setAttribute("tt", ttv); th.setAttribute("ttd", "u"); + th.setAttribute("ttm", "12"); } } }; diff --git a/copyparty/web/util.js b/copyparty/web/util.js index f8235d5a..aa88ea6f 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -650,6 +650,9 @@ var timer = (function () { }; function doevents() { + if (crashed) + return; + if (Date.now() - r.last < 69) return; @@ -695,6 +698,7 @@ var tt = (function () { r.el = this; var pos = this.getBoundingClientRect(), dir = this.getAttribute('ttd') || '', + margin = parseFloat(this.getAttribute('ttm') || 0), top = pos.top < window.innerHeight / 2, big = this.className.indexOf(' ttb') !== -1; @@ -706,23 +710,22 @@ var tt = (function () { r.tt.style.top = '0'; r.tt.innerHTML = msg.replace(/\$N/g, "
"); - var tw = r.tt.offsetWidth, - x = pos.left + (pos.right - pos.left) / 2 - tw / 2; - - if (x < 0) - x = 8; - - if (x + tw >= window.innerWidth - 8) { - x = window.innerWidth - tw - 8; - } - - r.tt.style.left = x + 'px'; - r.tt.style.top = top ? pos.bottom + 'px' : 'auto'; - r.tt.style.bottom = top ? 'auto' : (window.innerHeight - pos.top) + 'px'; - r.el.addEventListener('mouseleave', r.hide); window.addEventListener('scroll', r.hide); clmod(r.tt, 'show', 1); + + var tw = r.tt.offsetWidth, + x = pos.left + (pos.right - pos.left) / 2 - tw / 2; + + if (x + tw >= window.innerWidth - 24) + x = window.innerWidth - tw - 24; + + if (x < 0) + x = 12; + + r.tt.style.left = x + 'px'; + r.tt.style.top = top ? (margin + pos.bottom) + 'px' : 'auto'; + r.tt.style.bottom = top ? 'auto' : (margin + window.innerHeight - pos.top) + 'px'; }; r.hide = function (e) {