misc.js
1.16 KB
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
/* global jQuery */
// disable all events
(function ($, undefined) {
"use strict";
$.jstree.plugins.trigger = function (options, parent) {
this.init = function (el, options) {
// do not forget parent
parent.init.call(this, el, options);
this._data.trigger.disabled = false;
};
this.trigger = function (ev, data) {
if(!this._data.trigger.disabled) {
parent.trigger.call(this, ev, data);
}
};
this.disable_events = function () { this._data.trigger.disabled = true; };
this.enable_events = function () { this._data.trigger.disabled = false; };
};
})(jQuery);
// no hover
(function ($, undefined) {
"use strict";
$.jstree.plugins.nohover = function () {
this.hover_node = $.noop;
};
})(jQuery);
// conditional select
(function ($, undefined) {
"use strict";
$.jstree.defaults.conditionalselect = function () { return true; };
$.jstree.plugins.conditionalselect = function (options, parent) {
// own function
this.select_node = function (obj, supress_event, prevent_open) {
if(this.settings.conditionalselect.call(this, this.get_node(obj))) {
parent.select_node.call(this, obj, supress_event, prevent_open);
}
};
};
})(jQuery);