Mercurial > repos > mingchen0919 > aurora_htseq_site
comparison vakata-jstree-3.3.5/src/jstree.conditionalselect.js @ 0:dcf65671e56a draft
planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
author | mingchen0919 |
---|---|
date | Sun, 30 Dec 2018 12:52:51 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:dcf65671e56a |
---|---|
1 /** | |
2 * ### Conditionalselect plugin | |
3 * | |
4 * This plugin allows defining a callback to allow or deny node selection by user input (activate node method). | |
5 */ | |
6 /*globals jQuery, define, exports, require, document */ | |
7 (function (factory) { | |
8 "use strict"; | |
9 if (typeof define === 'function' && define.amd) { | |
10 define('jstree.conditionalselect', ['jquery','jstree'], factory); | |
11 } | |
12 else if(typeof exports === 'object') { | |
13 factory(require('jquery'), require('jstree')); | |
14 } | |
15 else { | |
16 factory(jQuery, jQuery.jstree); | |
17 } | |
18 }(function ($, jstree, undefined) { | |
19 "use strict"; | |
20 | |
21 if($.jstree.plugins.conditionalselect) { return; } | |
22 | |
23 /** | |
24 * a callback (function) which is invoked in the instance's scope and receives two arguments - the node and the event that triggered the `activate_node` call. Returning false prevents working with the node, returning true allows invoking activate_node. Defaults to returning `true`. | |
25 * @name $.jstree.defaults.checkbox.visible | |
26 * @plugin checkbox | |
27 */ | |
28 $.jstree.defaults.conditionalselect = function () { return true; }; | |
29 $.jstree.plugins.conditionalselect = function (options, parent) { | |
30 // own function | |
31 this.activate_node = function (obj, e) { | |
32 if(this.settings.conditionalselect.call(this, this.get_node(obj), e)) { | |
33 return parent.activate_node.call(this, obj, e); | |
34 } | |
35 }; | |
36 }; | |
37 | |
38 })); |