From 5996a8abcf12336586cee345180203dd1500c92f Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Fri, 20 Apr 2018 15:18:30 -0700 Subject: Rewrite tooltips code without jQuery --- assets/js/src/BoardDragAndDrop.js | 1 + assets/js/src/Tooltip.js | 75 --------------------------------------- 2 files changed, 1 insertion(+), 75 deletions(-) delete mode 100644 assets/js/src/Tooltip.js (limited to 'assets/js/src') diff --git a/assets/js/src/BoardDragAndDrop.js b/assets/js/src/BoardDragAndDrop.js index 77d22b55..eef45a19 100644 --- a/assets/js/src/BoardDragAndDrop.js +++ b/assets/js/src/BoardDragAndDrop.js @@ -103,6 +103,7 @@ Kanboard.BoardDragAndDrop.prototype.refresh = function(data) { this.app.hideLoadingIcon(); this.executeListeners(); this.dragAndDrop(); + KB.tooltip(); }; Kanboard.BoardDragAndDrop.prototype.executeListeners = function() { diff --git a/assets/js/src/Tooltip.js b/assets/js/src/Tooltip.js deleted file mode 100644 index 28e922cc..00000000 --- a/assets/js/src/Tooltip.js +++ /dev/null @@ -1,75 +0,0 @@ -Kanboard.Tooltip = function(app) { - this.app = app; -}; - -Kanboard.Tooltip.prototype.onBoardRendered = function() { - this.execute(); -}; - -Kanboard.Tooltip.prototype.execute = function() { - $(".tooltip").tooltip({ - track: false, - show: false, - hide: false, - position: { - my: 'left-20 top', - at: 'center bottom+9', - using: function(position, feedback) { - - $(this).css(position); - - var arrow_pos = feedback.target.left + feedback.target.width / 2 - feedback.element.left - 20; - - $("
") - .addClass("tooltip-arrow") - .addClass(feedback.vertical) - .addClass(arrow_pos < 1 ? "align-left" : "align-right") - .appendTo(this); - } - }, - content: function() { - var _this = this; - var href = $(this).attr('data-href'); - - if (! href) { - return '
' + $(this).attr("title") + '
'; - } - - $.get(href, function setTooltipContent(data) { - var tooltip = $('.ui-tooltip:visible'); - - $('.ui-tooltip-content:visible').html(data); - - // Clear previous position, it interferes with the updated position computation - tooltip.css({ top: '', left: '' }); - - // Remove arrow, it will be added when repositionning - tooltip.children('.tooltip-arrow').remove(); - - // Reposition the tooltip - var position = $(_this).tooltip("option", "position"); - position.of = $(_this); - tooltip.position(position); - }); - - return ''; - } - }) - .on("mouseenter", function() { - var _this = this; - $(this).tooltip("open"); - - $(".ui-tooltip").on("mouseleave", function() { - $(_this).tooltip('close'); - }); - }).on("mouseleave focusout", function(e) { - e.stopImmediatePropagation(); - var _this = this; - - setTimeout(function() { - if (! $(".ui-tooltip:hover").length) { - $(_this).tooltip("close"); - } - }, 100); - }); -}; -- cgit v1.2.3