43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
/* 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); |