1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
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;
$("<div>")
.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 '<div class="markdown">' + $(this).attr("title") + '</div>';
}
$.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 '<i class="fa fa-spinner fa-spin"></i>';
}
})
.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);
});
};
|