From 93cf5309335ac238d0ae4667c7b6da316623d889 Mon Sep 17 00:00:00 2001 From: sgiehl <stefan@piwik.org> Date: Sun, 6 Dec 2015 13:10:39 +0100 Subject: [PATCH] fixes #9266 - show tooltip for longer titles in popovers --- plugins/CoreHome/javascripts/popover.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/CoreHome/javascripts/popover.js b/plugins/CoreHome/javascripts/popover.js index 3766bdad66..308fc7a4bb 100644 --- a/plugins/CoreHome/javascripts/popover.js +++ b/plugins/CoreHome/javascripts/popover.js @@ -142,7 +142,17 @@ var Piwik_Popover = (function () { /** Set the title of the popover */ setTitle: function (titleHtml) { + var titleText = $('<div>' + titleHtml + '</div>').text(); + if (titleText.length > 60) { + titleHtml = $('<span>').attr('class', 'tooltip').attr('title', titleText).html(titleHtml); + } container.dialog('option', 'title', titleHtml); + try { + $('.tooltip', container.parentNode).tooltip('destroy'); + } catch (e) {} + if (titleText.length > 60) { + $('.tooltip', container.parentNode).tooltip({track: true, items: '.tooltip'}); + } }, /** Set inner HTML of the popover */ -- GitLab