-
Notifications
You must be signed in to change notification settings - Fork 988
/
jquery.fancytree.bstooltip.js
102 lines (84 loc) · 3.02 KB
/
jquery.fancytree.bstooltip.js
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*!
* jquery.fancytree.bstooltip.js
*
* Generated bootstrap tooltip
* (Extension module for jquery.fancytree.js: https://github.com/mar10/fancytree/)
*
*
* @version @VERSION
* @date @DATE
*/
;(function($, undefined) {
"use strict";
$.ui.fancytree.registerExtension({
name: "bstooltip",
version: "0.0.1",
options: {},
/* Init */
nodeRenderTitle: function(ctx, title) {
var node = ctx.node;
this._superApply(arguments);
if (node.data.toggle=='tooltip')
{
var options = [];
options['animation'] = node.data.animation;
options['container'] = node.data.container;
options['delay'] = node.data.delay;
options['html'] = node.data.html;
options['placement'] = node.data.placement;
options['selector'] = node.data.selector;
options['template'] = node.data.template;
options['title'] = node.data.title;
options['trigger'] = node.data.trigger;
options['viewport'] = node.data.viewport;
$("span.fancytree-title", node.span).tooltip(options);
}
if (node.data.buttonlinks)
{
//console.log(node.data.buttons);
$.each( node.data.buttonlinks, function( key, button ){
//console.log(button);
var jQbutton = $('<a role="button"></a>)');
jQbutton.attr("href",button.url);
if (button.cssclasses)
{
jQbutton.addClass(button.cssclasses);
}
else
{
jQbutton.addClass("btn btn-xs btn-default");
}
if (button.toggle)
{
jQbutton.data("toggle", button.toggle);
}
if (button.placement)
{
jQbutton.data("placement", button.placement);
}
if (button.title)
{
jQbutton.attr("title", button.title);
}
if (button.icon)
{
jQbutton.append('<i class="'+button.icon+'"></i>');
}
if (button.buttontext)
{
jQbutton.append(button.buttontext);
}
$("span.fancytree-title", node.span).append(' ').append( jQbutton );
if (button.toggle=='tooltip')
{
jQbutton.tooltip();
}
if (button.toggle=='popover')
{
jQbutton.popover();
}
} );
}
}
});
}(jQuery));