From 596dc9e36dfe3989f7a5deb2d055d56b34eccb2d Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Thu, 27 Sep 2018 13:33:03 +0200 Subject: [PATCH] Don't show tooltips on touch input devices (this closes #67) --- public/js/extensions.js | 10 ++++++++++ public/js/grocy.js | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/public/js/extensions.js b/public/js/extensions.js index 98e64ca2..8e3340fe 100644 --- a/public/js/extensions.js +++ b/public/js/extensions.js @@ -31,3 +31,13 @@ GetUriParam = function(key) } } }; + +IsTouchInputDevice = function() +{ + if (("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch) + { + return true; + } + + return false; +} diff --git a/public/js/grocy.js b/public/js/grocy.js index 7abe16fd..24b8fd29 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -91,6 +91,14 @@ window.FontAwesomeConfig = { searchPseudoElements: true } +// Don't show tooltips on touch input devices +if (IsTouchInputDevice()) +{ + var css = document.createElement("style"); + css.innerHTML = ".tooltip { display: none; }"; + document.body.appendChild(css); +} + Grocy.Api = { }; Grocy.Api.Get = function(apiFunction, success, error) {