From 890c31088015e076311f979c8b227601ba7ce858 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 20 Jul 2021 23:07:15 +0200 Subject: [PATCH] another attempt at fixing tooltips on iphone --- copyparty/web/util.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 528a8877..24cc67c2 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -7,7 +7,8 @@ if (!window['console']) var is_touch = 'ontouchstart' in window, - ANDROID = /(android)/i.test(navigator.userAgent); + IPHONE = /iPhone|iPad|iPod/i.test(navigator.userAgent), + ANDROID = /android/i.test(navigator.userAgent); // error handler for mobile devices @@ -547,12 +548,25 @@ var tt = (function () { clmod(r.tt, 'show', 1); }; - r.hide = function () { + r.hide = function (e) { + ev(e); clmod(r.tt, 'show'); if (r.el) r.el.removeEventListener('mouseleave', r.hide); }; + if (is_touch && IPHONE) { + var f1 = r.show, + f2 = r.hide; + + r.show = function () { + setTimeout(f1.bind(this), 301); + }; + r.hide = function () { + setTimeout(f2.bind(this), 301); + }; + } + r.tt.onclick = r.hide; r.att = function (ctr) {