From 600e9ac947071ff53dbc1bc654b292a34193e33e Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 17 Jul 2021 16:03:21 +0200 Subject: [PATCH] try to workaround iphones not hiding tooltips --- copyparty/web/browser.html | 8 ++++---- copyparty/web/util.js | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/copyparty/web/browser.html b/copyparty/web/browser.html index 7d1c907b..818108ec 100644 --- a/copyparty/web/browser.html +++ b/copyparty/web/browser.html @@ -39,7 +39,7 @@
- + 📂
@@ -47,14 +47,14 @@
- - + 📝 +
- + 📟
diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 7b491833..02b99900 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -502,7 +502,8 @@ function hist_replace(url) { var tt = (function () { var r = { "tt": mknod("div"), - "en": true + "en": true, + "el": null }; r.tt.setAttribute('id', 'tt'); @@ -517,6 +518,7 @@ var tt = (function () { if (!msg) return; + r.el = this; var pos = this.getBoundingClientRect(), dir = this.getAttribute('ttd') || '', left = pos.left < window.innerWidth / 2, @@ -535,13 +537,18 @@ var tt = (function () { r.tt.style.right = left ? 'auto' : (window.innerWidth - pos.right) + 'px'; r.tt.innerHTML = msg.replace(/\$N/g, "
"); + r.el.addEventListener('mouseleave', r.hide); clmod(r.tt, 'show', 1); }; r.hide = function () { clmod(r.tt, 'show'); + if (r.el) + r.el.removeEventListener('mouseleave', r.hide); }; + r.tt.onclick = r.hide; + r.att = function (ctr) { var _show = r.en ? r.show : null, _hide = r.en ? r.hide : null,