diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt03010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt03010-main.jsp index 6b23bb5a..dd8866b7 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt03010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt03010-main.jsp @@ -89,7 +89,7 @@ - + diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt03020-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt03020-main.jsp index 616a970b..6a8213d1 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt03020-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt03020-main.jsp @@ -51,7 +51,7 @@ - + diff --git a/src/main/webapp/WEB-INF/jsp/fims/user/user-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/user/user-info.jsp index 93f04d37..3363b545 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/user/user-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/user/user-info.jsp @@ -220,7 +220,7 @@ - + diff --git a/src/main/webapp/WEB-INF/jsp/include/tail.jsp b/src/main/webapp/WEB-INF/jsp/include/tail.jsp index d75dd84b..7e96d298 100644 --- a/src/main/webapp/WEB-INF/jsp/include/tail.jsp +++ b/src/main/webapp/WEB-INF/jsp/include/tail.jsp @@ -14,7 +14,7 @@ - + diff --git a/src/main/webapp/WEB-INF/jsp/select-url.jsp b/src/main/webapp/WEB-INF/jsp/select-url.jsp index 4e1f826e..56cf9a19 100644 --- a/src/main/webapp/WEB-INF/jsp/select-url.jsp +++ b/src/main/webapp/WEB-INF/jsp/select-url.jsp @@ -1,6 +1,6 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> -" /--%> +"
diff --git a/src/main/webapp/resources/3rd-party/jstree/jstree.js b/src/main/webapp/resources/3rd-party/jstree/jstree.js deleted file mode 100644 index 00617ef6..00000000 --- a/src/main/webapp/resources/3rd-party/jstree/jstree.js +++ /dev/null @@ -1,8605 +0,0 @@ -/*globals jQuery, define, module, exports, require, window, document, postMessage */ -(function (factory) { - "use strict"; - if (typeof define === 'function' && define.amd) { - define(['jquery'], factory); - } - else if(typeof module !== 'undefined' && module.exports) { - module.exports = factory(require('jquery')); - } - else { - factory(jQuery); - } -}(function ($, undefined) { - "use strict"; -/*! - * jsTree 3.3.7 - * http://jstree.com/ - * - * Copyright (c) 2014 Ivan Bozhanov (http://vakata.com) - * - * Licensed same as jquery - under the terms of the MIT License - * http://www.opensource.org/licenses/mit-license.php - */ -/*! - * if using jslint please allow for the jQuery global and use following options: - * jslint: loopfunc: true, browser: true, ass: true, bitwise: true, continue: true, nomen: true, plusplus: true, regexp: true, unparam: true, todo: true, white: true - */ -/*jshint -W083 */ - - // prevent another load? maybe there is a better way? - if($.jstree) { - return; - } - - /** - * ### jsTree core functionality - */ - - // internal variables - var instance_counter = 0, - ccp_node = false, - ccp_mode = false, - ccp_inst = false, - themes_loaded = [], - src = $('script:last').attr('src'), - document = window.document; // local variable is always faster to access then a global - - /** - * holds all jstree related functions and variables, including the actual class and methods to create, access and manipulate instances. - * @name $.jstree - */ - $.jstree = { - /** - * specifies the jstree version in use - * @name $.jstree.version - */ - version : '3.3.7', - /** - * holds all the default options used when creating new instances - * @name $.jstree.defaults - */ - defaults : { - /** - * configure which plugins will be active on an instance. Should be an array of strings, where each element is a plugin name. The default is `[]` - * @name $.jstree.defaults.plugins - */ - plugins : [] - }, - /** - * stores all loaded jstree plugins (used internally) - * @name $.jstree.plugins - */ - plugins : {}, - path : src && src.indexOf('/') !== -1 ? src.replace(/\/[^\/]+$/,'') : '', - idregex : /[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g, - root : '#' - }; - - /** - * creates a jstree instance - * @name $.jstree.create(el [, options]) - * @param {DOMElement|jQuery|String} el the element to create the instance on, can be jQuery extended or a selector - * @param {Object} options options for this instance (extends `$.jstree.defaults`) - * @return {jsTree} the new instance - */ - $.jstree.create = function (el, options) { - var tmp = new $.jstree.core(++instance_counter), - opt = options; - options = $.extend(true, {}, $.jstree.defaults, options); - if(opt && opt.plugins) { - options.plugins = opt.plugins; - } - $.each(options.plugins, function (i, k) { - if(i !== 'core') { - tmp = tmp.plugin(k, options[k]); - } - }); - $(el).data('jstree', tmp); - tmp.init(el, options); - return tmp; - }; - /** - * remove all traces of jstree from the DOM and destroy all instances - * @name $.jstree.destroy() - */ - $.jstree.destroy = function () { - $('.jstree:jstree').jstree('destroy'); - $(document).off('.jstree'); - }; - /** - * the jstree class constructor, used only internally - * @private - * @name $.jstree.core(id) - * @param {Number} id this instance's index - */ - $.jstree.core = function (id) { - this._id = id; - this._cnt = 0; - this._wrk = null; - this._data = { - core : { - themes : { - name : false, - dots : false, - icons : false, - ellipsis : false - }, - selected : [], - last_error : {}, - working : false, - worker_queue : [], - focused : null - } - }; - }; - /** - * get a reference to an existing instance - * - * __Examples__ - * - * // provided a container with an ID of "tree", and a nested node with an ID of "branch" - * // all of there will return the same instance - * $.jstree.reference('tree'); - * $.jstree.reference('#tree'); - * $.jstree.reference($('#tree')); - * $.jstree.reference(document.getElementByID('tree')); - * $.jstree.reference('branch'); - * $.jstree.reference('#branch'); - * $.jstree.reference($('#branch')); - * $.jstree.reference(document.getElementByID('branch')); - * - * @name $.jstree.reference(needle) - * @param {DOMElement|jQuery|String} needle - * @return {jsTree|null} the instance or `null` if not found - */ - $.jstree.reference = function (needle) { - var tmp = null, - obj = null; - if(needle && needle.id && (!needle.tagName || !needle.nodeType)) { needle = needle.id; } - - if(!obj || !obj.length) { - try { obj = $(needle); } catch (ignore) { } - } - if(!obj || !obj.length) { - try { obj = $('#' + needle.replace($.jstree.idregex,'\\$&')); } catch (ignore) { } - } - if(obj && obj.length && (obj = obj.closest('.jstree')).length && (obj = obj.data('jstree'))) { - tmp = obj; - } - else { - $('.jstree').each(function () { - var inst = $(this).data('jstree'); - if(inst && inst._model.data[needle]) { - tmp = inst; - return false; - } - }); - } - return tmp; - }; - /** - * Create an instance, get an instance or invoke a command on a instance. - * - * If there is no instance associated with the current node a new one is created and `arg` is used to extend `$.jstree.defaults` for this new instance. There would be no return value (chaining is not broken). - * - * If there is an existing instance and `arg` is a string the command specified by `arg` is executed on the instance, with any additional arguments passed to the function. If the function returns a value it will be returned (chaining could break depending on function). - * - * If there is an existing instance and `arg` is not a string the instance itself is returned (similar to `$.jstree.reference`). - * - * In any other case - nothing is returned and chaining is not broken. - * - * __Examples__ - * - * $('#tree1').jstree(); // creates an instance - * $('#tree2').jstree({ plugins : [] }); // create an instance with some options - * $('#tree1').jstree('open_node', '#branch_1'); // call a method on an existing instance, passing additional arguments - * $('#tree2').jstree(); // get an existing instance (or create an instance) - * $('#tree2').jstree(true); // get an existing instance (will not create new instance) - * $('#branch_1').jstree().select_node('#branch_1'); // get an instance (using a nested element and call a method) - * - * @name $().jstree([arg]) - * @param {String|Object} arg - * @return {Mixed} - */ - $.fn.jstree = function (arg) { - // check for string argument - var is_method = (typeof arg === 'string'), - args = Array.prototype.slice.call(arguments, 1), - result = null; - if(arg === true && !this.length) { return false; } - this.each(function () { - // get the instance (if there is one) and method (if it exists) - var instance = $.jstree.reference(this), - method = is_method && instance ? instance[arg] : null; - // if calling a method, and method is available - execute on the instance - result = is_method && method ? - method.apply(instance, args) : - null; - // if there is no instance and no method is being called - create one - if(!instance && !is_method && (arg === undefined || $.isPlainObject(arg))) { - $.jstree.create(this, arg); - } - // if there is an instance and no method is called - return the instance - if( (instance && !is_method) || arg === true ) { - result = instance || false; - } - // if there was a method call which returned a result - break and return the value - if(result !== null && result !== undefined) { - return false; - } - }); - // if there was a method call with a valid return value - return that, otherwise continue the chain - return result !== null && result !== undefined ? - result : this; - }; - /** - * used to find elements containing an instance - * - * __Examples__ - * - * $('div:jstree').each(function () { - * $(this).jstree('destroy'); - * }); - * - * @name $(':jstree') - * @return {jQuery} - */ - $.expr.pseudos.jstree = $.expr.createPseudo(function(search) { - return function(a) { - return $(a).hasClass('jstree') && - $(a).data('jstree') !== undefined; - }; - }); - - /** - * stores all defaults for the core - * @name $.jstree.defaults.core - */ - $.jstree.defaults.core = { - /** - * data configuration - * - * If left as `false` the HTML inside the jstree container element is used to populate the tree (that should be an unordered list with list items). - * - * You can also pass in a HTML string or a JSON array here. - * - * It is possible to pass in a standard jQuery-like AJAX config and jstree will automatically determine if the response is JSON or HTML and use that to populate the tree. - * In addition to the standard jQuery ajax options here you can suppy functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node is being loaded, the return value of those functions will be used. - * - * The last option is to specify a function, that function will receive the node being loaded as argument and a second param which is a function which should be called with the result. - * - * __Examples__ - * - * // AJAX - * $('#tree').jstree({ - * 'core' : { - * 'data' : { - * 'url' : '/get/children/', - * 'data' : function (node) { - * return { 'id' : node.id }; - * } - * } - * }); - * - * // direct data - * $('#tree').jstree({ - * 'core' : { - * 'data' : [ - * 'Simple root node', - * { - * 'id' : 'node_2', - * 'text' : 'Root node with options', - * 'state' : { 'opened' : true, 'selected' : true }, - * 'children' : [ { 'text' : 'Child 1' }, 'Child 2'] - * } - * ] - * } - * }); - * - * // function - * $('#tree').jstree({ - * 'core' : { - * 'data' : function (obj, callback) { - * callback.call(this, ['Root 1', 'Root 2']); - * } - * }); - * - * @name $.jstree.defaults.core.data - */ - data : false, - /** - * configure the various strings used throughout the tree - * - * You can use an object where the key is the string you need to replace and the value is your replacement. - * Another option is to specify a function which will be called with an argument of the needed string and should return the replacement. - * If left as `false` no replacement is made. - * - * __Examples__ - * - * $('#tree').jstree({ - * 'core' : { - * 'strings' : { - * 'Loading ...' : 'Please wait ...' - * } - * } - * }); - * - * @name $.jstree.defaults.core.strings - */ - strings : false, - /** - * determines what happens when a user tries to modify the structure of the tree - * If left as `false` all operations like create, rename, delete, move or copy are prevented. - * You can set this to `true` to allow all interactions or use a function to have better control. - * - * __Examples__ - * - * $('#tree').jstree({ - * 'core' : { - * 'check_callback' : function (operation, node, node_parent, node_position, more) { - * // operation can be 'create_node', 'rename_node', 'delete_node', 'move_node', 'copy_node' or 'edit' - * // in case of 'rename_node' node_position is filled with the new node name - * return operation === 'rename_node' ? true : false; - * } - * } - * }); - * - * @name $.jstree.defaults.core.check_callback - */ - check_callback : false, - /** - * a callback called with a single object parameter in the instance's scope when something goes wrong (operation prevented, ajax failed, etc) - * @name $.jstree.defaults.core.error - */ - error : $.noop, - /** - * the open / close animation duration in milliseconds - set this to `false` to disable the animation (default is `200`) - * @name $.jstree.defaults.core.animation - */ - animation : 200, - /** - * a boolean indicating if multiple nodes can be selected - * @name $.jstree.defaults.core.multiple - */ - multiple : true, - /** - * theme configuration object - * @name $.jstree.defaults.core.themes - */ - themes : { - /** - * the name of the theme to use (if left as `false` the default theme is used) - * @name $.jstree.defaults.core.themes.name - */ - name : false, - /** - * the URL of the theme's CSS file, leave this as `false` if you have manually included the theme CSS (recommended). You can set this to `true` too which will try to autoload the theme. - * @name $.jstree.defaults.core.themes.url - */ - url : false, - /** - * the location of all jstree themes - only used if `url` is set to `true` - * @name $.jstree.defaults.core.themes.dir - */ - dir : false, - /** - * a boolean indicating if connecting dots are shown - * @name $.jstree.defaults.core.themes.dots - */ - dots : true, - /** - * a boolean indicating if node icons are shown - * @name $.jstree.defaults.core.themes.icons - */ - icons : true, - /** - * a boolean indicating if node ellipsis should be shown - this only works with a fixed with on the container - * @name $.jstree.defaults.core.themes.ellipsis - */ - ellipsis : false, - /** - * a boolean indicating if the tree background is striped - * @name $.jstree.defaults.core.themes.stripes - */ - stripes : false, - /** - * a string (or boolean `false`) specifying the theme variant to use (if the theme supports variants) - * @name $.jstree.defaults.core.themes.variant - */ - variant : false, - /** - * a boolean specifying if a reponsive version of the theme should kick in on smaller screens (if the theme supports it). Defaults to `false`. - * @name $.jstree.defaults.core.themes.responsive - */ - responsive : false - }, - /** - * if left as `true` all parents of all selected nodes will be opened once the tree loads (so that all selected nodes are visible to the user) - * @name $.jstree.defaults.core.expand_selected_onload - */ - expand_selected_onload : true, - /** - * if left as `true` web workers will be used to parse incoming JSON data where possible, so that the UI will not be blocked by large requests. Workers are however about 30% slower. Defaults to `true` - * @name $.jstree.defaults.core.worker - */ - worker : true, - /** - * Force node text to plain text (and escape HTML). Defaults to `false` - * @name $.jstree.defaults.core.force_text - */ - force_text : false, - /** - * Should the node be toggled if the text is double clicked. Defaults to `true` - * @name $.jstree.defaults.core.dblclick_toggle - */ - dblclick_toggle : true, - /** - * Should the loaded nodes be part of the state. Defaults to `false` - * @name $.jstree.defaults.core.loaded_state - */ - loaded_state : false, - /** - * Should the last active node be focused when the tree container is blurred and the focused again. This helps working with screen readers. Defaults to `true` - * @name $.jstree.defaults.core.restore_focus - */ - restore_focus : true, - /** - * Default keyboard shortcuts (an object where each key is the button name or combo - like 'enter', 'ctrl-space', 'p', etc and the value is the function to execute in the instance's scope) - * @name $.jstree.defaults.core.keyboard - */ - keyboard : { - 'ctrl-space': function (e) { - // aria defines space only with Ctrl - e.type = "click"; - $(e.currentTarget).trigger(e); - }, - 'enter': function (e) { - // enter - e.type = "click"; - $(e.currentTarget).trigger(e); - }, - 'left': function (e) { - // left - e.preventDefault(); - if(this.is_open(e.currentTarget)) { - this.close_node(e.currentTarget); - } - else { - var o = this.get_parent(e.currentTarget); - if(o && o.id !== $.jstree.root) { this.get_node(o, true).children('.jstree-anchor').focus(); } - } - }, - 'up': function (e) { - // up - e.preventDefault(); - var o = this.get_prev_dom(e.currentTarget); - if(o && o.length) { o.children('.jstree-anchor').focus(); } - }, - 'right': function (e) { - // right - e.preventDefault(); - if(this.is_closed(e.currentTarget)) { - this.open_node(e.currentTarget, function (o) { this.get_node(o, true).children('.jstree-anchor').focus(); }); - } - else if (this.is_open(e.currentTarget)) { - var o = this.get_node(e.currentTarget, true).children('.jstree-children')[0]; - if(o) { $(this._firstChild(o)).children('.jstree-anchor').focus(); } - } - }, - 'down': function (e) { - // down - e.preventDefault(); - var o = this.get_next_dom(e.currentTarget); - if(o && o.length) { o.children('.jstree-anchor').focus(); } - }, - '*': function (e) { - // aria defines * on numpad as open_all - not very common - this.open_all(); - }, - 'home': function (e) { - // home - e.preventDefault(); - var o = this._firstChild(this.get_container_ul()[0]); - if(o) { $(o).children('.jstree-anchor').filter(':visible').focus(); } - }, - 'end': function (e) { - // end - e.preventDefault(); - this.element.find('.jstree-anchor').filter(':visible').last().focus(); - }, - 'f2': function (e) { - // f2 - safe to include - if check_callback is false it will fail - e.preventDefault(); - this.edit(e.currentTarget); - } - } - }; - $.jstree.core.prototype = { - /** - * used to decorate an instance with a plugin. Used internally. - * @private - * @name plugin(deco [, opts]) - * @param {String} deco the plugin to decorate with - * @param {Object} opts options for the plugin - * @return {jsTree} - */ - plugin : function (deco, opts) { - var Child = $.jstree.plugins[deco]; - if(Child) { - this._data[deco] = {}; - Child.prototype = this; - return new Child(opts, this); - } - return this; - }, - /** - * initialize the instance. Used internally. - * @private - * @name init(el, optons) - * @param {DOMElement|jQuery|String} el the element we are transforming - * @param {Object} options options for this instance - * @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree - */ - init : function (el, options) { - this._model = { - data : {}, - changed : [], - force_full_redraw : false, - redraw_timeout : false, - default_state : { - loaded : true, - opened : false, - selected : false, - disabled : false - } - }; - this._model.data[$.jstree.root] = { - id : $.jstree.root, - parent : null, - parents : [], - children : [], - children_d : [], - state : { loaded : false } - }; - - this.element = $(el).addClass('jstree jstree-' + this._id); - this.settings = options; - - this._data.core.ready = false; - this._data.core.loaded = false; - this._data.core.rtl = (this.element.css("direction") === "rtl"); - this.element[this._data.core.rtl ? 'addClass' : 'removeClass']("jstree-rtl"); - this.element.attr('role','tree'); - if(this.settings.core.multiple) { - this.element.attr('aria-multiselectable', true); - } - if(!this.element.attr('tabindex')) { - this.element.attr('tabindex','0'); - } - - this.bind(); - /** - * triggered after all events are bound - * @event - * @name init.jstree - */ - this.trigger("init"); - - this._data.core.original_container_html = this.element.find(" > ul > li").clone(true); - this._data.core.original_container_html - .find("li").addBack() - .contents().filter(function() { - return this.nodeType === 3 && (!this.nodeValue || /^\s+$/.test(this.nodeValue)); - }) - .remove(); - this.element.html("<"+"ul class='jstree-container-ul jstree-children' role='group'><"+"li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><"+"a class='jstree-anchor' href='#'>" + this.get_string("Loading ...") + ""); - this.element.attr('aria-activedescendant','j' + this._id + '_loading'); - this._data.core.li_height = this.get_container_ul().children("li").first().outerHeight() || 24; - this._data.core.node = this._create_prototype_node(); - /** - * triggered after the loading text is shown and before loading starts - * @event - * @name loading.jstree - */ - this.trigger("loading"); - this.load_node($.jstree.root); - }, - /** - * destroy an instance - * @name destroy() - * @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact - */ - destroy : function (keep_html) { - /** - * triggered before the tree is destroyed - * @event - * @name destroy.jstree - */ - this.trigger("destroy"); - if(this._wrk) { - try { - window.URL.revokeObjectURL(this._wrk); - this._wrk = null; - } - catch (ignore) { } - } - if(!keep_html) { this.element.empty(); } - this.teardown(); - }, - /** - * Create a prototype node - * @name _create_prototype_node() - * @return {DOMElement} - */ - _create_prototype_node : function () { - var _node = document.createElement('LI'), _temp1, _temp2; - _node.setAttribute('role', 'treeitem'); - _temp1 = document.createElement('I'); - _temp1.className = 'jstree-icon jstree-ocl'; - _temp1.setAttribute('role', 'presentation'); - _node.appendChild(_temp1); - _temp1 = document.createElement('A'); - _temp1.className = 'jstree-anchor'; - _temp1.setAttribute('href','#'); - _temp1.setAttribute('tabindex','-1'); - _temp2 = document.createElement('I'); - _temp2.className = 'jstree-icon jstree-themeicon'; - _temp2.setAttribute('role', 'presentation'); - _temp1.appendChild(_temp2); - _node.appendChild(_temp1); - _temp1 = _temp2 = null; - - return _node; - }, - _kbevent_to_func : function (e) { - var keys = { - 8: "Backspace", 9: "Tab", 13: "Return", 19: "Pause", 27: "Esc", - 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home", - 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "Print", 45: "Insert", - 46: "Delete", 96: "Numpad0", 97: "Numpad1", 98: "Numpad2", 99 : "Numpad3", - 100: "Numpad4", 101: "Numpad5", 102: "Numpad6", 103: "Numpad7", - 104: "Numpad8", 105: "Numpad9", '-13': "NumpadEnter", 112: "F1", - 113: "F2", 114: "F3", 115: "F4", 116: "F5", 117: "F6", 118: "F7", - 119: "F8", 120: "F9", 121: "F10", 122: "F11", 123: "F12", 144: "Numlock", - 145: "Scrolllock", 16: 'Shift', 17: 'Ctrl', 18: 'Alt', - 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', - 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a', - 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h', - 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o', - 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v', - 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.', - 186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`', - 219: '[', 220: '\\',221: ']', 222: "'", 111: '/', 106: '*', 173: '-' - }; - var parts = []; - if (e.ctrlKey) { parts.push('ctrl'); } - if (e.altKey) { parts.push('alt'); } - if (e.shiftKey) { parts.push('shift'); } - parts.push(keys[e.which] || e.which); - parts = parts.sort().join('-').toLowerCase(); - - var kb = this.settings.core.keyboard, i, tmp; - for (i in kb) { - if (kb.hasOwnProperty(i)) { - tmp = i; - if (tmp !== '-' && tmp !== '+') { - tmp = tmp.replace('--', '-MINUS').replace('+-', '-MINUS').replace('++', '-PLUS').replace('-+', '-PLUS'); - tmp = tmp.split(/-|\+/).sort().join('-').replace('MINUS', '-').replace('PLUS', '+').toLowerCase(); - } - if (tmp === parts) { - return kb[i]; - } - } - } - return null; - }, - /** - * part of the destroying of an instance. Used internally. - * @private - * @name teardown() - */ - teardown : function () { - this.unbind(); - this.element - .removeClass('jstree') - .removeData('jstree') - .find("[class^='jstree']") - .addBack() - .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); }); - this.element = null; - }, - /** - * bind all events. Used internally. - * @private - * @name bind() - */ - bind : function () { - var word = '', - tout = null, - was_click = 0; - this.element - .on("dblclick.jstree", function (e) { - if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } - if(document.selection && document.selection.empty) { - document.selection.empty(); - } - else { - if(window.getSelection) { - var sel = window.getSelection(); - try { - sel.removeAllRanges(); - sel.collapse(); - } catch (ignore) { } - } - } - }) - .on("mousedown.jstree", $.proxy(function (e) { - if(e.target === this.element[0]) { - e.preventDefault(); // prevent losing focus when clicking scroll arrows (FF, Chrome) - was_click = +(new Date()); // ie does not allow to prevent losing focus - } - }, this)) - .on("mousedown.jstree", ".jstree-ocl", function (e) { - e.preventDefault(); // prevent any node inside from losing focus when clicking the open/close icon - }) - .on("click.jstree", ".jstree-ocl", $.proxy(function (e) { - this.toggle_node(e.target); - }, this)) - .on("dblclick.jstree", ".jstree-anchor", $.proxy(function (e) { - if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } - if(this.settings.core.dblclick_toggle) { - this.toggle_node(e.target); - } - }, this)) - .on("click.jstree", ".jstree-anchor", $.proxy(function (e) { - e.preventDefault(); - if(e.currentTarget !== document.activeElement) { $(e.currentTarget).focus(); } - this.activate_node(e.currentTarget, e); - }, this)) - .on('keydown.jstree', '.jstree-anchor', $.proxy(function (e) { - if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } - if(this._data.core.rtl) { - if(e.which === 37) { e.which = 39; } - else if(e.which === 39) { e.which = 37; } - } - var f = this._kbevent_to_func(e); - if (f) { - var r = f.call(this, e); - if (r === false || r === true) { - return r; - } - } - }, this)) - .on("load_node.jstree", $.proxy(function (e, data) { - if(data.status) { - if(data.node.id === $.jstree.root && !this._data.core.loaded) { - this._data.core.loaded = true; - if(this._firstChild(this.get_container_ul()[0])) { - this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id); - } - /** - * triggered after the root node is loaded for the first time - * @event - * @name loaded.jstree - */ - this.trigger("loaded"); - } - if(!this._data.core.ready) { - setTimeout($.proxy(function() { - if(this.element && !this.get_container_ul().find('.jstree-loading').length) { - this._data.core.ready = true; - if(this._data.core.selected.length) { - if(this.settings.core.expand_selected_onload) { - var tmp = [], i, j; - for(i = 0, j = this._data.core.selected.length; i < j; i++) { - tmp = tmp.concat(this._model.data[this._data.core.selected[i]].parents); - } - tmp = $.vakata.array_unique(tmp); - for(i = 0, j = tmp.length; i < j; i++) { - this.open_node(tmp[i], false, 0); - } - } - this.trigger('changed', { 'action' : 'ready', 'selected' : this._data.core.selected }); - } - /** - * triggered after all nodes are finished loading - * @event - * @name ready.jstree - */ - this.trigger("ready"); - } - }, this), 0); - } - } - }, this)) - // quick searching when the tree is focused - .on('keypress.jstree', $.proxy(function (e) { - if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } - if(tout) { clearTimeout(tout); } - tout = setTimeout(function () { - word = ''; - }, 500); - - var chr = String.fromCharCode(e.which).toLowerCase(), - col = this.element.find('.jstree-anchor').filter(':visible'), - ind = col.index(document.activeElement) || 0, - end = false; - word += chr; - - // match for whole word from current node down (including the current node) - if(word.length > 1) { - col.slice(ind).each($.proxy(function (i, v) { - if($(v).text().toLowerCase().indexOf(word) === 0) { - $(v).focus(); - end = true; - return false; - } - }, this)); - if(end) { return; } - - // match for whole word from the beginning of the tree - col.slice(0, ind).each($.proxy(function (i, v) { - if($(v).text().toLowerCase().indexOf(word) === 0) { - $(v).focus(); - end = true; - return false; - } - }, this)); - if(end) { return; } - } - // list nodes that start with that letter (only if word consists of a single char) - if(new RegExp('^' + chr.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '+$').test(word)) { - // search for the next node starting with that letter - col.slice(ind + 1).each($.proxy(function (i, v) { - if($(v).text().toLowerCase().charAt(0) === chr) { - $(v).focus(); - end = true; - return false; - } - }, this)); - if(end) { return; } - - // search from the beginning - col.slice(0, ind + 1).each($.proxy(function (i, v) { - if($(v).text().toLowerCase().charAt(0) === chr) { - $(v).focus(); - end = true; - return false; - } - }, this)); - if(end) { return; } - } - }, this)) - // THEME RELATED - .on("init.jstree", $.proxy(function () { - var s = this.settings.core.themes; - this._data.core.themes.dots = s.dots; - this._data.core.themes.stripes = s.stripes; - this._data.core.themes.icons = s.icons; - this._data.core.themes.ellipsis = s.ellipsis; - this.set_theme(s.name || "default", s.url); - this.set_theme_variant(s.variant); - }, this)) - .on("loading.jstree", $.proxy(function () { - this[ this._data.core.themes.dots ? "show_dots" : "hide_dots" ](); - this[ this._data.core.themes.icons ? "show_icons" : "hide_icons" ](); - this[ this._data.core.themes.stripes ? "show_stripes" : "hide_stripes" ](); - this[ this._data.core.themes.ellipsis ? "show_ellipsis" : "hide_ellipsis" ](); - }, this)) - .on('blur.jstree', '.jstree-anchor', $.proxy(function (e) { - this._data.core.focused = null; - $(e.currentTarget).filter('.jstree-hovered').mouseleave(); - this.element.attr('tabindex', '0'); - }, this)) - .on('focus.jstree', '.jstree-anchor', $.proxy(function (e) { - var tmp = this.get_node(e.currentTarget); - if(tmp && tmp.id) { - this._data.core.focused = tmp.id; - } - this.element.find('.jstree-hovered').not(e.currentTarget).mouseleave(); - $(e.currentTarget).mouseenter(); - this.element.attr('tabindex', '-1'); - }, this)) - .on('focus.jstree', $.proxy(function () { - if(+(new Date()) - was_click > 500 && !this._data.core.focused && this.settings.core.restore_focus) { - was_click = 0; - var act = this.get_node(this.element.attr('aria-activedescendant'), true); - if(act) { - act.find('> .jstree-anchor').focus(); - } - } - }, this)) - .on('mouseenter.jstree', '.jstree-anchor', $.proxy(function (e) { - this.hover_node(e.currentTarget); - }, this)) - .on('mouseleave.jstree', '.jstree-anchor', $.proxy(function (e) { - this.dehover_node(e.currentTarget); - }, this)); - }, - /** - * part of the destroying of an instance. Used internally. - * @private - * @name unbind() - */ - unbind : function () { - this.element.off('.jstree'); - $(document).off('.jstree-' + this._id); - }, - /** - * trigger an event. Used internally. - * @private - * @name trigger(ev [, data]) - * @param {String} ev the name of the event to trigger - * @param {Object} data additional data to pass with the event - */ - trigger : function (ev, data) { - if(!data) { - data = {}; - } - data.instance = this; - this.element.triggerHandler(ev.replace('.jstree','') + '.jstree', data); - }, - /** - * returns the jQuery extended instance container - * @name get_container() - * @return {jQuery} - */ - get_container : function () { - return this.element; - }, - /** - * returns the jQuery extended main UL node inside the instance container. Used internally. - * @private - * @name get_container_ul() - * @return {jQuery} - */ - get_container_ul : function () { - return this.element.children(".jstree-children").first(); - }, - /** - * gets string replacements (localization). Used internally. - * @private - * @name get_string(key) - * @param {String} key - * @return {String} - */ - get_string : function (key) { - var a = this.settings.core.strings; - if($.isFunction(a)) { return a.call(this, key); } - if(a && a[key]) { return a[key]; } - return key; - }, - /** - * gets the first child of a DOM node. Used internally. - * @private - * @name _firstChild(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _firstChild : function (dom) { - dom = dom ? dom.firstChild : null; - while(dom !== null && dom.nodeType !== 1) { - dom = dom.nextSibling; - } - return dom; - }, - /** - * gets the next sibling of a DOM node. Used internally. - * @private - * @name _nextSibling(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _nextSibling : function (dom) { - dom = dom ? dom.nextSibling : null; - while(dom !== null && dom.nodeType !== 1) { - dom = dom.nextSibling; - } - return dom; - }, - /** - * gets the previous sibling of a DOM node. Used internally. - * @private - * @name _previousSibling(dom) - * @param {DOMElement} dom - * @return {DOMElement} - */ - _previousSibling : function (dom) { - dom = dom ? dom.previousSibling : null; - while(dom !== null && dom.nodeType !== 1) { - dom = dom.previousSibling; - } - return dom; - }, - /** - * get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc) - * @name get_node(obj [, as_dom]) - * @param {mixed} obj - * @param {Boolean} as_dom - * @return {Object|jQuery} - */ - get_node : function (obj, as_dom) { - if(obj && obj.id) { - obj = obj.id; - } - if (obj instanceof jQuery && obj.length && obj[0].id) { - obj = obj[0].id; - } - var dom; - try { - if(this._model.data[obj]) { - obj = this._model.data[obj]; - } - else if(typeof obj === "string" && this._model.data[obj.replace(/^#/, '')]) { - obj = this._model.data[obj.replace(/^#/, '')]; - } - else if(typeof obj === "string" && (dom = $('#' + obj.replace($.jstree.idregex,'\\$&'), this.element)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) { - obj = this._model.data[dom.closest('.jstree-node').attr('id')]; - } - else if((dom = this.element.find(obj)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) { - obj = this._model.data[dom.closest('.jstree-node').attr('id')]; - } - else if((dom = this.element.find(obj)).length && dom.hasClass('jstree')) { - obj = this._model.data[$.jstree.root]; - } - else { - return false; - } - - if(as_dom) { - obj = obj.id === $.jstree.root ? this.element : $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element); - } - return obj; - } catch (ex) { return false; } - }, - /** - * get the path to a node, either consisting of node texts, or of node IDs, optionally glued together (otherwise an array) - * @name get_path(obj [, glue, ids]) - * @param {mixed} obj the node - * @param {String} glue if you want the path as a string - pass the glue here (for example '/'), if a falsy value is supplied here, an array is returned - * @param {Boolean} ids if set to true build the path using ID, otherwise node text is used - * @return {mixed} - */ - get_path : function (obj, glue, ids) { - obj = obj.parents ? obj : this.get_node(obj); - if(!obj || obj.id === $.jstree.root || !obj.parents) { - return false; - } - var i, j, p = []; - p.push(ids ? obj.id : obj.text); - for(i = 0, j = obj.parents.length; i < j; i++) { - p.push(ids ? obj.parents[i] : this.get_text(obj.parents[i])); - } - p = p.reverse().slice(1); - return glue ? p.join(glue) : p; - }, - /** - * get the next visible node that is below the `obj` node. If `strict` is set to `true` only sibling nodes are returned. - * @name get_next_dom(obj [, strict]) - * @param {mixed} obj - * @param {Boolean} strict - * @return {jQuery} - */ - get_next_dom : function (obj, strict) { - var tmp; - obj = this.get_node(obj, true); - if(obj[0] === this.element[0]) { - tmp = this._firstChild(this.get_container_ul()[0]); - while (tmp && tmp.offsetHeight === 0) { - tmp = this._nextSibling(tmp); - } - return tmp ? $(tmp) : false; - } - if(!obj || !obj.length) { - return false; - } - if(strict) { - tmp = obj[0]; - do { - tmp = this._nextSibling(tmp); - } while (tmp && tmp.offsetHeight === 0); - return tmp ? $(tmp) : false; - } - if(obj.hasClass("jstree-open")) { - tmp = this._firstChild(obj.children('.jstree-children')[0]); - while (tmp && tmp.offsetHeight === 0) { - tmp = this._nextSibling(tmp); - } - if(tmp !== null) { - return $(tmp); - } - } - tmp = obj[0]; - do { - tmp = this._nextSibling(tmp); - } while (tmp && tmp.offsetHeight === 0); - if(tmp !== null) { - return $(tmp); - } - return obj.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first(); - }, - /** - * get the previous visible node that is above the `obj` node. If `strict` is set to `true` only sibling nodes are returned. - * @name get_prev_dom(obj [, strict]) - * @param {mixed} obj - * @param {Boolean} strict - * @return {jQuery} - */ - get_prev_dom : function (obj, strict) { - var tmp; - obj = this.get_node(obj, true); - if(obj[0] === this.element[0]) { - tmp = this.get_container_ul()[0].lastChild; - while (tmp && tmp.offsetHeight === 0) { - tmp = this._previousSibling(tmp); - } - return tmp ? $(tmp) : false; - } - if(!obj || !obj.length) { - return false; - } - if(strict) { - tmp = obj[0]; - do { - tmp = this._previousSibling(tmp); - } while (tmp && tmp.offsetHeight === 0); - return tmp ? $(tmp) : false; - } - tmp = obj[0]; - do { - tmp = this._previousSibling(tmp); - } while (tmp && tmp.offsetHeight === 0); - if(tmp !== null) { - obj = $(tmp); - while(obj.hasClass("jstree-open")) { - obj = obj.children(".jstree-children").first().children(".jstree-node:visible:last"); - } - return obj; - } - tmp = obj[0].parentNode.parentNode; - return tmp && tmp.className && tmp.className.indexOf('jstree-node') !== -1 ? $(tmp) : false; - }, - /** - * get the parent ID of a node - * @name get_parent(obj) - * @param {mixed} obj - * @return {String} - */ - get_parent : function (obj) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - return obj.parent; - }, - /** - * get a jQuery collection of all the children of a node (node must be rendered), returns false on error - * @name get_children_dom(obj) - * @param {mixed} obj - * @return {jQuery} - */ - get_children_dom : function (obj) { - obj = this.get_node(obj, true); - if(obj[0] === this.element[0]) { - return this.get_container_ul().children(".jstree-node"); - } - if(!obj || !obj.length) { - return false; - } - return obj.children(".jstree-children").children(".jstree-node"); - }, - /** - * checks if a node has children - * @name is_parent(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_parent : function (obj) { - obj = this.get_node(obj); - return obj && (obj.state.loaded === false || obj.children.length > 0); - }, - /** - * checks if a node is loaded (its children are available) - * @name is_loaded(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_loaded : function (obj) { - obj = this.get_node(obj); - return obj && obj.state.loaded; - }, - /** - * check if a node is currently loading (fetching children) - * @name is_loading(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_loading : function (obj) { - obj = this.get_node(obj); - return obj && obj.state && obj.state.loading; - }, - /** - * check if a node is opened - * @name is_open(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_open : function (obj) { - obj = this.get_node(obj); - return obj && obj.state.opened; - }, - /** - * check if a node is in a closed state - * @name is_closed(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_closed : function (obj) { - obj = this.get_node(obj); - return obj && this.is_parent(obj) && !obj.state.opened; - }, - /** - * check if a node has no children - * @name is_leaf(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_leaf : function (obj) { - return !this.is_parent(obj); - }, - /** - * loads a node (fetches its children using the `core.data` setting). Multiple nodes can be passed to by using an array. - * @name load_node(obj [, callback]) - * @param {mixed} obj - * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives two arguments - the node and a boolean status - * @return {Boolean} - * @trigger load_node.jstree - */ - load_node : function (obj, callback) { - var k, l, i, j, c; - if($.isArray(obj)) { - this._load_nodes(obj.slice(), callback); - return true; - } - obj = this.get_node(obj); - if(!obj) { - if(callback) { callback.call(this, obj, false); } - return false; - } - // if(obj.state.loading) { } // the node is already loading - just wait for it to load and invoke callback? but if called implicitly it should be loaded again? - if(obj.state.loaded) { - obj.state.loaded = false; - for(i = 0, j = obj.parents.length; i < j; i++) { - this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) { - return $.inArray(v, obj.children_d) === -1; - }); - } - for(k = 0, l = obj.children_d.length; k < l; k++) { - if(this._model.data[obj.children_d[k]].state.selected) { - c = true; - } - delete this._model.data[obj.children_d[k]]; - } - if (c) { - this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) { - return $.inArray(v, obj.children_d) === -1; - }); - } - obj.children = []; - obj.children_d = []; - if(c) { - this.trigger('changed', { 'action' : 'load_node', 'node' : obj, 'selected' : this._data.core.selected }); - } - } - obj.state.failed = false; - obj.state.loading = true; - this.get_node(obj, true).addClass("jstree-loading").attr('aria-busy',true); - this._load_node(obj, $.proxy(function (status) { - obj = this._model.data[obj.id]; - obj.state.loading = false; - obj.state.loaded = status; - obj.state.failed = !obj.state.loaded; - var dom = this.get_node(obj, true), i = 0, j = 0, m = this._model.data, has_children = false; - for(i = 0, j = obj.children.length; i < j; i++) { - if(m[obj.children[i]] && !m[obj.children[i]].state.hidden) { - has_children = true; - break; - } - } - if(obj.state.loaded && dom && dom.length) { - dom.removeClass('jstree-closed jstree-open jstree-leaf'); - if (!has_children) { - dom.addClass('jstree-leaf'); - } - else { - if (obj.id !== '#') { - dom.addClass(obj.state.opened ? 'jstree-open' : 'jstree-closed'); - } - } - } - dom.removeClass("jstree-loading").attr('aria-busy',false); - /** - * triggered after a node is loaded - * @event - * @name load_node.jstree - * @param {Object} node the node that was loading - * @param {Boolean} status was the node loaded successfully - */ - this.trigger('load_node', { "node" : obj, "status" : status }); - if(callback) { - callback.call(this, obj, status); - } - }, this)); - return true; - }, - /** - * load an array of nodes (will also load unavailable nodes as soon as they appear in the structure). Used internally. - * @private - * @name _load_nodes(nodes [, callback]) - * @param {array} nodes - * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes - */ - _load_nodes : function (nodes, callback, is_callback, force_reload) { - var r = true, - c = function () { this._load_nodes(nodes, callback, true); }, - m = this._model.data, i, j, tmp = []; - for(i = 0, j = nodes.length; i < j; i++) { - if(m[nodes[i]] && ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || (!is_callback && force_reload) )) { - if(!this.is_loading(nodes[i])) { - this.load_node(nodes[i], c); - } - r = false; - } - } - if(r) { - for(i = 0, j = nodes.length; i < j; i++) { - if(m[nodes[i]] && m[nodes[i]].state.loaded) { - tmp.push(nodes[i]); - } - } - if(callback && !callback.done) { - callback.call(this, tmp); - callback.done = true; - } - } - }, - /** - * loads all unloaded nodes - * @name load_all([obj, callback]) - * @param {mixed} obj the node to load recursively, omit to load all nodes in the tree - * @param {function} callback a function to be executed once loading all the nodes is complete, - * @trigger load_all.jstree - */ - load_all : function (obj, callback) { - if(!obj) { obj = $.jstree.root; } - obj = this.get_node(obj); - if(!obj) { return false; } - var to_load = [], - m = this._model.data, - c = m[obj.id].children_d, - i, j; - if(obj.state && !obj.state.loaded) { - to_load.push(obj.id); - } - for(i = 0, j = c.length; i < j; i++) { - if(m[c[i]] && m[c[i]].state && !m[c[i]].state.loaded) { - to_load.push(c[i]); - } - } - if(to_load.length) { - this._load_nodes(to_load, function () { - this.load_all(obj, callback); - }); - } - else { - /** - * triggered after a load_all call completes - * @event - * @name load_all.jstree - * @param {Object} node the recursively loaded node - */ - if(callback) { callback.call(this, obj); } - this.trigger('load_all', { "node" : obj }); - } - }, - /** - * handles the actual loading of a node. Used only internally. - * @private - * @name _load_node(obj [, callback]) - * @param {mixed} obj - * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status - * @return {Boolean} - */ - _load_node : function (obj, callback) { - var s = this.settings.core.data, t; - var notTextOrCommentNode = function notTextOrCommentNode () { - return this.nodeType !== 3 && this.nodeType !== 8; - }; - // use original HTML - if(!s) { - if(obj.id === $.jstree.root) { - return this._append_html_data(obj, this._data.core.original_container_html.clone(true), function (status) { - callback.call(this, status); - }); - } - else { - return callback.call(this, false); - } - // return callback.call(this, obj.id === $.jstree.root ? this._append_html_data(obj, this._data.core.original_container_html.clone(true)) : false); - } - if($.isFunction(s)) { - return s.call(this, obj, $.proxy(function (d) { - if(d === false) { - callback.call(this, false); - } - else { - this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $($.parseHTML(d)).filter(notTextOrCommentNode) : d, function (status) { - callback.call(this, status); - }); - } - // return d === false ? callback.call(this, false) : callback.call(this, this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $(d) : d)); - }, this)); - } - if(typeof s === 'object') { - if(s.url) { - s = $.extend(true, {}, s); - if($.isFunction(s.url)) { - s.url = s.url.call(this, obj); - } - if($.isFunction(s.data)) { - s.data = s.data.call(this, obj); - } - return $.ajax(s) - .done($.proxy(function (d,t,x) { - var type = x.getResponseHeader('Content-Type'); - if((type && type.indexOf('json') !== -1) || typeof d === "object") { - return this._append_json_data(obj, d, function (status) { callback.call(this, status); }); - //return callback.call(this, this._append_json_data(obj, d)); - } - if((type && type.indexOf('html') !== -1) || typeof d === "string") { - return this._append_html_data(obj, $($.parseHTML(d)).filter(notTextOrCommentNode), function (status) { callback.call(this, status); }); - // return callback.call(this, this._append_html_data(obj, $(d))); - } - this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : x }) }; - this.settings.core.error.call(this, this._data.core.last_error); - return callback.call(this, false); - }, this)) - .fail($.proxy(function (f) { - this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : f }) }; - callback.call(this, false); - this.settings.core.error.call(this, this._data.core.last_error); - }, this)); - } - if ($.isArray(s)) { - t = $.extend(true, [], s); - } else if ($.isPlainObject(s)) { - t = $.extend(true, {}, s); - } else { - t = s; - } - if(obj.id === $.jstree.root) { - return this._append_json_data(obj, t, function (status) { - callback.call(this, status); - }); - } - else { - this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_05', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) }; - this.settings.core.error.call(this, this._data.core.last_error); - return callback.call(this, false); - } - //return callback.call(this, (obj.id === $.jstree.root ? this._append_json_data(obj, t) : false) ); - } - if(typeof s === 'string') { - if(obj.id === $.jstree.root) { - return this._append_html_data(obj, $($.parseHTML(s)).filter(notTextOrCommentNode), function (status) { - callback.call(this, status); - }); - } - else { - this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_06', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) }; - this.settings.core.error.call(this, this._data.core.last_error); - return callback.call(this, false); - } - //return callback.call(this, (obj.id === $.jstree.root ? this._append_html_data(obj, $(s)) : false) ); - } - return callback.call(this, false); - }, - /** - * adds a node to the list of nodes to redraw. Used only internally. - * @private - * @name _node_changed(obj [, callback]) - * @param {mixed} obj - */ - _node_changed : function (obj) { - obj = this.get_node(obj); - if (obj && $.inArray(obj.id, this._model.changed) === -1) { - this._model.changed.push(obj.id); - } - }, - /** - * appends HTML content to the tree. Used internally. - * @private - * @name _append_html_data(obj, data) - * @param {mixed} obj the node to append to - * @param {String} data the HTML string to parse and append - * @trigger model.jstree, changed.jstree - */ - _append_html_data : function (dom, data, cb) { - dom = this.get_node(dom); - dom.children = []; - dom.children_d = []; - var dat = data.is('ul') ? data.children() : data, - par = dom.id, - chd = [], - dpc = [], - m = this._model.data, - p = m[par], - s = this._data.core.selected.length, - tmp, i, j; - dat.each($.proxy(function (i, v) { - tmp = this._parse_model_from_html($(v), par, p.parents.concat()); - if(tmp) { - chd.push(tmp); - dpc.push(tmp); - if(m[tmp].children_d.length) { - dpc = dpc.concat(m[tmp].children_d); - } - } - }, this)); - p.children = chd; - p.children_d = dpc; - for(i = 0, j = p.parents.length; i < j; i++) { - m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); - } - /** - * triggered when new data is inserted to the tree model - * @event - * @name model.jstree - * @param {Array} nodes an array of node IDs - * @param {String} parent the parent ID of the nodes - */ - this.trigger('model', { "nodes" : dpc, 'parent' : par }); - if(par !== $.jstree.root) { - this._node_changed(par); - this.redraw(); - } - else { - this.get_container_ul().children('.jstree-initial-node').remove(); - this.redraw(true); - } - if(this._data.core.selected.length !== s) { - this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected }); - } - cb.call(this, true); - }, - /** - * appends JSON content to the tree. Used internally. - * @private - * @name _append_json_data(obj, data) - * @param {mixed} obj the node to append to - * @param {String} data the JSON object to parse and append - * @param {Boolean} force_processing internal param - do not set - * @trigger model.jstree, changed.jstree - */ - _append_json_data : function (dom, data, cb, force_processing) { - if(this.element === null) { return; } - dom = this.get_node(dom); - dom.children = []; - dom.children_d = []; - // *%$@!!! - if(data.d) { - data = data.d; - if(typeof data === "string") { - data = JSON.parse(data); - } - } - if(!$.isArray(data)) { data = [data]; } - var w = null, - args = { - 'df' : this._model.default_state, - 'dat' : data, - 'par' : dom.id, - 'm' : this._model.data, - 't_id' : this._id, - 't_cnt' : this._cnt, - 'sel' : this._data.core.selected - }, - func = function (data, undefined) { - if(data.data) { data = data.data; } - var dat = data.dat, - par = data.par, - chd = [], - dpc = [], - add = [], - df = data.df, - t_id = data.t_id, - t_cnt = data.t_cnt, - m = data.m, - p = m[par], - sel = data.sel, - tmp, i, j, rslt, - parse_flat = function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = ps.concat(); } - if(p) { ps.unshift(p); } - var tid = d.id.toString(), - i, j, c, e, - tmp = { - id : tid, - text : d.text || '', - icon : d.icon !== undefined ? d.icon : true, - parent : p, - parents : ps, - children : d.children || [], - children_d : d.children_d || [], - data : d.data, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }; - for(i in df) { - if(df.hasOwnProperty(i)) { - tmp.state[i] = df[i]; - } - } - if(d && d.data && d.data.jstree && d.data.jstree.icon) { - tmp.icon = d.data.jstree.icon; - } - if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { - tmp.icon = true; - } - if(d && d.data) { - tmp.data = d.data; - if(d.data.jstree) { - for(i in d.data.jstree) { - if(d.data.jstree.hasOwnProperty(i)) { - tmp.state[i] = d.data.jstree[i]; - } - } - } - } - if(d && typeof d.state === 'object') { - for (i in d.state) { - if(d.state.hasOwnProperty(i)) { - tmp.state[i] = d.state[i]; - } - } - } - if(d && typeof d.li_attr === 'object') { - for (i in d.li_attr) { - if(d.li_attr.hasOwnProperty(i)) { - tmp.li_attr[i] = d.li_attr[i]; - } - } - } - if(!tmp.li_attr.id) { - tmp.li_attr.id = tid; - } - if(d && typeof d.a_attr === 'object') { - for (i in d.a_attr) { - if(d.a_attr.hasOwnProperty(i)) { - tmp.a_attr[i] = d.a_attr[i]; - } - } - } - if(d && d.children && d.children === true) { - tmp.state.loaded = false; - tmp.children = []; - tmp.children_d = []; - } - m[tmp.id] = tmp; - for(i = 0, j = tmp.children.length; i < j; i++) { - c = parse_flat(m[tmp.children[i]], tmp.id, ps); - e = m[c]; - tmp.children_d.push(c); - if(e.children_d.length) { - tmp.children_d = tmp.children_d.concat(e.children_d); - } - } - delete d.data; - delete d.children; - m[tmp.id].original = d; - if(tmp.state.selected) { - add.push(tmp.id); - } - return tmp.id; - }, - parse_nest = function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = ps.concat(); } - if(p) { ps.unshift(p); } - var tid = false, i, j, c, e, tmp; - do { - tid = 'j' + t_id + '_' + (++t_cnt); - } while(m[tid]); - - tmp = { - id : false, - text : typeof d === 'string' ? d : '', - icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true, - parent : p, - parents : ps, - children : [], - children_d : [], - data : null, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }; - for(i in df) { - if(df.hasOwnProperty(i)) { - tmp.state[i] = df[i]; - } - } - if(d && d.id) { tmp.id = d.id.toString(); } - if(d && d.text) { tmp.text = d.text; } - if(d && d.data && d.data.jstree && d.data.jstree.icon) { - tmp.icon = d.data.jstree.icon; - } - if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { - tmp.icon = true; - } - if(d && d.data) { - tmp.data = d.data; - if(d.data.jstree) { - for(i in d.data.jstree) { - if(d.data.jstree.hasOwnProperty(i)) { - tmp.state[i] = d.data.jstree[i]; - } - } - } - } - if(d && typeof d.state === 'object') { - for (i in d.state) { - if(d.state.hasOwnProperty(i)) { - tmp.state[i] = d.state[i]; - } - } - } - if(d && typeof d.li_attr === 'object') { - for (i in d.li_attr) { - if(d.li_attr.hasOwnProperty(i)) { - tmp.li_attr[i] = d.li_attr[i]; - } - } - } - if(tmp.li_attr.id && !tmp.id) { - tmp.id = tmp.li_attr.id.toString(); - } - if(!tmp.id) { - tmp.id = tid; - } - if(!tmp.li_attr.id) { - tmp.li_attr.id = tmp.id; - } - if(d && typeof d.a_attr === 'object') { - for (i in d.a_attr) { - if(d.a_attr.hasOwnProperty(i)) { - tmp.a_attr[i] = d.a_attr[i]; - } - } - } - if(d && d.children && d.children.length) { - for(i = 0, j = d.children.length; i < j; i++) { - c = parse_nest(d.children[i], tmp.id, ps); - e = m[c]; - tmp.children.push(c); - if(e.children_d.length) { - tmp.children_d = tmp.children_d.concat(e.children_d); - } - } - tmp.children_d = tmp.children_d.concat(tmp.children); - } - if(d && d.children && d.children === true) { - tmp.state.loaded = false; - tmp.children = []; - tmp.children_d = []; - } - delete d.data; - delete d.children; - tmp.original = d; - m[tmp.id] = tmp; - if(tmp.state.selected) { - add.push(tmp.id); - } - return tmp.id; - }; - - if(dat.length && dat[0].id !== undefined && dat[0].parent !== undefined) { - // Flat JSON support (for easy import from DB): - // 1) convert to object (foreach) - for(i = 0, j = dat.length; i < j; i++) { - if(!dat[i].children) { - dat[i].children = []; - } - if(!dat[i].state) { - dat[i].state = {}; - } - m[dat[i].id.toString()] = dat[i]; - } - // 2) populate children (foreach) - for(i = 0, j = dat.length; i < j; i++) { - if (!m[dat[i].parent.toString()]) { - this._data.core.last_error = { 'error' : 'parse', 'plugin' : 'core', 'id' : 'core_07', 'reason' : 'Node with invalid parent', 'data' : JSON.stringify({ 'id' : dat[i].id.toString(), 'parent' : dat[i].parent.toString() }) }; - this.settings.core.error.call(this, this._data.core.last_error); - continue; - } - - m[dat[i].parent.toString()].children.push(dat[i].id.toString()); - // populate parent.children_d - p.children_d.push(dat[i].id.toString()); - } - // 3) normalize && populate parents and children_d with recursion - for(i = 0, j = p.children.length; i < j; i++) { - tmp = parse_flat(m[p.children[i]], par, p.parents.concat()); - dpc.push(tmp); - if(m[tmp].children_d.length) { - dpc = dpc.concat(m[tmp].children_d); - } - } - for(i = 0, j = p.parents.length; i < j; i++) { - m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); - } - // ?) three_state selection - p.state.selected && t - (if three_state foreach(dat => ch) -> foreach(parents) if(parent.selected) child.selected = true; - rslt = { - 'cnt' : t_cnt, - 'mod' : m, - 'sel' : sel, - 'par' : par, - 'dpc' : dpc, - 'add' : add - }; - } - else { - for(i = 0, j = dat.length; i < j; i++) { - tmp = parse_nest(dat[i], par, p.parents.concat()); - if(tmp) { - chd.push(tmp); - dpc.push(tmp); - if(m[tmp].children_d.length) { - dpc = dpc.concat(m[tmp].children_d); - } - } - } - p.children = chd; - p.children_d = dpc; - for(i = 0, j = p.parents.length; i < j; i++) { - m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); - } - rslt = { - 'cnt' : t_cnt, - 'mod' : m, - 'sel' : sel, - 'par' : par, - 'dpc' : dpc, - 'add' : add - }; - } - if(typeof window === 'undefined' || typeof window.document === 'undefined') { - postMessage(rslt); - } - else { - return rslt; - } - }, - rslt = function (rslt, worker) { - if(this.element === null) { return; } - this._cnt = rslt.cnt; - var i, m = this._model.data; - for (i in m) { - if (m.hasOwnProperty(i) && m[i].state && m[i].state.loading && rslt.mod[i]) { - rslt.mod[i].state.loading = true; - } - } - this._model.data = rslt.mod; // breaks the reference in load_node - careful - - if(worker) { - var j, a = rslt.add, r = rslt.sel, s = this._data.core.selected.slice(); - m = this._model.data; - // if selection was changed while calculating in worker - if(r.length !== s.length || $.vakata.array_unique(r.concat(s)).length !== r.length) { - // deselect nodes that are no longer selected - for(i = 0, j = r.length; i < j; i++) { - if($.inArray(r[i], a) === -1 && $.inArray(r[i], s) === -1) { - m[r[i]].state.selected = false; - } - } - // select nodes that were selected in the mean time - for(i = 0, j = s.length; i < j; i++) { - if($.inArray(s[i], r) === -1) { - m[s[i]].state.selected = true; - } - } - } - } - if(rslt.add.length) { - this._data.core.selected = this._data.core.selected.concat(rslt.add); - } - - this.trigger('model', { "nodes" : rslt.dpc, 'parent' : rslt.par }); - - if(rslt.par !== $.jstree.root) { - this._node_changed(rslt.par); - this.redraw(); - } - else { - // this.get_container_ul().children('.jstree-initial-node').remove(); - this.redraw(true); - } - if(rslt.add.length) { - this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected }); - } - cb.call(this, true); - }; - if(this.settings.core.worker && window.Blob && window.URL && window.Worker) { - try { - if(this._wrk === null) { - this._wrk = window.URL.createObjectURL( - new window.Blob( - ['self.onmessage = ' + func.toString()], - {type:"text/javascript"} - ) - ); - } - if(!this._data.core.working || force_processing) { - this._data.core.working = true; - w = new window.Worker(this._wrk); - w.onmessage = $.proxy(function (e) { - rslt.call(this, e.data, true); - try { w.terminate(); w = null; } catch(ignore) { } - if(this._data.core.worker_queue.length) { - this._append_json_data.apply(this, this._data.core.worker_queue.shift()); - } - else { - this._data.core.working = false; - } - }, this); - if(!args.par) { - if(this._data.core.worker_queue.length) { - this._append_json_data.apply(this, this._data.core.worker_queue.shift()); - } - else { - this._data.core.working = false; - } - } - else { - w.postMessage(args); - } - } - else { - this._data.core.worker_queue.push([dom, data, cb, true]); - } - } - catch(e) { - rslt.call(this, func(args), false); - if(this._data.core.worker_queue.length) { - this._append_json_data.apply(this, this._data.core.worker_queue.shift()); - } - else { - this._data.core.working = false; - } - } - } - else { - rslt.call(this, func(args), false); - } - }, - /** - * parses a node from a jQuery object and appends them to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_html(d [, p, ps]) - * @param {jQuery} d the jQuery object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_html : function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = [].concat(ps); } - if(p) { ps.unshift(p); } - var c, e, m = this._model.data, - data = { - id : false, - text : false, - icon : true, - parent : p, - parents : ps, - children : [], - children_d : [], - data : null, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }, i, tmp, tid; - for(i in this._model.default_state) { - if(this._model.default_state.hasOwnProperty(i)) { - data.state[i] = this._model.default_state[i]; - } - } - tmp = $.vakata.attributes(d, true); - $.each(tmp, function (i, v) { - v = $.trim(v); - if(!v.length) { return true; } - data.li_attr[i] = v; - if(i === 'id') { - data.id = v.toString(); - } - }); - tmp = d.children('a').first(); - if(tmp.length) { - tmp = $.vakata.attributes(tmp, true); - $.each(tmp, function (i, v) { - v = $.trim(v); - if(v.length) { - data.a_attr[i] = v; - } - }); - } - tmp = d.children("a").first().length ? d.children("a").first().clone() : d.clone(); - tmp.children("ins, i, ul").remove(); - tmp = tmp.html(); - tmp = $('
').html(tmp); - data.text = this.settings.core.force_text ? tmp.text() : tmp.html(); - tmp = d.data(); - data.data = tmp ? $.extend(true, {}, tmp) : null; - data.state.opened = d.hasClass('jstree-open'); - data.state.selected = d.children('a').hasClass('jstree-clicked'); - data.state.disabled = d.children('a').hasClass('jstree-disabled'); - if(data.data && data.data.jstree) { - for(i in data.data.jstree) { - if(data.data.jstree.hasOwnProperty(i)) { - data.state[i] = data.data.jstree[i]; - } - } - } - tmp = d.children("a").children(".jstree-themeicon"); - if(tmp.length) { - data.icon = tmp.hasClass('jstree-themeicon-hidden') ? false : tmp.attr('rel'); - } - if(data.state.icon !== undefined) { - data.icon = data.state.icon; - } - if(data.icon === undefined || data.icon === null || data.icon === "") { - data.icon = true; - } - tmp = d.children("ul").children("li"); - do { - tid = 'j' + this._id + '_' + (++this._cnt); - } while(m[tid]); - data.id = data.li_attr.id ? data.li_attr.id.toString() : tid; - if(tmp.length) { - tmp.each($.proxy(function (i, v) { - c = this._parse_model_from_html($(v), data.id, ps); - e = this._model.data[c]; - data.children.push(c); - if(e.children_d.length) { - data.children_d = data.children_d.concat(e.children_d); - } - }, this)); - data.children_d = data.children_d.concat(data.children); - } - else { - if(d.hasClass('jstree-closed')) { - data.state.loaded = false; - } - } - if(data.li_attr['class']) { - data.li_attr['class'] = data.li_attr['class'].replace('jstree-closed','').replace('jstree-open',''); - } - if(data.a_attr['class']) { - data.a_attr['class'] = data.a_attr['class'].replace('jstree-clicked','').replace('jstree-disabled',''); - } - m[data.id] = data; - if(data.state.selected) { - this._data.core.selected.push(data.id); - } - return data.id; - }, - /** - * parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_flat_json(d [, p, ps]) - * @param {Object} d the JSON object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_flat_json : function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = ps.concat(); } - if(p) { ps.unshift(p); } - var tid = d.id.toString(), - m = this._model.data, - df = this._model.default_state, - i, j, c, e, - tmp = { - id : tid, - text : d.text || '', - icon : d.icon !== undefined ? d.icon : true, - parent : p, - parents : ps, - children : d.children || [], - children_d : d.children_d || [], - data : d.data, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }; - for(i in df) { - if(df.hasOwnProperty(i)) { - tmp.state[i] = df[i]; - } - } - if(d && d.data && d.data.jstree && d.data.jstree.icon) { - tmp.icon = d.data.jstree.icon; - } - if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { - tmp.icon = true; - } - if(d && d.data) { - tmp.data = d.data; - if(d.data.jstree) { - for(i in d.data.jstree) { - if(d.data.jstree.hasOwnProperty(i)) { - tmp.state[i] = d.data.jstree[i]; - } - } - } - } - if(d && typeof d.state === 'object') { - for (i in d.state) { - if(d.state.hasOwnProperty(i)) { - tmp.state[i] = d.state[i]; - } - } - } - if(d && typeof d.li_attr === 'object') { - for (i in d.li_attr) { - if(d.li_attr.hasOwnProperty(i)) { - tmp.li_attr[i] = d.li_attr[i]; - } - } - } - if(!tmp.li_attr.id) { - tmp.li_attr.id = tid; - } - if(d && typeof d.a_attr === 'object') { - for (i in d.a_attr) { - if(d.a_attr.hasOwnProperty(i)) { - tmp.a_attr[i] = d.a_attr[i]; - } - } - } - if(d && d.children && d.children === true) { - tmp.state.loaded = false; - tmp.children = []; - tmp.children_d = []; - } - m[tmp.id] = tmp; - for(i = 0, j = tmp.children.length; i < j; i++) { - c = this._parse_model_from_flat_json(m[tmp.children[i]], tmp.id, ps); - e = m[c]; - tmp.children_d.push(c); - if(e.children_d.length) { - tmp.children_d = tmp.children_d.concat(e.children_d); - } - } - delete d.data; - delete d.children; - m[tmp.id].original = d; - if(tmp.state.selected) { - this._data.core.selected.push(tmp.id); - } - return tmp.id; - }, - /** - * parses a node from a JSON object and appends it to the in memory tree model. Used internally. - * @private - * @name _parse_model_from_json(d [, p, ps]) - * @param {Object} d the JSON object to parse - * @param {String} p the parent ID - * @param {Array} ps list of all parents - * @return {String} the ID of the object added to the model - */ - _parse_model_from_json : function (d, p, ps) { - if(!ps) { ps = []; } - else { ps = ps.concat(); } - if(p) { ps.unshift(p); } - var tid = false, i, j, c, e, m = this._model.data, df = this._model.default_state, tmp; - do { - tid = 'j' + this._id + '_' + (++this._cnt); - } while(m[tid]); - - tmp = { - id : false, - text : typeof d === 'string' ? d : '', - icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true, - parent : p, - parents : ps, - children : [], - children_d : [], - data : null, - state : { }, - li_attr : { id : false }, - a_attr : { href : '#' }, - original : false - }; - for(i in df) { - if(df.hasOwnProperty(i)) { - tmp.state[i] = df[i]; - } - } - if(d && d.id) { tmp.id = d.id.toString(); } - if(d && d.text) { tmp.text = d.text; } - if(d && d.data && d.data.jstree && d.data.jstree.icon) { - tmp.icon = d.data.jstree.icon; - } - if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { - tmp.icon = true; - } - if(d && d.data) { - tmp.data = d.data; - if(d.data.jstree) { - for(i in d.data.jstree) { - if(d.data.jstree.hasOwnProperty(i)) { - tmp.state[i] = d.data.jstree[i]; - } - } - } - } - if(d && typeof d.state === 'object') { - for (i in d.state) { - if(d.state.hasOwnProperty(i)) { - tmp.state[i] = d.state[i]; - } - } - } - if(d && typeof d.li_attr === 'object') { - for (i in d.li_attr) { - if(d.li_attr.hasOwnProperty(i)) { - tmp.li_attr[i] = d.li_attr[i]; - } - } - } - if(tmp.li_attr.id && !tmp.id) { - tmp.id = tmp.li_attr.id.toString(); - } - if(!tmp.id) { - tmp.id = tid; - } - if(!tmp.li_attr.id) { - tmp.li_attr.id = tmp.id; - } - if(d && typeof d.a_attr === 'object') { - for (i in d.a_attr) { - if(d.a_attr.hasOwnProperty(i)) { - tmp.a_attr[i] = d.a_attr[i]; - } - } - } - if(d && d.children && d.children.length) { - for(i = 0, j = d.children.length; i < j; i++) { - c = this._parse_model_from_json(d.children[i], tmp.id, ps); - e = m[c]; - tmp.children.push(c); - if(e.children_d.length) { - tmp.children_d = tmp.children_d.concat(e.children_d); - } - } - tmp.children_d = tmp.children_d.concat(tmp.children); - } - if(d && d.children && d.children === true) { - tmp.state.loaded = false; - tmp.children = []; - tmp.children_d = []; - } - delete d.data; - delete d.children; - tmp.original = d; - m[tmp.id] = tmp; - if(tmp.state.selected) { - this._data.core.selected.push(tmp.id); - } - return tmp.id; - }, - /** - * redraws all nodes that need to be redrawn. Used internally. - * @private - * @name _redraw() - * @trigger redraw.jstree - */ - _redraw : function () { - var nodes = this._model.force_full_redraw ? this._model.data[$.jstree.root].children.concat([]) : this._model.changed.concat([]), - f = document.createElement('UL'), tmp, i, j, fe = this._data.core.focused; - for(i = 0, j = nodes.length; i < j; i++) { - tmp = this.redraw_node(nodes[i], true, this._model.force_full_redraw); - if(tmp && this._model.force_full_redraw) { - f.appendChild(tmp); - } - } - if(this._model.force_full_redraw) { - f.className = this.get_container_ul()[0].className; - f.setAttribute('role','group'); - this.element.empty().append(f); - //this.get_container_ul()[0].appendChild(f); - } - if(fe !== null && this.settings.core.restore_focus) { - tmp = this.get_node(fe, true); - if(tmp && tmp.length && tmp.children('.jstree-anchor')[0] !== document.activeElement) { - tmp.children('.jstree-anchor').focus(); - } - else { - this._data.core.focused = null; - } - } - this._model.force_full_redraw = false; - this._model.changed = []; - /** - * triggered after nodes are redrawn - * @event - * @name redraw.jstree - * @param {array} nodes the redrawn nodes - */ - this.trigger('redraw', { "nodes" : nodes }); - }, - /** - * redraws all nodes that need to be redrawn or optionally - the whole tree - * @name redraw([full]) - * @param {Boolean} full if set to `true` all nodes are redrawn. - */ - redraw : function (full) { - if(full) { - this._model.force_full_redraw = true; - } - //if(this._model.redraw_timeout) { - // clearTimeout(this._model.redraw_timeout); - //} - //this._model.redraw_timeout = setTimeout($.proxy(this._redraw, this),0); - this._redraw(); - }, - /** - * redraws a single node's children. Used internally. - * @private - * @name draw_children(node) - * @param {mixed} node the node whose children will be redrawn - */ - draw_children : function (node) { - var obj = this.get_node(node), - i = false, - j = false, - k = false, - d = document; - if(!obj) { return false; } - if(obj.id === $.jstree.root) { return this.redraw(true); } - node = this.get_node(node, true); - if(!node || !node.length) { return false; } // TODO: quick toggle - - node.children('.jstree-children').remove(); - node = node[0]; - if(obj.children.length && obj.state.loaded) { - k = d.createElement('UL'); - k.setAttribute('role', 'group'); - k.className = 'jstree-children'; - for(i = 0, j = obj.children.length; i < j; i++) { - k.appendChild(this.redraw_node(obj.children[i], true, true)); - } - node.appendChild(k); - } - }, - /** - * redraws a single node. Used internally. - * @private - * @name redraw_node(node, deep, is_callback, force_render) - * @param {mixed} node the node to redraw - * @param {Boolean} deep should child nodes be redrawn too - * @param {Boolean} is_callback is this a recursion call - * @param {Boolean} force_render should children of closed parents be drawn anyway - */ - redraw_node : function (node, deep, is_callback, force_render) { - var obj = this.get_node(node), - par = false, - ind = false, - old = false, - i = false, - j = false, - k = false, - c = '', - d = document, - m = this._model.data, - f = false, - s = false, - tmp = null, - t = 0, - l = 0, - has_children = false, - last_sibling = false; - if(!obj) { return false; } - if(obj.id === $.jstree.root) { return this.redraw(true); } - deep = deep || obj.children.length === 0; - node = !document.querySelector ? document.getElementById(obj.id) : this.element[0].querySelector('#' + ("0123456789".indexOf(obj.id[0]) !== -1 ? '\\3' + obj.id[0] + ' ' + obj.id.substr(1).replace($.jstree.idregex,'\\$&') : obj.id.replace($.jstree.idregex,'\\$&')) ); //, this.element); - if(!node) { - deep = true; - //node = d.createElement('LI'); - if(!is_callback) { - par = obj.parent !== $.jstree.root ? $('#' + obj.parent.replace($.jstree.idregex,'\\$&'), this.element)[0] : null; - if(par !== null && (!par || !m[obj.parent].state.opened)) { - return false; - } - ind = $.inArray(obj.id, par === null ? m[$.jstree.root].children : m[obj.parent].children); - } - } - else { - node = $(node); - if(!is_callback) { - par = node.parent().parent()[0]; - if(par === this.element[0]) { - par = null; - } - ind = node.index(); - } - // m[obj.id].data = node.data(); // use only node's data, no need to touch jquery storage - if(!deep && obj.children.length && !node.children('.jstree-children').length) { - deep = true; - } - if(!deep) { - old = node.children('.jstree-children')[0]; - } - f = node.children('.jstree-anchor')[0] === document.activeElement; - node.remove(); - //node = d.createElement('LI'); - //node = node[0]; - } - node = this._data.core.node.cloneNode(true); - // node is DOM, deep is boolean - - c = 'jstree-node '; - for(i in obj.li_attr) { - if(obj.li_attr.hasOwnProperty(i)) { - if(i === 'id') { continue; } - if(i !== 'class') { - node.setAttribute(i, obj.li_attr[i]); - } - else { - c += obj.li_attr[i]; - } - } - } - if(!obj.a_attr.id) { - obj.a_attr.id = obj.id + '_anchor'; - } - node.setAttribute('aria-selected', !!obj.state.selected); - node.setAttribute('aria-level', obj.parents.length); - node.setAttribute('aria-labelledby', obj.a_attr.id); - if(obj.state.disabled) { - node.setAttribute('aria-disabled', true); - } - - for(i = 0, j = obj.children.length; i < j; i++) { - if(!m[obj.children[i]].state.hidden) { - has_children = true; - break; - } - } - if(obj.parent !== null && m[obj.parent] && !obj.state.hidden) { - i = $.inArray(obj.id, m[obj.parent].children); - last_sibling = obj.id; - if(i !== -1) { - i++; - for(j = m[obj.parent].children.length; i < j; i++) { - if(!m[m[obj.parent].children[i]].state.hidden) { - last_sibling = m[obj.parent].children[i]; - } - if(last_sibling !== obj.id) { - break; - } - } - } - } - - if(obj.state.hidden) { - c += ' jstree-hidden'; - } - if (obj.state.loading) { - c += ' jstree-loading'; - } - if(obj.state.loaded && !has_children) { - c += ' jstree-leaf'; - } - else { - c += obj.state.opened && obj.state.loaded ? ' jstree-open' : ' jstree-closed'; - node.setAttribute('aria-expanded', (obj.state.opened && obj.state.loaded) ); - } - if(last_sibling === obj.id) { - c += ' jstree-last'; - } - node.id = obj.id; - node.className = c; - c = ( obj.state.selected ? ' jstree-clicked' : '') + ( obj.state.disabled ? ' jstree-disabled' : ''); - for(j in obj.a_attr) { - if(obj.a_attr.hasOwnProperty(j)) { - if(j === 'href' && obj.a_attr[j] === '#') { continue; } - if(j !== 'class') { - node.childNodes[1].setAttribute(j, obj.a_attr[j]); - } - else { - c += ' ' + obj.a_attr[j]; - } - } - } - if(c.length) { - node.childNodes[1].className = 'jstree-anchor ' + c; - } - if((obj.icon && obj.icon !== true) || obj.icon === false) { - if(obj.icon === false) { - node.childNodes[1].childNodes[0].className += ' jstree-themeicon-hidden'; - } - else if(obj.icon.indexOf('/') === -1 && obj.icon.indexOf('.') === -1) { - node.childNodes[1].childNodes[0].className += ' ' + obj.icon + ' jstree-themeicon-custom'; - } - else { - node.childNodes[1].childNodes[0].style.backgroundImage = 'url("'+obj.icon+'")'; - node.childNodes[1].childNodes[0].style.backgroundPosition = 'center center'; - node.childNodes[1].childNodes[0].style.backgroundSize = 'auto'; - node.childNodes[1].childNodes[0].className += ' jstree-themeicon-custom'; - } - } - - if(this.settings.core.force_text) { - node.childNodes[1].appendChild(d.createTextNode(obj.text)); - } - else { - node.childNodes[1].innerHTML += obj.text; - } - - - if(deep && obj.children.length && (obj.state.opened || force_render) && obj.state.loaded) { - k = d.createElement('UL'); - k.setAttribute('role', 'group'); - k.className = 'jstree-children'; - for(i = 0, j = obj.children.length; i < j; i++) { - k.appendChild(this.redraw_node(obj.children[i], deep, true)); - } - node.appendChild(k); - } - if(old) { - node.appendChild(old); - } - if(!is_callback) { - // append back using par / ind - if(!par) { - par = this.element[0]; - } - for(i = 0, j = par.childNodes.length; i < j; i++) { - if(par.childNodes[i] && par.childNodes[i].className && par.childNodes[i].className.indexOf('jstree-children') !== -1) { - tmp = par.childNodes[i]; - break; - } - } - if(!tmp) { - tmp = d.createElement('UL'); - tmp.setAttribute('role', 'group'); - tmp.className = 'jstree-children'; - par.appendChild(tmp); - } - par = tmp; - - if(ind < par.childNodes.length) { - par.insertBefore(node, par.childNodes[ind]); - } - else { - par.appendChild(node); - } - if(f) { - t = this.element[0].scrollTop; - l = this.element[0].scrollLeft; - node.childNodes[1].focus(); - this.element[0].scrollTop = t; - this.element[0].scrollLeft = l; - } - } - if(obj.state.opened && !obj.state.loaded) { - obj.state.opened = false; - setTimeout($.proxy(function () { - this.open_node(obj.id, false, 0); - }, this), 0); - } - return node; - }, - /** - * opens a node, revealing its children. If the node is not loaded it will be loaded and opened once ready. - * @name open_node(obj [, callback, animation]) - * @param {mixed} obj the node to open - * @param {Function} callback a function to execute once the node is opened - * @param {Number} animation the animation duration in milliseconds when opening the node (overrides the `core.animation` setting). Use `false` for no animation. - * @trigger open_node.jstree, after_open.jstree, before_open.jstree - */ - open_node : function (obj, callback, animation) { - var t1, t2, d, t; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.open_node(obj[t1], callback, animation); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - animation = animation === undefined ? this.settings.core.animation : animation; - if(!this.is_closed(obj)) { - if(callback) { - callback.call(this, obj, false); - } - return false; - } - if(!this.is_loaded(obj)) { - if(this.is_loading(obj)) { - return setTimeout($.proxy(function () { - this.open_node(obj, callback, animation); - }, this), 500); - } - this.load_node(obj, function (o, ok) { - return ok ? this.open_node(o, callback, animation) : (callback ? callback.call(this, o, false) : false); - }); - } - else { - d = this.get_node(obj, true); - t = this; - if(d.length) { - if(animation && d.children(".jstree-children").length) { - d.children(".jstree-children").stop(true, true); - } - if(obj.children.length && !this._firstChild(d.children('.jstree-children')[0])) { - this.draw_children(obj); - //d = this.get_node(obj, true); - } - if(!animation) { - this.trigger('before_open', { "node" : obj }); - d[0].className = d[0].className.replace('jstree-closed', 'jstree-open'); - d[0].setAttribute("aria-expanded", true); - } - else { - this.trigger('before_open', { "node" : obj }); - d - .children(".jstree-children").css("display","none").end() - .removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded", true) - .children(".jstree-children").stop(true, true) - .slideDown(animation, function () { - this.style.display = ""; - if (t.element) { - t.trigger("after_open", { "node" : obj }); - } - }); - } - } - obj.state.opened = true; - if(callback) { - callback.call(this, obj, true); - } - if(!d.length) { - /** - * triggered when a node is about to be opened (if the node is supposed to be in the DOM, it will be, but it won't be visible yet) - * @event - * @name before_open.jstree - * @param {Object} node the opened node - */ - this.trigger('before_open', { "node" : obj }); - } - /** - * triggered when a node is opened (if there is an animation it will not be completed yet) - * @event - * @name open_node.jstree - * @param {Object} node the opened node - */ - this.trigger('open_node', { "node" : obj }); - if(!animation || !d.length) { - /** - * triggered when a node is opened and the animation is complete - * @event - * @name after_open.jstree - * @param {Object} node the opened node - */ - this.trigger("after_open", { "node" : obj }); - } - return true; - } - }, - /** - * opens every parent of a node (node should be loaded) - * @name _open_to(obj) - * @param {mixed} obj the node to reveal - * @private - */ - _open_to : function (obj) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - var i, j, p = obj.parents; - for(i = 0, j = p.length; i < j; i+=1) { - if(i !== $.jstree.root) { - this.open_node(p[i], false, 0); - } - } - return $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element); - }, - /** - * closes a node, hiding its children - * @name close_node(obj [, animation]) - * @param {mixed} obj the node to close - * @param {Number} animation the animation duration in milliseconds when closing the node (overrides the `core.animation` setting). Use `false` for no animation. - * @trigger close_node.jstree, after_close.jstree - */ - close_node : function (obj, animation) { - var t1, t2, t, d; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.close_node(obj[t1], animation); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - if(this.is_closed(obj)) { - return false; - } - animation = animation === undefined ? this.settings.core.animation : animation; - t = this; - d = this.get_node(obj, true); - - obj.state.opened = false; - /** - * triggered when a node is closed (if there is an animation it will not be complete yet) - * @event - * @name close_node.jstree - * @param {Object} node the closed node - */ - this.trigger('close_node',{ "node" : obj }); - if(!d.length) { - /** - * triggered when a node is closed and the animation is complete - * @event - * @name after_close.jstree - * @param {Object} node the closed node - */ - this.trigger("after_close", { "node" : obj }); - } - else { - if(!animation) { - d[0].className = d[0].className.replace('jstree-open', 'jstree-closed'); - d.attr("aria-expanded", false).children('.jstree-children').remove(); - this.trigger("after_close", { "node" : obj }); - } - else { - d - .children(".jstree-children").attr("style","display:block !important").end() - .removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded", false) - .children(".jstree-children").stop(true, true).slideUp(animation, function () { - this.style.display = ""; - d.children('.jstree-children').remove(); - if (t.element) { - t.trigger("after_close", { "node" : obj }); - } - }); - } - } - }, - /** - * toggles a node - closing it if it is open, opening it if it is closed - * @name toggle_node(obj) - * @param {mixed} obj the node to toggle - */ - toggle_node : function (obj) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.toggle_node(obj[t1]); - } - return true; - } - if(this.is_closed(obj)) { - return this.open_node(obj); - } - if(this.is_open(obj)) { - return this.close_node(obj); - } - }, - /** - * opens all nodes within a node (or the tree), revealing their children. If the node is not loaded it will be loaded and opened once ready. - * @name open_all([obj, animation, original_obj]) - * @param {mixed} obj the node to open recursively, omit to open all nodes in the tree - * @param {Number} animation the animation duration in milliseconds when opening the nodes, the default is no animation - * @param {jQuery} reference to the node that started the process (internal use) - * @trigger open_all.jstree - */ - open_all : function (obj, animation, original_obj) { - if(!obj) { obj = $.jstree.root; } - obj = this.get_node(obj); - if(!obj) { return false; } - var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), i, j, _this; - if(!dom.length) { - for(i = 0, j = obj.children_d.length; i < j; i++) { - if(this.is_closed(this._model.data[obj.children_d[i]])) { - this._model.data[obj.children_d[i]].state.opened = true; - } - } - return this.trigger('open_all', { "node" : obj }); - } - original_obj = original_obj || dom; - _this = this; - dom = this.is_closed(obj) ? dom.find('.jstree-closed').addBack() : dom.find('.jstree-closed'); - dom.each(function () { - _this.open_node( - this, - function(node, status) { if(status && this.is_parent(node)) { this.open_all(node, animation, original_obj); } }, - animation || 0 - ); - }); - if(original_obj.find('.jstree-closed').length === 0) { - /** - * triggered when an `open_all` call completes - * @event - * @name open_all.jstree - * @param {Object} node the opened node - */ - this.trigger('open_all', { "node" : this.get_node(original_obj) }); - } - }, - /** - * closes all nodes within a node (or the tree), revealing their children - * @name close_all([obj, animation]) - * @param {mixed} obj the node to close recursively, omit to close all nodes in the tree - * @param {Number} animation the animation duration in milliseconds when closing the nodes, the default is no animation - * @trigger close_all.jstree - */ - close_all : function (obj, animation) { - if(!obj) { obj = $.jstree.root; } - obj = this.get_node(obj); - if(!obj) { return false; } - var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), - _this = this, i, j; - if(dom.length) { - dom = this.is_open(obj) ? dom.find('.jstree-open').addBack() : dom.find('.jstree-open'); - $(dom.get().reverse()).each(function () { _this.close_node(this, animation || 0); }); - } - for(i = 0, j = obj.children_d.length; i < j; i++) { - this._model.data[obj.children_d[i]].state.opened = false; - } - /** - * triggered when an `close_all` call completes - * @event - * @name close_all.jstree - * @param {Object} node the closed node - */ - this.trigger('close_all', { "node" : obj }); - }, - /** - * checks if a node is disabled (not selectable) - * @name is_disabled(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_disabled : function (obj) { - obj = this.get_node(obj); - return obj && obj.state && obj.state.disabled; - }, - /** - * enables a node - so that it can be selected - * @name enable_node(obj) - * @param {mixed} obj the node to enable - * @trigger enable_node.jstree - */ - enable_node : function (obj) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.enable_node(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - obj.state.disabled = false; - this.get_node(obj,true).children('.jstree-anchor').removeClass('jstree-disabled').attr('aria-disabled', false); - /** - * triggered when an node is enabled - * @event - * @name enable_node.jstree - * @param {Object} node the enabled node - */ - this.trigger('enable_node', { 'node' : obj }); - }, - /** - * disables a node - so that it can not be selected - * @name disable_node(obj) - * @param {mixed} obj the node to disable - * @trigger disable_node.jstree - */ - disable_node : function (obj) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.disable_node(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - obj.state.disabled = true; - this.get_node(obj,true).children('.jstree-anchor').addClass('jstree-disabled').attr('aria-disabled', true); - /** - * triggered when an node is disabled - * @event - * @name disable_node.jstree - * @param {Object} node the disabled node - */ - this.trigger('disable_node', { 'node' : obj }); - }, - /** - * determines if a node is hidden - * @name is_hidden(obj) - * @param {mixed} obj the node - */ - is_hidden : function (obj) { - obj = this.get_node(obj); - return obj.state.hidden === true; - }, - /** - * hides a node - it is still in the structure but will not be visible - * @name hide_node(obj) - * @param {mixed} obj the node to hide - * @param {Boolean} skip_redraw internal parameter controlling if redraw is called - * @trigger hide_node.jstree - */ - hide_node : function (obj, skip_redraw) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.hide_node(obj[t1], true); - } - if (!skip_redraw) { - this.redraw(); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - if(!obj.state.hidden) { - obj.state.hidden = true; - this._node_changed(obj.parent); - if(!skip_redraw) { - this.redraw(); - } - /** - * triggered when an node is hidden - * @event - * @name hide_node.jstree - * @param {Object} node the hidden node - */ - this.trigger('hide_node', { 'node' : obj }); - } - }, - /** - * shows a node - * @name show_node(obj) - * @param {mixed} obj the node to show - * @param {Boolean} skip_redraw internal parameter controlling if redraw is called - * @trigger show_node.jstree - */ - show_node : function (obj, skip_redraw) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.show_node(obj[t1], true); - } - if (!skip_redraw) { - this.redraw(); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - if(obj.state.hidden) { - obj.state.hidden = false; - this._node_changed(obj.parent); - if(!skip_redraw) { - this.redraw(); - } - /** - * triggered when an node is shown - * @event - * @name show_node.jstree - * @param {Object} node the shown node - */ - this.trigger('show_node', { 'node' : obj }); - } - }, - /** - * hides all nodes - * @name hide_all() - * @trigger hide_all.jstree - */ - hide_all : function (skip_redraw) { - var i, m = this._model.data, ids = []; - for(i in m) { - if(m.hasOwnProperty(i) && i !== $.jstree.root && !m[i].state.hidden) { - m[i].state.hidden = true; - ids.push(i); - } - } - this._model.force_full_redraw = true; - if(!skip_redraw) { - this.redraw(); - } - /** - * triggered when all nodes are hidden - * @event - * @name hide_all.jstree - * @param {Array} nodes the IDs of all hidden nodes - */ - this.trigger('hide_all', { 'nodes' : ids }); - return ids; - }, - /** - * shows all nodes - * @name show_all() - * @trigger show_all.jstree - */ - show_all : function (skip_redraw) { - var i, m = this._model.data, ids = []; - for(i in m) { - if(m.hasOwnProperty(i) && i !== $.jstree.root && m[i].state.hidden) { - m[i].state.hidden = false; - ids.push(i); - } - } - this._model.force_full_redraw = true; - if(!skip_redraw) { - this.redraw(); - } - /** - * triggered when all nodes are shown - * @event - * @name show_all.jstree - * @param {Array} nodes the IDs of all shown nodes - */ - this.trigger('show_all', { 'nodes' : ids }); - return ids; - }, - /** - * called when a node is selected by the user. Used internally. - * @private - * @name activate_node(obj, e) - * @param {mixed} obj the node - * @param {Object} e the related event - * @trigger activate_node.jstree, changed.jstree - */ - activate_node : function (obj, e) { - if(this.is_disabled(obj)) { - return false; - } - if(!e || typeof e !== 'object') { - e = {}; - } - - // ensure last_clicked is still in the DOM, make it fresh (maybe it was moved?) and make sure it is still selected, if not - make last_clicked the last selected node - this._data.core.last_clicked = this._data.core.last_clicked && this._data.core.last_clicked.id !== undefined ? this.get_node(this._data.core.last_clicked.id) : null; - if(this._data.core.last_clicked && !this._data.core.last_clicked.state.selected) { this._data.core.last_clicked = null; } - if(!this._data.core.last_clicked && this._data.core.selected.length) { this._data.core.last_clicked = this.get_node(this._data.core.selected[this._data.core.selected.length - 1]); } - - if(!this.settings.core.multiple || (!e.metaKey && !e.ctrlKey && !e.shiftKey) || (e.shiftKey && (!this._data.core.last_clicked || !this.get_parent(obj) || this.get_parent(obj) !== this._data.core.last_clicked.parent ) )) { - if(!this.settings.core.multiple && (e.metaKey || e.ctrlKey || e.shiftKey) && this.is_selected(obj)) { - this.deselect_node(obj, false, e); - } - else { - this.deselect_all(true); - this.select_node(obj, false, false, e); - this._data.core.last_clicked = this.get_node(obj); - } - } - else { - if(e.shiftKey) { - var o = this.get_node(obj).id, - l = this._data.core.last_clicked.id, - p = this.get_node(this._data.core.last_clicked.parent).children, - c = false, - i, j; - for(i = 0, j = p.length; i < j; i += 1) { - // separate IFs work whem o and l are the same - if(p[i] === o) { - c = !c; - } - if(p[i] === l) { - c = !c; - } - if(!this.is_disabled(p[i]) && (c || p[i] === o || p[i] === l)) { - if (!this.is_hidden(p[i])) { - this.select_node(p[i], true, false, e); - } - } - else { - this.deselect_node(p[i], true, e); - } - } - this.trigger('changed', { 'action' : 'select_node', 'node' : this.get_node(obj), 'selected' : this._data.core.selected, 'event' : e }); - } - else { - if(!this.is_selected(obj)) { - this.select_node(obj, false, false, e); - } - else { - this.deselect_node(obj, false, e); - } - } - } - /** - * triggered when an node is clicked or intercated with by the user - * @event - * @name activate_node.jstree - * @param {Object} node - * @param {Object} event the ooriginal event (if any) which triggered the call (may be an empty object) - */ - this.trigger('activate_node', { 'node' : this.get_node(obj), 'event' : e }); - }, - /** - * applies the hover state on a node, called when a node is hovered by the user. Used internally. - * @private - * @name hover_node(obj) - * @param {mixed} obj - * @trigger hover_node.jstree - */ - hover_node : function (obj) { - obj = this.get_node(obj, true); - if(!obj || !obj.length || obj.children('.jstree-hovered').length) { - return false; - } - var o = this.element.find('.jstree-hovered'), t = this.element; - if(o && o.length) { this.dehover_node(o); } - - obj.children('.jstree-anchor').addClass('jstree-hovered'); - /** - * triggered when an node is hovered - * @event - * @name hover_node.jstree - * @param {Object} node - */ - this.trigger('hover_node', { 'node' : this.get_node(obj) }); - setTimeout(function () { t.attr('aria-activedescendant', obj[0].id); }, 0); - }, - /** - * removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally. - * @private - * @name dehover_node(obj) - * @param {mixed} obj - * @trigger dehover_node.jstree - */ - dehover_node : function (obj) { - obj = this.get_node(obj, true); - if(!obj || !obj.length || !obj.children('.jstree-hovered').length) { - return false; - } - obj.children('.jstree-anchor').removeClass('jstree-hovered'); - /** - * triggered when an node is no longer hovered - * @event - * @name dehover_node.jstree - * @param {Object} node - */ - this.trigger('dehover_node', { 'node' : this.get_node(obj) }); - }, - /** - * select a node - * @name select_node(obj [, supress_event, prevent_open]) - * @param {mixed} obj an array can be used to select multiple nodes - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @param {Boolean} prevent_open if set to `true` parents of the selected node won't be opened - * @trigger select_node.jstree, changed.jstree - */ - select_node : function (obj, supress_event, prevent_open, e) { - var dom, t1, t2, th; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.select_node(obj[t1], supress_event, prevent_open, e); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(!obj.state.selected) { - obj.state.selected = true; - this._data.core.selected.push(obj.id); - if(!prevent_open) { - dom = this._open_to(obj); - } - if(dom && dom.length) { - dom.attr('aria-selected', true).children('.jstree-anchor').addClass('jstree-clicked'); - } - /** - * triggered when an node is selected - * @event - * @name select_node.jstree - * @param {Object} node - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this select_node - */ - this.trigger('select_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); - if(!supress_event) { - /** - * triggered when selection changes - * @event - * @name changed.jstree - * @param {Object} node - * @param {Object} action the action that caused the selection to change - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this changed event - */ - this.trigger('changed', { 'action' : 'select_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); - } - } - }, - /** - * deselect a node - * @name deselect_node(obj [, supress_event]) - * @param {mixed} obj an array can be used to deselect multiple nodes - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger deselect_node.jstree, changed.jstree - */ - deselect_node : function (obj, supress_event, e) { - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.deselect_node(obj[t1], supress_event, e); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(obj.state.selected) { - obj.state.selected = false; - this._data.core.selected = $.vakata.array_remove_item(this._data.core.selected, obj.id); - if(dom.length) { - dom.attr('aria-selected', false).children('.jstree-anchor').removeClass('jstree-clicked'); - } - /** - * triggered when an node is deselected - * @event - * @name deselect_node.jstree - * @param {Object} node - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this deselect_node - */ - this.trigger('deselect_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); - if(!supress_event) { - this.trigger('changed', { 'action' : 'deselect_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); - } - } - }, - /** - * select all nodes in the tree - * @name select_all([supress_event]) - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger select_all.jstree, changed.jstree - */ - select_all : function (supress_event) { - var tmp = this._data.core.selected.concat([]), i, j; - this._data.core.selected = this._model.data[$.jstree.root].children_d.concat(); - for(i = 0, j = this._data.core.selected.length; i < j; i++) { - if(this._model.data[this._data.core.selected[i]]) { - this._model.data[this._data.core.selected[i]].state.selected = true; - } - } - this.redraw(true); - /** - * triggered when all nodes are selected - * @event - * @name select_all.jstree - * @param {Array} selected the current selection - */ - this.trigger('select_all', { 'selected' : this._data.core.selected }); - if(!supress_event) { - this.trigger('changed', { 'action' : 'select_all', 'selected' : this._data.core.selected, 'old_selection' : tmp }); - } - }, - /** - * deselect all selected nodes - * @name deselect_all([supress_event]) - * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered - * @trigger deselect_all.jstree, changed.jstree - */ - deselect_all : function (supress_event) { - var tmp = this._data.core.selected.concat([]), i, j; - for(i = 0, j = this._data.core.selected.length; i < j; i++) { - if(this._model.data[this._data.core.selected[i]]) { - this._model.data[this._data.core.selected[i]].state.selected = false; - } - } - this._data.core.selected = []; - this.element.find('.jstree-clicked').removeClass('jstree-clicked').parent().attr('aria-selected', false); - /** - * triggered when all nodes are deselected - * @event - * @name deselect_all.jstree - * @param {Object} node the previous selection - * @param {Array} selected the current selection - */ - this.trigger('deselect_all', { 'selected' : this._data.core.selected, 'node' : tmp }); - if(!supress_event) { - this.trigger('changed', { 'action' : 'deselect_all', 'selected' : this._data.core.selected, 'old_selection' : tmp }); - } - }, - /** - * checks if a node is selected - * @name is_selected(obj) - * @param {mixed} obj - * @return {Boolean} - */ - is_selected : function (obj) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - return obj.state.selected; - }, - /** - * get an array of all selected nodes - * @name get_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_selected : function (full) { - return full ? $.map(this._data.core.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.core.selected.slice(); - }, - /** - * get an array of all top level selected nodes (ignoring children of selected nodes) - * @name get_top_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_top_selected : function (full) { - var tmp = this.get_selected(true), - obj = {}, i, j, k, l; - for(i = 0, j = tmp.length; i < j; i++) { - obj[tmp[i].id] = tmp[i]; - } - for(i = 0, j = tmp.length; i < j; i++) { - for(k = 0, l = tmp[i].children_d.length; k < l; k++) { - if(obj[tmp[i].children_d[k]]) { - delete obj[tmp[i].children_d[k]]; - } - } - } - tmp = []; - for(i in obj) { - if(obj.hasOwnProperty(i)) { - tmp.push(i); - } - } - return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp; - }, - /** - * get an array of all bottom level selected nodes (ignoring selected parents) - * @name get_bottom_selected([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - */ - get_bottom_selected : function (full) { - var tmp = this.get_selected(true), - obj = [], i, j; - for(i = 0, j = tmp.length; i < j; i++) { - if(!tmp[i].children.length) { - obj.push(tmp[i].id); - } - } - return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj; - }, - /** - * gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally. - * @name get_state() - * @private - * @return {Object} - */ - get_state : function () { - var state = { - 'core' : { - 'open' : [], - 'loaded' : [], - 'scroll' : { - 'left' : this.element.scrollLeft(), - 'top' : this.element.scrollTop() - }, - /*! - 'themes' : { - 'name' : this.get_theme(), - 'icons' : this._data.core.themes.icons, - 'dots' : this._data.core.themes.dots - }, - */ - 'selected' : [] - } - }, i; - for(i in this._model.data) { - if(this._model.data.hasOwnProperty(i)) { - if(i !== $.jstree.root) { - if(this._model.data[i].state.loaded && this.settings.core.loaded_state) { - state.core.loaded.push(i); - } - if(this._model.data[i].state.opened) { - state.core.open.push(i); - } - if(this._model.data[i].state.selected) { - state.core.selected.push(i); - } - } - } - } - return state; - }, - /** - * sets the state of the tree. Used internally. - * @name set_state(state [, callback]) - * @private - * @param {Object} state the state to restore. Keep in mind this object is passed by reference and jstree will modify it. - * @param {Function} callback an optional function to execute once the state is restored. - * @trigger set_state.jstree - */ - set_state : function (state, callback) { - if(state) { - if(state.core && state.core.selected && state.core.initial_selection === undefined) { - state.core.initial_selection = this._data.core.selected.concat([]).sort().join(','); - } - if(state.core) { - var res, n, t, _this, i; - if(state.core.loaded) { - if(!this.settings.core.loaded_state || !$.isArray(state.core.loaded) || !state.core.loaded.length) { - delete state.core.loaded; - this.set_state(state, callback); - } - else { - this._load_nodes(state.core.loaded, function (nodes) { - delete state.core.loaded; - this.set_state(state, callback); - }); - } - return false; - } - if(state.core.open) { - if(!$.isArray(state.core.open) || !state.core.open.length) { - delete state.core.open; - this.set_state(state, callback); - } - else { - this._load_nodes(state.core.open, function (nodes) { - this.open_node(nodes, false, 0); - delete state.core.open; - this.set_state(state, callback); - }); - } - return false; - } - if(state.core.scroll) { - if(state.core.scroll && state.core.scroll.left !== undefined) { - this.element.scrollLeft(state.core.scroll.left); - } - if(state.core.scroll && state.core.scroll.top !== undefined) { - this.element.scrollTop(state.core.scroll.top); - } - delete state.core.scroll; - this.set_state(state, callback); - return false; - } - if(state.core.selected) { - _this = this; - if (state.core.initial_selection === undefined || - state.core.initial_selection === this._data.core.selected.concat([]).sort().join(',') - ) { - this.deselect_all(); - $.each(state.core.selected, function (i, v) { - _this.select_node(v, false, true); - }); - } - delete state.core.initial_selection; - delete state.core.selected; - this.set_state(state, callback); - return false; - } - for(i in state) { - if(state.hasOwnProperty(i) && i !== "core" && $.inArray(i, this.settings.plugins) === -1) { - delete state[i]; - } - } - if($.isEmptyObject(state.core)) { - delete state.core; - this.set_state(state, callback); - return false; - } - } - if($.isEmptyObject(state)) { - state = null; - if(callback) { callback.call(this); } - /** - * triggered when a `set_state` call completes - * @event - * @name set_state.jstree - */ - this.trigger('set_state'); - return false; - } - return true; - } - return false; - }, - /** - * refreshes the tree - all nodes are reloaded with calls to `load_node`. - * @name refresh() - * @param {Boolean} skip_loading an option to skip showing the loading indicator - * @param {Mixed} forget_state if set to `true` state will not be reapplied, if set to a function (receiving the current state as argument) the result of that function will be used as state - * @trigger refresh.jstree - */ - refresh : function (skip_loading, forget_state) { - this._data.core.state = forget_state === true ? {} : this.get_state(); - if(forget_state && $.isFunction(forget_state)) { this._data.core.state = forget_state.call(this, this._data.core.state); } - this._cnt = 0; - this._model.data = {}; - this._model.data[$.jstree.root] = { - id : $.jstree.root, - parent : null, - parents : [], - children : [], - children_d : [], - state : { loaded : false } - }; - this._data.core.selected = []; - this._data.core.last_clicked = null; - this._data.core.focused = null; - - var c = this.get_container_ul()[0].className; - if(!skip_loading) { - this.element.html("<"+"ul class='"+c+"' role='group'><"+"li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j"+this._id+"_loading'><"+"a class='jstree-anchor' href='#'>" + this.get_string("Loading ...") + ""); - this.element.attr('aria-activedescendant','j'+this._id+'_loading'); - } - this.load_node($.jstree.root, function (o, s) { - if(s) { - this.get_container_ul()[0].className = c; - if(this._firstChild(this.get_container_ul()[0])) { - this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id); - } - this.set_state($.extend(true, {}, this._data.core.state), function () { - /** - * triggered when a `refresh` call completes - * @event - * @name refresh.jstree - */ - this.trigger('refresh'); - }); - } - this._data.core.state = null; - }); - }, - /** - * refreshes a node in the tree (reload its children) all opened nodes inside that node are reloaded with calls to `load_node`. - * @name refresh_node(obj) - * @param {mixed} obj the node - * @trigger refresh_node.jstree - */ - refresh_node : function (obj) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - var opened = [], to_load = [], s = this._data.core.selected.concat([]); - to_load.push(obj.id); - if(obj.state.opened === true) { opened.push(obj.id); } - this.get_node(obj, true).find('.jstree-open').each(function() { to_load.push(this.id); opened.push(this.id); }); - this._load_nodes(to_load, $.proxy(function (nodes) { - this.open_node(opened, false, 0); - this.select_node(s); - /** - * triggered when a node is refreshed - * @event - * @name refresh_node.jstree - * @param {Object} node - the refreshed node - * @param {Array} nodes - an array of the IDs of the nodes that were reloaded - */ - this.trigger('refresh_node', { 'node' : obj, 'nodes' : nodes }); - }, this), false, true); - }, - /** - * set (change) the ID of a node - * @name set_id(obj, id) - * @param {mixed} obj the node - * @param {String} id the new ID - * @return {Boolean} - * @trigger set_id.jstree - */ - set_id : function (obj, id) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - var i, j, m = this._model.data, old = obj.id; - id = id.toString(); - // update parents (replace current ID with new one in children and children_d) - m[obj.parent].children[$.inArray(obj.id, m[obj.parent].children)] = id; - for(i = 0, j = obj.parents.length; i < j; i++) { - m[obj.parents[i]].children_d[$.inArray(obj.id, m[obj.parents[i]].children_d)] = id; - } - // update children (replace current ID with new one in parent and parents) - for(i = 0, j = obj.children.length; i < j; i++) { - m[obj.children[i]].parent = id; - } - for(i = 0, j = obj.children_d.length; i < j; i++) { - m[obj.children_d[i]].parents[$.inArray(obj.id, m[obj.children_d[i]].parents)] = id; - } - i = $.inArray(obj.id, this._data.core.selected); - if(i !== -1) { this._data.core.selected[i] = id; } - // update model and obj itself (obj.id, this._model.data[KEY]) - i = this.get_node(obj.id, true); - if(i) { - i.attr('id', id); //.children('.jstree-anchor').attr('id', id + '_anchor').end().attr('aria-labelledby', id + '_anchor'); - if(this.element.attr('aria-activedescendant') === obj.id) { - this.element.attr('aria-activedescendant', id); - } - } - delete m[obj.id]; - obj.id = id; - obj.li_attr.id = id; - m[id] = obj; - /** - * triggered when a node id value is changed - * @event - * @name set_id.jstree - * @param {Object} node - * @param {String} old the old id - */ - this.trigger('set_id',{ "node" : obj, "new" : obj.id, "old" : old }); - return true; - }, - /** - * get the text value of a node - * @name get_text(obj) - * @param {mixed} obj the node - * @return {String} - */ - get_text : function (obj) { - obj = this.get_node(obj); - return (!obj || obj.id === $.jstree.root) ? false : obj.text; - }, - /** - * set the text value of a node. Used internally, please use `rename_node(obj, val)`. - * @private - * @name set_text(obj, val) - * @param {mixed} obj the node, you can pass an array to set the text on multiple nodes - * @param {String} val the new text value - * @return {Boolean} - * @trigger set_text.jstree - */ - set_text : function (obj, val) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.set_text(obj[t1], val); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - obj.text = val; - if(this.get_node(obj, true).length) { - this.redraw_node(obj.id); - } - /** - * triggered when a node text value is changed - * @event - * @name set_text.jstree - * @param {Object} obj - * @param {String} text the new value - */ - this.trigger('set_text',{ "obj" : obj, "text" : val }); - return true; - }, - /** - * gets a JSON representation of a node (or the whole tree) - * @name get_json([obj, options]) - * @param {mixed} obj - * @param {Object} options - * @param {Boolean} options.no_state do not return state information - * @param {Boolean} options.no_id do not return ID - * @param {Boolean} options.no_children do not include children - * @param {Boolean} options.no_data do not include node data - * @param {Boolean} options.no_li_attr do not include LI attributes - * @param {Boolean} options.no_a_attr do not include A attributes - * @param {Boolean} options.flat return flat JSON instead of nested - * @return {Object} - */ - get_json : function (obj, options, flat) { - obj = this.get_node(obj || $.jstree.root); - if(!obj) { return false; } - if(options && options.flat && !flat) { flat = []; } - var tmp = { - 'id' : obj.id, - 'text' : obj.text, - 'icon' : this.get_icon(obj), - 'li_attr' : $.extend(true, {}, obj.li_attr), - 'a_attr' : $.extend(true, {}, obj.a_attr), - 'state' : {}, - 'data' : options && options.no_data ? false : $.extend(true, $.isArray(obj.data)?[]:{}, obj.data) - //( this.get_node(obj, true).length ? this.get_node(obj, true).data() : obj.data ), - }, i, j; - if(options && options.flat) { - tmp.parent = obj.parent; - } - else { - tmp.children = []; - } - if(!options || !options.no_state) { - for(i in obj.state) { - if(obj.state.hasOwnProperty(i)) { - tmp.state[i] = obj.state[i]; - } - } - } else { - delete tmp.state; - } - if(options && options.no_li_attr) { - delete tmp.li_attr; - } - if(options && options.no_a_attr) { - delete tmp.a_attr; - } - if(options && options.no_id) { - delete tmp.id; - if(tmp.li_attr && tmp.li_attr.id) { - delete tmp.li_attr.id; - } - if(tmp.a_attr && tmp.a_attr.id) { - delete tmp.a_attr.id; - } - } - if(options && options.flat && obj.id !== $.jstree.root) { - flat.push(tmp); - } - if(!options || !options.no_children) { - for(i = 0, j = obj.children.length; i < j; i++) { - if(options && options.flat) { - this.get_json(obj.children[i], options, flat); - } - else { - tmp.children.push(this.get_json(obj.children[i], options)); - } - } - } - return options && options.flat ? flat : (obj.id === $.jstree.root ? tmp.children : tmp); - }, - /** - * create a new node (do not confuse with load_node) - * @name create_node([par, node, pos, callback, is_loaded]) - * @param {mixed} par the parent node (to create a root node use either "#" (string) or `null`) - * @param {mixed} node the data for the new node (a valid JSON object, or a simple string with the name) - * @param {mixed} pos the index at which to insert the node, "first" and "last" are also supported, default is "last" - * @param {Function} callback a function to be called once the node is created - * @param {Boolean} is_loaded internal argument indicating if the parent node was succesfully loaded - * @return {String} the ID of the newly create node - * @trigger model.jstree, create_node.jstree - */ - create_node : function (par, node, pos, callback, is_loaded) { - if(par === null) { par = $.jstree.root; } - par = this.get_node(par); - if(!par) { return false; } - pos = pos === undefined ? "last" : pos; - if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { - return this.load_node(par, function () { this.create_node(par, node, pos, callback, true); }); - } - if(!node) { node = { "text" : this.get_string('New node') }; } - if(typeof node === "string") { - node = { "text" : node }; - } else { - node = $.extend(true, {}, node); - } - if(node.text === undefined) { node.text = this.get_string('New node'); } - var tmp, dpc, i, j; - - if(par.id === $.jstree.root) { - if(pos === "before") { pos = "first"; } - if(pos === "after") { pos = "last"; } - } - switch(pos) { - case "before": - tmp = this.get_node(par.parent); - pos = $.inArray(par.id, tmp.children); - par = tmp; - break; - case "after" : - tmp = this.get_node(par.parent); - pos = $.inArray(par.id, tmp.children) + 1; - par = tmp; - break; - case "inside": - case "first": - pos = 0; - break; - case "last": - pos = par.children.length; - break; - default: - if(!pos) { pos = 0; } - break; - } - if(pos > par.children.length) { pos = par.children.length; } - if(!node.id) { node.id = true; } - if(!this.check("create_node", node, par, pos)) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - if(node.id === true) { delete node.id; } - node = this._parse_model_from_json(node, par.id, par.parents.concat()); - if(!node) { return false; } - tmp = this.get_node(node); - dpc = []; - dpc.push(node); - dpc = dpc.concat(tmp.children_d); - this.trigger('model', { "nodes" : dpc, "parent" : par.id }); - - par.children_d = par.children_d.concat(dpc); - for(i = 0, j = par.parents.length; i < j; i++) { - this._model.data[par.parents[i]].children_d = this._model.data[par.parents[i]].children_d.concat(dpc); - } - node = tmp; - tmp = []; - for(i = 0, j = par.children.length; i < j; i++) { - tmp[i >= pos ? i+1 : i] = par.children[i]; - } - tmp[pos] = node.id; - par.children = tmp; - - this.redraw_node(par, true); - /** - * triggered when a node is created - * @event - * @name create_node.jstree - * @param {Object} node - * @param {String} parent the parent's ID - * @param {Number} position the position of the new node among the parent's children - */ - this.trigger('create_node', { "node" : this.get_node(node), "parent" : par.id, "position" : pos }); - if(callback) { callback.call(this, this.get_node(node)); } - return node.id; - }, - /** - * set the text value of a node - * @name rename_node(obj, val) - * @param {mixed} obj the node, you can pass an array to rename multiple nodes to the same name - * @param {String} val the new text value - * @return {Boolean} - * @trigger rename_node.jstree - */ - rename_node : function (obj, val) { - var t1, t2, old; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.rename_node(obj[t1], val); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - old = obj.text; - if(!this.check("rename_node", obj, this.get_parent(obj), val)) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - this.set_text(obj, val); // .apply(this, Array.prototype.slice.call(arguments)) - /** - * triggered when a node is renamed - * @event - * @name rename_node.jstree - * @param {Object} node - * @param {String} text the new value - * @param {String} old the old value - */ - this.trigger('rename_node', { "node" : obj, "text" : val, "old" : old }); - return true; - }, - /** - * remove a node - * @name delete_node(obj) - * @param {mixed} obj the node, you can pass an array to delete multiple nodes - * @return {Boolean} - * @trigger delete_node.jstree, changed.jstree - */ - delete_node : function (obj) { - var t1, t2, par, pos, tmp, i, j, k, l, c, top, lft; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.delete_node(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - par = this.get_node(obj.parent); - pos = $.inArray(obj.id, par.children); - c = false; - if(!this.check("delete_node", obj, par, pos)) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - if(pos !== -1) { - par.children = $.vakata.array_remove(par.children, pos); - } - tmp = obj.children_d.concat([]); - tmp.push(obj.id); - for(i = 0, j = obj.parents.length; i < j; i++) { - this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) { - return $.inArray(v, tmp) === -1; - }); - } - for(k = 0, l = tmp.length; k < l; k++) { - if(this._model.data[tmp[k]].state.selected) { - c = true; - break; - } - } - if (c) { - this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) { - return $.inArray(v, tmp) === -1; - }); - } - /** - * triggered when a node is deleted - * @event - * @name delete_node.jstree - * @param {Object} node - * @param {String} parent the parent's ID - */ - this.trigger('delete_node', { "node" : obj, "parent" : par.id }); - if(c) { - this.trigger('changed', { 'action' : 'delete_node', 'node' : obj, 'selected' : this._data.core.selected, 'parent' : par.id }); - } - for(k = 0, l = tmp.length; k < l; k++) { - delete this._model.data[tmp[k]]; - } - if($.inArray(this._data.core.focused, tmp) !== -1) { - this._data.core.focused = null; - top = this.element[0].scrollTop; - lft = this.element[0].scrollLeft; - if(par.id === $.jstree.root) { - if (this._model.data[$.jstree.root].children[0]) { - this.get_node(this._model.data[$.jstree.root].children[0], true).children('.jstree-anchor').focus(); - } - } - else { - this.get_node(par, true).children('.jstree-anchor').focus(); - } - this.element[0].scrollTop = top; - this.element[0].scrollLeft = lft; - } - this.redraw_node(par, true); - return true; - }, - /** - * check if an operation is premitted on the tree. Used internally. - * @private - * @name check(chk, obj, par, pos) - * @param {String} chk the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node" - * @param {mixed} obj the node - * @param {mixed} par the parent - * @param {mixed} pos the position to insert at, or if "rename_node" - the new name - * @param {mixed} more some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node - * @return {Boolean} - */ - check : function (chk, obj, par, pos, more) { - obj = obj && obj.id ? obj : this.get_node(obj); - par = par && par.id ? par : this.get_node(par); - var tmp = chk.match(/^move_node|copy_node|create_node$/i) ? par : obj, - chc = this.settings.core.check_callback; - if(chk === "move_node" || chk === "copy_node") { - if((!more || !more.is_multi) && (obj.id === par.id || (chk === "move_node" && $.inArray(obj.id, par.children) === pos) || $.inArray(par.id, obj.children_d) !== -1)) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_01', 'reason' : 'Moving parent inside child', 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - } - if(tmp && tmp.data) { tmp = tmp.data; } - if(tmp && tmp.functions && (tmp.functions[chk] === false || tmp.functions[chk] === true)) { - if(tmp.functions[chk] === false) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_02', 'reason' : 'Node data prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return tmp.functions[chk]; - } - if(chc === false || ($.isFunction(chc) && chc.call(this, chk, obj, par, pos, more) === false) || (chc && chc[chk] === false)) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_03', 'reason' : 'User config for core.check_callback prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - return true; - }, - /** - * get the last error - * @name last_error() - * @return {Object} - */ - last_error : function () { - return this._data.core.last_error; - }, - /** - * move a node to a new parent - * @name move_node(obj, par [, pos, callback, is_loaded]) - * @param {mixed} obj the node to move, pass an array to move multiple nodes - * @param {mixed} par the new parent - * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` - * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position - * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded - * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn - * @param {Boolean} instance internal parameter indicating if the node comes from another instance - * @trigger move_node.jstree - */ - move_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { - var t1, t2, old_par, old_pos, new_par, old_ins, is_multi, dpc, tmp, i, j, k, l, p; - - par = this.get_node(par); - pos = pos === undefined ? 0 : pos; - if(!par) { return false; } - if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { - return this.load_node(par, function () { this.move_node(obj, par, pos, callback, true, false, origin); }); - } - - if($.isArray(obj)) { - if(obj.length === 1) { - obj = obj[0]; - } - else { - //obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - if((tmp = this.move_node(obj[t1], par, pos, callback, is_loaded, false, origin))) { - par = tmp; - pos = "after"; - } - } - this.redraw(); - return true; - } - } - obj = obj && obj.id ? obj : this.get_node(obj); - - if(!obj || obj.id === $.jstree.root) { return false; } - - old_par = (obj.parent || $.jstree.root).toString(); - new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent); - old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id)); - is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id); - old_pos = old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1; - if(old_ins && old_ins._id) { - obj = old_ins._model.data[obj.id]; - } - - if(is_multi) { - if((tmp = this.copy_node(obj, par, pos, callback, is_loaded, false, origin))) { - if(old_ins) { old_ins.delete_node(obj); } - return tmp; - } - return false; - } - //var m = this._model.data; - if(par.id === $.jstree.root) { - if(pos === "before") { pos = "first"; } - if(pos === "after") { pos = "last"; } - } - switch(pos) { - case "before": - pos = $.inArray(par.id, new_par.children); - break; - case "after" : - pos = $.inArray(par.id, new_par.children) + 1; - break; - case "inside": - case "first": - pos = 0; - break; - case "last": - pos = new_par.children.length; - break; - default: - if(!pos) { pos = 0; } - break; - } - if(pos > new_par.children.length) { pos = new_par.children.length; } - if(!this.check("move_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - if(obj.parent === new_par.id) { - dpc = new_par.children.concat(); - tmp = $.inArray(obj.id, dpc); - if(tmp !== -1) { - dpc = $.vakata.array_remove(dpc, tmp); - if(pos > tmp) { pos--; } - } - tmp = []; - for(i = 0, j = dpc.length; i < j; i++) { - tmp[i >= pos ? i+1 : i] = dpc[i]; - } - tmp[pos] = obj.id; - new_par.children = tmp; - this._node_changed(new_par.id); - this.redraw(new_par.id === $.jstree.root); - } - else { - // clean old parent and up - tmp = obj.children_d.concat(); - tmp.push(obj.id); - for(i = 0, j = obj.parents.length; i < j; i++) { - dpc = []; - p = old_ins._model.data[obj.parents[i]].children_d; - for(k = 0, l = p.length; k < l; k++) { - if($.inArray(p[k], tmp) === -1) { - dpc.push(p[k]); - } - } - old_ins._model.data[obj.parents[i]].children_d = dpc; - } - old_ins._model.data[old_par].children = $.vakata.array_remove_item(old_ins._model.data[old_par].children, obj.id); - - // insert into new parent and up - for(i = 0, j = new_par.parents.length; i < j; i++) { - this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(tmp); - } - dpc = []; - for(i = 0, j = new_par.children.length; i < j; i++) { - dpc[i >= pos ? i+1 : i] = new_par.children[i]; - } - dpc[pos] = obj.id; - new_par.children = dpc; - new_par.children_d.push(obj.id); - new_par.children_d = new_par.children_d.concat(obj.children_d); - - // update object - obj.parent = new_par.id; - tmp = new_par.parents.concat(); - tmp.unshift(new_par.id); - p = obj.parents.length; - obj.parents = tmp; - - // update object children - tmp = tmp.concat(); - for(i = 0, j = obj.children_d.length; i < j; i++) { - this._model.data[obj.children_d[i]].parents = this._model.data[obj.children_d[i]].parents.slice(0,p*-1); - Array.prototype.push.apply(this._model.data[obj.children_d[i]].parents, tmp); - } - - if(old_par === $.jstree.root || new_par.id === $.jstree.root) { - this._model.force_full_redraw = true; - } - if(!this._model.force_full_redraw) { - this._node_changed(old_par); - this._node_changed(new_par.id); - } - if(!skip_redraw) { - this.redraw(); - } - } - if(callback) { callback.call(this, obj, new_par, pos); } - /** - * triggered when a node is moved - * @event - * @name move_node.jstree - * @param {Object} node - * @param {String} parent the parent's ID - * @param {Number} position the position of the node among the parent's children - * @param {String} old_parent the old parent of the node - * @param {Number} old_position the old position of the node - * @param {Boolean} is_multi do the node and new parent belong to different instances - * @param {jsTree} old_instance the instance the node came from - * @param {jsTree} new_instance the instance of the new parent - */ - this.trigger('move_node', { "node" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_pos, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this }); - return obj.id; - }, - /** - * copy a node to a new parent - * @name copy_node(obj, par [, pos, callback, is_loaded]) - * @param {mixed} obj the node to copy, pass an array to copy multiple nodes - * @param {mixed} par the new parent - * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` - * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position - * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded - * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn - * @param {Boolean} instance internal parameter indicating if the node comes from another instance - * @trigger model.jstree copy_node.jstree - */ - copy_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { - var t1, t2, dpc, tmp, i, j, node, old_par, new_par, old_ins, is_multi; - - par = this.get_node(par); - pos = pos === undefined ? 0 : pos; - if(!par) { return false; } - if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { - return this.load_node(par, function () { this.copy_node(obj, par, pos, callback, true, false, origin); }); - } - - if($.isArray(obj)) { - if(obj.length === 1) { - obj = obj[0]; - } - else { - //obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - if((tmp = this.copy_node(obj[t1], par, pos, callback, is_loaded, true, origin))) { - par = tmp; - pos = "after"; - } - } - this.redraw(); - return true; - } - } - obj = obj && obj.id ? obj : this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - - old_par = (obj.parent || $.jstree.root).toString(); - new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent); - old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id)); - is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id); - - if(old_ins && old_ins._id) { - obj = old_ins._model.data[obj.id]; - } - - if(par.id === $.jstree.root) { - if(pos === "before") { pos = "first"; } - if(pos === "after") { pos = "last"; } - } - switch(pos) { - case "before": - pos = $.inArray(par.id, new_par.children); - break; - case "after" : - pos = $.inArray(par.id, new_par.children) + 1; - break; - case "inside": - case "first": - pos = 0; - break; - case "last": - pos = new_par.children.length; - break; - default: - if(!pos) { pos = 0; } - break; - } - if(pos > new_par.children.length) { pos = new_par.children.length; } - if(!this.check("copy_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - node = old_ins ? old_ins.get_json(obj, { no_id : true, no_data : true, no_state : true }) : obj; - if(!node) { return false; } - if(node.id === true) { delete node.id; } - node = this._parse_model_from_json(node, new_par.id, new_par.parents.concat()); - if(!node) { return false; } - tmp = this.get_node(node); - if(obj && obj.state && obj.state.loaded === false) { tmp.state.loaded = false; } - dpc = []; - dpc.push(node); - dpc = dpc.concat(tmp.children_d); - this.trigger('model', { "nodes" : dpc, "parent" : new_par.id }); - - // insert into new parent and up - for(i = 0, j = new_par.parents.length; i < j; i++) { - this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(dpc); - } - dpc = []; - for(i = 0, j = new_par.children.length; i < j; i++) { - dpc[i >= pos ? i+1 : i] = new_par.children[i]; - } - dpc[pos] = tmp.id; - new_par.children = dpc; - new_par.children_d.push(tmp.id); - new_par.children_d = new_par.children_d.concat(tmp.children_d); - - if(new_par.id === $.jstree.root) { - this._model.force_full_redraw = true; - } - if(!this._model.force_full_redraw) { - this._node_changed(new_par.id); - } - if(!skip_redraw) { - this.redraw(new_par.id === $.jstree.root); - } - if(callback) { callback.call(this, tmp, new_par, pos); } - /** - * triggered when a node is copied - * @event - * @name copy_node.jstree - * @param {Object} node the copied node - * @param {Object} original the original node - * @param {String} parent the parent's ID - * @param {Number} position the position of the node among the parent's children - * @param {String} old_parent the old parent of the node - * @param {Number} old_position the position of the original node - * @param {Boolean} is_multi do the node and new parent belong to different instances - * @param {jsTree} old_instance the instance the node came from - * @param {jsTree} new_instance the instance of the new parent - */ - this.trigger('copy_node', { "node" : tmp, "original" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1,'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this }); - return tmp.id; - }, - /** - * cut a node (a later call to `paste(obj)` would move the node) - * @name cut(obj) - * @param {mixed} obj multiple objects can be passed using an array - * @trigger cut.jstree - */ - cut : function (obj) { - if(!obj) { obj = this._data.core.selected.concat(); } - if(!$.isArray(obj)) { obj = [obj]; } - if(!obj.length) { return false; } - var tmp = [], o, t1, t2; - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - o = this.get_node(obj[t1]); - if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); } - } - if(!tmp.length) { return false; } - ccp_node = tmp; - ccp_inst = this; - ccp_mode = 'move_node'; - /** - * triggered when nodes are added to the buffer for moving - * @event - * @name cut.jstree - * @param {Array} node - */ - this.trigger('cut', { "node" : obj }); - }, - /** - * copy a node (a later call to `paste(obj)` would copy the node) - * @name copy(obj) - * @param {mixed} obj multiple objects can be passed using an array - * @trigger copy.jstree - */ - copy : function (obj) { - if(!obj) { obj = this._data.core.selected.concat(); } - if(!$.isArray(obj)) { obj = [obj]; } - if(!obj.length) { return false; } - var tmp = [], o, t1, t2; - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - o = this.get_node(obj[t1]); - if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); } - } - if(!tmp.length) { return false; } - ccp_node = tmp; - ccp_inst = this; - ccp_mode = 'copy_node'; - /** - * triggered when nodes are added to the buffer for copying - * @event - * @name copy.jstree - * @param {Array} node - */ - this.trigger('copy', { "node" : obj }); - }, - /** - * get the current buffer (any nodes that are waiting for a paste operation) - * @name get_buffer() - * @return {Object} an object consisting of `mode` ("copy_node" or "move_node"), `node` (an array of objects) and `inst` (the instance) - */ - get_buffer : function () { - return { 'mode' : ccp_mode, 'node' : ccp_node, 'inst' : ccp_inst }; - }, - /** - * check if there is something in the buffer to paste - * @name can_paste() - * @return {Boolean} - */ - can_paste : function () { - return ccp_mode !== false && ccp_node !== false; // && ccp_inst._model.data[ccp_node]; - }, - /** - * copy or move the previously cut or copied nodes to a new parent - * @name paste(obj [, pos]) - * @param {mixed} obj the new parent - * @param {mixed} pos the position to insert at (besides integer, "first" and "last" are supported), defaults to integer `0` - * @trigger paste.jstree - */ - paste : function (obj, pos) { - obj = this.get_node(obj); - if(!obj || !ccp_mode || !ccp_mode.match(/^(copy_node|move_node)$/) || !ccp_node) { return false; } - if(this[ccp_mode](ccp_node, obj, pos, false, false, false, ccp_inst)) { - /** - * triggered when paste is invoked - * @event - * @name paste.jstree - * @param {String} parent the ID of the receiving node - * @param {Array} node the nodes in the buffer - * @param {String} mode the performed operation - "copy_node" or "move_node" - */ - this.trigger('paste', { "parent" : obj.id, "node" : ccp_node, "mode" : ccp_mode }); - } - ccp_node = false; - ccp_mode = false; - ccp_inst = false; - }, - /** - * clear the buffer of previously copied or cut nodes - * @name clear_buffer() - * @trigger clear_buffer.jstree - */ - clear_buffer : function () { - ccp_node = false; - ccp_mode = false; - ccp_inst = false; - /** - * triggered when the copy / cut buffer is cleared - * @event - * @name clear_buffer.jstree - */ - this.trigger('clear_buffer'); - }, - /** - * put a node in edit mode (input field to rename the node) - * @name edit(obj [, default_text, callback]) - * @param {mixed} obj - * @param {String} default_text the text to populate the input with (if omitted or set to a non-string value the node's text value is used) - * @param {Function} callback a function to be called once the text box is blurred, it is called in the instance's scope and receives the node, a status parameter (true if the rename is successful, false otherwise) and a boolean indicating if the user cancelled the edit. You can access the node's title using .text - */ - edit : function (obj, default_text, callback) { - var rtl, w, a, s, t, h1, h2, fn, tmp, cancel = false; - obj = this.get_node(obj); - if(!obj) { return false; } - if(!this.check("edit", obj, this.get_parent(obj))) { - this.settings.core.error.call(this, this._data.core.last_error); - return false; - } - tmp = obj; - default_text = typeof default_text === 'string' ? default_text : obj.text; - this.set_text(obj, ""); - obj = this._open_to(obj); - tmp.text = default_text; - - rtl = this._data.core.rtl; - w = this.element.width(); - this._data.core.focused = tmp.id; - a = obj.children('.jstree-anchor').focus(); - s = $(''); - /*! - oi = obj.children("i:visible"), - ai = a.children("i:visible"), - w1 = oi.width() * oi.length, - w2 = ai.width() * ai.length, - */ - t = default_text; - h1 = $("<"+"div />", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo(document.body); - h2 = $("<"+"input />", { - "value" : t, - "class" : "jstree-rename-input", - // "size" : t.length, - "css" : { - "padding" : "0", - "border" : "1px solid silver", - "box-sizing" : "border-box", - "display" : "inline-block", - "height" : (this._data.core.li_height) + "px", - "lineHeight" : (this._data.core.li_height) + "px", - "width" : "150px" // will be set a bit further down - }, - "blur" : $.proxy(function (e) { - e.stopImmediatePropagation(); - e.preventDefault(); - var i = s.children(".jstree-rename-input"), - v = i.val(), - f = this.settings.core.force_text, - nv; - if(v === "") { v = t; } - h1.remove(); - s.replaceWith(a); - s.remove(); - t = f ? t : $('
').append($.parseHTML(t)).html(); - obj = this.get_node(obj); - this.set_text(obj, t); - nv = !!this.rename_node(obj, f ? $('
').text(v).text() : $('
').append($.parseHTML(v)).html()); - if(!nv) { - this.set_text(obj, t); // move this up? and fix #483 - } - this._data.core.focused = tmp.id; - setTimeout($.proxy(function () { - var node = this.get_node(tmp.id, true); - if(node.length) { - this._data.core.focused = tmp.id; - node.children('.jstree-anchor').focus(); - } - }, this), 0); - if(callback) { - callback.call(this, tmp, nv, cancel); - } - h2 = null; - }, this), - "keydown" : function (e) { - var key = e.which; - if(key === 27) { - cancel = true; - this.value = t; - } - if(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) { - e.stopImmediatePropagation(); - } - if(key === 27 || key === 13) { - e.preventDefault(); - this.blur(); - } - }, - "click" : function (e) { e.stopImmediatePropagation(); }, - "mousedown" : function (e) { e.stopImmediatePropagation(); }, - "keyup" : function (e) { - h2.width(Math.min(h1.text("pW" + this.value).width(),w)); - }, - "keypress" : function(e) { - if(e.which === 13) { return false; } - } - }); - fn = { - fontFamily : a.css('fontFamily') || '', - fontSize : a.css('fontSize') || '', - fontWeight : a.css('fontWeight') || '', - fontStyle : a.css('fontStyle') || '', - fontStretch : a.css('fontStretch') || '', - fontVariant : a.css('fontVariant') || '', - letterSpacing : a.css('letterSpacing') || '', - wordSpacing : a.css('wordSpacing') || '' - }; - s.attr('class', a.attr('class')).append(a.contents().clone()).append(h2); - a.replaceWith(s); - h1.css(fn); - h2.css(fn).width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select(); - $(document).one('mousedown.jstree touchstart.jstree dnd_start.vakata', function (e) { - if (h2 && e.target !== h2) { - $(h2).blur(); - } - }); - }, - - - /** - * changes the theme - * @name set_theme(theme_name [, theme_url]) - * @param {String} theme_name the name of the new theme to apply - * @param {mixed} theme_url the location of the CSS file for this theme. Omit or set to `false` if you manually included the file. Set to `true` to autoload from the `core.themes.dir` directory. - * @trigger set_theme.jstree - */ - set_theme : function (theme_name, theme_url) { - if(!theme_name) { return false; } - if(theme_url === true) { - var dir = this.settings.core.themes.dir; - if(!dir) { dir = $.jstree.path + '/themes'; } - theme_url = dir + '/' + theme_name + '/style.css'; - } - if(theme_url && $.inArray(theme_url, themes_loaded) === -1) { - $('head').append('<'+'link rel="stylesheet" href="' + theme_url + '" type="text/css" />'); - themes_loaded.push(theme_url); - } - if(this._data.core.themes.name) { - this.element.removeClass('jstree-' + this._data.core.themes.name); - } - this._data.core.themes.name = theme_name; - this.element.addClass('jstree-' + theme_name); - this.element[this.settings.core.themes.responsive ? 'addClass' : 'removeClass' ]('jstree-' + theme_name + '-responsive'); - /** - * triggered when a theme is set - * @event - * @name set_theme.jstree - * @param {String} theme the new theme - */ - this.trigger('set_theme', { 'theme' : theme_name }); - }, - /** - * gets the name of the currently applied theme name - * @name get_theme() - * @return {String} - */ - get_theme : function () { return this._data.core.themes.name; }, - /** - * changes the theme variant (if the theme has variants) - * @name set_theme_variant(variant_name) - * @param {String|Boolean} variant_name the variant to apply (if `false` is used the current variant is removed) - */ - set_theme_variant : function (variant_name) { - if(this._data.core.themes.variant) { - this.element.removeClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant); - } - this._data.core.themes.variant = variant_name; - if(variant_name) { - this.element.addClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant); - } - }, - /** - * gets the name of the currently applied theme variant - * @name get_theme() - * @return {String} - */ - get_theme_variant : function () { return this._data.core.themes.variant; }, - /** - * shows a striped background on the container (if the theme supports it) - * @name show_stripes() - */ - show_stripes : function () { - this._data.core.themes.stripes = true; - this.get_container_ul().addClass("jstree-striped"); - /** - * triggered when stripes are shown - * @event - * @name show_stripes.jstree - */ - this.trigger('show_stripes'); - }, - /** - * hides the striped background on the container - * @name hide_stripes() - */ - hide_stripes : function () { - this._data.core.themes.stripes = false; - this.get_container_ul().removeClass("jstree-striped"); - /** - * triggered when stripes are hidden - * @event - * @name hide_stripes.jstree - */ - this.trigger('hide_stripes'); - }, - /** - * toggles the striped background on the container - * @name toggle_stripes() - */ - toggle_stripes : function () { if(this._data.core.themes.stripes) { this.hide_stripes(); } else { this.show_stripes(); } }, - /** - * shows the connecting dots (if the theme supports it) - * @name show_dots() - */ - show_dots : function () { - this._data.core.themes.dots = true; - this.get_container_ul().removeClass("jstree-no-dots"); - /** - * triggered when dots are shown - * @event - * @name show_dots.jstree - */ - this.trigger('show_dots'); - }, - /** - * hides the connecting dots - * @name hide_dots() - */ - hide_dots : function () { - this._data.core.themes.dots = false; - this.get_container_ul().addClass("jstree-no-dots"); - /** - * triggered when dots are hidden - * @event - * @name hide_dots.jstree - */ - this.trigger('hide_dots'); - }, - /** - * toggles the connecting dots - * @name toggle_dots() - */ - toggle_dots : function () { if(this._data.core.themes.dots) { this.hide_dots(); } else { this.show_dots(); } }, - /** - * show the node icons - * @name show_icons() - */ - show_icons : function () { - this._data.core.themes.icons = true; - this.get_container_ul().removeClass("jstree-no-icons"); - /** - * triggered when icons are shown - * @event - * @name show_icons.jstree - */ - this.trigger('show_icons'); - }, - /** - * hide the node icons - * @name hide_icons() - */ - hide_icons : function () { - this._data.core.themes.icons = false; - this.get_container_ul().addClass("jstree-no-icons"); - /** - * triggered when icons are hidden - * @event - * @name hide_icons.jstree - */ - this.trigger('hide_icons'); - }, - /** - * toggle the node icons - * @name toggle_icons() - */ - toggle_icons : function () { if(this._data.core.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }, - /** - * show the node ellipsis - * @name show_icons() - */ - show_ellipsis : function () { - this._data.core.themes.ellipsis = true; - this.get_container_ul().addClass("jstree-ellipsis"); - /** - * triggered when ellisis is shown - * @event - * @name show_ellipsis.jstree - */ - this.trigger('show_ellipsis'); - }, - /** - * hide the node ellipsis - * @name hide_ellipsis() - */ - hide_ellipsis : function () { - this._data.core.themes.ellipsis = false; - this.get_container_ul().removeClass("jstree-ellipsis"); - /** - * triggered when ellisis is hidden - * @event - * @name hide_ellipsis.jstree - */ - this.trigger('hide_ellipsis'); - }, - /** - * toggle the node ellipsis - * @name toggle_icons() - */ - toggle_ellipsis : function () { if(this._data.core.themes.ellipsis) { this.hide_ellipsis(); } else { this.show_ellipsis(); } }, - /** - * set the node icon for a node - * @name set_icon(obj, icon) - * @param {mixed} obj - * @param {String} icon the new icon - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class - */ - set_icon : function (obj, icon) { - var t1, t2, dom, old; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.set_icon(obj[t1], icon); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - old = obj.icon; - obj.icon = icon === true || icon === null || icon === undefined || icon === '' ? true : icon; - dom = this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon"); - if(icon === false) { - dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel"); - this.hide_icon(obj); - } - else if(icon === true || icon === null || icon === undefined || icon === '') { - dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel"); - if(old === false) { this.show_icon(obj); } - } - else if(icon.indexOf("/") === -1 && icon.indexOf(".") === -1) { - dom.removeClass(old).css("background",""); - dom.addClass(icon + ' jstree-themeicon-custom').attr("rel",icon); - if(old === false) { this.show_icon(obj); } - } - else { - dom.removeClass(old).css("background",""); - dom.addClass('jstree-themeicon-custom').css("background", "url('" + icon + "') center center no-repeat").attr("rel",icon); - if(old === false) { this.show_icon(obj); } - } - return true; - }, - /** - * get the node icon for a node - * @name get_icon(obj) - * @param {mixed} obj - * @return {String} - */ - get_icon : function (obj) { - obj = this.get_node(obj); - return (!obj || obj.id === $.jstree.root) ? false : obj.icon; - }, - /** - * hide the icon on an individual node - * @name hide_icon(obj) - * @param {mixed} obj - */ - hide_icon : function (obj) { - var t1, t2; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.hide_icon(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj === $.jstree.root) { return false; } - obj.icon = false; - this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon").addClass('jstree-themeicon-hidden'); - return true; - }, - /** - * show the icon on an individual node - * @name show_icon(obj) - * @param {mixed} obj - */ - show_icon : function (obj) { - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.show_icon(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj === $.jstree.root) { return false; } - dom = this.get_node(obj, true); - obj.icon = dom.length ? dom.children(".jstree-anchor").children(".jstree-themeicon").attr('rel') : true; - if(!obj.icon) { obj.icon = true; } - dom.children(".jstree-anchor").children(".jstree-themeicon").removeClass('jstree-themeicon-hidden'); - return true; - } - }; - - // helpers - $.vakata = {}; - // collect attributes - $.vakata.attributes = function(node, with_values) { - node = $(node)[0]; - var attr = with_values ? {} : []; - if(node && node.attributes) { - $.each(node.attributes, function (i, v) { - if($.inArray(v.name.toLowerCase(),['style','contenteditable','hasfocus','tabindex']) !== -1) { return; } - if(v.value !== null && $.trim(v.value) !== '') { - if(with_values) { attr[v.name] = v.value; } - else { attr.push(v.name); } - } - }); - } - return attr; - }; - $.vakata.array_unique = function(array) { - var a = [], i, j, l, o = {}; - for(i = 0, l = array.length; i < l; i++) { - if(o[array[i]] === undefined) { - a.push(array[i]); - o[array[i]] = true; - } - } - return a; - }; - // remove item from array - $.vakata.array_remove = function(array, from) { - array.splice(from, 1); - return array; - //var rest = array.slice((to || from) + 1 || array.length); - //array.length = from < 0 ? array.length + from : from; - //array.push.apply(array, rest); - //return array; - }; - // remove item from array - $.vakata.array_remove_item = function(array, item) { - var tmp = $.inArray(item, array); - return tmp !== -1 ? $.vakata.array_remove(array, tmp) : array; - }; - $.vakata.array_filter = function(c,a,b,d,e) { - if (c.filter) { - return c.filter(a, b); - } - d=[]; - for (e in c) { - if (~~e+''===e+'' && e>=0 && a.call(b,c[e],+e,c)) { - d.push(c[e]); - } - } - return d; - }; - - -/** - * ### Changed plugin - * - * This plugin adds more information to the `changed.jstree` event. The new data is contained in the `changed` event data property, and contains a lists of `selected` and `deselected` nodes. - */ - - $.jstree.plugins.changed = function (options, parent) { - var last = []; - this.trigger = function (ev, data) { - var i, j; - if(!data) { - data = {}; - } - if(ev.replace('.jstree','') === 'changed') { - data.changed = { selected : [], deselected : [] }; - var tmp = {}; - for(i = 0, j = last.length; i < j; i++) { - tmp[last[i]] = 1; - } - for(i = 0, j = data.selected.length; i < j; i++) { - if(!tmp[data.selected[i]]) { - data.changed.selected.push(data.selected[i]); - } - else { - tmp[data.selected[i]] = 2; - } - } - for(i = 0, j = last.length; i < j; i++) { - if(tmp[last[i]] === 1) { - data.changed.deselected.push(last[i]); - } - } - last = data.selected.slice(); - } - /** - * triggered when selection changes (the "changed" plugin enhances the original event with more data) - * @event - * @name changed.jstree - * @param {Object} node - * @param {Object} action the action that caused the selection to change - * @param {Array} selected the current selection - * @param {Object} changed an object containing two properties `selected` and `deselected` - both arrays of node IDs, which were selected or deselected since the last changed event - * @param {Object} event the event (if any) that triggered this changed event - * @plugin changed - */ - parent.trigger.call(this, ev, data); - }; - this.refresh = function (skip_loading, forget_state) { - last = []; - return parent.refresh.apply(this, arguments); - }; - }; - -/** - * ### Checkbox plugin - * - * This plugin renders checkbox icons in front of each node, making multiple selection much easier. - * It also supports tri-state behavior, meaning that if a node has a few of its children checked it will be rendered as undetermined, and state will be propagated up. - */ - - var _i = document.createElement('I'); - _i.className = 'jstree-icon jstree-checkbox'; - _i.setAttribute('role', 'presentation'); - /** - * stores all defaults for the checkbox plugin - * @name $.jstree.defaults.checkbox - * @plugin checkbox - */ - $.jstree.defaults.checkbox = { - /** - * a boolean indicating if checkboxes should be visible (can be changed at a later time using `show_checkboxes()` and `hide_checkboxes`). Defaults to `true`. - * @name $.jstree.defaults.checkbox.visible - * @plugin checkbox - */ - visible : true, - /** - * a boolean indicating if checkboxes should cascade down and have an undetermined state. Defaults to `true`. - * @name $.jstree.defaults.checkbox.three_state - * @plugin checkbox - */ - three_state : true, - /** - * a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`. - * @name $.jstree.defaults.checkbox.whole_node - * @plugin checkbox - */ - whole_node : true, - /** - * a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`. - * @name $.jstree.defaults.checkbox.keep_selected_style - * @plugin checkbox - */ - keep_selected_style : true, - /** - * This setting controls how cascading and undetermined nodes are applied. - * If 'up' is in the string - cascading up is enabled, if 'down' is in the string - cascading down is enabled, if 'undetermined' is in the string - undetermined nodes will be used. - * If `three_state` is set to `true` this setting is automatically set to 'up+down+undetermined'. Defaults to ''. - * @name $.jstree.defaults.checkbox.cascade - * @plugin checkbox - */ - cascade : '', - /** - * This setting controls if checkbox are bound to the general tree selection or to an internal array maintained by the checkbox plugin. Defaults to `true`, only set to `false` if you know exactly what you are doing. - * @name $.jstree.defaults.checkbox.tie_selection - * @plugin checkbox - */ - tie_selection : true, - - /** - * This setting controls if cascading down affects disabled checkboxes - * @name $.jstree.defaults.checkbox.cascade_to_disabled - * @plugin checkbox - */ - cascade_to_disabled : true, - - /** - * This setting controls if cascading down affects hidden checkboxes - * @name $.jstree.defaults.checkbox.cascade_to_hidden - * @plugin checkbox - */ - cascade_to_hidden : true - }; - $.jstree.plugins.checkbox = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - this._data.checkbox.uto = false; - this._data.checkbox.selected = []; - if(this.settings.checkbox.three_state) { - this.settings.checkbox.cascade = 'up+down+undetermined'; - } - this.element - .on("init.jstree", $.proxy(function () { - this._data.checkbox.visible = this.settings.checkbox.visible; - if(!this.settings.checkbox.keep_selected_style) { - this.element.addClass('jstree-checkbox-no-clicked'); - } - if(this.settings.checkbox.tie_selection) { - this.element.addClass('jstree-checkbox-selection'); - } - }, this)) - .on("loading.jstree", $.proxy(function () { - this[ this._data.checkbox.visible ? 'show_checkboxes' : 'hide_checkboxes' ](); - }, this)); - if(this.settings.checkbox.cascade.indexOf('undetermined') !== -1) { - this.element - .on('changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree', $.proxy(function () { - // only if undetermined is in setting - if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); } - this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50); - }, this)); - } - if(!this.settings.checkbox.tie_selection) { - this.element - .on('model.jstree', $.proxy(function (e, data) { - var m = this._model.data, - p = m[data.parent], - dpc = data.nodes, - i, j; - for(i = 0, j = dpc.length; i < j; i++) { - m[dpc[i]].state.checked = m[dpc[i]].state.checked || (m[dpc[i]].original && m[dpc[i]].original.state && m[dpc[i]].original.state.checked); - if(m[dpc[i]].state.checked) { - this._data.checkbox.selected.push(dpc[i]); - } - } - }, this)); - } - if(this.settings.checkbox.cascade.indexOf('up') !== -1 || this.settings.checkbox.cascade.indexOf('down') !== -1) { - this.element - .on('model.jstree', $.proxy(function (e, data) { - var m = this._model.data, - p = m[data.parent], - dpc = data.nodes, - chd = [], - c, i, j, k, l, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection; - - if(s.indexOf('down') !== -1) { - // apply down - if(p.state[ t ? 'selected' : 'checked' ]) { - for(i = 0, j = dpc.length; i < j; i++) { - m[dpc[i]].state[ t ? 'selected' : 'checked' ] = true; - } - - this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(dpc); - } - else { - for(i = 0, j = dpc.length; i < j; i++) { - if(m[dpc[i]].state[ t ? 'selected' : 'checked' ]) { - for(k = 0, l = m[dpc[i]].children_d.length; k < l; k++) { - m[m[dpc[i]].children_d[k]].state[ t ? 'selected' : 'checked' ] = true; - } - this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(m[dpc[i]].children_d); - } - } - } - } - - if(s.indexOf('up') !== -1) { - // apply up - for(i = 0, j = p.children_d.length; i < j; i++) { - if(!m[p.children_d[i]].children.length) { - chd.push(m[p.children_d[i]].parent); - } - } - chd = $.vakata.array_unique(chd); - for(k = 0, l = chd.length; k < l; k++) { - p = m[chd[k]]; - while(p && p.id !== $.jstree.root) { - c = 0; - for(i = 0, j = p.children.length; i < j; i++) { - c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(c === j) { - p.state[ t ? 'selected' : 'checked' ] = true; - this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass( t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - p = this.get_node(p.parent); - } - } - } - - this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected); - }, this)) - .on(this.settings.checkbox.tie_selection ? 'select_node.jstree' : 'check_node.jstree', $.proxy(function (e, data) { - var self = this, - obj = data.node, - m = this._model.data, - par = this.get_node(obj.parent), - i, j, c, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection, - sel = {}, cur = this._data[ t ? 'core' : 'checkbox' ].selected; - - for (i = 0, j = cur.length; i < j; i++) { - sel[cur[i]] = true; - } - - // apply down - if(s.indexOf('down') !== -1) { - //this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected.concat(obj.children_d)); - var selectedIds = this._cascade_new_checked_state(obj.id, true); - var temp = obj.children_d.concat(obj.id); - for (i = 0, j = temp.length; i < j; i++) { - if (selectedIds.indexOf(temp[i]) > -1) { - sel[temp[i]] = true; - } - else { - delete sel[temp[i]]; - } - } - } - - // apply up - if(s.indexOf('up') !== -1) { - while(par && par.id !== $.jstree.root) { - c = 0; - for(i = 0, j = par.children.length; i < j; i++) { - c += m[par.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(c === j) { - par.state[ t ? 'selected' : 'checked' ] = true; - sel[par.id] = true; - //this._data[ t ? 'core' : 'checkbox' ].selected.push(par.id); - tmp = this.get_node(par, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - par = this.get_node(par.parent); - } - } - - cur = []; - for (i in sel) { - if (sel.hasOwnProperty(i)) { - cur.push(i); - } - } - this._data[ t ? 'core' : 'checkbox' ].selected = cur; - }, this)) - .on(this.settings.checkbox.tie_selection ? 'deselect_all.jstree' : 'uncheck_all.jstree', $.proxy(function (e, data) { - var obj = this.get_node($.jstree.root), - m = this._model.data, - i, j, tmp; - for(i = 0, j = obj.children_d.length; i < j; i++) { - tmp = m[obj.children_d[i]]; - if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { - tmp.original.state.undetermined = false; - } - } - }, this)) - .on(this.settings.checkbox.tie_selection ? 'deselect_node.jstree' : 'uncheck_node.jstree', $.proxy(function (e, data) { - var self = this, - obj = data.node, - dom = this.get_node(obj, true), - i, j, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection, - cur = this._data[ t ? 'core' : 'checkbox' ].selected, sel = {}, - stillSelectedIds = [], - allIds = obj.children_d.concat(obj.id); - - // apply down - if(s.indexOf('down') !== -1) { - var selectedIds = this._cascade_new_checked_state(obj.id, false); - - cur = cur.filter(function(id) { - return allIds.indexOf(id) === -1 || selectedIds.indexOf(id) > -1; - }); - } - - // only apply up if cascade up is enabled and if this node is not selected - // (if all child nodes are disabled and cascade_to_disabled === false then this node will till be selected). - if(s.indexOf('up') !== -1 && cur.indexOf(obj.id) === -1) { - for(i = 0, j = obj.parents.length; i < j; i++) { - tmp = this._model.data[obj.parents[i]]; - tmp.state[ t ? 'selected' : 'checked' ] = false; - if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { - tmp.original.state.undetermined = false; - } - tmp = this.get_node(obj.parents[i], true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - - cur = cur.filter(function(id) { - return obj.parents.indexOf(id) === -1; - }); - } - - this._data[ t ? 'core' : 'checkbox' ].selected = cur; - }, this)); - } - if(this.settings.checkbox.cascade.indexOf('up') !== -1) { - this.element - .on('delete_node.jstree', $.proxy(function (e, data) { - // apply up (whole handler) - var p = this.get_node(data.parent), - m = this._model.data, - i, j, c, tmp, t = this.settings.checkbox.tie_selection; - while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) { - c = 0; - for(i = 0, j = p.children.length; i < j; i++) { - c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(j > 0 && c === j) { - p.state[ t ? 'selected' : 'checked' ] = true; - this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - p = this.get_node(p.parent); - } - }, this)) - .on('move_node.jstree', $.proxy(function (e, data) { - // apply up (whole handler) - var is_multi = data.is_multi, - old_par = data.old_parent, - new_par = this.get_node(data.parent), - m = this._model.data, - p, c, i, j, tmp, t = this.settings.checkbox.tie_selection; - if(!is_multi) { - p = this.get_node(old_par); - while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) { - c = 0; - for(i = 0, j = p.children.length; i < j; i++) { - c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(j > 0 && c === j) { - p.state[ t ? 'selected' : 'checked' ] = true; - this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - p = this.get_node(p.parent); - } - } - p = new_par; - while(p && p.id !== $.jstree.root) { - c = 0; - for(i = 0, j = p.children.length; i < j; i++) { - c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; - } - if(c === j) { - if(!p.state[ t ? 'selected' : 'checked' ]) { - p.state[ t ? 'selected' : 'checked' ] = true; - this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - } - else { - if(p.state[ t ? 'selected' : 'checked' ]) { - p.state[ t ? 'selected' : 'checked' ] = false; - this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_remove_item(this._data[ t ? 'core' : 'checkbox' ].selected, p.id); - tmp = this.get_node(p, true); - if(tmp && tmp.length) { - tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - break; - } - } - p = this.get_node(p.parent); - } - }, this)); - } - }; - /** - * get an array of all nodes whose state is "undetermined" - * @name get_undetermined([full]) - * @param {boolean} full: if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - this.get_undetermined = function (full) { - if (this.settings.checkbox.cascade.indexOf('undetermined') === -1) { - return []; - } - var i, j, k, l, o = {}, m = this._model.data, t = this.settings.checkbox.tie_selection, s = this._data[ t ? 'core' : 'checkbox' ].selected, p = [], tt = this, r = []; - for(i = 0, j = s.length; i < j; i++) { - if(m[s[i]] && m[s[i]].parents) { - for(k = 0, l = m[s[i]].parents.length; k < l; k++) { - if(o[m[s[i]].parents[k]] !== undefined) { - break; - } - if(m[s[i]].parents[k] !== $.jstree.root) { - o[m[s[i]].parents[k]] = true; - p.push(m[s[i]].parents[k]); - } - } - } - } - // attempt for server side undetermined state - this.element.find('.jstree-closed').not(':has(.jstree-children)') - .each(function () { - var tmp = tt.get_node(this), tmp2; - - if(!tmp) { return; } - - if(!tmp.state.loaded) { - if(tmp.original && tmp.original.state && tmp.original.state.undetermined && tmp.original.state.undetermined === true) { - if(o[tmp.id] === undefined && tmp.id !== $.jstree.root) { - o[tmp.id] = true; - p.push(tmp.id); - } - for(k = 0, l = tmp.parents.length; k < l; k++) { - if(o[tmp.parents[k]] === undefined && tmp.parents[k] !== $.jstree.root) { - o[tmp.parents[k]] = true; - p.push(tmp.parents[k]); - } - } - } - } - else { - for(i = 0, j = tmp.children_d.length; i < j; i++) { - tmp2 = m[tmp.children_d[i]]; - if(!tmp2.state.loaded && tmp2.original && tmp2.original.state && tmp2.original.state.undetermined && tmp2.original.state.undetermined === true) { - if(o[tmp2.id] === undefined && tmp2.id !== $.jstree.root) { - o[tmp2.id] = true; - p.push(tmp2.id); - } - for(k = 0, l = tmp2.parents.length; k < l; k++) { - if(o[tmp2.parents[k]] === undefined && tmp2.parents[k] !== $.jstree.root) { - o[tmp2.parents[k]] = true; - p.push(tmp2.parents[k]); - } - } - } - } - } - }); - for (i = 0, j = p.length; i < j; i++) { - if(!m[p[i]].state[ t ? 'selected' : 'checked' ]) { - r.push(full ? m[p[i]] : p[i]); - } - } - return r; - }; - /** - * set the undetermined state where and if necessary. Used internally. - * @private - * @name _undetermined() - * @plugin checkbox - */ - this._undetermined = function () { - if(this.element === null) { return; } - var p = this.get_undetermined(false), i, j, s; - - this.element.find('.jstree-undetermined').removeClass('jstree-undetermined'); - for (i = 0, j = p.length; i < j; i++) { - s = this.get_node(p[i], true); - if(s && s.length) { - s.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-undetermined'); - } - } - }; - this.redraw_node = function(obj, deep, is_callback, force_render) { - obj = parent.redraw_node.apply(this, arguments); - if(obj) { - var i, j, tmp = null, icon = null; - for(i = 0, j = obj.childNodes.length; i < j; i++) { - if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { - tmp = obj.childNodes[i]; - break; - } - } - if(tmp) { - if(!this.settings.checkbox.tie_selection && this._model.data[obj.id].state.checked) { tmp.className += ' jstree-checked'; } - icon = _i.cloneNode(false); - if(this._model.data[obj.id].state.checkbox_disabled) { icon.className += ' jstree-checkbox-disabled'; } - tmp.insertBefore(icon, tmp.childNodes[0]); - } - } - if(!is_callback && this.settings.checkbox.cascade.indexOf('undetermined') !== -1) { - if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); } - this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50); - } - return obj; - }; - /** - * show the node checkbox icons - * @name show_checkboxes() - * @plugin checkbox - */ - this.show_checkboxes = function () { this._data.core.themes.checkboxes = true; this.get_container_ul().removeClass("jstree-no-checkboxes"); }; - /** - * hide the node checkbox icons - * @name hide_checkboxes() - * @plugin checkbox - */ - this.hide_checkboxes = function () { this._data.core.themes.checkboxes = false; this.get_container_ul().addClass("jstree-no-checkboxes"); }; - /** - * toggle the node icons - * @name toggle_checkboxes() - * @plugin checkbox - */ - this.toggle_checkboxes = function () { if(this._data.core.themes.checkboxes) { this.hide_checkboxes(); } else { this.show_checkboxes(); } }; - /** - * checks if a node is in an undetermined state - * @name is_undetermined(obj) - * @param {mixed} obj - * @return {Boolean} - */ - this.is_undetermined = function (obj) { - obj = this.get_node(obj); - var s = this.settings.checkbox.cascade, i, j, t = this.settings.checkbox.tie_selection, d = this._data[ t ? 'core' : 'checkbox' ].selected, m = this._model.data; - if(!obj || obj.state[ t ? 'selected' : 'checked' ] === true || s.indexOf('undetermined') === -1 || (s.indexOf('down') === -1 && s.indexOf('up') === -1)) { - return false; - } - if(!obj.state.loaded && obj.original.state.undetermined === true) { - return true; - } - for(i = 0, j = obj.children_d.length; i < j; i++) { - if($.inArray(obj.children_d[i], d) !== -1 || (!m[obj.children_d[i]].state.loaded && m[obj.children_d[i]].original.state.undetermined)) { - return true; - } - } - return false; - }; - /** - * disable a node's checkbox - * @name disable_checkbox(obj) - * @param {mixed} obj an array can be used too - * @trigger disable_checkbox.jstree - * @plugin checkbox - */ - this.disable_checkbox = function (obj) { - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.disable_checkbox(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(!obj.state.checkbox_disabled) { - obj.state.checkbox_disabled = true; - if(dom && dom.length) { - dom.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-checkbox-disabled'); - } - /** - * triggered when an node's checkbox is disabled - * @event - * @name disable_checkbox.jstree - * @param {Object} node - * @plugin checkbox - */ - this.trigger('disable_checkbox', { 'node' : obj }); - } - }; - /** - * enable a node's checkbox - * @name disable_checkbox(obj) - * @param {mixed} obj an array can be used too - * @trigger enable_checkbox.jstree - * @plugin checkbox - */ - this.enable_checkbox = function (obj) { - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.enable_checkbox(obj[t1]); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(obj.state.checkbox_disabled) { - obj.state.checkbox_disabled = false; - if(dom && dom.length) { - dom.children('.jstree-anchor').children('.jstree-checkbox').removeClass('jstree-checkbox-disabled'); - } - /** - * triggered when an node's checkbox is enabled - * @event - * @name enable_checkbox.jstree - * @param {Object} node - * @plugin checkbox - */ - this.trigger('enable_checkbox', { 'node' : obj }); - } - }; - - this.activate_node = function (obj, e) { - if($(e.target).hasClass('jstree-checkbox-disabled')) { - return false; - } - if(this.settings.checkbox.tie_selection && (this.settings.checkbox.whole_node || $(e.target).hasClass('jstree-checkbox'))) { - e.ctrlKey = true; - } - if(this.settings.checkbox.tie_selection || (!this.settings.checkbox.whole_node && !$(e.target).hasClass('jstree-checkbox'))) { - return parent.activate_node.call(this, obj, e); - } - if(this.is_disabled(obj)) { - return false; - } - if(this.is_checked(obj)) { - this.uncheck_node(obj, e); - } - else { - this.check_node(obj, e); - } - this.trigger('activate_node', { 'node' : this.get_node(obj) }); - }; - - /** - * Cascades checked state to a node and all its descendants. This function does NOT affect hidden and disabled nodes (or their descendants). - * However if these unaffected nodes are already selected their ids will be included in the returned array. - * @private - * @param {string} id the node ID - * @param {bool} checkedState should the nodes be checked or not - * @returns {Array} Array of all node id's (in this tree branch) that are checked. - */ - this._cascade_new_checked_state = function (id, checkedState) { - var self = this; - var t = this.settings.checkbox.tie_selection; - var node = this._model.data[id]; - var selectedNodeIds = []; - var selectedChildrenIds = [], i, j, selectedChildIds; - - if ( - (this.settings.checkbox.cascade_to_disabled || !node.state.disabled) && - (this.settings.checkbox.cascade_to_hidden || !node.state.hidden) - ) { - //First try and check/uncheck the children - if (node.children) { - for (i = 0, j = node.children.length; i < j; i++) { - var childId = node.children[i]; - selectedChildIds = self._cascade_new_checked_state(childId, checkedState); - selectedNodeIds = selectedNodeIds.concat(selectedChildIds); - if (selectedChildIds.indexOf(childId) > -1) { - selectedChildrenIds.push(childId); - } - } - } - - var dom = self.get_node(node, true); - - //A node's state is undetermined if some but not all of it's children are checked/selected . - var undetermined = selectedChildrenIds.length > 0 && selectedChildrenIds.length < node.children.length; - - if(node.original && node.original.state && node.original.state.undetermined) { - node.original.state.undetermined = undetermined; - } - - //If a node is undetermined then remove selected class - if (undetermined) { - node.state[ t ? 'selected' : 'checked' ] = false; - dom.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - //Otherwise, if the checkedState === true (i.e. the node is being checked now) and all of the node's children are checked (if it has any children), - //check the node and style it correctly. - else if (checkedState && selectedChildrenIds.length === node.children.length) { - node.state[ t ? 'selected' : 'checked' ] = checkedState; - selectedNodeIds.push(node.id); - - dom.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - else { - node.state[ t ? 'selected' : 'checked' ] = false; - dom.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); - } - } - else { - selectedChildIds = this.get_checked_descendants(id); - - if (node.state[ t ? 'selected' : 'checked' ]) { - selectedChildIds.push(node.id); - } - - selectedNodeIds = selectedNodeIds.concat(selectedChildIds); - } - - return selectedNodeIds; - }; - - /** - * Gets ids of nodes selected in branch (of tree) specified by id (does not include the node specified by id) - * @name get_checked_descendants(obj) - * @param {string} id the node ID - * @return {Array} array of IDs - * @plugin checkbox - */ - this.get_checked_descendants = function (id) { - var self = this; - var t = self.settings.checkbox.tie_selection; - var node = self._model.data[id]; - - return node.children_d.filter(function(_id) { - return self._model.data[_id].state[ t ? 'selected' : 'checked' ]; - }); - }; - - /** - * check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally) - * @name check_node(obj) - * @param {mixed} obj an array can be used to check multiple nodes - * @trigger check_node.jstree - * @plugin checkbox - */ - this.check_node = function (obj, e) { - if(this.settings.checkbox.tie_selection) { return this.select_node(obj, false, true, e); } - var dom, t1, t2, th; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.check_node(obj[t1], e); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(!obj.state.checked) { - obj.state.checked = true; - this._data.checkbox.selected.push(obj.id); - if(dom && dom.length) { - dom.children('.jstree-anchor').addClass('jstree-checked'); - } - /** - * triggered when an node is checked (only if tie_selection in checkbox settings is false) - * @event - * @name check_node.jstree - * @param {Object} node - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this check_node - * @plugin checkbox - */ - this.trigger('check_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e }); - } - }; - /** - * uncheck a node (only if tie_selection in checkbox settings is false, otherwise deselect_node will be called internally) - * @name uncheck_node(obj) - * @param {mixed} obj an array can be used to uncheck multiple nodes - * @trigger uncheck_node.jstree - * @plugin checkbox - */ - this.uncheck_node = function (obj, e) { - if(this.settings.checkbox.tie_selection) { return this.deselect_node(obj, false, e); } - var t1, t2, dom; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.uncheck_node(obj[t1], e); - } - return true; - } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { - return false; - } - dom = this.get_node(obj, true); - if(obj.state.checked) { - obj.state.checked = false; - this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, obj.id); - if(dom.length) { - dom.children('.jstree-anchor').removeClass('jstree-checked'); - } - /** - * triggered when an node is unchecked (only if tie_selection in checkbox settings is false) - * @event - * @name uncheck_node.jstree - * @param {Object} node - * @param {Array} selected the current selection - * @param {Object} event the event (if any) that triggered this uncheck_node - * @plugin checkbox - */ - this.trigger('uncheck_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e }); - } - }; - - /** - * checks all nodes in the tree (only if tie_selection in checkbox settings is false, otherwise select_all will be called internally) - * @name check_all() - * @trigger check_all.jstree, changed.jstree - * @plugin checkbox - */ - this.check_all = function () { - if(this.settings.checkbox.tie_selection) { return this.select_all(); } - var tmp = this._data.checkbox.selected.concat([]), i, j; - this._data.checkbox.selected = this._model.data[$.jstree.root].children_d.concat(); - for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) { - if(this._model.data[this._data.checkbox.selected[i]]) { - this._model.data[this._data.checkbox.selected[i]].state.checked = true; - } - } - this.redraw(true); - /** - * triggered when all nodes are checked (only if tie_selection in checkbox settings is false) - * @event - * @name check_all.jstree - * @param {Array} selected the current selection - * @plugin checkbox - */ - this.trigger('check_all', { 'selected' : this._data.checkbox.selected }); - }; - /** - * uncheck all checked nodes (only if tie_selection in checkbox settings is false, otherwise deselect_all will be called internally) - * @name uncheck_all() - * @trigger uncheck_all.jstree - * @plugin checkbox - */ - this.uncheck_all = function () { - if(this.settings.checkbox.tie_selection) { return this.deselect_all(); } - var tmp = this._data.checkbox.selected.concat([]), i, j; - for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) { - if(this._model.data[this._data.checkbox.selected[i]]) { - this._model.data[this._data.checkbox.selected[i]].state.checked = false; - } - } - this._data.checkbox.selected = []; - this.element.find('.jstree-checked').removeClass('jstree-checked'); - /** - * triggered when all nodes are unchecked (only if tie_selection in checkbox settings is false) - * @event - * @name uncheck_all.jstree - * @param {Object} node the previous selection - * @param {Array} selected the current selection - * @plugin checkbox - */ - this.trigger('uncheck_all', { 'selected' : this._data.checkbox.selected, 'node' : tmp }); - }; - /** - * checks if a node is checked (if tie_selection is on in the settings this function will return the same as is_selected) - * @name is_checked(obj) - * @param {mixed} obj - * @return {Boolean} - * @plugin checkbox - */ - this.is_checked = function (obj) { - if(this.settings.checkbox.tie_selection) { return this.is_selected(obj); } - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - return obj.state.checked; - }; - /** - * get an array of all checked nodes (if tie_selection is on in the settings this function will return the same as get_selected) - * @name get_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - this.get_checked = function (full) { - if(this.settings.checkbox.tie_selection) { return this.get_selected(full); } - return full ? $.map(this._data.checkbox.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.checkbox.selected; - }; - /** - * get an array of all top level checked nodes (ignoring children of checked nodes) (if tie_selection is on in the settings this function will return the same as get_top_selected) - * @name get_top_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - this.get_top_checked = function (full) { - if(this.settings.checkbox.tie_selection) { return this.get_top_selected(full); } - var tmp = this.get_checked(true), - obj = {}, i, j, k, l; - for(i = 0, j = tmp.length; i < j; i++) { - obj[tmp[i].id] = tmp[i]; - } - for(i = 0, j = tmp.length; i < j; i++) { - for(k = 0, l = tmp[i].children_d.length; k < l; k++) { - if(obj[tmp[i].children_d[k]]) { - delete obj[tmp[i].children_d[k]]; - } - } - } - tmp = []; - for(i in obj) { - if(obj.hasOwnProperty(i)) { - tmp.push(i); - } - } - return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp; - }; - /** - * get an array of all bottom level checked nodes (ignoring selected parents) (if tie_selection is on in the settings this function will return the same as get_bottom_selected) - * @name get_bottom_checked([full]) - * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned - * @return {Array} - * @plugin checkbox - */ - this.get_bottom_checked = function (full) { - if(this.settings.checkbox.tie_selection) { return this.get_bottom_selected(full); } - var tmp = this.get_checked(true), - obj = [], i, j; - for(i = 0, j = tmp.length; i < j; i++) { - if(!tmp[i].children.length) { - obj.push(tmp[i].id); - } - } - return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj; - }; - this.load_node = function (obj, callback) { - var k, l, i, j, c, tmp; - if(!$.isArray(obj) && !this.settings.checkbox.tie_selection) { - tmp = this.get_node(obj); - if(tmp && tmp.state.loaded) { - for(k = 0, l = tmp.children_d.length; k < l; k++) { - if(this._model.data[tmp.children_d[k]].state.checked) { - c = true; - this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, tmp.children_d[k]); - } - } - } - } - return parent.load_node.apply(this, arguments); - }; - this.get_state = function () { - var state = parent.get_state.apply(this, arguments); - if(this.settings.checkbox.tie_selection) { return state; } - state.checkbox = this._data.checkbox.selected.slice(); - return state; - }; - this.set_state = function (state, callback) { - var res = parent.set_state.apply(this, arguments); - if(res && state.checkbox) { - if(!this.settings.checkbox.tie_selection) { - this.uncheck_all(); - var _this = this; - $.each(state.checkbox, function (i, v) { - _this.check_node(v); - }); - } - delete state.checkbox; - this.set_state(state, callback); - return false; - } - return res; - }; - this.refresh = function (skip_loading, forget_state) { - if(this.settings.checkbox.tie_selection) { - this._data.checkbox.selected = []; - } - return parent.refresh.apply(this, arguments); - }; - }; - - // include the checkbox plugin by default - // $.jstree.defaults.plugins.push("checkbox"); - - -/** - * ### Conditionalselect plugin - * - * This plugin allows defining a callback to allow or deny node selection by user input (activate node method). - */ - - /** - * 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`. - * @name $.jstree.defaults.checkbox.visible - * @plugin checkbox - */ - $.jstree.defaults.conditionalselect = function () { return true; }; - $.jstree.plugins.conditionalselect = function (options, parent) { - // own function - this.activate_node = function (obj, e) { - if(this.settings.conditionalselect.call(this, this.get_node(obj), e)) { - return parent.activate_node.call(this, obj, e); - } - }; - }; - - -/** - * ### Contextmenu plugin - * - * Shows a context menu when a node is right-clicked. - */ - - /** - * stores all defaults for the contextmenu plugin - * @name $.jstree.defaults.contextmenu - * @plugin contextmenu - */ - $.jstree.defaults.contextmenu = { - /** - * a boolean indicating if the node should be selected when the context menu is invoked on it. Defaults to `true`. - * @name $.jstree.defaults.contextmenu.select_node - * @plugin contextmenu - */ - select_node : true, - /** - * a boolean indicating if the menu should be shown aligned with the node. Defaults to `true`, otherwise the mouse coordinates are used. - * @name $.jstree.defaults.contextmenu.show_at_node - * @plugin contextmenu - */ - show_at_node : true, - /** - * an object of actions, or a function that accepts a node and a callback function and calls the callback function with an object of actions available for that node (you can also return the items too). - * - * Each action consists of a key (a unique name) and a value which is an object with the following properties (only label and action are required). Once a menu item is activated the `action` function will be invoked with an object containing the following keys: item - the contextmenu item definition as seen below, reference - the DOM node that was used (the tree node), element - the contextmenu DOM element, position - an object with x/y properties indicating the position of the menu. - * - * * `separator_before` - a boolean indicating if there should be a separator before this item - * * `separator_after` - a boolean indicating if there should be a separator after this item - * * `_disabled` - a boolean indicating if this action should be disabled - * * `label` - a string - the name of the action (could be a function returning a string) - * * `title` - a string - an optional tooltip for the item - * * `action` - a function to be executed if this item is chosen, the function will receive - * * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class - * * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2) - * * `shortcut_label` - shortcut label (like for example `F2` for rename) - * * `submenu` - an object with the same structure as $.jstree.defaults.contextmenu.items which can be used to create a submenu - each key will be rendered as a separate option in a submenu that will appear once the current item is hovered - * - * @name $.jstree.defaults.contextmenu.items - * @plugin contextmenu - */ - items : function (o, cb) { // Could be an object directly - return { - "create" : { - "separator_before" : false, - "separator_after" : true, - "_disabled" : false, //(this.check("create_node", data.reference, {}, "last")), - "label" : "Create", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - inst.create_node(obj, {}, "last", function (new_node) { - try { - inst.edit(new_node); - } catch (ex) { - setTimeout(function () { inst.edit(new_node); },0); - } - }); - } - }, - "rename" : { - "separator_before" : false, - "separator_after" : false, - "_disabled" : false, //(this.check("rename_node", data.reference, this.get_parent(data.reference), "")), - "label" : "Rename", - /*! - "shortcut" : 113, - "shortcut_label" : 'F2', - "icon" : "glyphicon glyphicon-leaf", - */ - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - inst.edit(obj); - } - }, - "remove" : { - "separator_before" : false, - "icon" : false, - "separator_after" : false, - "_disabled" : false, //(this.check("delete_node", data.reference, this.get_parent(data.reference), "")), - "label" : "Delete", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - if(inst.is_selected(obj)) { - inst.delete_node(inst.get_selected()); - } - else { - inst.delete_node(obj); - } - } - }, - "ccp" : { - "separator_before" : true, - "icon" : false, - "separator_after" : false, - "label" : "Edit", - "action" : false, - "submenu" : { - "cut" : { - "separator_before" : false, - "separator_after" : false, - "label" : "Cut", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - if(inst.is_selected(obj)) { - inst.cut(inst.get_top_selected()); - } - else { - inst.cut(obj); - } - } - }, - "copy" : { - "separator_before" : false, - "icon" : false, - "separator_after" : false, - "label" : "Copy", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - if(inst.is_selected(obj)) { - inst.copy(inst.get_top_selected()); - } - else { - inst.copy(obj); - } - } - }, - "paste" : { - "separator_before" : false, - "icon" : false, - "_disabled" : function (data) { - return !$.jstree.reference(data.reference).can_paste(); - }, - "separator_after" : false, - "label" : "Paste", - "action" : function (data) { - var inst = $.jstree.reference(data.reference), - obj = inst.get_node(data.reference); - inst.paste(obj); - } - } - } - } - }; - } - }; - - $.jstree.plugins.contextmenu = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - - var last_ts = 0, cto = null, ex, ey; - this.element - .on("init.jstree loading.jstree ready.jstree", $.proxy(function () { - this.get_container_ul().addClass('jstree-contextmenu'); - }, this)) - .on("contextmenu.jstree", ".jstree-anchor", $.proxy(function (e, data) { - if (e.target.tagName.toLowerCase() === 'input') { - return; - } - e.preventDefault(); - last_ts = e.ctrlKey ? +new Date() : 0; - if(data || cto) { - last_ts = (+new Date()) + 10000; - } - if(cto) { - clearTimeout(cto); - } - if(!this.is_loading(e.currentTarget)) { - this.show_contextmenu(e.currentTarget, e.pageX, e.pageY, e); - } - }, this)) - .on("click.jstree", ".jstree-anchor", $.proxy(function (e) { - if(this._data.contextmenu.visible && (!last_ts || (+new Date()) - last_ts > 250)) { // work around safari & macOS ctrl+click - $.vakata.context.hide(); - } - last_ts = 0; - }, this)) - .on("touchstart.jstree", ".jstree-anchor", function (e) { - if(!e.originalEvent || !e.originalEvent.changedTouches || !e.originalEvent.changedTouches[0]) { - return; - } - ex = e.originalEvent.changedTouches[0].clientX; - ey = e.originalEvent.changedTouches[0].clientY; - cto = setTimeout(function () { - $(e.currentTarget).trigger('contextmenu', true); - }, 750); - }) - .on('touchmove.vakata.jstree', function (e) { - if(cto && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0] && (Math.abs(ex - e.originalEvent.changedTouches[0].clientX) > 10 || Math.abs(ey - e.originalEvent.changedTouches[0].clientY) > 10)) { - clearTimeout(cto); - $.vakata.context.hide(); - } - }) - .on('touchend.vakata.jstree', function (e) { - if(cto) { - clearTimeout(cto); - } - }); - - /*! - if(!('oncontextmenu' in document.body) && ('ontouchstart' in document.body)) { - var el = null, tm = null; - this.element - .on("touchstart", ".jstree-anchor", function (e) { - el = e.currentTarget; - tm = +new Date(); - $(document).one("touchend", function (e) { - e.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset); - e.currentTarget = e.target; - tm = ((+(new Date())) - tm); - if(e.target === el && tm > 600 && tm < 1000) { - e.preventDefault(); - $(el).trigger('contextmenu', e); - } - el = null; - tm = null; - }); - }); - } - */ - $(document).on("context_hide.vakata.jstree", $.proxy(function (e, data) { - this._data.contextmenu.visible = false; - $(data.reference).removeClass('jstree-context'); - }, this)); - }; - this.teardown = function () { - if(this._data.contextmenu.visible) { - $.vakata.context.hide(); - } - parent.teardown.call(this); - }; - - /** - * prepare and show the context menu for a node - * @name show_contextmenu(obj [, x, y]) - * @param {mixed} obj the node - * @param {Number} x the x-coordinate relative to the document to show the menu at - * @param {Number} y the y-coordinate relative to the document to show the menu at - * @param {Object} e the event if available that triggered the contextmenu - * @plugin contextmenu - * @trigger show_contextmenu.jstree - */ - this.show_contextmenu = function (obj, x, y, e) { - obj = this.get_node(obj); - if(!obj || obj.id === $.jstree.root) { return false; } - var s = this.settings.contextmenu, - d = this.get_node(obj, true), - a = d.children(".jstree-anchor"), - o = false, - i = false; - if(s.show_at_node || x === undefined || y === undefined) { - o = a.offset(); - x = o.left; - y = o.top + this._data.core.li_height; - } - if(this.settings.contextmenu.select_node && !this.is_selected(obj)) { - this.activate_node(obj, e); - } - - i = s.items; - if($.isFunction(i)) { - i = i.call(this, obj, $.proxy(function (i) { - this._show_contextmenu(obj, x, y, i); - }, this)); - } - if($.isPlainObject(i)) { - this._show_contextmenu(obj, x, y, i); - } - }; - /** - * show the prepared context menu for a node - * @name _show_contextmenu(obj, x, y, i) - * @param {mixed} obj the node - * @param {Number} x the x-coordinate relative to the document to show the menu at - * @param {Number} y the y-coordinate relative to the document to show the menu at - * @param {Number} i the object of items to show - * @plugin contextmenu - * @trigger show_contextmenu.jstree - * @private - */ - this._show_contextmenu = function (obj, x, y, i) { - var d = this.get_node(obj, true), - a = d.children(".jstree-anchor"); - $(document).one("context_show.vakata.jstree", $.proxy(function (e, data) { - var cls = 'jstree-contextmenu jstree-' + this.get_theme() + '-contextmenu'; - $(data.element).addClass(cls); - a.addClass('jstree-context'); - }, this)); - this._data.contextmenu.visible = true; - $.vakata.context.show(a, { 'x' : x, 'y' : y }, i); - /** - * triggered when the contextmenu is shown for a node - * @event - * @name show_contextmenu.jstree - * @param {Object} node the node - * @param {Number} x the x-coordinate of the menu relative to the document - * @param {Number} y the y-coordinate of the menu relative to the document - * @plugin contextmenu - */ - this.trigger('show_contextmenu', { "node" : obj, "x" : x, "y" : y }); - }; - }; - - // contextmenu helper - (function ($) { - var right_to_left = false, - vakata_context = { - element : false, - reference : false, - position_x : 0, - position_y : 0, - items : [], - html : "", - is_visible : false - }; - - $.vakata.context = { - settings : { - hide_onmouseleave : 0, - icons : true - }, - _trigger : function (event_name) { - $(document).triggerHandler("context_" + event_name + ".vakata", { - "reference" : vakata_context.reference, - "element" : vakata_context.element, - "position" : { - "x" : vakata_context.position_x, - "y" : vakata_context.position_y - } - }); - }, - _execute : function (i) { - i = vakata_context.items[i]; - return i && (!i._disabled || ($.isFunction(i._disabled) && !i._disabled({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }))) && i.action ? i.action.call(null, { - "item" : i, - "reference" : vakata_context.reference, - "element" : vakata_context.element, - "position" : { - "x" : vakata_context.position_x, - "y" : vakata_context.position_y - } - }) : false; - }, - _parse : function (o, is_callback) { - if(!o) { return false; } - if(!is_callback) { - vakata_context.html = ""; - vakata_context.items = []; - } - var str = "", - sep = false, - tmp; - - if(is_callback) { str += "<"+"ul>"; } - $.each(o, function (i, val) { - if(!val) { return true; } - vakata_context.items.push(val); - if(!sep && val.separator_before) { - str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>"; - } - sep = false; - str += "<"+"li class='" + (val._class || "") + (val._disabled === true || ($.isFunction(val._disabled) && val._disabled({ "item" : val, "reference" : vakata_context.reference, "element" : vakata_context.element })) ? " vakata-contextmenu-disabled " : "") + "' "+(val.shortcut?" data-shortcut='"+val.shortcut+"' ":'')+">"; - str += "<"+"a href='#' rel='" + (vakata_context.items.length - 1) + "' " + (val.title ? "title='" + val.title + "'" : "") + ">"; - if($.vakata.context.settings.icons) { - str += "<"+"i "; - if(val.icon) { - if(val.icon.indexOf("/") !== -1 || val.icon.indexOf(".") !== -1) { str += " style='background:url(\"" + val.icon + "\") center center no-repeat' "; } - else { str += " class='" + val.icon + "' "; } - } - str += "><"+"/i><"+"span class='vakata-contextmenu-sep'> <"+"/span>"; - } - str += ($.isFunction(val.label) ? val.label({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }) : val.label) + (val.shortcut?' '+ (val.shortcut_label || '') +'':'') + "<"+"/a>"; - if(val.submenu) { - tmp = $.vakata.context._parse(val.submenu, true); - if(tmp) { str += tmp; } - } - str += "<"+"/li>"; - if(val.separator_after) { - str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>"; - sep = true; - } - }); - str = str.replace(/
  • <\/li\>$/,""); - if(is_callback) { str += ""; } - /** - * triggered on the document when the contextmenu is parsed (HTML is built) - * @event - * @plugin contextmenu - * @name context_parse.vakata - * @param {jQuery} reference the element that was right clicked - * @param {jQuery} element the DOM element of the menu itself - * @param {Object} position the x & y coordinates of the menu - */ - if(!is_callback) { vakata_context.html = str; $.vakata.context._trigger("parse"); } - return str.length > 10 ? str : false; - }, - _show_submenu : function (o) { - o = $(o); - if(!o.length || !o.children("ul").length) { return; } - var e = o.children("ul"), - xl = o.offset().left, - x = xl + o.outerWidth(), - y = o.offset().top, - w = e.width(), - h = e.height(), - dw = $(window).width() + $(window).scrollLeft(), - dh = $(window).height() + $(window).scrollTop(); - // може да се спести е една проверка - дали няма някой от класовете вече нагоре - if(right_to_left) { - o[x - (w + 10 + o.outerWidth()) < 0 ? "addClass" : "removeClass"]("vakata-context-left"); - } - else { - o[x + w > dw && xl > dw - x ? "addClass" : "removeClass"]("vakata-context-right"); - } - if(y + h + 10 > dh) { - e.css("bottom","-1px"); - } - - //if does not fit - stick it to the side - if (o.hasClass('vakata-context-right')) { - if (xl < w) { - e.css("margin-right", xl - w); - } - } else { - if (dw - x < w) { - e.css("margin-left", dw - x - w); - } - } - - e.show(); - }, - show : function (reference, position, data) { - var o, e, x, y, w, h, dw, dh, cond = true; - if(vakata_context.element && vakata_context.element.length) { - vakata_context.element.width(''); - } - switch(cond) { - case (!position && !reference): - return false; - case (!!position && !!reference): - vakata_context.reference = reference; - vakata_context.position_x = position.x; - vakata_context.position_y = position.y; - break; - case (!position && !!reference): - vakata_context.reference = reference; - o = reference.offset(); - vakata_context.position_x = o.left + reference.outerHeight(); - vakata_context.position_y = o.top; - break; - case (!!position && !reference): - vakata_context.position_x = position.x; - vakata_context.position_y = position.y; - break; - } - if(!!reference && !data && $(reference).data('vakata_contextmenu')) { - data = $(reference).data('vakata_contextmenu'); - } - if($.vakata.context._parse(data)) { - vakata_context.element.html(vakata_context.html); - } - if(vakata_context.items.length) { - vakata_context.element.appendTo(document.body); - e = vakata_context.element; - x = vakata_context.position_x; - y = vakata_context.position_y; - w = e.width(); - h = e.height(); - dw = $(window).width() + $(window).scrollLeft(); - dh = $(window).height() + $(window).scrollTop(); - if(right_to_left) { - x -= (e.outerWidth() - $(reference).outerWidth()); - if(x < $(window).scrollLeft() + 20) { - x = $(window).scrollLeft() + 20; - } - } - if(x + w + 20 > dw) { - x = dw - (w + 20); - } - if(y + h + 20 > dh) { - y = dh - (h + 20); - } - - vakata_context.element - .css({ "left" : x, "top" : y }) - .show() - .find('a').first().focus().parent().addClass("vakata-context-hover"); - vakata_context.is_visible = true; - /** - * triggered on the document when the contextmenu is shown - * @event - * @plugin contextmenu - * @name context_show.vakata - * @param {jQuery} reference the element that was right clicked - * @param {jQuery} element the DOM element of the menu itself - * @param {Object} position the x & y coordinates of the menu - */ - $.vakata.context._trigger("show"); - } - }, - hide : function () { - if(vakata_context.is_visible) { - vakata_context.element.hide().find("ul").hide().end().find(':focus').blur().end().detach(); - vakata_context.is_visible = false; - /** - * triggered on the document when the contextmenu is hidden - * @event - * @plugin contextmenu - * @name context_hide.vakata - * @param {jQuery} reference the element that was right clicked - * @param {jQuery} element the DOM element of the menu itself - * @param {Object} position the x & y coordinates of the menu - */ - $.vakata.context._trigger("hide"); - } - } - }; - $(function () { - right_to_left = $(document.body).css("direction") === "rtl"; - var to = false; - - vakata_context.element = $("
      "); - vakata_context.element - .on("mouseenter", "li", function (e) { - e.stopImmediatePropagation(); - - if($.contains(this, e.relatedTarget)) { - // премахнато заради delegate mouseleave по-долу - // $(this).find(".vakata-context-hover").removeClass("vakata-context-hover"); - return; - } - - if(to) { clearTimeout(to); } - vakata_context.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(); - - $(this) - .siblings().find("ul").hide().end().end() - .parentsUntil(".vakata-context", "li").addBack().addClass("vakata-context-hover"); - $.vakata.context._show_submenu(this); - }) - // тестово - дали не натоварва? - .on("mouseleave", "li", function (e) { - if($.contains(this, e.relatedTarget)) { return; } - $(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover"); - }) - .on("mouseleave", function (e) { - $(this).find(".vakata-context-hover").removeClass("vakata-context-hover"); - if($.vakata.context.settings.hide_onmouseleave) { - to = setTimeout( - (function (t) { - return function () { $.vakata.context.hide(); }; - }(this)), $.vakata.context.settings.hide_onmouseleave); - } - }) - .on("click", "a", function (e) { - e.preventDefault(); - //}) - //.on("mouseup", "a", function (e) { - if(!$(this).blur().parent().hasClass("vakata-context-disabled") && $.vakata.context._execute($(this).attr("rel")) !== false) { - $.vakata.context.hide(); - } - }) - .on('keydown', 'a', function (e) { - var o = null; - switch(e.which) { - case 13: - case 32: - e.type = "click"; - e.preventDefault(); - $(e.currentTarget).trigger(e); - break; - case 37: - if(vakata_context.is_visible) { - vakata_context.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children('a').focus(); - e.stopImmediatePropagation(); - e.preventDefault(); - } - break; - case 38: - if(vakata_context.is_visible) { - o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(); - if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last(); } - o.addClass("vakata-context-hover").children('a').focus(); - e.stopImmediatePropagation(); - e.preventDefault(); - } - break; - case 39: - if(vakata_context.is_visible) { - vakata_context.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children('a').focus(); - e.stopImmediatePropagation(); - e.preventDefault(); - } - break; - case 40: - if(vakata_context.is_visible) { - o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(); - if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first(); } - o.addClass("vakata-context-hover").children('a').focus(); - e.stopImmediatePropagation(); - e.preventDefault(); - } - break; - case 27: - $.vakata.context.hide(); - e.preventDefault(); - break; - default: - //console.log(e.which); - break; - } - }) - .on('keydown', function (e) { - e.preventDefault(); - var a = vakata_context.element.find('.vakata-contextmenu-shortcut-' + e.which).parent(); - if(a.parent().not('.vakata-context-disabled')) { - a.click(); - } - }); - - $(document) - .on("mousedown.vakata.jstree", function (e) { - if(vakata_context.is_visible && vakata_context.element[0] !== e.target && !$.contains(vakata_context.element[0], e.target)) { - $.vakata.context.hide(); - } - }) - .on("context_show.vakata.jstree", function (e, data) { - vakata_context.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"); - if(right_to_left) { - vakata_context.element.addClass("vakata-context-rtl").css("direction", "rtl"); - } - // also apply a RTL class? - vakata_context.element.find("ul").hide().end(); - }); - }); - }($)); - // $.jstree.defaults.plugins.push("contextmenu"); - - -/** - * ### Drag'n'drop plugin - * - * Enables dragging and dropping of nodes in the tree, resulting in a move or copy operations. - */ - - /** - * stores all defaults for the drag'n'drop plugin - * @name $.jstree.defaults.dnd - * @plugin dnd - */ - $.jstree.defaults.dnd = { - /** - * a boolean indicating if a copy should be possible while dragging (by pressint the meta key or Ctrl). Defaults to `true`. - * @name $.jstree.defaults.dnd.copy - * @plugin dnd - */ - copy : true, - /** - * a number indicating how long a node should remain hovered while dragging to be opened. Defaults to `500`. - * @name $.jstree.defaults.dnd.open_timeout - * @plugin dnd - */ - open_timeout : 500, - /** - * a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the nodes about to be dragged as an argument (array) and the event that started the drag - return `false` to prevent dragging - * @name $.jstree.defaults.dnd.is_draggable - * @plugin dnd - */ - is_draggable : true, - /** - * a boolean indicating if checks should constantly be made while the user is dragging the node (as opposed to checking only on drop), default is `true` - * @name $.jstree.defaults.dnd.check_while_dragging - * @plugin dnd - */ - check_while_dragging : true, - /** - * a boolean indicating if nodes from this tree should only be copied with dnd (as opposed to moved), default is `false` - * @name $.jstree.defaults.dnd.always_copy - * @plugin dnd - */ - always_copy : false, - /** - * when dropping a node "inside", this setting indicates the position the node should go to - it can be an integer or a string: "first" (same as 0) or "last", default is `0` - * @name $.jstree.defaults.dnd.inside_pos - * @plugin dnd - */ - inside_pos : 0, - /** - * when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node - * @name $.jstree.defaults.dnd.drag_selection - * @plugin dnd - */ - drag_selection : true, - /** - * controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string "selected" which means only selected nodes can be dragged on touch devices. - * @name $.jstree.defaults.dnd.touch - * @plugin dnd - */ - touch : true, - /** - * controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target. - * @name $.jstree.defaults.dnd.large_drop_target - * @plugin dnd - */ - large_drop_target : false, - /** - * controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to "selected". - * @name $.jstree.defaults.dnd.large_drag_target - * @plugin dnd - */ - large_drag_target : false, - /** - * controls whether use HTML5 dnd api instead of classical. That will allow better integration of dnd events with other HTML5 controls. - * @reference http://caniuse.com/#feat=dragndrop - * @name $.jstree.defaults.dnd.use_html5 - * @plugin dnd - */ - use_html5: false - }; - var drg, elm; - // TODO: now check works by checking for each node individually, how about max_children, unique, etc? - $.jstree.plugins.dnd = function (options, parent) { - this.init = function (el, options) { - parent.init.call(this, el, options); - this.settings.dnd.use_html5 = this.settings.dnd.use_html5 && ('draggable' in document.createElement('span')); - }; - this.bind = function () { - parent.bind.call(this); - - this.element - .on(this.settings.dnd.use_html5 ? 'dragstart.jstree' : 'mousedown.jstree touchstart.jstree', this.settings.dnd.large_drag_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) { - if(this.settings.dnd.large_drag_target && $(e.target).closest('.jstree-node')[0] !== e.currentTarget) { - return true; - } - if(e.type === "touchstart" && (!this.settings.dnd.touch || (this.settings.dnd.touch === 'selected' && !$(e.currentTarget).closest('.jstree-node').children('.jstree-anchor').hasClass('jstree-clicked')))) { - return true; - } - var obj = this.get_node(e.target), - mlt = this.is_selected(obj) && this.settings.dnd.drag_selection ? this.get_top_selected().length : 1, - txt = (mlt > 1 ? mlt + ' ' + this.get_string('nodes') : this.get_text(e.currentTarget)); - if(this.settings.core.force_text) { - txt = $.vakata.html.escape(txt); - } - if(obj && obj.id && obj.id !== $.jstree.root && (e.which === 1 || e.type === "touchstart" || e.type === "dragstart") && - (this.settings.dnd.is_draggable === true || ($.isFunction(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_top_selected(true) : [obj]), e))) - ) { - drg = { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_top_selected() : [obj.id] }; - elm = e.currentTarget; - if (this.settings.dnd.use_html5) { - $.vakata.dnd._trigger('start', e, { 'helper': $(), 'element': elm, 'data': drg }); - } else { - this.element.trigger('mousedown.jstree'); - return $.vakata.dnd.start(e, drg, '
      ' + txt + '
      '); - } - } - }, this)); - if (this.settings.dnd.use_html5) { - this.element - .on('dragover.jstree', function (e) { - e.preventDefault(); - $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); - return false; - }) - //.on('dragenter.jstree', this.settings.dnd.large_drop_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) { - // e.preventDefault(); - // $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); - // return false; - // }, this)) - .on('drop.jstree', $.proxy(function (e) { - e.preventDefault(); - $.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg }); - return false; - }, this)); - } - }; - this.redraw_node = function(obj, deep, callback, force_render) { - obj = parent.redraw_node.apply(this, arguments); - if (obj && this.settings.dnd.use_html5) { - if (this.settings.dnd.large_drag_target) { - obj.setAttribute('draggable', true); - } else { - var i, j, tmp = null; - for(i = 0, j = obj.childNodes.length; i < j; i++) { - if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { - tmp = obj.childNodes[i]; - break; - } - } - if(tmp) { - tmp.setAttribute('draggable', true); - } - } - } - return obj; - }; - }; - - $(function() { - // bind only once for all instances - var lastmv = false, - laster = false, - lastev = false, - opento = false, - marker = $('
       
      ').hide(); //.appendTo('body'); - - $(document) - .on('dragover.vakata.jstree', function (e) { - if (elm) { - $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); - } - }) - .on('drop.vakata.jstree', function (e) { - if (elm) { - $.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg }); - elm = null; - drg = null; - } - }) - .on('dnd_start.vakata.jstree', function (e, data) { - lastmv = false; - lastev = false; - if(!data || !data.data || !data.data.jstree) { return; } - marker.appendTo(document.body); //.show(); - }) - .on('dnd_move.vakata.jstree', function (e, data) { - var isDifferentNode = data.event.target !== lastev.target; - if(opento) { - if (!data.event || data.event.type !== 'dragover' || isDifferentNode) { - clearTimeout(opento); - } - } - if(!data || !data.data || !data.data.jstree) { return; } - - // if we are hovering the marker image do nothing (can happen on "inside" drags) - if(data.event.target.id && data.event.target.id === 'jstree-marker') { - return; - } - lastev = data.event; - - var ins = $.jstree.reference(data.event.target), - ref = false, - off = false, - rel = false, - tmp, l, t, h, p, i, o, ok, t1, t2, op, ps, pr, ip, tm, is_copy, pn; - // if we are over an instance - if(ins && ins._data && ins._data.dnd) { - marker.attr('class', 'jstree-' + ins.get_theme() + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' )); - is_copy = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))); - data.helper - .children().attr('class', 'jstree-' + ins.get_theme() + ' jstree-' + ins.get_theme() + '-' + ins.get_theme_variant() + ' ' + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' )) - .find('.jstree-copy').first()[ is_copy ? 'show' : 'hide' ](); - - // if are hovering the container itself add a new root node - //console.log(data.event); - if( (data.event.target === ins.element[0] || data.event.target === ins.get_container_ul()[0]) && ins.get_container_ul().children().length === 0) { - ok = true; - for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) { - ok = ok && ins.check( (data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey)) ) ? "copy_node" : "move_node"), (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), $.jstree.root, 'last', { 'dnd' : true, 'ref' : ins.get_node($.jstree.root), 'pos' : 'i', 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }); - if(!ok) { break; } - } - if(ok) { - lastmv = { 'ins' : ins, 'par' : $.jstree.root, 'pos' : 'last' }; - marker.hide(); - data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok'); - if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { - data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move'; - } - return; - } - } - else { - // if we are hovering a tree node - ref = ins.settings.dnd.large_drop_target ? $(data.event.target).closest('.jstree-node').children('.jstree-anchor') : $(data.event.target).closest('.jstree-anchor'); - if(ref && ref.length && ref.parent().is('.jstree-closed, .jstree-open, .jstree-leaf')) { - off = ref.offset(); - rel = (data.event.pageY !== undefined ? data.event.pageY : data.event.originalEvent.pageY) - off.top; - h = ref.outerHeight(); - if(rel < h / 3) { - o = ['b', 'i', 'a']; - } - else if(rel > h - h / 3) { - o = ['a', 'i', 'b']; - } - else { - o = rel > h / 2 ? ['i', 'a', 'b'] : ['i', 'b', 'a']; - } - $.each(o, function (j, v) { - switch(v) { - case 'b': - l = off.left - 6; - t = off.top; - p = ins.get_parent(ref); - i = ref.parent().index(); - break; - case 'i': - ip = ins.settings.dnd.inside_pos; - tm = ins.get_node(ref.parent()); - l = off.left - 2; - t = off.top + h / 2 + 1; - p = tm.id; - i = ip === 'first' ? 0 : (ip === 'last' ? tm.children.length : Math.min(ip, tm.children.length)); - break; - case 'a': - l = off.left - 6; - t = off.top + h; - p = ins.get_parent(ref); - i = ref.parent().index() + 1; - break; - } - ok = true; - for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) { - op = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? "copy_node" : "move_node"; - ps = i; - if(op === "move_node" && v === 'a' && (data.data.origin && data.data.origin === ins) && p === ins.get_parent(data.data.nodes[t1])) { - pr = ins.get_node(p); - if(ps > $.inArray(data.data.nodes[t1], pr.children)) { - ps -= 1; - } - } - ok = ok && ( (ins && ins.settings && ins.settings.dnd && ins.settings.dnd.check_while_dragging === false) || ins.check(op, (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), p, ps, { 'dnd' : true, 'ref' : ins.get_node(ref.parent()), 'pos' : v, 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }) ); - if(!ok) { - if(ins && ins.last_error) { laster = ins.last_error(); } - break; - } - } - if(v === 'i' && ref.parent().is('.jstree-closed') && ins.settings.dnd.open_timeout) { - if (!data.event || data.event.type !== 'dragover' || isDifferentNode) { - if (opento) { clearTimeout(opento); } - opento = setTimeout((function (x, z) { return function () { x.open_node(z); }; }(ins, ref)), ins.settings.dnd.open_timeout); - } - } - if(ok) { - pn = ins.get_node(p, true); - if (!pn.hasClass('.jstree-dnd-parent')) { - $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); - pn.addClass('jstree-dnd-parent'); - } - lastmv = { 'ins' : ins, 'par' : p, 'pos' : v === 'i' && ip === 'last' && i === 0 && !ins.is_loaded(tm) ? 'last' : i }; - marker.css({ 'left' : l + 'px', 'top' : t + 'px' }).show(); - data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok'); - if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { - data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move'; - } - laster = {}; - o = true; - return false; - } - }); - if(o === true) { return; } - } - } - } - $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); - lastmv = false; - data.helper.find('.jstree-icon').removeClass('jstree-ok').addClass('jstree-er'); - if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { - //data.event.originalEvent.dataTransfer.dropEffect = 'none'; - } - marker.hide(); - }) - .on('dnd_scroll.vakata.jstree', function (e, data) { - if(!data || !data.data || !data.data.jstree) { return; } - marker.hide(); - lastmv = false; - lastev = false; - data.helper.find('.jstree-icon').first().removeClass('jstree-ok').addClass('jstree-er'); - }) - .on('dnd_stop.vakata.jstree', function (e, data) { - $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); - if(opento) { clearTimeout(opento); } - if(!data || !data.data || !data.data.jstree) { return; } - marker.hide().detach(); - var i, j, nodes = []; - if(lastmv) { - for(i = 0, j = data.data.nodes.length; i < j; i++) { - nodes[i] = data.data.origin ? data.data.origin.get_node(data.data.nodes[i]) : data.data.nodes[i]; - } - lastmv.ins[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? 'copy_node' : 'move_node' ](nodes, lastmv.par, lastmv.pos, false, false, false, data.data.origin); - } - else { - i = $(data.event.target).closest('.jstree'); - if(i.length && laster && laster.error && laster.error === 'check') { - i = i.jstree(true); - if(i) { - i.settings.core.error.call(this, laster); - } - } - } - lastev = false; - lastmv = false; - }) - .on('keyup.jstree keydown.jstree', function (e, data) { - data = $.vakata.dnd._get(); - if(data && data.data && data.data.jstree) { - if (e.type === "keyup" && e.which === 27) { - if (opento) { clearTimeout(opento); } - lastmv = false; - laster = false; - lastev = false; - opento = false; - marker.hide().detach(); - $.vakata.dnd._clean(); - } else { - data.helper.find('.jstree-copy').first()[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (e.metaKey || e.ctrlKey))) ? 'show' : 'hide' ](); - if(lastev) { - lastev.metaKey = e.metaKey; - lastev.ctrlKey = e.ctrlKey; - $.vakata.dnd._trigger('move', lastev); - } - } - } - }); - }); - - // helpers - (function ($) { - $.vakata.html = { - div : $('
      '), - escape : function (str) { - return $.vakata.html.div.text(str).html(); - }, - strip : function (str) { - return $.vakata.html.div.empty().append($.parseHTML(str)).text(); - } - }; - // private variable - var vakata_dnd = { - element : false, - target : false, - is_down : false, - is_drag : false, - helper : false, - helper_w: 0, - data : false, - init_x : 0, - init_y : 0, - scroll_l: 0, - scroll_t: 0, - scroll_e: false, - scroll_i: false, - is_touch: false - }; - $.vakata.dnd = { - settings : { - scroll_speed : 10, - scroll_proximity : 20, - helper_left : 5, - helper_top : 10, - threshold : 5, - threshold_touch : 10 - }, - _trigger : function (event_name, e, data) { - if (data === undefined) { - data = $.vakata.dnd._get(); - } - data.event = e; - $(document).triggerHandler("dnd_" + event_name + ".vakata", data); - }, - _get : function () { - return { - "data" : vakata_dnd.data, - "element" : vakata_dnd.element, - "helper" : vakata_dnd.helper - }; - }, - _clean : function () { - if(vakata_dnd.helper) { vakata_dnd.helper.remove(); } - if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; } - vakata_dnd = { - element : false, - target : false, - is_down : false, - is_drag : false, - helper : false, - helper_w: 0, - data : false, - init_x : 0, - init_y : 0, - scroll_l: 0, - scroll_t: 0, - scroll_e: false, - scroll_i: false, - is_touch: false - }; - $(document).off("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag); - $(document).off("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop); - }, - _scroll : function (init_only) { - if(!vakata_dnd.scroll_e || (!vakata_dnd.scroll_l && !vakata_dnd.scroll_t)) { - if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; } - return false; - } - if(!vakata_dnd.scroll_i) { - vakata_dnd.scroll_i = setInterval($.vakata.dnd._scroll, 100); - return false; - } - if(init_only === true) { return false; } - - var i = vakata_dnd.scroll_e.scrollTop(), - j = vakata_dnd.scroll_e.scrollLeft(); - vakata_dnd.scroll_e.scrollTop(i + vakata_dnd.scroll_t * $.vakata.dnd.settings.scroll_speed); - vakata_dnd.scroll_e.scrollLeft(j + vakata_dnd.scroll_l * $.vakata.dnd.settings.scroll_speed); - if(i !== vakata_dnd.scroll_e.scrollTop() || j !== vakata_dnd.scroll_e.scrollLeft()) { - /** - * triggered on the document when a drag causes an element to scroll - * @event - * @plugin dnd - * @name dnd_scroll.vakata - * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start - * @param {DOM} element the DOM element being dragged - * @param {jQuery} helper the helper shown next to the mouse - * @param {jQuery} event the element that is scrolling - */ - $.vakata.dnd._trigger("scroll", vakata_dnd.scroll_e); - } - }, - start : function (e, data, html) { - if(e.type === "touchstart" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { - e.pageX = e.originalEvent.changedTouches[0].pageX; - e.pageY = e.originalEvent.changedTouches[0].pageY; - e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); - } - if(vakata_dnd.is_drag) { $.vakata.dnd.stop({}); } - try { - e.currentTarget.unselectable = "on"; - e.currentTarget.onselectstart = function() { return false; }; - if(e.currentTarget.style) { - e.currentTarget.style.touchAction = "none"; - e.currentTarget.style.msTouchAction = "none"; - e.currentTarget.style.MozUserSelect = "none"; - } - } catch(ignore) { } - vakata_dnd.init_x = e.pageX; - vakata_dnd.init_y = e.pageY; - vakata_dnd.data = data; - vakata_dnd.is_down = true; - vakata_dnd.element = e.currentTarget; - vakata_dnd.target = e.target; - vakata_dnd.is_touch = e.type === "touchstart"; - if(html !== false) { - vakata_dnd.helper = $("
      ").html(html).css({ - "display" : "block", - "margin" : "0", - "padding" : "0", - "position" : "absolute", - "top" : "-2000px", - "lineHeight" : "16px", - "zIndex" : "10000" - }); - } - $(document).on("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag); - $(document).on("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop); - return false; - }, - drag : function (e) { - if(e.type === "touchmove" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { - e.pageX = e.originalEvent.changedTouches[0].pageX; - e.pageY = e.originalEvent.changedTouches[0].pageY; - e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); - } - if(!vakata_dnd.is_down) { return; } - if(!vakata_dnd.is_drag) { - if( - Math.abs(e.pageX - vakata_dnd.init_x) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) || - Math.abs(e.pageY - vakata_dnd.init_y) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) - ) { - if(vakata_dnd.helper) { - vakata_dnd.helper.appendTo(document.body); - vakata_dnd.helper_w = vakata_dnd.helper.outerWidth(); - } - vakata_dnd.is_drag = true; - $(vakata_dnd.target).one('click.vakata', false); - /** - * triggered on the document when a drag starts - * @event - * @plugin dnd - * @name dnd_start.vakata - * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start - * @param {DOM} element the DOM element being dragged - * @param {jQuery} helper the helper shown next to the mouse - * @param {Object} event the event that caused the start (probably mousemove) - */ - $.vakata.dnd._trigger("start", e); - } - else { return; } - } - - var d = false, w = false, - dh = false, wh = false, - dw = false, ww = false, - dt = false, dl = false, - ht = false, hl = false; - - vakata_dnd.scroll_t = 0; - vakata_dnd.scroll_l = 0; - vakata_dnd.scroll_e = false; - $($(e.target).parentsUntil("body").addBack().get().reverse()) - .filter(function () { - return (/^auto|scroll$/).test($(this).css("overflow")) && - (this.scrollHeight > this.offsetHeight || this.scrollWidth > this.offsetWidth); - }) - .each(function () { - var t = $(this), o = t.offset(); - if(this.scrollHeight > this.offsetHeight) { - if(o.top + t.height() - e.pageY < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; } - if(e.pageY - o.top < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; } - } - if(this.scrollWidth > this.offsetWidth) { - if(o.left + t.width() - e.pageX < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; } - if(e.pageX - o.left < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; } - } - if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) { - vakata_dnd.scroll_e = $(this); - return false; - } - }); - - if(!vakata_dnd.scroll_e) { - d = $(document); w = $(window); - dh = d.height(); wh = w.height(); - dw = d.width(); ww = w.width(); - dt = d.scrollTop(); dl = d.scrollLeft(); - if(dh > wh && e.pageY - dt < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; } - if(dh > wh && wh - (e.pageY - dt) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; } - if(dw > ww && e.pageX - dl < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; } - if(dw > ww && ww - (e.pageX - dl) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; } - if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) { - vakata_dnd.scroll_e = d; - } - } - if(vakata_dnd.scroll_e) { $.vakata.dnd._scroll(true); } - - if(vakata_dnd.helper) { - ht = parseInt(e.pageY + $.vakata.dnd.settings.helper_top, 10); - hl = parseInt(e.pageX + $.vakata.dnd.settings.helper_left, 10); - if(dh && ht + 25 > dh) { ht = dh - 50; } - if(dw && hl + vakata_dnd.helper_w > dw) { hl = dw - (vakata_dnd.helper_w + 2); } - vakata_dnd.helper.css({ - left : hl + "px", - top : ht + "px" - }); - } - /** - * triggered on the document when a drag is in progress - * @event - * @plugin dnd - * @name dnd_move.vakata - * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start - * @param {DOM} element the DOM element being dragged - * @param {jQuery} helper the helper shown next to the mouse - * @param {Object} event the event that caused this to trigger (most likely mousemove) - */ - $.vakata.dnd._trigger("move", e); - return false; - }, - stop : function (e) { - if(e.type === "touchend" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { - e.pageX = e.originalEvent.changedTouches[0].pageX; - e.pageY = e.originalEvent.changedTouches[0].pageY; - e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); - } - if(vakata_dnd.is_drag) { - /** - * triggered on the document when a drag stops (the dragged element is dropped) - * @event - * @plugin dnd - * @name dnd_stop.vakata - * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start - * @param {DOM} element the DOM element being dragged - * @param {jQuery} helper the helper shown next to the mouse - * @param {Object} event the event that caused the stop - */ - if (e.target !== vakata_dnd.target) { - $(vakata_dnd.target).off('click.vakata'); - } - $.vakata.dnd._trigger("stop", e); - } - else { - if(e.type === "touchend" && e.target === vakata_dnd.target) { - var to = setTimeout(function () { $(e.target).click(); }, 100); - $(e.target).one('click', function() { if(to) { clearTimeout(to); } }); - } - } - $.vakata.dnd._clean(); - return false; - } - }; - }($)); - - // include the dnd plugin by default - // $.jstree.defaults.plugins.push("dnd"); - - -/** - * ### Massload plugin - * - * Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading). - */ - - /** - * massload configuration - * - * It is possible to set this to a standard jQuery-like AJAX config. - * In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used. - * - * You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result. - * - * Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array. - * - * { - * "id1" : [{ "text" : "Child of ID1", "id" : "c1" }, { "text" : "Another child of ID1", "id" : "c2" }], - * "id2" : [{ "text" : "Child of ID2", "id" : "c3" }] - * } - * - * @name $.jstree.defaults.massload - * @plugin massload - */ - $.jstree.defaults.massload = null; - $.jstree.plugins.massload = function (options, parent) { - this.init = function (el, options) { - this._data.massload = {}; - parent.init.call(this, el, options); - }; - this._load_nodes = function (nodes, callback, is_callback, force_reload) { - var s = this.settings.massload, - nodesString = JSON.stringify(nodes), - toLoad = [], - m = this._model.data, - i, j, dom; - if (!is_callback) { - for(i = 0, j = nodes.length; i < j; i++) { - if(!m[nodes[i]] || ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || force_reload) ) { - toLoad.push(nodes[i]); - dom = this.get_node(nodes[i], true); - if (dom && dom.length) { - dom.addClass("jstree-loading").attr('aria-busy',true); - } - } - } - this._data.massload = {}; - if (toLoad.length) { - if($.isFunction(s)) { - return s.call(this, toLoad, $.proxy(function (data) { - var i, j; - if(data) { - for(i in data) { - if(data.hasOwnProperty(i)) { - this._data.massload[i] = data[i]; - } - } - } - for(i = 0, j = nodes.length; i < j; i++) { - dom = this.get_node(nodes[i], true); - if (dom && dom.length) { - dom.removeClass("jstree-loading").attr('aria-busy',false); - } - } - parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); - }, this)); - } - if(typeof s === 'object' && s && s.url) { - s = $.extend(true, {}, s); - if($.isFunction(s.url)) { - s.url = s.url.call(this, toLoad); - } - if($.isFunction(s.data)) { - s.data = s.data.call(this, toLoad); - } - return $.ajax(s) - .done($.proxy(function (data,t,x) { - var i, j; - if(data) { - for(i in data) { - if(data.hasOwnProperty(i)) { - this._data.massload[i] = data[i]; - } - } - } - for(i = 0, j = nodes.length; i < j; i++) { - dom = this.get_node(nodes[i], true); - if (dom && dom.length) { - dom.removeClass("jstree-loading").attr('aria-busy',false); - } - } - parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); - }, this)) - .fail($.proxy(function (f) { - parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); - }, this)); - } - } - } - return parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); - }; - this._load_node = function (obj, callback) { - var data = this._data.massload[obj.id], - rslt = null, dom; - if(data) { - rslt = this[typeof data === 'string' ? '_append_html_data' : '_append_json_data']( - obj, - typeof data === 'string' ? $($.parseHTML(data)).filter(function () { return this.nodeType !== 3; }) : data, - function (status) { callback.call(this, status); } - ); - dom = this.get_node(obj.id, true); - if (dom && dom.length) { - dom.removeClass("jstree-loading").attr('aria-busy',false); - } - delete this._data.massload[obj.id]; - return rslt; - } - return parent._load_node.call(this, obj, callback); - }; - }; - -/** - * ### Search plugin - * - * Adds search functionality to jsTree. - */ - - /** - * stores all defaults for the search plugin - * @name $.jstree.defaults.search - * @plugin search - */ - $.jstree.defaults.search = { - /** - * a jQuery-like AJAX config, which jstree uses if a server should be queried for results. - * - * A `str` (which is the search string) parameter will be added with the request, an optional `inside` parameter will be added if the search is limited to a node id. The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed. - * Leave this setting as `false` to not query the server. You can also set this to a function, which will be invoked in the instance's scope and receive 3 parameters - the search string, the callback to call with the array of nodes to load, and the optional node ID to limit the search to - * @name $.jstree.defaults.search.ajax - * @plugin search - */ - ajax : false, - /** - * Indicates if the search should be fuzzy or not (should `chnd3` match `child node 3`). Default is `false`. - * @name $.jstree.defaults.search.fuzzy - * @plugin search - */ - fuzzy : false, - /** - * Indicates if the search should be case sensitive. Default is `false`. - * @name $.jstree.defaults.search.case_sensitive - * @plugin search - */ - case_sensitive : false, - /** - * Indicates if the tree should be filtered (by default) to show only matching nodes (keep in mind this can be a heavy on large trees in old browsers). - * This setting can be changed at runtime when calling the search method. Default is `false`. - * @name $.jstree.defaults.search.show_only_matches - * @plugin search - */ - show_only_matches : false, - /** - * Indicates if the children of matched element are shown (when show_only_matches is true) - * This setting can be changed at runtime when calling the search method. Default is `false`. - * @name $.jstree.defaults.search.show_only_matches_children - * @plugin search - */ - show_only_matches_children : false, - /** - * Indicates if all nodes opened to reveal the search result, should be closed when the search is cleared or a new search is performed. Default is `true`. - * @name $.jstree.defaults.search.close_opened_onclear - * @plugin search - */ - close_opened_onclear : true, - /** - * Indicates if only leaf nodes should be included in search results. Default is `false`. - * @name $.jstree.defaults.search.search_leaves_only - * @plugin search - */ - search_leaves_only : false, - /** - * If set to a function it wil be called in the instance's scope with two arguments - search string and node (where node will be every node in the structure, so use with caution). - * If the function returns a truthy value the node will be considered a match (it might not be displayed if search_only_leaves is set to true and the node is not a leaf). Default is `false`. - * @name $.jstree.defaults.search.search_callback - * @plugin search - */ - search_callback : false - }; - - $.jstree.plugins.search = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - - this._data.search.str = ""; - this._data.search.dom = $(); - this._data.search.res = []; - this._data.search.opn = []; - this._data.search.som = false; - this._data.search.smc = false; - this._data.search.hdn = []; - - this.element - .on("search.jstree", $.proxy(function (e, data) { - if(this._data.search.som && data.res.length) { - var m = this._model.data, i, j, p = [], k, l; - for(i = 0, j = data.res.length; i < j; i++) { - if(m[data.res[i]] && !m[data.res[i]].state.hidden) { - p.push(data.res[i]); - p = p.concat(m[data.res[i]].parents); - if(this._data.search.smc) { - for (k = 0, l = m[data.res[i]].children_d.length; k < l; k++) { - if (m[m[data.res[i]].children_d[k]] && !m[m[data.res[i]].children_d[k]].state.hidden) { - p.push(m[data.res[i]].children_d[k]); - } - } - } - } - } - p = $.vakata.array_remove_item($.vakata.array_unique(p), $.jstree.root); - this._data.search.hdn = this.hide_all(true); - this.show_node(p, true); - this.redraw(true); - } - }, this)) - .on("clear_search.jstree", $.proxy(function (e, data) { - if(this._data.search.som && data.res.length) { - this.show_node(this._data.search.hdn, true); - this.redraw(true); - } - }, this)); - }; - /** - * used to search the tree nodes for a given string - * @name search(str [, skip_async]) - * @param {String} str the search string - * @param {Boolean} skip_async if set to true server will not be queried even if configured - * @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers) - * @param {mixed} inside an optional node to whose children to limit the search - * @param {Boolean} append if set to true the results of this search are appended to the previous search - * @plugin search - * @trigger search.jstree - */ - this.search = function (str, skip_async, show_only_matches, inside, append, show_only_matches_children) { - if(str === false || $.trim(str.toString()) === "") { - return this.clear_search(); - } - inside = this.get_node(inside); - inside = inside && inside.id ? inside.id : null; - str = str.toString(); - var s = this.settings.search, - a = s.ajax ? s.ajax : false, - m = this._model.data, - f = null, - r = [], - p = [], i, j; - if(this._data.search.res.length && !append) { - this.clear_search(); - } - if(show_only_matches === undefined) { - show_only_matches = s.show_only_matches; - } - if(show_only_matches_children === undefined) { - show_only_matches_children = s.show_only_matches_children; - } - if(!skip_async && a !== false) { - if($.isFunction(a)) { - return a.call(this, str, $.proxy(function (d) { - if(d && d.d) { d = d.d; } - this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () { - this.search(str, true, show_only_matches, inside, append, show_only_matches_children); - }); - }, this), inside); - } - else { - a = $.extend({}, a); - if(!a.data) { a.data = {}; } - a.data.str = str; - if(inside) { - a.data.inside = inside; - } - if (this._data.search.lastRequest) { - this._data.search.lastRequest.abort(); - } - this._data.search.lastRequest = $.ajax(a) - .fail($.proxy(function () { - this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'search', 'id' : 'search_01', 'reason' : 'Could not load search parents', 'data' : JSON.stringify(a) }; - this.settings.core.error.call(this, this._data.core.last_error); - }, this)) - .done($.proxy(function (d) { - if(d && d.d) { d = d.d; } - this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () { - this.search(str, true, show_only_matches, inside, append, show_only_matches_children); - }); - }, this)); - return this._data.search.lastRequest; - } - } - if(!append) { - this._data.search.str = str; - this._data.search.dom = $(); - this._data.search.res = []; - this._data.search.opn = []; - this._data.search.som = show_only_matches; - this._data.search.smc = show_only_matches_children; - } - - f = new $.vakata.search(str, true, { caseSensitive : s.case_sensitive, fuzzy : s.fuzzy }); - $.each(m[inside ? inside : $.jstree.root].children_d, function (ii, i) { - var v = m[i]; - if(v.text && !v.state.hidden && (!s.search_leaves_only || (v.state.loaded && v.children.length === 0)) && ( (s.search_callback && s.search_callback.call(this, str, v)) || (!s.search_callback && f.search(v.text).isMatch) ) ) { - r.push(i); - p = p.concat(v.parents); - } - }); - if(r.length) { - p = $.vakata.array_unique(p); - for(i = 0, j = p.length; i < j; i++) { - if(p[i] !== $.jstree.root && m[p[i]] && this.open_node(p[i], null, 0) === true) { - this._data.search.opn.push(p[i]); - } - } - if(!append) { - this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #'))); - this._data.search.res = r; - } - else { - this._data.search.dom = this._data.search.dom.add($(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #')))); - this._data.search.res = $.vakata.array_unique(this._data.search.res.concat(r)); - } - this._data.search.dom.children(".jstree-anchor").addClass('jstree-search'); - } - /** - * triggered after search is complete - * @event - * @name search.jstree - * @param {jQuery} nodes a jQuery collection of matching nodes - * @param {String} str the search string - * @param {Array} res a collection of objects represeing the matching nodes - * @plugin search - */ - this.trigger('search', { nodes : this._data.search.dom, str : str, res : this._data.search.res, show_only_matches : show_only_matches }); - }; - /** - * used to clear the last search (removes classes and shows all nodes if filtering is on) - * @name clear_search() - * @plugin search - * @trigger clear_search.jstree - */ - this.clear_search = function () { - if(this.settings.search.close_opened_onclear) { - this.close_node(this._data.search.opn, 0); - } - /** - * triggered after search is complete - * @event - * @name clear_search.jstree - * @param {jQuery} nodes a jQuery collection of matching nodes (the result from the last search) - * @param {String} str the search string (the last search string) - * @param {Array} res a collection of objects represeing the matching nodes (the result from the last search) - * @plugin search - */ - this.trigger('clear_search', { 'nodes' : this._data.search.dom, str : this._data.search.str, res : this._data.search.res }); - if(this._data.search.res.length) { - this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(this._data.search.res, function (v) { - return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); - }).join(', #'))); - this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search"); - } - this._data.search.str = ""; - this._data.search.res = []; - this._data.search.opn = []; - this._data.search.dom = $(); - }; - - this.redraw_node = function(obj, deep, callback, force_render) { - obj = parent.redraw_node.apply(this, arguments); - if(obj) { - if($.inArray(obj.id, this._data.search.res) !== -1) { - var i, j, tmp = null; - for(i = 0, j = obj.childNodes.length; i < j; i++) { - if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { - tmp = obj.childNodes[i]; - break; - } - } - if(tmp) { - tmp.className += ' jstree-search'; - } - } - } - return obj; - }; - }; - - // helpers - (function ($) { - // from http://kiro.me/projects/fuse.html - $.vakata.search = function(pattern, txt, options) { - options = options || {}; - options = $.extend({}, $.vakata.search.defaults, options); - if(options.fuzzy !== false) { - options.fuzzy = true; - } - pattern = options.caseSensitive ? pattern : pattern.toLowerCase(); - var MATCH_LOCATION = options.location, - MATCH_DISTANCE = options.distance, - MATCH_THRESHOLD = options.threshold, - patternLen = pattern.length, - matchmask, pattern_alphabet, match_bitapScore, search; - if(patternLen > 32) { - options.fuzzy = false; - } - if(options.fuzzy) { - matchmask = 1 << (patternLen - 1); - pattern_alphabet = (function () { - var mask = {}, - i = 0; - for (i = 0; i < patternLen; i++) { - mask[pattern.charAt(i)] = 0; - } - for (i = 0; i < patternLen; i++) { - mask[pattern.charAt(i)] |= 1 << (patternLen - i - 1); - } - return mask; - }()); - match_bitapScore = function (e, x) { - var accuracy = e / patternLen, - proximity = Math.abs(MATCH_LOCATION - x); - if(!MATCH_DISTANCE) { - return proximity ? 1.0 : accuracy; - } - return accuracy + (proximity / MATCH_DISTANCE); - }; - } - search = function (text) { - text = options.caseSensitive ? text : text.toLowerCase(); - if(pattern === text || text.indexOf(pattern) !== -1) { - return { - isMatch: true, - score: 0 - }; - } - if(!options.fuzzy) { - return { - isMatch: false, - score: 1 - }; - } - var i, j, - textLen = text.length, - scoreThreshold = MATCH_THRESHOLD, - bestLoc = text.indexOf(pattern, MATCH_LOCATION), - binMin, binMid, - binMax = patternLen + textLen, - lastRd, start, finish, rd, charMatch, - score = 1, - locations = []; - if (bestLoc !== -1) { - scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold); - bestLoc = text.lastIndexOf(pattern, MATCH_LOCATION + patternLen); - if (bestLoc !== -1) { - scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold); - } - } - bestLoc = -1; - for (i = 0; i < patternLen; i++) { - binMin = 0; - binMid = binMax; - while (binMin < binMid) { - if (match_bitapScore(i, MATCH_LOCATION + binMid) <= scoreThreshold) { - binMin = binMid; - } else { - binMax = binMid; - } - binMid = Math.floor((binMax - binMin) / 2 + binMin); - } - binMax = binMid; - start = Math.max(1, MATCH_LOCATION - binMid + 1); - finish = Math.min(MATCH_LOCATION + binMid, textLen) + patternLen; - rd = new Array(finish + 2); - rd[finish + 1] = (1 << i) - 1; - for (j = finish; j >= start; j--) { - charMatch = pattern_alphabet[text.charAt(j - 1)]; - if (i === 0) { - rd[j] = ((rd[j + 1] << 1) | 1) & charMatch; - } else { - rd[j] = ((rd[j + 1] << 1) | 1) & charMatch | (((lastRd[j + 1] | lastRd[j]) << 1) | 1) | lastRd[j + 1]; - } - if (rd[j] & matchmask) { - score = match_bitapScore(i, j - 1); - if (score <= scoreThreshold) { - scoreThreshold = score; - bestLoc = j - 1; - locations.push(bestLoc); - if (bestLoc > MATCH_LOCATION) { - start = Math.max(1, 2 * MATCH_LOCATION - bestLoc); - } else { - break; - } - } - } - } - if (match_bitapScore(i + 1, MATCH_LOCATION) > scoreThreshold) { - break; - } - lastRd = rd; - } - return { - isMatch: bestLoc >= 0, - score: score - }; - }; - return txt === true ? { 'search' : search } : search(txt); - }; - $.vakata.search.defaults = { - location : 0, - distance : 100, - threshold : 0.6, - fuzzy : false, - caseSensitive : false - }; - }($)); - - // include the search plugin by default - // $.jstree.defaults.plugins.push("search"); - - -/** - * ### Sort plugin - * - * Automatically sorts all siblings in the tree according to a sorting function. - */ - - /** - * the settings function used to sort the nodes. - * It is executed in the tree's context, accepts two nodes as arguments and should return `1` or `-1`. - * @name $.jstree.defaults.sort - * @plugin sort - */ - $.jstree.defaults.sort = function (a, b) { - //return this.get_type(a) === this.get_type(b) ? (this.get_text(a) > this.get_text(b) ? 1 : -1) : this.get_type(a) >= this.get_type(b); - return this.get_text(a) > this.get_text(b) ? 1 : -1; - }; - $.jstree.plugins.sort = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - this.element - .on("model.jstree", $.proxy(function (e, data) { - this.sort(data.parent, true); - }, this)) - .on("rename_node.jstree create_node.jstree", $.proxy(function (e, data) { - this.sort(data.parent || data.node.parent, false); - this.redraw_node(data.parent || data.node.parent, true); - }, this)) - .on("move_node.jstree copy_node.jstree", $.proxy(function (e, data) { - this.sort(data.parent, false); - this.redraw_node(data.parent, true); - }, this)); - }; - /** - * used to sort a node's children - * @private - * @name sort(obj [, deep]) - * @param {mixed} obj the node - * @param {Boolean} deep if set to `true` nodes are sorted recursively. - * @plugin sort - * @trigger search.jstree - */ - this.sort = function (obj, deep) { - var i, j; - obj = this.get_node(obj); - if(obj && obj.children && obj.children.length) { - obj.children.sort($.proxy(this.settings.sort, this)); - if(deep) { - for(i = 0, j = obj.children_d.length; i < j; i++) { - this.sort(obj.children_d[i], false); - } - } - } - }; - }; - - // include the sort plugin by default - // $.jstree.defaults.plugins.push("sort"); - -/** - * ### State plugin - * - * Saves the state of the tree (selected nodes, opened nodes) on the user's computer using available options (localStorage, cookies, etc) - */ - - var to = false; - /** - * stores all defaults for the state plugin - * @name $.jstree.defaults.state - * @plugin state - */ - $.jstree.defaults.state = { - /** - * A string for the key to use when saving the current tree (change if using multiple trees in your project). Defaults to `jstree`. - * @name $.jstree.defaults.state.key - * @plugin state - */ - key : 'jstree', - /** - * A space separated list of events that trigger a state save. Defaults to `changed.jstree open_node.jstree close_node.jstree`. - * @name $.jstree.defaults.state.events - * @plugin state - */ - events : 'changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree', - /** - * Time in milliseconds after which the state will expire. Defaults to 'false' meaning - no expire. - * @name $.jstree.defaults.state.ttl - * @plugin state - */ - ttl : false, - /** - * A function that will be executed prior to restoring state with one argument - the state object. Can be used to clear unwanted parts of the state. - * @name $.jstree.defaults.state.filter - * @plugin state - */ - filter : false, - /** - * Should loaded nodes be restored (setting this to true means that it is possible that the whole tree will be loaded for some users - use with caution). Defaults to `false` - * @name $.jstree.defaults.state.preserve_loaded - * @plugin state - */ - preserve_loaded : false - }; - $.jstree.plugins.state = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - var bind = $.proxy(function () { - this.element.on(this.settings.state.events, $.proxy(function () { - if(to) { clearTimeout(to); } - to = setTimeout($.proxy(function () { this.save_state(); }, this), 100); - }, this)); - /** - * triggered when the state plugin is finished restoring the state (and immediately after ready if there is no state to restore). - * @event - * @name state_ready.jstree - * @plugin state - */ - this.trigger('state_ready'); - }, this); - this.element - .on("ready.jstree", $.proxy(function (e, data) { - this.element.one("restore_state.jstree", bind); - if(!this.restore_state()) { bind(); } - }, this)); - }; - /** - * save the state - * @name save_state() - * @plugin state - */ - this.save_state = function () { - var tm = this.get_state(); - if (!this.settings.state.preserve_loaded) { - delete tm.core.loaded; - } - var st = { 'state' : tm, 'ttl' : this.settings.state.ttl, 'sec' : +(new Date()) }; - $.vakata.storage.set(this.settings.state.key, JSON.stringify(st)); - }; - /** - * restore the state from the user's computer - * @name restore_state() - * @plugin state - */ - this.restore_state = function () { - var k = $.vakata.storage.get(this.settings.state.key); - if(!!k) { try { k = JSON.parse(k); } catch(ex) { return false; } } - if(!!k && k.ttl && k.sec && +(new Date()) - k.sec > k.ttl) { return false; } - if(!!k && k.state) { k = k.state; } - if(!!k && $.isFunction(this.settings.state.filter)) { k = this.settings.state.filter.call(this, k); } - if(!!k) { - if (!this.settings.state.preserve_loaded) { - delete k.core.loaded; - } - this.element.one("set_state.jstree", function (e, data) { data.instance.trigger('restore_state', { 'state' : $.extend(true, {}, k) }); }); - this.set_state(k); - return true; - } - return false; - }; - /** - * clear the state on the user's computer - * @name clear_state() - * @plugin state - */ - this.clear_state = function () { - return $.vakata.storage.del(this.settings.state.key); - }; - }; - - (function ($, undefined) { - $.vakata.storage = { - // simply specifying the functions in FF throws an error - set : function (key, val) { return window.localStorage.setItem(key, val); }, - get : function (key) { return window.localStorage.getItem(key); }, - del : function (key) { return window.localStorage.removeItem(key); } - }; - }($)); - - // include the state plugin by default - // $.jstree.defaults.plugins.push("state"); - -/** - * ### Types plugin - * - * Makes it possible to add predefined types for groups of nodes, which make it possible to easily control nesting rules and icon for each group. - */ - - /** - * An object storing all types as key value pairs, where the key is the type name and the value is an object that could contain following keys (all optional). - * - * * `max_children` the maximum number of immediate children this node type can have. Do not specify or set to `-1` for unlimited. - * * `max_depth` the maximum number of nesting this node type can have. A value of `1` would mean that the node can have children, but no grandchildren. Do not specify or set to `-1` for unlimited. - * * `valid_children` an array of node type strings, that nodes of this type can have as children. Do not specify or set to `-1` for no limits. - * * `icon` a string - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class. Omit to use the default icon from your theme. - * * `li_attr` an object of values which will be used to add HTML attributes on the resulting LI DOM node (merged with the node's own data) - * * `a_attr` an object of values which will be used to add HTML attributes on the resulting A DOM node (merged with the node's own data) - * - * There are two predefined types: - * - * * `#` represents the root of the tree, for example `max_children` would control the maximum number of root nodes. - * * `default` represents the default node - any settings here will be applied to all nodes that do not have a type specified. - * - * @name $.jstree.defaults.types - * @plugin types - */ - $.jstree.defaults.types = { - 'default' : {} - }; - $.jstree.defaults.types[$.jstree.root] = {}; - - $.jstree.plugins.types = function (options, parent) { - this.init = function (el, options) { - var i, j; - if(options && options.types && options.types['default']) { - for(i in options.types) { - if(i !== "default" && i !== $.jstree.root && options.types.hasOwnProperty(i)) { - for(j in options.types['default']) { - if(options.types['default'].hasOwnProperty(j) && options.types[i][j] === undefined) { - options.types[i][j] = options.types['default'][j]; - } - } - } - } - } - parent.init.call(this, el, options); - this._model.data[$.jstree.root].type = $.jstree.root; - }; - this.refresh = function (skip_loading, forget_state) { - parent.refresh.call(this, skip_loading, forget_state); - this._model.data[$.jstree.root].type = $.jstree.root; - }; - this.bind = function () { - this.element - .on('model.jstree', $.proxy(function (e, data) { - var m = this._model.data, - dpc = data.nodes, - t = this.settings.types, - i, j, c = 'default', k; - for(i = 0, j = dpc.length; i < j; i++) { - c = 'default'; - if(m[dpc[i]].original && m[dpc[i]].original.type && t[m[dpc[i]].original.type]) { - c = m[dpc[i]].original.type; - } - if(m[dpc[i]].data && m[dpc[i]].data.jstree && m[dpc[i]].data.jstree.type && t[m[dpc[i]].data.jstree.type]) { - c = m[dpc[i]].data.jstree.type; - } - m[dpc[i]].type = c; - if(m[dpc[i]].icon === true && t[c].icon !== undefined) { - m[dpc[i]].icon = t[c].icon; - } - if(t[c].li_attr !== undefined && typeof t[c].li_attr === 'object') { - for (k in t[c].li_attr) { - if (t[c].li_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (m[dpc[i]].li_attr[k] === undefined) { - m[dpc[i]].li_attr[k] = t[c].li_attr[k]; - } - else if (k === 'class') { - m[dpc[i]].li_attr['class'] = t[c].li_attr['class'] + ' ' + m[dpc[i]].li_attr['class']; - } - } - } - } - if(t[c].a_attr !== undefined && typeof t[c].a_attr === 'object') { - for (k in t[c].a_attr) { - if (t[c].a_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (m[dpc[i]].a_attr[k] === undefined) { - m[dpc[i]].a_attr[k] = t[c].a_attr[k]; - } - else if (k === 'href' && m[dpc[i]].a_attr[k] === '#') { - m[dpc[i]].a_attr['href'] = t[c].a_attr['href']; - } - else if (k === 'class') { - m[dpc[i]].a_attr['class'] = t[c].a_attr['class'] + ' ' + m[dpc[i]].a_attr['class']; - } - } - } - } - } - m[$.jstree.root].type = $.jstree.root; - }, this)); - parent.bind.call(this); - }; - this.get_json = function (obj, options, flat) { - var i, j, - m = this._model.data, - opt = options ? $.extend(true, {}, options, {no_id:false}) : {}, - tmp = parent.get_json.call(this, obj, opt, flat); - if(tmp === false) { return false; } - if($.isArray(tmp)) { - for(i = 0, j = tmp.length; i < j; i++) { - tmp[i].type = tmp[i].id && m[tmp[i].id] && m[tmp[i].id].type ? m[tmp[i].id].type : "default"; - if(options && options.no_id) { - delete tmp[i].id; - if(tmp[i].li_attr && tmp[i].li_attr.id) { - delete tmp[i].li_attr.id; - } - if(tmp[i].a_attr && tmp[i].a_attr.id) { - delete tmp[i].a_attr.id; - } - } - } - } - else { - tmp.type = tmp.id && m[tmp.id] && m[tmp.id].type ? m[tmp.id].type : "default"; - if(options && options.no_id) { - tmp = this._delete_ids(tmp); - } - } - return tmp; - }; - this._delete_ids = function (tmp) { - if($.isArray(tmp)) { - for(var i = 0, j = tmp.length; i < j; i++) { - tmp[i] = this._delete_ids(tmp[i]); - } - return tmp; - } - delete tmp.id; - if(tmp.li_attr && tmp.li_attr.id) { - delete tmp.li_attr.id; - } - if(tmp.a_attr && tmp.a_attr.id) { - delete tmp.a_attr.id; - } - if(tmp.children && $.isArray(tmp.children)) { - tmp.children = this._delete_ids(tmp.children); - } - return tmp; - }; - this.check = function (chk, obj, par, pos, more) { - if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; } - obj = obj && obj.id ? obj : this.get_node(obj); - par = par && par.id ? par : this.get_node(par); - var m = obj && obj.id ? (more && more.origin ? more.origin : $.jstree.reference(obj.id)) : null, tmp, d, i, j; - m = m && m._model && m._model.data ? m._model.data : null; - switch(chk) { - case "create_node": - case "move_node": - case "copy_node": - if(chk !== 'move_node' || $.inArray(obj.id, par.children) === -1) { - tmp = this.get_rules(par); - if(tmp.max_children !== undefined && tmp.max_children !== -1 && tmp.max_children === par.children.length) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_01', 'reason' : 'max_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - if(tmp.valid_children !== undefined && tmp.valid_children !== -1 && $.inArray((obj.type || 'default'), tmp.valid_children) === -1) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_02', 'reason' : 'valid_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - if(m && obj.children_d && obj.parents) { - d = 0; - for(i = 0, j = obj.children_d.length; i < j; i++) { - d = Math.max(d, m[obj.children_d[i]].parents.length); - } - d = d - obj.parents.length + 1; - } - if(d <= 0 || d === undefined) { d = 1; } - do { - if(tmp.max_depth !== undefined && tmp.max_depth !== -1 && tmp.max_depth < d) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_03', 'reason' : 'max_depth prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - return false; - } - par = this.get_node(par.parent); - tmp = this.get_rules(par); - d++; - } while(par); - } - break; - } - return true; - }; - /** - * used to retrieve the type settings object for a node - * @name get_rules(obj) - * @param {mixed} obj the node to find the rules for - * @return {Object} - * @plugin types - */ - this.get_rules = function (obj) { - obj = this.get_node(obj); - if(!obj) { return false; } - var tmp = this.get_type(obj, true); - if(tmp.max_depth === undefined) { tmp.max_depth = -1; } - if(tmp.max_children === undefined) { tmp.max_children = -1; } - if(tmp.valid_children === undefined) { tmp.valid_children = -1; } - return tmp; - }; - /** - * used to retrieve the type string or settings object for a node - * @name get_type(obj [, rules]) - * @param {mixed} obj the node to find the rules for - * @param {Boolean} rules if set to `true` instead of a string the settings object will be returned - * @return {String|Object} - * @plugin types - */ - this.get_type = function (obj, rules) { - obj = this.get_node(obj); - return (!obj) ? false : ( rules ? $.extend({ 'type' : obj.type }, this.settings.types[obj.type]) : obj.type); - }; - /** - * used to change a node's type - * @name set_type(obj, type) - * @param {mixed} obj the node to change - * @param {String} type the new type - * @plugin types - */ - this.set_type = function (obj, type) { - var m = this._model.data, t, t1, t2, old_type, old_icon, k, d, a; - if($.isArray(obj)) { - obj = obj.slice(); - for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { - this.set_type(obj[t1], type); - } - return true; - } - t = this.settings.types; - obj = this.get_node(obj); - if(!t[type] || !obj) { return false; } - d = this.get_node(obj, true); - if (d && d.length) { - a = d.children('.jstree-anchor'); - } - old_type = obj.type; - old_icon = this.get_icon(obj); - obj.type = type; - if(old_icon === true || !t[old_type] || (t[old_type].icon !== undefined && old_icon === t[old_type].icon)) { - this.set_icon(obj, t[type].icon !== undefined ? t[type].icon : true); - } - - // remove old type props - if(t[old_type] && t[old_type].li_attr !== undefined && typeof t[old_type].li_attr === 'object') { - for (k in t[old_type].li_attr) { - if (t[old_type].li_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (k === 'class') { - m[obj.id].li_attr['class'] = (m[obj.id].li_attr['class'] || '').replace(t[old_type].li_attr[k], ''); - if (d) { d.removeClass(t[old_type].li_attr[k]); } - } - else if (m[obj.id].li_attr[k] === t[old_type].li_attr[k]) { - m[obj.id].li_attr[k] = null; - if (d) { d.removeAttr(k); } - } - } - } - } - if(t[old_type] && t[old_type].a_attr !== undefined && typeof t[old_type].a_attr === 'object') { - for (k in t[old_type].a_attr) { - if (t[old_type].a_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (k === 'class') { - m[obj.id].a_attr['class'] = (m[obj.id].a_attr['class'] || '').replace(t[old_type].a_attr[k], ''); - if (a) { a.removeClass(t[old_type].a_attr[k]); } - } - else if (m[obj.id].a_attr[k] === t[old_type].a_attr[k]) { - if (k === 'href') { - m[obj.id].a_attr[k] = '#'; - if (a) { a.attr('href', '#'); } - } - else { - delete m[obj.id].a_attr[k]; - if (a) { a.removeAttr(k); } - } - } - } - } - } - - // add new props - if(t[type].li_attr !== undefined && typeof t[type].li_attr === 'object') { - for (k in t[type].li_attr) { - if (t[type].li_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (m[obj.id].li_attr[k] === undefined) { - m[obj.id].li_attr[k] = t[type].li_attr[k]; - if (d) { - if (k === 'class') { - d.addClass(t[type].li_attr[k]); - } - else { - d.attr(k, t[type].li_attr[k]); - } - } - } - else if (k === 'class') { - m[obj.id].li_attr['class'] = t[type].li_attr[k] + ' ' + m[obj.id].li_attr['class']; - if (d) { d.addClass(t[type].li_attr[k]); } - } - } - } - } - if(t[type].a_attr !== undefined && typeof t[type].a_attr === 'object') { - for (k in t[type].a_attr) { - if (t[type].a_attr.hasOwnProperty(k)) { - if (k === 'id') { - continue; - } - else if (m[obj.id].a_attr[k] === undefined) { - m[obj.id].a_attr[k] = t[type].a_attr[k]; - if (a) { - if (k === 'class') { - a.addClass(t[type].a_attr[k]); - } - else { - a.attr(k, t[type].a_attr[k]); - } - } - } - else if (k === 'href' && m[obj.id].a_attr[k] === '#') { - m[obj.id].a_attr['href'] = t[type].a_attr['href']; - if (a) { a.attr('href', t[type].a_attr['href']); } - } - else if (k === 'class') { - m[obj.id].a_attr['class'] = t[type].a_attr['class'] + ' ' + m[obj.id].a_attr['class']; - if (a) { a.addClass(t[type].a_attr[k]); } - } - } - } - } - - return true; - }; - }; - // include the types plugin by default - // $.jstree.defaults.plugins.push("types"); - - -/** - * ### Unique plugin - * - * Enforces that no nodes with the same name can coexist as siblings. - */ - - /** - * stores all defaults for the unique plugin - * @name $.jstree.defaults.unique - * @plugin unique - */ - $.jstree.defaults.unique = { - /** - * Indicates if the comparison should be case sensitive. Default is `false`. - * @name $.jstree.defaults.unique.case_sensitive - * @plugin unique - */ - case_sensitive : false, - /** - * Indicates if white space should be trimmed before the comparison. Default is `false`. - * @name $.jstree.defaults.unique.trim_whitespace - * @plugin unique - */ - trim_whitespace : false, - /** - * A callback executed in the instance's scope when a new node is created and the name is already taken, the two arguments are the conflicting name and the counter. The default will produce results like `New node (2)`. - * @name $.jstree.defaults.unique.duplicate - * @plugin unique - */ - duplicate : function (name, counter) { - return name + ' (' + counter + ')'; - } - }; - - $.jstree.plugins.unique = function (options, parent) { - this.check = function (chk, obj, par, pos, more) { - if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; } - obj = obj && obj.id ? obj : this.get_node(obj); - par = par && par.id ? par : this.get_node(par); - if(!par || !par.children) { return true; } - var n = chk === "rename_node" ? pos : obj.text, - c = [], - s = this.settings.unique.case_sensitive, - w = this.settings.unique.trim_whitespace, - m = this._model.data, i, j, t; - for(i = 0, j = par.children.length; i < j; i++) { - t = m[par.children[i]].text; - if (!s) { - t = t.toLowerCase(); - } - if (w) { - t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); - } - c.push(t); - } - if(!s) { n = n.toLowerCase(); } - if (w) { n = n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } - switch(chk) { - case "delete_node": - return true; - case "rename_node": - t = obj.text || ''; - if (!s) { - t = t.toLowerCase(); - } - if (w) { - t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); - } - i = ($.inArray(n, c) === -1 || (obj.text && t === n)); - if(!i) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_01', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return i; - case "create_node": - i = ($.inArray(n, c) === -1); - if(!i) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_04', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return i; - case "copy_node": - i = ($.inArray(n, c) === -1); - if(!i) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_02', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return i; - case "move_node": - i = ( (obj.parent === par.id && (!more || !more.is_multi)) || $.inArray(n, c) === -1); - if(!i) { - this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_03', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; - } - return i; - } - return true; - }; - this.create_node = function (par, node, pos, callback, is_loaded) { - if(!node || node.text === undefined) { - if(par === null) { - par = $.jstree.root; - } - par = this.get_node(par); - if(!par) { - return parent.create_node.call(this, par, node, pos, callback, is_loaded); - } - pos = pos === undefined ? "last" : pos; - if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { - return parent.create_node.call(this, par, node, pos, callback, is_loaded); - } - if(!node) { node = {}; } - var tmp, n, dpc, i, j, m = this._model.data, s = this.settings.unique.case_sensitive, w = this.settings.unique.trim_whitespace, cb = this.settings.unique.duplicate, t; - n = tmp = this.get_string('New node'); - dpc = []; - for(i = 0, j = par.children.length; i < j; i++) { - t = m[par.children[i]].text; - if (!s) { - t = t.toLowerCase(); - } - if (w) { - t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); - } - dpc.push(t); - } - i = 1; - t = n; - if (!s) { - t = t.toLowerCase(); - } - if (w) { - t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); - } - while($.inArray(t, dpc) !== -1) { - n = cb.call(this, tmp, (++i)).toString(); - t = n; - if (!s) { - t = t.toLowerCase(); - } - if (w) { - t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); - } - } - node.text = n; - } - return parent.create_node.call(this, par, node, pos, callback, is_loaded); - }; - }; - - // include the unique plugin by default - // $.jstree.defaults.plugins.push("unique"); - - -/** - * ### Wholerow plugin - * - * Makes each node appear block level. Making selection easier. May cause slow down for large trees in old browsers. - */ - - var div = document.createElement('DIV'); - div.setAttribute('unselectable','on'); - div.setAttribute('role','presentation'); - div.className = 'jstree-wholerow'; - div.innerHTML = ' '; - $.jstree.plugins.wholerow = function (options, parent) { - this.bind = function () { - parent.bind.call(this); - - this.element - .on('ready.jstree set_state.jstree', $.proxy(function () { - this.hide_dots(); - }, this)) - .on("init.jstree loading.jstree ready.jstree", $.proxy(function () { - //div.style.height = this._data.core.li_height + 'px'; - this.get_container_ul().addClass('jstree-wholerow-ul'); - }, this)) - .on("deselect_all.jstree", $.proxy(function (e, data) { - this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked'); - }, this)) - .on("changed.jstree", $.proxy(function (e, data) { - this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked'); - var tmp = false, i, j; - for(i = 0, j = data.selected.length; i < j; i++) { - tmp = this.get_node(data.selected[i], true); - if(tmp && tmp.length) { - tmp.children('.jstree-wholerow').addClass('jstree-wholerow-clicked'); - } - } - }, this)) - .on("open_node.jstree", $.proxy(function (e, data) { - this.get_node(data.node, true).find('.jstree-clicked').parent().children('.jstree-wholerow').addClass('jstree-wholerow-clicked'); - }, this)) - .on("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) { - if(e.type === "hover_node" && this.is_disabled(data.node)) { return; } - this.get_node(data.node, true).children('.jstree-wholerow')[e.type === "hover_node"?"addClass":"removeClass"]('jstree-wholerow-hovered'); - }, this)) - .on("contextmenu.jstree", ".jstree-wholerow", $.proxy(function (e) { - if (this._data.contextmenu) { - e.preventDefault(); - var tmp = $.Event('contextmenu', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey, pageX : e.pageX, pageY : e.pageY }); - $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp); - } - }, this)) - /*! - .on("mousedown.jstree touchstart.jstree", ".jstree-wholerow", function (e) { - if(e.target === e.currentTarget) { - var a = $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor"); - e.target = a[0]; - a.trigger(e); - } - }) - */ - .on("click.jstree", ".jstree-wholerow", function (e) { - e.stopImmediatePropagation(); - var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); - $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); - }) - .on("dblclick.jstree", ".jstree-wholerow", function (e) { - e.stopImmediatePropagation(); - var tmp = $.Event('dblclick', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); - $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); - }) - .on("click.jstree", ".jstree-leaf > .jstree-ocl", $.proxy(function (e) { - e.stopImmediatePropagation(); - var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); - $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); - }, this)) - .on("mouseover.jstree", ".jstree-wholerow, .jstree-icon", $.proxy(function (e) { - e.stopImmediatePropagation(); - if(!this.is_disabled(e.currentTarget)) { - this.hover_node(e.currentTarget); - } - return false; - }, this)) - .on("mouseleave.jstree", ".jstree-node", $.proxy(function (e) { - this.dehover_node(e.currentTarget); - }, this)); - }; - this.teardown = function () { - if(this.settings.wholerow) { - this.element.find(".jstree-wholerow").remove(); - } - parent.teardown.call(this); - }; - this.redraw_node = function(obj, deep, callback, force_render) { - obj = parent.redraw_node.apply(this, arguments); - if(obj) { - var tmp = div.cloneNode(true); - //tmp.style.height = this._data.core.li_height + 'px'; - if($.inArray(obj.id, this._data.core.selected) !== -1) { tmp.className += ' jstree-wholerow-clicked'; } - if(this._data.core.focused && this._data.core.focused === obj.id) { tmp.className += ' jstree-wholerow-hovered'; } - obj.insertBefore(tmp, obj.childNodes[0]); - } - return obj; - }; - }; - // include the wholerow plugin by default - // $.jstree.defaults.plugins.push("wholerow"); - if(window.customElements && Object && Object.create) { - var proto = Object.create(HTMLElement.prototype); - proto.createdCallback = function () { - var c = { core : {}, plugins : [] }, i; - for(i in $.jstree.plugins) { - if($.jstree.plugins.hasOwnProperty(i) && this.attributes[i]) { - c.plugins.push(i); - if(this.getAttribute(i) && JSON.parse(this.getAttribute(i))) { - c[i] = JSON.parse(this.getAttribute(i)); - } - } - } - for(i in $.jstree.defaults.core) { - if($.jstree.defaults.core.hasOwnProperty(i) && this.attributes[i]) { - c.core[i] = JSON.parse(this.getAttribute(i)) || this.getAttribute(i); - } - } - $(this).jstree(c); - }; - // proto.attributeChangedCallback = function (name, previous, value) { }; - try { - window.customElements.define("vakata-jstree", function() {}, { prototype: proto }); - } catch (ignore) { } - } - -})); \ No newline at end of file diff --git a/src/main/webapp/resources/3rd-party/jstree/jstree.min.js b/src/main/webapp/resources/3rd-party/jstree/jstree.min.js deleted file mode 100644 index 9221c338..00000000 --- a/src/main/webapp/resources/3rd-party/jstree/jstree.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/*! jsTree - v3.3.7 - 2018-11-06 - (MIT) */ -!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"undefined"!=typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a,b){"use strict";if(!a.jstree){var c=0,d=!1,e=!1,f=!1,g=[],h=a("script:last").attr("src"),i=window.document;a.jstree={version:"3.3.7",defaults:{plugins:[]},plugins:{},path:h&&-1!==h.indexOf("/")?h.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},a.jstree.create=function(b,d){var e=new a.jstree.core(++c),f=d;return d=a.extend(!0,{},a.jstree.defaults,d),f&&f.plugins&&(d.plugins=f.plugins),a.each(d.plugins,function(a,b){"core"!==a&&(e=e.plugin(b,d[b]))}),a(b).data("jstree",e),e.init(b,d),e},a.jstree.destroy=function(){a(".jstree:jstree").jstree("destroy"),a(i).off(".jstree")},a.jstree.core=function(a){this._id=a,this._cnt=0,this._wrk=null,this._data={core:{themes:{name:!1,dots:!1,icons:!1,ellipsis:!1},selected:[],last_error:{},working:!1,worker_queue:[],focused:null}}},a.jstree.reference=function(b){var c=null,d=null;if(!b||!b.id||b.tagName&&b.nodeType||(b=b.id),!d||!d.length)try{d=a(b)}catch(e){}if(!d||!d.length)try{d=a("#"+b.replace(a.jstree.idregex,"\\$&"))}catch(e){}return d&&d.length&&(d=d.closest(".jstree")).length&&(d=d.data("jstree"))?c=d:a(".jstree").each(function(){var d=a(this).data("jstree");return d&&d._model.data[b]?(c=d,!1):void 0}),c},a.fn.jstree=function(c){var d="string"==typeof c,e=Array.prototype.slice.call(arguments,1),f=null;return c!==!0||this.length?(this.each(function(){var g=a.jstree.reference(this),h=d&&g?g[c]:null;return f=d&&h?h.apply(g,e):null,g||d||c!==b&&!a.isPlainObject(c)||a.jstree.create(this,c),(g&&!d||c===!0)&&(f=g||!1),null!==f&&f!==b?!1:void 0}),null!==f&&f!==b?f:this):!1},a.expr.pseudos.jstree=a.expr.createPseudo(function(c){return function(c){return a(c).hasClass("jstree")&&a(c).data("jstree")!==b}}),a.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:a.noop,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,ellipsis:!1,stripes:!1,variant:!1,responsive:!1},expand_selected_onload:!0,worker:!0,force_text:!1,dblclick_toggle:!0,loaded_state:!1,restore_focus:!0,keyboard:{"ctrl-space":function(b){b.type="click",a(b.currentTarget).trigger(b)},enter:function(b){b.type="click",a(b.currentTarget).trigger(b)},left:function(b){if(b.preventDefault(),this.is_open(b.currentTarget))this.close_node(b.currentTarget);else{var c=this.get_parent(b.currentTarget);c&&c.id!==a.jstree.root&&this.get_node(c,!0).children(".jstree-anchor").focus()}},up:function(a){a.preventDefault();var b=this.get_prev_dom(a.currentTarget);b&&b.length&&b.children(".jstree-anchor").focus()},right:function(b){if(b.preventDefault(),this.is_closed(b.currentTarget))this.open_node(b.currentTarget,function(a){this.get_node(a,!0).children(".jstree-anchor").focus()});else if(this.is_open(b.currentTarget)){var c=this.get_node(b.currentTarget,!0).children(".jstree-children")[0];c&&a(this._firstChild(c)).children(".jstree-anchor").focus()}},down:function(a){a.preventDefault();var b=this.get_next_dom(a.currentTarget);b&&b.length&&b.children(".jstree-anchor").focus()},"*":function(a){this.open_all()},home:function(b){b.preventDefault();var c=this._firstChild(this.get_container_ul()[0]);c&&a(c).children(".jstree-anchor").filter(":visible").focus()},end:function(a){a.preventDefault(),this.element.find(".jstree-anchor").filter(":visible").last().focus()},f2:function(a){a.preventDefault(),this.edit(a.currentTarget)}}},a.jstree.core.prototype={plugin:function(b,c){var d=a.jstree.plugins[b];return d?(this._data[b]={},d.prototype=this,new d(c,this)):this},init:function(b,c){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this._model.data[a.jstree.root]={id:a.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this.element=a(b).addClass("jstree jstree-"+this._id),this.settings=c,this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.settings.core.multiple&&this.element.attr("aria-multiselectable",!0),this.element.attr("tabindex")||this.element.attr("tabindex","0"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html(""),this.element.attr("aria-activedescendant","j"+this._id+"_loading"),this._data.core.li_height=this.get_container_ul().children("li").first().outerHeight()||24,this._data.core.node=this._create_prototype_node(),this.trigger("loading"),this.load_node(a.jstree.root)},destroy:function(a){if(this.trigger("destroy"),this._wrk)try{window.URL.revokeObjectURL(this._wrk),this._wrk=null}catch(b){}a||this.element.empty(),this.teardown()},_create_prototype_node:function(){var a=i.createElement("LI"),b,c;return a.setAttribute("role","treeitem"),b=i.createElement("I"),b.className="jstree-icon jstree-ocl",b.setAttribute("role","presentation"),a.appendChild(b),b=i.createElement("A"),b.className="jstree-anchor",b.setAttribute("href","#"),b.setAttribute("tabindex","-1"),c=i.createElement("I"),c.className="jstree-icon jstree-themeicon",c.setAttribute("role","presentation"),b.appendChild(c),a.appendChild(b),b=c=null,a},_kbevent_to_func:function(a){var b={8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock",16:"Shift",17:"Ctrl",18:"Alt",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*",173:"-"},c=[];a.ctrlKey&&c.push("ctrl"),a.altKey&&c.push("alt"),a.shiftKey&&c.push("shift"),c.push(b[a.which]||a.which),c=c.sort().join("-").toLowerCase();var d=this.settings.core.keyboard,e,f;for(e in d)if(d.hasOwnProperty(e)&&(f=e,"-"!==f&&"+"!==f&&(f=f.replace("--","-MINUS").replace("+-","-MINUS").replace("++","-PLUS").replace("-+","-PLUS"),f=f.split(/-|\+/).sort().join("-").replace("MINUS","-").replace("PLUS","+").toLowerCase()),f===c))return d[e];return null},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){var b="",c=null,d=0;this.element.on("dblclick.jstree",function(a){if(a.target.tagName&&"input"===a.target.tagName.toLowerCase())return!0;if(i.selection&&i.selection.empty)i.selection.empty();else if(window.getSelection){var b=window.getSelection();try{b.removeAllRanges(),b.collapse()}catch(c){}}}).on("mousedown.jstree",a.proxy(function(a){a.target===this.element[0]&&(a.preventDefault(),d=+new Date)},this)).on("mousedown.jstree",".jstree-ocl",function(a){a.preventDefault()}).on("click.jstree",".jstree-ocl",a.proxy(function(a){this.toggle_node(a.target)},this)).on("dblclick.jstree",".jstree-anchor",a.proxy(function(a){return a.target.tagName&&"input"===a.target.tagName.toLowerCase()?!0:void(this.settings.core.dblclick_toggle&&this.toggle_node(a.target))},this)).on("click.jstree",".jstree-anchor",a.proxy(function(b){b.preventDefault(),b.currentTarget!==i.activeElement&&a(b.currentTarget).focus(),this.activate_node(b.currentTarget,b)},this)).on("keydown.jstree",".jstree-anchor",a.proxy(function(a){if(a.target.tagName&&"input"===a.target.tagName.toLowerCase())return!0;this._data.core.rtl&&(37===a.which?a.which=39:39===a.which&&(a.which=37));var b=this._kbevent_to_func(a);if(b){var c=b.call(this,a);if(c===!1||c===!0)return c}},this)).on("load_node.jstree",a.proxy(function(b,c){c.status&&(c.node.id!==a.jstree.root||this._data.core.loaded||(this._data.core.loaded=!0,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.trigger("loaded")),this._data.core.ready||setTimeout(a.proxy(function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var b=[],c,d;for(c=0,d=this._data.core.selected.length;d>c;c++)b=b.concat(this._model.data[this._data.core.selected[c]].parents);for(b=a.vakata.array_unique(b),c=0,d=b.length;d>c;c++)this.open_node(b[c],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}},this),0))},this)).on("keypress.jstree",a.proxy(function(d){if(d.target.tagName&&"input"===d.target.tagName.toLowerCase())return!0;c&&clearTimeout(c),c=setTimeout(function(){b=""},500);var e=String.fromCharCode(d.which).toLowerCase(),f=this.element.find(".jstree-anchor").filter(":visible"),g=f.index(i.activeElement)||0,h=!1;if(b+=e,b.length>1){if(f.slice(g).each(a.proxy(function(c,d){return 0===a(d).text().toLowerCase().indexOf(b)?(a(d).focus(),h=!0,!1):void 0},this)),h)return;if(f.slice(0,g).each(a.proxy(function(c,d){return 0===a(d).text().toLowerCase().indexOf(b)?(a(d).focus(),h=!0,!1):void 0},this)),h)return}if(new RegExp("^"+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(b)){if(f.slice(g+1).each(a.proxy(function(b,c){return a(c).text().toLowerCase().charAt(0)===e?(a(c).focus(),h=!0,!1):void 0},this)),h)return;if(f.slice(0,g+1).each(a.proxy(function(b,c){return a(c).text().toLowerCase().charAt(0)===e?(a(c).focus(),h=!0,!1):void 0},this)),h)return}},this)).on("init.jstree",a.proxy(function(){var a=this.settings.core.themes;this._data.core.themes.dots=a.dots,this._data.core.themes.stripes=a.stripes,this._data.core.themes.icons=a.icons,this._data.core.themes.ellipsis=a.ellipsis,this.set_theme(a.name||"default",a.url),this.set_theme_variant(a.variant)},this)).on("loading.jstree",a.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"](),this[this._data.core.themes.ellipsis?"show_ellipsis":"hide_ellipsis"]()},this)).on("blur.jstree",".jstree-anchor",a.proxy(function(b){this._data.core.focused=null,a(b.currentTarget).filter(".jstree-hovered").mouseleave(),this.element.attr("tabindex","0")},this)).on("focus.jstree",".jstree-anchor",a.proxy(function(b){var c=this.get_node(b.currentTarget);c&&c.id&&(this._data.core.focused=c.id),this.element.find(".jstree-hovered").not(b.currentTarget).mouseleave(),a(b.currentTarget).mouseenter(),this.element.attr("tabindex","-1")},this)).on("focus.jstree",a.proxy(function(){if(+new Date-d>500&&!this._data.core.focused&&this.settings.core.restore_focus){d=0;var a=this.get_node(this.element.attr("aria-activedescendant"),!0);a&&a.find("> .jstree-anchor").focus()}},this)).on("mouseenter.jstree",".jstree-anchor",a.proxy(function(a){this.hover_node(a.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",a.proxy(function(a){this.dehover_node(a.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),a(i).off(".jstree-"+this._id)},trigger:function(a,b){b||(b={}),b.instance=this,this.element.triggerHandler(a.replace(".jstree","")+".jstree",b)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(b){var c=this.settings.core.strings;return a.isFunction(c)?c.call(this,b):c&&c[b]?c[b]:b},_firstChild:function(a){a=a?a.firstChild:null;while(null!==a&&1!==a.nodeType)a=a.nextSibling;return a},_nextSibling:function(a){a=a?a.nextSibling:null;while(null!==a&&1!==a.nodeType)a=a.nextSibling;return a},_previousSibling:function(a){a=a?a.previousSibling:null;while(null!==a&&1!==a.nodeType)a=a.previousSibling;return a},get_node:function(b,c){b&&b.id&&(b=b.id),b instanceof jQuery&&b.length&&b[0].id&&(b=b[0].id);var d;try{if(this._model.data[b])b=this._model.data[b];else if("string"==typeof b&&this._model.data[b.replace(/^#/,"")])b=this._model.data[b.replace(/^#/,"")];else if("string"==typeof b&&(d=a("#"+b.replace(a.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[d.closest(".jstree-node").attr("id")])b=this._model.data[d.closest(".jstree-node").attr("id")];else if((d=this.element.find(b)).length&&this._model.data[d.closest(".jstree-node").attr("id")])b=this._model.data[d.closest(".jstree-node").attr("id")];else{if(!(d=this.element.find(b)).length||!d.hasClass("jstree"))return!1;b=this._model.data[a.jstree.root]}return c&&(b=b.id===a.jstree.root?this.element:a("#"+b.id.replace(a.jstree.idregex,"\\$&"),this.element)),b}catch(e){return!1}},get_path:function(b,c,d){if(b=b.parents?b:this.get_node(b),!b||b.id===a.jstree.root||!b.parents)return!1;var e,f,g=[];for(g.push(d?b.id:b.text),e=0,f=b.parents.length;f>e;e++)g.push(d?b.parents[e]:this.get_text(b.parents[e]));return g=g.reverse().slice(1),c?g.join(c):g},get_next_dom:function(b,c){var d;if(b=this.get_node(b,!0),b[0]===this.element[0]){d=this._firstChild(this.get_container_ul()[0]);while(d&&0===d.offsetHeight)d=this._nextSibling(d);return d?a(d):!1}if(!b||!b.length)return!1;if(c){d=b[0];do d=this._nextSibling(d);while(d&&0===d.offsetHeight);return d?a(d):!1}if(b.hasClass("jstree-open")){d=this._firstChild(b.children(".jstree-children")[0]);while(d&&0===d.offsetHeight)d=this._nextSibling(d);if(null!==d)return a(d)}d=b[0];do d=this._nextSibling(d);while(d&&0===d.offsetHeight);return null!==d?a(d):b.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(b,c){var d;if(b=this.get_node(b,!0),b[0]===this.element[0]){d=this.get_container_ul()[0].lastChild;while(d&&0===d.offsetHeight)d=this._previousSibling(d);return d?a(d):!1}if(!b||!b.length)return!1;if(c){d=b[0];do d=this._previousSibling(d);while(d&&0===d.offsetHeight);return d?a(d):!1}d=b[0];do d=this._previousSibling(d);while(d&&0===d.offsetHeight);if(null!==d){b=a(d);while(b.hasClass("jstree-open"))b=b.children(".jstree-children").first().children(".jstree-node:visible:last");return b}return d=b[0].parentNode.parentNode,d&&d.className&&-1!==d.className.indexOf("jstree-node")?a(d):!1},get_parent:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.parent:!1},get_children_dom:function(a){return a=this.get_node(a,!0),a[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):a&&a.length?a.children(".jstree-children").children(".jstree-node"):!1},is_parent:function(a){return a=this.get_node(a),a&&(a.state.loaded===!1||a.children.length>0)},is_loaded:function(a){return a=this.get_node(a),a&&a.state.loaded},is_loading:function(a){return a=this.get_node(a),a&&a.state&&a.state.loading},is_open:function(a){return a=this.get_node(a),a&&a.state.opened},is_closed:function(a){return a=this.get_node(a),a&&this.is_parent(a)&&!a.state.opened},is_leaf:function(a){return!this.is_parent(a)},load_node:function(b,c){var d,e,f,g,h;if(a.isArray(b))return this._load_nodes(b.slice(),c),!0;if(b=this.get_node(b),!b)return c&&c.call(this,b,!1),!1;if(b.state.loaded){for(b.state.loaded=!1,f=0,g=b.parents.length;g>f;f++)this._model.data[b.parents[f]].children_d=a.vakata.array_filter(this._model.data[b.parents[f]].children_d,function(c){return-1===a.inArray(c,b.children_d)});for(d=0,e=b.children_d.length;e>d;d++)this._model.data[b.children_d[d]].state.selected&&(h=!0),delete this._model.data[b.children_d[d]];h&&(this._data.core.selected=a.vakata.array_filter(this._data.core.selected,function(c){return-1===a.inArray(c,b.children_d)})),b.children=[],b.children_d=[],h&&this.trigger("changed",{action:"load_node",node:b,selected:this._data.core.selected})}return b.state.failed=!1,b.state.loading=!0,this.get_node(b,!0).addClass("jstree-loading").attr("aria-busy",!0),this._load_node(b,a.proxy(function(a){b=this._model.data[b.id],b.state.loading=!1,b.state.loaded=a,b.state.failed=!b.state.loaded;var d=this.get_node(b,!0),e=0,f=0,g=this._model.data,h=!1;for(e=0,f=b.children.length;f>e;e++)if(g[b.children[e]]&&!g[b.children[e]].state.hidden){h=!0;break}b.state.loaded&&d&&d.length&&(d.removeClass("jstree-closed jstree-open jstree-leaf"),h?"#"!==b.id&&d.addClass(b.state.opened?"jstree-open":"jstree-closed"):d.addClass("jstree-leaf")),d.removeClass("jstree-loading").attr("aria-busy",!1),this.trigger("load_node",{node:b,status:a}),c&&c.call(this,b,a)},this)),!0},_load_nodes:function(a,b,c,d){var e=!0,f=function(){this._load_nodes(a,b,!0)},g=this._model.data,h,i,j=[];for(h=0,i=a.length;i>h;h++)g[a[h]]&&(!g[a[h]].state.loaded&&!g[a[h]].state.failed||!c&&d)&&(this.is_loading(a[h])||this.load_node(a[h],f),e=!1);if(e){for(h=0,i=a.length;i>h;h++)g[a[h]]&&g[a[h]].state.loaded&&j.push(a[h]);b&&!b.done&&(b.call(this,j),b.done=!0)}},load_all:function(b,c){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var d=[],e=this._model.data,f=e[b.id].children_d,g,h;for(b.state&&!b.state.loaded&&d.push(b.id),g=0,h=f.length;h>g;g++)e[f[g]]&&e[f[g]].state&&!e[f[g]].state.loaded&&d.push(f[g]);d.length?this._load_nodes(d,function(){this.load_all(b,c)}):(c&&c.call(this,b),this.trigger("load_all",{node:b}))},_load_node:function(b,c){var d=this.settings.core.data,e,f=function g(){return 3!==this.nodeType&&8!==this.nodeType};return d?a.isFunction(d)?d.call(this,b,a.proxy(function(d){d===!1?c.call(this,!1):this["string"==typeof d?"_append_html_data":"_append_json_data"](b,"string"==typeof d?a(a.parseHTML(d)).filter(f):d,function(a){c.call(this,a)})},this)):"object"==typeof d?d.url?(d=a.extend(!0,{},d),a.isFunction(d.url)&&(d.url=d.url.call(this,b)),a.isFunction(d.data)&&(d.data=d.data.call(this,b)),a.ajax(d).done(a.proxy(function(d,e,g){var h=g.getResponseHeader("Content-Type");return h&&-1!==h.indexOf("json")||"object"==typeof d?this._append_json_data(b,d,function(a){c.call(this,a)}):h&&-1!==h.indexOf("html")||"string"==typeof d?this._append_html_data(b,a(a.parseHTML(d)).filter(f),function(a){c.call(this,a)}):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:b.id,xhr:g})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1))},this)).fail(a.proxy(function(a){this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:b.id,xhr:a})},c.call(this,!1),this.settings.core.error.call(this,this._data.core.last_error)},this))):(e=a.isArray(d)?a.extend(!0,[],d):a.isPlainObject(d)?a.extend(!0,{},d):d,b.id===a.jstree.root?this._append_json_data(b,e,function(a){c.call(this,a)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:b.id})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1))):"string"==typeof d?b.id===a.jstree.root?this._append_html_data(b,a(a.parseHTML(d)).filter(f),function(a){c.call(this,a)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:b.id})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1)):c.call(this,!1):b.id===a.jstree.root?this._append_html_data(b,this._data.core.original_container_html.clone(!0),function(a){c.call(this,a)}):c.call(this,!1)},_node_changed:function(b){b=this.get_node(b),b&&-1===a.inArray(b.id,this._model.changed)&&this._model.changed.push(b.id)},_append_html_data:function(b,c,d){b=this.get_node(b),b.children=[],b.children_d=[];var e=c.is("ul")?c.children():c,f=b.id,g=[],h=[],i=this._model.data,j=i[f],k=this._data.core.selected.length,l,m,n;for(e.each(a.proxy(function(b,c){l=this._parse_model_from_html(a(c),f,j.parents.concat()),l&&(g.push(l),h.push(l),i[l].children_d.length&&(h=h.concat(i[l].children_d)))},this)),j.children=g,j.children_d=h,m=0,n=j.parents.length;n>m;m++)i[j.parents[m]].children_d=i[j.parents[m]].children_d.concat(h);this.trigger("model",{nodes:h,parent:f}),f!==a.jstree.root?(this._node_changed(f),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==k&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),d.call(this,!0)},_append_json_data:function(b,c,d,e){if(null!==this.element){b=this.get_node(b),b.children=[],b.children_d=[],c.d&&(c=c.d,"string"==typeof c&&(c=JSON.parse(c))),a.isArray(c)||(c=[c]);var f=null,g={df:this._model.default_state,dat:c,par:b.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},h=function(a,b){a.data&&(a=a.data);var c=a.dat,d=a.par,e=[],f=[],g=[],h=a.df,i=a.t_id,j=a.t_cnt,k=a.m,l=k[d],m=a.sel,n,o,p,q,r=function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=a.id.toString(),f,i,j,l,m={id:e,text:a.text||"",icon:a.icon!==b?a.icon:!0,parent:c,parents:d,children:a.children||[],children_d:a.children_d||[],data:a.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in h)h.hasOwnProperty(f)&&(m.state[f]=h[f]);if(a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(m.icon=a.data.jstree.icon),(m.icon===b||null===m.icon||""===m.icon)&&(m.icon=!0),a&&a.data&&(m.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(m.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(m.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(m.li_attr[f]=a.li_attr[f]);if(m.li_attr.id||(m.li_attr.id=e),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(m.a_attr[f]=a.a_attr[f]);for(a&&a.children&&a.children===!0&&(m.state.loaded=!1,m.children=[],m.children_d=[]),k[m.id]=m,f=0,i=m.children.length;i>f;f++)j=r(k[m.children[f]],m.id,d),l=k[j],m.children_d.push(j),l.children_d.length&&(m.children_d=m.children_d.concat(l.children_d));return delete a.data,delete a.children,k[m.id].original=a,m.state.selected&&g.push(m.id),m.id},s=function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=!1,f,l,m,n,o;do e="j"+i+"_"+ ++j;while(k[e]);o={id:!1,text:"string"==typeof a?a:"",icon:"object"==typeof a&&a.icon!==b?a.icon:!0,parent:c,parents:d,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in h)h.hasOwnProperty(f)&&(o.state[f]=h[f]);if(a&&a.id&&(o.id=a.id.toString()),a&&a.text&&(o.text=a.text),a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(o.icon=a.data.jstree.icon),(o.icon===b||null===o.icon||""===o.icon)&&(o.icon=!0),a&&a.data&&(o.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(o.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(o.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(o.li_attr[f]=a.li_attr[f]);if(o.li_attr.id&&!o.id&&(o.id=o.li_attr.id.toString()),o.id||(o.id=e),o.li_attr.id||(o.li_attr.id=o.id),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(o.a_attr[f]=a.a_attr[f]);if(a&&a.children&&a.children.length){for(f=0,l=a.children.length;l>f;f++)m=s(a.children[f],o.id,d),n=k[m],o.children.push(m),n.children_d.length&&(o.children_d=o.children_d.concat(n.children_d));o.children_d=o.children_d.concat(o.children)}return a&&a.children&&a.children===!0&&(o.state.loaded=!1,o.children=[],o.children_d=[]),delete a.data,delete a.children,o.original=a,k[o.id]=o,o.state.selected&&g.push(o.id),o.id};if(c.length&&c[0].id!==b&&c[0].parent!==b){for(o=0,p=c.length;p>o;o++)c[o].children||(c[o].children=[]),c[o].state||(c[o].state={}),k[c[o].id.toString()]=c[o];for(o=0,p=c.length;p>o;o++)k[c[o].parent.toString()]?(k[c[o].parent.toString()].children.push(c[o].id.toString()),l.children_d.push(c[o].id.toString())):(this._data.core.last_error={error:"parse",plugin:"core",id:"core_07",reason:"Node with invalid parent",data:JSON.stringify({id:c[o].id.toString(),parent:c[o].parent.toString()})},this.settings.core.error.call(this,this._data.core.last_error));for(o=0,p=l.children.length;p>o;o++)n=r(k[l.children[o]],d,l.parents.concat()),f.push(n),k[n].children_d.length&&(f=f.concat(k[n].children_d));for(o=0,p=l.parents.length;p>o;o++)k[l.parents[o]].children_d=k[l.parents[o]].children_d.concat(f);q={cnt:j,mod:k,sel:m,par:d,dpc:f,add:g}}else{for(o=0,p=c.length;p>o;o++)n=s(c[o],d,l.parents.concat()),n&&(e.push(n),f.push(n),k[n].children_d.length&&(f=f.concat(k[n].children_d)));for(l.children=e,l.children_d=f,o=0,p=l.parents.length;p>o;o++)k[l.parents[o]].children_d=k[l.parents[o]].children_d.concat(f);q={cnt:j,mod:k,sel:m,par:d,dpc:f,add:g}}return"undefined"!=typeof window&&"undefined"!=typeof window.document?q:void postMessage(q)},i=function(b,c){if(null!==this.element){this._cnt=b.cnt;var e,f=this._model.data;for(e in f)f.hasOwnProperty(e)&&f[e].state&&f[e].state.loading&&b.mod[e]&&(b.mod[e].state.loading=!0);if(this._model.data=b.mod,c){var g,h=b.add,i=b.sel,j=this._data.core.selected.slice();if(f=this._model.data,i.length!==j.length||a.vakata.array_unique(i.concat(j)).length!==i.length){for(e=0,g=i.length;g>e;e++)-1===a.inArray(i[e],h)&&-1===a.inArray(i[e],j)&&(f[i[e]].state.selected=!1);for(e=0,g=j.length;g>e;e++)-1===a.inArray(j[e],i)&&(f[j[e]].state.selected=!0)}}b.add.length&&(this._data.core.selected=this._data.core.selected.concat(b.add)),this.trigger("model",{nodes:b.dpc,parent:b.par}),b.par!==a.jstree.root?(this._node_changed(b.par),this.redraw()):this.redraw(!0),b.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),d.call(this,!0)}};if(this.settings.core.worker&&window.Blob&&window.URL&&window.Worker)try{null===this._wrk&&(this._wrk=window.URL.createObjectURL(new window.Blob(["self.onmessage = "+h.toString()],{type:"text/javascript"}))),!this._data.core.working||e?(this._data.core.working=!0,f=new window.Worker(this._wrk),f.onmessage=a.proxy(function(a){i.call(this,a.data,!0);try{f.terminate(),f=null}catch(b){}this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1},this),g.par?f.postMessage(g):this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1):this._data.core.worker_queue.push([b,c,d,!0])}catch(j){i.call(this,h(g),!1),this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else i.call(this,h(g),!1)}},_parse_model_from_html:function(c,d,e){e=e?[].concat(e):[],d&&e.unshift(d);var f,g,h=this._model.data,i={id:!1,text:!1,icon:!0,parent:d,parents:e,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},j,k,l;for(j in this._model.default_state)this._model.default_state.hasOwnProperty(j)&&(i.state[j]=this._model.default_state[j]);if(k=a.vakata.attributes(c,!0),a.each(k,function(b,c){return c=a.trim(c),c.length?(i.li_attr[b]=c,void("id"===b&&(i.id=c.toString()))):!0}),k=c.children("a").first(),k.length&&(k=a.vakata.attributes(k,!0),a.each(k,function(b,c){c=a.trim(c),c.length&&(i.a_attr[b]=c)})),k=c.children("a").first().length?c.children("a").first().clone():c.clone(),k.children("ins, i, ul").remove(),k=k.html(),k=a("
      ").html(k),i.text=this.settings.core.force_text?k.text():k.html(),k=c.data(),i.data=k?a.extend(!0,{},k):null,i.state.opened=c.hasClass("jstree-open"),i.state.selected=c.children("a").hasClass("jstree-clicked"),i.state.disabled=c.children("a").hasClass("jstree-disabled"),i.data&&i.data.jstree)for(j in i.data.jstree)i.data.jstree.hasOwnProperty(j)&&(i.state[j]=i.data.jstree[j]);k=c.children("a").children(".jstree-themeicon"),k.length&&(i.icon=k.hasClass("jstree-themeicon-hidden")?!1:k.attr("rel")),i.state.icon!==b&&(i.icon=i.state.icon),(i.icon===b||null===i.icon||""===i.icon)&&(i.icon=!0),k=c.children("ul").children("li");do l="j"+this._id+"_"+ ++this._cnt;while(h[l]);return i.id=i.li_attr.id?i.li_attr.id.toString():l,k.length?(k.each(a.proxy(function(b,c){f=this._parse_model_from_html(a(c),i.id,e),g=this._model.data[f],i.children.push(f),g.children_d.length&&(i.children_d=i.children_d.concat(g.children_d))},this)),i.children_d=i.children_d.concat(i.children)):c.hasClass("jstree-closed")&&(i.state.loaded=!1),i.li_attr["class"]&&(i.li_attr["class"]=i.li_attr["class"].replace("jstree-closed","").replace("jstree-open","")),i.a_attr["class"]&&(i.a_attr["class"]=i.a_attr["class"].replace("jstree-clicked","").replace("jstree-disabled","")),h[i.id]=i,i.state.selected&&this._data.core.selected.push(i.id),i.id},_parse_model_from_flat_json:function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=a.id.toString(),f=this._model.data,g=this._model.default_state,h,i,j,k,l={id:e,text:a.text||"",icon:a.icon!==b?a.icon:!0,parent:c,parents:d,children:a.children||[],children_d:a.children_d||[],data:a.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(h in g)g.hasOwnProperty(h)&&(l.state[h]=g[h]);if(a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(l.icon=a.data.jstree.icon),(l.icon===b||null===l.icon||""===l.icon)&&(l.icon=!0),a&&a.data&&(l.data=a.data,a.data.jstree))for(h in a.data.jstree)a.data.jstree.hasOwnProperty(h)&&(l.state[h]=a.data.jstree[h]);if(a&&"object"==typeof a.state)for(h in a.state)a.state.hasOwnProperty(h)&&(l.state[h]=a.state[h]);if(a&&"object"==typeof a.li_attr)for(h in a.li_attr)a.li_attr.hasOwnProperty(h)&&(l.li_attr[h]=a.li_attr[h]);if(l.li_attr.id||(l.li_attr.id=e),a&&"object"==typeof a.a_attr)for(h in a.a_attr)a.a_attr.hasOwnProperty(h)&&(l.a_attr[h]=a.a_attr[h]);for(a&&a.children&&a.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),f[l.id]=l,h=0,i=l.children.length;i>h;h++)j=this._parse_model_from_flat_json(f[l.children[h]],l.id,d),k=f[j],l.children_d.push(j),k.children_d.length&&(l.children_d=l.children_d.concat(k.children_d));return delete a.data,delete a.children,f[l.id].original=a,l.state.selected&&this._data.core.selected.push(l.id),l.id},_parse_model_from_json:function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=!1,f,g,h,i,j=this._model.data,k=this._model.default_state,l;do e="j"+this._id+"_"+ ++this._cnt;while(j[e]);l={id:!1,text:"string"==typeof a?a:"",icon:"object"==typeof a&&a.icon!==b?a.icon:!0,parent:c,parents:d,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in k)k.hasOwnProperty(f)&&(l.state[f]=k[f]);if(a&&a.id&&(l.id=a.id.toString()),a&&a.text&&(l.text=a.text),a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(l.icon=a.data.jstree.icon),(l.icon===b||null===l.icon||""===l.icon)&&(l.icon=!0),a&&a.data&&(l.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(l.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(l.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(l.li_attr[f]=a.li_attr[f]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()), -l.id||(l.id=e),l.li_attr.id||(l.li_attr.id=l.id),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(l.a_attr[f]=a.a_attr[f]);if(a&&a.children&&a.children.length){for(f=0,g=a.children.length;g>f;f++)h=this._parse_model_from_json(a.children[f],l.id,d),i=j[h],l.children.push(h),i.children_d.length&&(l.children_d=l.children_d.concat(i.children_d));l.children_d=l.children_d.concat(l.children)}return a&&a.children&&a.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete a.data,delete a.children,l.original=a,j[l.id]=l,l.state.selected&&this._data.core.selected.push(l.id),l.id},_redraw:function(){var b=this._model.force_full_redraw?this._model.data[a.jstree.root].children.concat([]):this._model.changed.concat([]),c=i.createElement("UL"),d,e,f,g=this._data.core.focused;for(e=0,f=b.length;f>e;e++)d=this.redraw_node(b[e],!0,this._model.force_full_redraw),d&&this._model.force_full_redraw&&c.appendChild(d);this._model.force_full_redraw&&(c.className=this.get_container_ul()[0].className,c.setAttribute("role","group"),this.element.empty().append(c)),null!==g&&this.settings.core.restore_focus&&(d=this.get_node(g,!0),d&&d.length&&d.children(".jstree-anchor")[0]!==i.activeElement?d.children(".jstree-anchor").focus():this._data.core.focused=null),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:b})},redraw:function(a){a&&(this._model.force_full_redraw=!0),this._redraw()},draw_children:function(b){var c=this.get_node(b),d=!1,e=!1,f=!1,g=i;if(!c)return!1;if(c.id===a.jstree.root)return this.redraw(!0);if(b=this.get_node(b,!0),!b||!b.length)return!1;if(b.children(".jstree-children").remove(),b=b[0],c.children.length&&c.state.loaded){for(f=g.createElement("UL"),f.setAttribute("role","group"),f.className="jstree-children",d=0,e=c.children.length;e>d;d++)f.appendChild(this.redraw_node(c.children[d],!0,!0));b.appendChild(f)}},redraw_node:function(b,c,d,e){var f=this.get_node(b),g=!1,h=!1,j=!1,k=!1,l=!1,m=!1,n="",o=i,p=this._model.data,q=!1,r=!1,s=null,t=0,u=0,v=!1,w=!1;if(!f)return!1;if(f.id===a.jstree.root)return this.redraw(!0);if(c=c||0===f.children.length,b=i.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(f.id[0])?"\\3"+f.id[0]+" "+f.id.substr(1).replace(a.jstree.idregex,"\\$&"):f.id.replace(a.jstree.idregex,"\\$&"))):i.getElementById(f.id))b=a(b),d||(g=b.parent().parent()[0],g===this.element[0]&&(g=null),h=b.index()),c||!f.children.length||b.children(".jstree-children").length||(c=!0),c||(j=b.children(".jstree-children")[0]),q=b.children(".jstree-anchor")[0]===i.activeElement,b.remove();else if(c=!0,!d){if(g=f.parent!==a.jstree.root?a("#"+f.parent.replace(a.jstree.idregex,"\\$&"),this.element)[0]:null,!(null===g||g&&p[f.parent].state.opened))return!1;h=a.inArray(f.id,null===g?p[a.jstree.root].children:p[f.parent].children)}b=this._data.core.node.cloneNode(!0),n="jstree-node ";for(k in f.li_attr)if(f.li_attr.hasOwnProperty(k)){if("id"===k)continue;"class"!==k?b.setAttribute(k,f.li_attr[k]):n+=f.li_attr[k]}for(f.a_attr.id||(f.a_attr.id=f.id+"_anchor"),b.setAttribute("aria-selected",!!f.state.selected),b.setAttribute("aria-level",f.parents.length),b.setAttribute("aria-labelledby",f.a_attr.id),f.state.disabled&&b.setAttribute("aria-disabled",!0),k=0,l=f.children.length;l>k;k++)if(!p[f.children[k]].state.hidden){v=!0;break}if(null!==f.parent&&p[f.parent]&&!f.state.hidden&&(k=a.inArray(f.id,p[f.parent].children),w=f.id,-1!==k))for(k++,l=p[f.parent].children.length;l>k;k++)if(p[p[f.parent].children[k]].state.hidden||(w=p[f.parent].children[k]),w!==f.id)break;f.state.hidden&&(n+=" jstree-hidden"),f.state.loading&&(n+=" jstree-loading"),f.state.loaded&&!v?n+=" jstree-leaf":(n+=f.state.opened&&f.state.loaded?" jstree-open":" jstree-closed",b.setAttribute("aria-expanded",f.state.opened&&f.state.loaded)),w===f.id&&(n+=" jstree-last"),b.id=f.id,b.className=n,n=(f.state.selected?" jstree-clicked":"")+(f.state.disabled?" jstree-disabled":"");for(l in f.a_attr)if(f.a_attr.hasOwnProperty(l)){if("href"===l&&"#"===f.a_attr[l])continue;"class"!==l?b.childNodes[1].setAttribute(l,f.a_attr[l]):n+=" "+f.a_attr[l]}if(n.length&&(b.childNodes[1].className="jstree-anchor "+n),(f.icon&&f.icon!==!0||f.icon===!1)&&(f.icon===!1?b.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===f.icon.indexOf("/")&&-1===f.icon.indexOf(".")?b.childNodes[1].childNodes[0].className+=" "+f.icon+" jstree-themeicon-custom":(b.childNodes[1].childNodes[0].style.backgroundImage='url("'+f.icon+'")',b.childNodes[1].childNodes[0].style.backgroundPosition="center center",b.childNodes[1].childNodes[0].style.backgroundSize="auto",b.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?b.childNodes[1].appendChild(o.createTextNode(f.text)):b.childNodes[1].innerHTML+=f.text,c&&f.children.length&&(f.state.opened||e)&&f.state.loaded){for(m=o.createElement("UL"),m.setAttribute("role","group"),m.className="jstree-children",k=0,l=f.children.length;l>k;k++)m.appendChild(this.redraw_node(f.children[k],c,!0));b.appendChild(m)}if(j&&b.appendChild(j),!d){for(g||(g=this.element[0]),k=0,l=g.childNodes.length;l>k;k++)if(g.childNodes[k]&&g.childNodes[k].className&&-1!==g.childNodes[k].className.indexOf("jstree-children")){s=g.childNodes[k];break}s||(s=o.createElement("UL"),s.setAttribute("role","group"),s.className="jstree-children",g.appendChild(s)),g=s,hf;f++)this.open_node(c[f],d,e);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?(e=e===b?this.settings.core.animation:e,this.is_closed(c)?this.is_loaded(c)?(h=this.get_node(c,!0),i=this,h.length&&(e&&h.children(".jstree-children").length&&h.children(".jstree-children").stop(!0,!0),c.children.length&&!this._firstChild(h.children(".jstree-children")[0])&&this.draw_children(c),e?(this.trigger("before_open",{node:c}),h.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children(".jstree-children").stop(!0,!0).slideDown(e,function(){this.style.display="",i.element&&i.trigger("after_open",{node:c})})):(this.trigger("before_open",{node:c}),h[0].className=h[0].className.replace("jstree-closed","jstree-open"),h[0].setAttribute("aria-expanded",!0))),c.state.opened=!0,d&&d.call(this,c,!0),h.length||this.trigger("before_open",{node:c}),this.trigger("open_node",{node:c}),e&&h.length||this.trigger("after_open",{node:c}),!0):this.is_loading(c)?setTimeout(a.proxy(function(){this.open_node(c,d,e)},this),500):void this.load_node(c,function(a,b){return b?this.open_node(a,d,e):d?d.call(this,a,!1):!1}):(d&&d.call(this,c,!1),!1)):!1},_open_to:function(b){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var c,d,e=b.parents;for(c=0,d=e.length;d>c;c+=1)c!==a.jstree.root&&this.open_node(e[c],!1,0);return a("#"+b.id.replace(a.jstree.idregex,"\\$&"),this.element)},close_node:function(c,d){var e,f,g,h;if(a.isArray(c)){for(c=c.slice(),e=0,f=c.length;f>e;e++)this.close_node(c[e],d);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?this.is_closed(c)?!1:(d=d===b?this.settings.core.animation:d,g=this,h=this.get_node(c,!0),c.state.opened=!1,this.trigger("close_node",{node:c}),void(h.length?d?h.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children(".jstree-children").stop(!0,!0).slideUp(d,function(){this.style.display="",h.children(".jstree-children").remove(),g.element&&g.trigger("after_close",{node:c})}):(h[0].className=h[0].className.replace("jstree-open","jstree-closed"),h.attr("aria-expanded",!1).children(".jstree-children").remove(),this.trigger("after_close",{node:c})):this.trigger("after_close",{node:c}))):!1},toggle_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.toggle_node(b[c]);return!0}return this.is_closed(b)?this.open_node(b):this.is_open(b)?this.close_node(b):void 0},open_all:function(b,c,d){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var e=b.id===a.jstree.root?this.get_container_ul():this.get_node(b,!0),f,g,h;if(!e.length){for(f=0,g=b.children_d.length;g>f;f++)this.is_closed(this._model.data[b.children_d[f]])&&(this._model.data[b.children_d[f]].state.opened=!0);return this.trigger("open_all",{node:b})}d=d||e,h=this,e=this.is_closed(b)?e.find(".jstree-closed").addBack():e.find(".jstree-closed"),e.each(function(){h.open_node(this,function(a,b){b&&this.is_parent(a)&&this.open_all(a,c,d)},c||0)}),0===d.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(d)})},close_all:function(b,c){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var d=b.id===a.jstree.root?this.get_container_ul():this.get_node(b,!0),e=this,f,g;for(d.length&&(d=this.is_open(b)?d.find(".jstree-open").addBack():d.find(".jstree-open"),a(d.get().reverse()).each(function(){e.close_node(this,c||0)})),f=0,g=b.children_d.length;g>f;f++)this._model.data[b.children_d[f]].state.opened=!1;this.trigger("close_all",{node:b})},is_disabled:function(a){return a=this.get_node(a),a&&a.state&&a.state.disabled},enable_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.enable_node(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.state.disabled=!1,this.get_node(b,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),void this.trigger("enable_node",{node:b})):!1},disable_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.disable_node(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.state.disabled=!0,this.get_node(b,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),void this.trigger("disable_node",{node:b})):!1},is_hidden:function(a){return a=this.get_node(a),a.state.hidden===!0},hide_node:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.hide_node(b[d],!0);return c||this.redraw(),!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?void(b.state.hidden||(b.state.hidden=!0,this._node_changed(b.parent),c||this.redraw(),this.trigger("hide_node",{node:b}))):!1},show_node:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.show_node(b[d],!0);return c||this.redraw(),!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?void(b.state.hidden&&(b.state.hidden=!1,this._node_changed(b.parent),c||this.redraw(),this.trigger("show_node",{node:b}))):!1},hide_all:function(b){var c,d=this._model.data,e=[];for(c in d)d.hasOwnProperty(c)&&c!==a.jstree.root&&!d[c].state.hidden&&(d[c].state.hidden=!0,e.push(c));return this._model.force_full_redraw=!0,b||this.redraw(),this.trigger("hide_all",{nodes:e}),e},show_all:function(b){var c,d=this._model.data,e=[];for(c in d)d.hasOwnProperty(c)&&c!==a.jstree.root&&d[c].state.hidden&&(d[c].state.hidden=!1,e.push(c));return this._model.force_full_redraw=!0,b||this.redraw(),this.trigger("show_all",{nodes:e}),e},activate_node:function(a,c){if(this.is_disabled(a))return!1;if(c&&"object"==typeof c||(c={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==b?this.get_node(this._data.core.last_clicked.id):null,this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&(this._data.core.last_clicked=null),!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1])),this.settings.core.multiple&&(c.metaKey||c.ctrlKey||c.shiftKey)&&(!c.shiftKey||this._data.core.last_clicked&&this.get_parent(a)&&this.get_parent(a)===this._data.core.last_clicked.parent))if(c.shiftKey){var d=this.get_node(a).id,e=this._data.core.last_clicked.id,f=this.get_node(this._data.core.last_clicked.parent).children,g=!1,h,i;for(h=0,i=f.length;i>h;h+=1)f[h]===d&&(g=!g),f[h]===e&&(g=!g),this.is_disabled(f[h])||!g&&f[h]!==d&&f[h]!==e?this.deselect_node(f[h],!0,c):this.is_hidden(f[h])||this.select_node(f[h],!0,!1,c);this.trigger("changed",{action:"select_node",node:this.get_node(a),selected:this._data.core.selected,event:c})}else this.is_selected(a)?this.deselect_node(a,!1,c):this.select_node(a,!1,!1,c);else!this.settings.core.multiple&&(c.metaKey||c.ctrlKey||c.shiftKey)&&this.is_selected(a)?this.deselect_node(a,!1,c):(this.deselect_all(!0),this.select_node(a,!1,!1,c),this._data.core.last_clicked=this.get_node(a));this.trigger("activate_node",{node:this.get_node(a),event:c})},hover_node:function(a){if(a=this.get_node(a,!0),!a||!a.length||a.children(".jstree-hovered").length)return!1;var b=this.element.find(".jstree-hovered"),c=this.element;b&&b.length&&this.dehover_node(b),a.children(".jstree-anchor").addClass("jstree-hovered"),this.trigger("hover_node",{node:this.get_node(a)}),setTimeout(function(){c.attr("aria-activedescendant",a[0].id)},0)},dehover_node:function(a){return a=this.get_node(a,!0),a&&a.length&&a.children(".jstree-hovered").length?(a.children(".jstree-anchor").removeClass("jstree-hovered"),void this.trigger("dehover_node",{node:this.get_node(a)})):!1},select_node:function(b,c,d,e){var f,g,h,i;if(a.isArray(b)){for(b=b.slice(),g=0,h=b.length;h>g;g++)this.select_node(b[g],c,d,e);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=this.get_node(b,!0),void(b.state.selected||(b.state.selected=!0,this._data.core.selected.push(b.id),d||(f=this._open_to(b)),f&&f.length&&f.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:b,selected:this._data.core.selected,event:e}),c||this.trigger("changed",{action:"select_node",node:b,selected:this._data.core.selected,event:e})))):!1},deselect_node:function(b,c,d){var e,f,g;if(a.isArray(b)){for(b=b.slice(),e=0,f=b.length;f>e;e++)this.deselect_node(b[e],c,d);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(g=this.get_node(b,!0),void(b.state.selected&&(b.state.selected=!1,this._data.core.selected=a.vakata.array_remove_item(this._data.core.selected,b.id),g.length&&g.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:b,selected:this._data.core.selected,event:d}),c||this.trigger("changed",{action:"deselect_node",node:b,selected:this._data.core.selected,event:d})))):!1},select_all:function(b){var c=this._data.core.selected.concat([]),d,e;for(this._data.core.selected=this._model.data[a.jstree.root].children_d.concat(),d=0,e=this._data.core.selected.length;e>d;d++)this._model.data[this._data.core.selected[d]]&&(this._model.data[this._data.core.selected[d]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),b||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:c})},deselect_all:function(a){var b=this._data.core.selected.concat([]),c,d;for(c=0,d=this._data.core.selected.length;d>c;c++)this._model.data[this._data.core.selected[c]]&&(this._model.data[this._data.core.selected[c]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked").parent().attr("aria-selected",!1),this.trigger("deselect_all",{selected:this._data.core.selected,node:b}),a||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:b})},is_selected:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.state.selected:!1},get_selected:function(b){return b?a.map(this._data.core.selected,a.proxy(function(a){return this.get_node(a)},this)):this._data.core.selected.slice()},get_top_selected:function(b){var c=this.get_selected(!0),d={},e,f,g,h;for(e=0,f=c.length;f>e;e++)d[c[e].id]=c[e];for(e=0,f=c.length;f>e;e++)for(g=0,h=c[e].children_d.length;h>g;g++)d[c[e].children_d[g]]&&delete d[c[e].children_d[g]];c=[];for(e in d)d.hasOwnProperty(e)&&c.push(e);return b?a.map(c,a.proxy(function(a){return this.get_node(a)},this)):c},get_bottom_selected:function(b){var c=this.get_selected(!0),d=[],e,f;for(e=0,f=c.length;f>e;e++)c[e].children.length||d.push(c[e].id);return b?a.map(d,a.proxy(function(a){return this.get_node(a)},this)):d},get_state:function(){var b={core:{open:[],loaded:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}},c;for(c in this._model.data)this._model.data.hasOwnProperty(c)&&c!==a.jstree.root&&(this._model.data[c].state.loaded&&this.settings.core.loaded_state&&b.core.loaded.push(c),this._model.data[c].state.opened&&b.core.open.push(c),this._model.data[c].state.selected&&b.core.selected.push(c));return b},set_state:function(c,d){if(c){if(c.core&&c.core.selected&&c.core.initial_selection===b&&(c.core.initial_selection=this._data.core.selected.concat([]).sort().join(",")),c.core){var e,f,g,h,i;if(c.core.loaded)return this.settings.core.loaded_state&&a.isArray(c.core.loaded)&&c.core.loaded.length?this._load_nodes(c.core.loaded,function(a){delete c.core.loaded,this.set_state(c,d)}):(delete c.core.loaded,this.set_state(c,d)),!1;if(c.core.open)return a.isArray(c.core.open)&&c.core.open.length?this._load_nodes(c.core.open,function(a){this.open_node(a,!1,0),delete c.core.open,this.set_state(c,d)}):(delete c.core.open,this.set_state(c,d)),!1;if(c.core.scroll)return c.core.scroll&&c.core.scroll.left!==b&&this.element.scrollLeft(c.core.scroll.left),c.core.scroll&&c.core.scroll.top!==b&&this.element.scrollTop(c.core.scroll.top),delete c.core.scroll,this.set_state(c,d),!1;if(c.core.selected)return h=this,(c.core.initial_selection===b||c.core.initial_selection===this._data.core.selected.concat([]).sort().join(","))&&(this.deselect_all(),a.each(c.core.selected,function(a,b){h.select_node(b,!1,!0)})),delete c.core.initial_selection,delete c.core.selected,this.set_state(c,d),!1;for(i in c)c.hasOwnProperty(i)&&"core"!==i&&-1===a.inArray(i,this.settings.plugins)&&delete c[i];if(a.isEmptyObject(c.core))return delete c.core,this.set_state(c,d),!1}return a.isEmptyObject(c)?(c=null,d&&d.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(b,c){this._data.core.state=c===!0?{}:this.get_state(),c&&a.isFunction(c)&&(this._data.core.state=c.call(this,this._data.core.state)),this._cnt=0,this._model.data={},this._model.data[a.jstree.root]={id:a.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this._data.core.selected=[],this._data.core.last_clicked=null,this._data.core.focused=null;var d=this.get_container_ul()[0].className;b||(this.element.html(""),this.element.attr("aria-activedescendant","j"+this._id+"_loading")),this.load_node(a.jstree.root,function(b,c){c&&(this.get_container_ul()[0].className=d,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(a.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")})),this._data.core.state=null})},refresh_node:function(b){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var c=[],d=[],e=this._data.core.selected.concat([]);d.push(b.id),b.state.opened===!0&&c.push(b.id),this.get_node(b,!0).find(".jstree-open").each(function(){d.push(this.id),c.push(this.id)}),this._load_nodes(d,a.proxy(function(a){this.open_node(c,!1,0),this.select_node(e),this.trigger("refresh_node",{node:b,nodes:a})},this),!1,!0)},set_id:function(b,c){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var d,e,f=this._model.data,g=b.id;for(c=c.toString(),f[b.parent].children[a.inArray(b.id,f[b.parent].children)]=c,d=0,e=b.parents.length;e>d;d++)f[b.parents[d]].children_d[a.inArray(b.id,f[b.parents[d]].children_d)]=c;for(d=0,e=b.children.length;e>d;d++)f[b.children[d]].parent=c;for(d=0,e=b.children_d.length;e>d;d++)f[b.children_d[d]].parents[a.inArray(b.id,f[b.children_d[d]].parents)]=c;return d=a.inArray(b.id,this._data.core.selected),-1!==d&&(this._data.core.selected[d]=c),d=this.get_node(b.id,!0),d&&(d.attr("id",c),this.element.attr("aria-activedescendant")===b.id&&this.element.attr("aria-activedescendant",c)),delete f[b.id],b.id=c,b.li_attr.id=c,f[c]=b,this.trigger("set_id",{node:b,"new":b.id,old:g}),!0},get_text:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.text:!1},set_text:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.set_text(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.text=c,this.get_node(b,!0).length&&this.redraw_node(b.id),this.trigger("set_text",{obj:b,text:c}),!0):!1},get_json:function(b,c,d){if(b=this.get_node(b||a.jstree.root),!b)return!1;c&&c.flat&&!d&&(d=[]);var e={id:b.id,text:b.text,icon:this.get_icon(b),li_attr:a.extend(!0,{},b.li_attr),a_attr:a.extend(!0,{},b.a_attr),state:{},data:c&&c.no_data?!1:a.extend(!0,a.isArray(b.data)?[]:{},b.data)},f,g;if(c&&c.flat?e.parent=b.parent:e.children=[],c&&c.no_state)delete e.state;else for(f in b.state)b.state.hasOwnProperty(f)&&(e.state[f]=b.state[f]);if(c&&c.no_li_attr&&delete e.li_attr,c&&c.no_a_attr&&delete e.a_attr,c&&c.no_id&&(delete e.id,e.li_attr&&e.li_attr.id&&delete e.li_attr.id,e.a_attr&&e.a_attr.id&&delete e.a_attr.id),c&&c.flat&&b.id!==a.jstree.root&&d.push(e),!c||!c.no_children)for(f=0,g=b.children.length;g>f;f++)c&&c.flat?this.get_json(b.children[f],c,d):e.children.push(this.get_json(b.children[f],c));return c&&c.flat?d:b.id===a.jstree.root?e.children:e},create_node:function(c,d,e,f,g){if(null===c&&(c=a.jstree.root),c=this.get_node(c),!c)return!1;if(e=e===b?"last":e,!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(c))return this.load_node(c,function(){this.create_node(c,d,e,f,!0)});d||(d={text:this.get_string("New node")}),d="string"==typeof d?{text:d}:a.extend(!0,{},d),d.text===b&&(d.text=this.get_string("New node"));var h,i,j,k;switch(c.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":h=this.get_node(c.parent),e=a.inArray(c.id,h.children),c=h;break;case"after":h=this.get_node(c.parent),e=a.inArray(c.id,h.children)+1,c=h;break;case"inside":case"first":e=0;break;case"last":e=c.children.length;break;default:e||(e=0)}if(e>c.children.length&&(e=c.children.length),d.id||(d.id=!0),!this.check("create_node",d,c,e))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(d.id===!0&&delete d.id,d=this._parse_model_from_json(d,c.id,c.parents.concat()),!d)return!1;for(h=this.get_node(d),i=[],i.push(d),i=i.concat(h.children_d),this.trigger("model",{nodes:i,parent:c.id}),c.children_d=c.children_d.concat(i),j=0,k=c.parents.length;k>j;j++)this._model.data[c.parents[j]].children_d=this._model.data[c.parents[j]].children_d.concat(i);for(d=h,h=[],j=0,k=c.children.length;k>j;j++)h[j>=e?j+1:j]=c.children[j];return h[e]=d.id,c.children=h,this.redraw_node(c,!0),this.trigger("create_node",{node:this.get_node(d),parent:c.id,position:e}),f&&f.call(this,this.get_node(d)),d.id},rename_node:function(b,c){var d,e,f;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.rename_node(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=b.text,this.check("rename_node",b,this.get_parent(b),c)?(this.set_text(b,c),this.trigger("rename_node",{node:b,text:c,old:f}),!0):(this.settings.core.error.call(this,this._data.core.last_error),!1)):!1},delete_node:function(b){var c,d,e,f,g,h,i,j,k,l,m,n;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.delete_node(b[c]);return!0}if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;if(e=this.get_node(b.parent),f=a.inArray(b.id,e.children),l=!1,!this.check("delete_node",b,e,f))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==f&&(e.children=a.vakata.array_remove(e.children,f)),g=b.children_d.concat([]),g.push(b.id),h=0,i=b.parents.length;i>h;h++)this._model.data[b.parents[h]].children_d=a.vakata.array_filter(this._model.data[b.parents[h]].children_d,function(b){return-1===a.inArray(b,g)});for(j=0,k=g.length;k>j;j++)if(this._model.data[g[j]].state.selected){l=!0;break}for(l&&(this._data.core.selected=a.vakata.array_filter(this._data.core.selected,function(b){return-1===a.inArray(b,g)})),this.trigger("delete_node",{node:b,parent:e.id}),l&&this.trigger("changed",{action:"delete_node",node:b,selected:this._data.core.selected,parent:e.id}),j=0,k=g.length;k>j;j++)delete this._model.data[g[j]];return-1!==a.inArray(this._data.core.focused,g)&&(this._data.core.focused=null,m=this.element[0].scrollTop,n=this.element[0].scrollLeft,e.id===a.jstree.root?this._model.data[a.jstree.root].children[0]&&this.get_node(this._model.data[a.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(e,!0).children(".jstree-anchor").focus(),this.element[0].scrollTop=m,this.element[0].scrollLeft=n),this.redraw_node(e,!0),!0},check:function(b,c,d,e,f){c=c&&c.id?c:this.get_node(c),d=d&&d.id?d:this.get_node(d);var g=b.match(/^move_node|copy_node|create_node$/i)?d:c,h=this.settings.core.check_callback;return"move_node"!==b&&"copy_node"!==b||f&&f.is_multi||c.id!==d.id&&("move_node"!==b||a.inArray(c.id,d.children)!==e)&&-1===a.inArray(d.id,c.children_d)?(g&&g.data&&(g=g.data),g&&g.functions&&(g.functions[b]===!1||g.functions[b]===!0)?(g.functions[b]===!1&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+b,data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})}),g.functions[b]):h===!1||a.isFunction(h)&&h.call(this,b,c,d,e,f)===!1||h&&h[b]===!1?(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+b,data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})},!1):!0):(this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})},!1)},last_error:function(){return this._data.core.last_error},move_node:function(c,d,e,f,g,h,i){var j,k,l,m,n,o,p,q,r,s,t,u,v,w;if(d=this.get_node(d),e=e===b?0:e,!d)return!1;if(!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(d))return this.load_node(d,function(){this.move_node(c,d,e,f,!0,!1,i)});if(a.isArray(c)){if(1!==c.length){for(j=0,k=c.length;k>j;j++)(r=this.move_node(c[j],d,e,f,g,!1,i))&&(d=r,e="after");return this.redraw(),!0}c=c[0]}if(c=c&&c.id?c:this.get_node(c),!c||c.id===a.jstree.root)return!1;if(l=(c.parent||a.jstree.root).toString(),n=e.toString().match(/^(before|after)$/)&&d.id!==a.jstree.root?this.get_node(d.parent):d,o=i?i:this._model.data[c.id]?this:a.jstree.reference(c.id),p=!o||!o._id||this._id!==o._id,m=o&&o._id&&l&&o._model.data[l]&&o._model.data[l].children?a.inArray(c.id,o._model.data[l].children):-1,o&&o._id&&(c=o._model.data[c.id]),p)return(r=this.copy_node(c,d,e,f,g,!1,i))?(o&&o.delete_node(c),r):!1;switch(d.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":e=a.inArray(d.id,n.children);break;case"after":e=a.inArray(d.id,n.children)+1;break;case"inside":case"first":e=0;break;case"last":e=n.children.length;break;default:e||(e=0)}if(e>n.children.length&&(e=n.children.length),!this.check("move_node",c,n,e,{core:!0,origin:i,is_multi:o&&o._id&&o._id!==this._id,is_foreign:!o||!o._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(c.parent===n.id){for(q=n.children.concat(),r=a.inArray(c.id,q),-1!==r&&(q=a.vakata.array_remove(q,r),e>r&&e--),r=[],s=0,t=q.length;t>s;s++)r[s>=e?s+1:s]=q[s];r[e]=c.id,n.children=r,this._node_changed(n.id),this.redraw(n.id===a.jstree.root)}else{for(r=c.children_d.concat(),r.push(c.id),s=0,t=c.parents.length;t>s;s++){for(q=[],w=o._model.data[c.parents[s]].children_d,u=0,v=w.length;v>u;u++)-1===a.inArray(w[u],r)&&q.push(w[u]);o._model.data[c.parents[s]].children_d=q}for(o._model.data[l].children=a.vakata.array_remove_item(o._model.data[l].children,c.id),s=0,t=n.parents.length;t>s;s++)this._model.data[n.parents[s]].children_d=this._model.data[n.parents[s]].children_d.concat(r);for(q=[],s=0,t=n.children.length;t>s;s++)q[s>=e?s+1:s]=n.children[s];for(q[e]=c.id,n.children=q,n.children_d.push(c.id),n.children_d=n.children_d.concat(c.children_d),c.parent=n.id,r=n.parents.concat(),r.unshift(n.id),w=c.parents.length,c.parents=r,r=r.concat(),s=0,t=c.children_d.length;t>s;s++)this._model.data[c.children_d[s]].parents=this._model.data[c.children_d[s]].parents.slice(0,-1*w),Array.prototype.push.apply(this._model.data[c.children_d[s]].parents,r);(l===a.jstree.root||n.id===a.jstree.root)&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(l),this._node_changed(n.id)),h||this.redraw()}return f&&f.call(this,c,n,e),this.trigger("move_node",{node:c,parent:n.id,position:e,old_parent:l,old_position:m,is_multi:o&&o._id&&o._id!==this._id,is_foreign:!o||!o._id,old_instance:o,new_instance:this}),c.id},copy_node:function(c,d,e,f,g,h,i){var j,k,l,m,n,o,p,q,r,s,t;if(d=this.get_node(d),e=e===b?0:e,!d)return!1;if(!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(d))return this.load_node(d,function(){this.copy_node(c,d,e,f,!0,!1,i)});if(a.isArray(c)){if(1!==c.length){for(j=0,k=c.length;k>j;j++)(m=this.copy_node(c[j],d,e,f,g,!0,i))&&(d=m,e="after");return this.redraw(),!0}c=c[0]}if(c=c&&c.id?c:this.get_node(c),!c||c.id===a.jstree.root)return!1;switch(q=(c.parent||a.jstree.root).toString(),r=e.toString().match(/^(before|after)$/)&&d.id!==a.jstree.root?this.get_node(d.parent):d,s=i?i:this._model.data[c.id]?this:a.jstree.reference(c.id),t=!s||!s._id||this._id!==s._id,s&&s._id&&(c=s._model.data[c.id]),d.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":e=a.inArray(d.id,r.children);break;case"after":e=a.inArray(d.id,r.children)+1;break;case"inside":case"first":e=0;break;case"last":e=r.children.length;break;default:e||(e=0)}if(e>r.children.length&&(e=r.children.length),!this.check("copy_node",c,r,e,{core:!0,origin:i,is_multi:s&&s._id&&s._id!==this._id,is_foreign:!s||!s._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(p=s?s.get_json(c,{no_id:!0,no_data:!0,no_state:!0}):c,!p)return!1;if(p.id===!0&&delete p.id,p=this._parse_model_from_json(p,r.id,r.parents.concat()),!p)return!1;for(m=this.get_node(p),c&&c.state&&c.state.loaded===!1&&(m.state.loaded=!1),l=[],l.push(p),l=l.concat(m.children_d),this.trigger("model",{nodes:l,parent:r.id}),n=0,o=r.parents.length;o>n;n++)this._model.data[r.parents[n]].children_d=this._model.data[r.parents[n]].children_d.concat(l);for(l=[],n=0,o=r.children.length;o>n;n++)l[n>=e?n+1:n]=r.children[n];return l[e]=m.id,r.children=l,r.children_d.push(m.id),r.children_d=r.children_d.concat(m.children_d),r.id===a.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(r.id),h||this.redraw(r.id===a.jstree.root),f&&f.call(this,m,r,e),this.trigger("copy_node",{node:m,original:c,parent:r.id,position:e,old_parent:q,old_position:s&&s._id&&q&&s._model.data[q]&&s._model.data[q].children?a.inArray(c.id,s._model.data[q].children):-1,is_multi:s&&s._id&&s._id!==this._id,is_foreign:!s||!s._id,old_instance:s,new_instance:this}),m.id},cut:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var c=[],g,h,i;for(h=0,i=b.length;i>h;h++)g=this.get_node(b[h]),g&&g.id&&g.id!==a.jstree.root&&c.push(g); -return c.length?(d=c,f=this,e="move_node",void this.trigger("cut",{node:b})):!1},copy:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var c=[],g,h,i;for(h=0,i=b.length;i>h;h++)g=this.get_node(b[h]),g&&g.id&&g.id!==a.jstree.root&&c.push(g);return c.length?(d=c,f=this,e="copy_node",void this.trigger("copy",{node:b})):!1},get_buffer:function(){return{mode:e,node:d,inst:f}},can_paste:function(){return e!==!1&&d!==!1},paste:function(a,b){return a=this.get_node(a),a&&e&&e.match(/^(copy_node|move_node)$/)&&d?(this[e](d,a,b,!1,!1,!1,f)&&this.trigger("paste",{parent:a.id,node:d,mode:e}),d=!1,e=!1,void(f=!1)):!1},clear_buffer:function(){d=!1,e=!1,f=!1,this.trigger("clear_buffer")},edit:function(b,c,d){var e,f,g,h,j,k,l,m,n,o=!1;return(b=this.get_node(b))?this.check("edit",b,this.get_parent(b))?(n=b,c="string"==typeof c?c:b.text,this.set_text(b,""),b=this._open_to(b),n.text=c,e=this._data.core.rtl,f=this.element.width(),this._data.core.focused=n.id,g=b.children(".jstree-anchor").focus(),h=a(""),j=c,k=a("
      ",{css:{position:"absolute",top:"-200px",left:e?"0px":"-1000px",visibility:"hidden"}}).appendTo(i.body),l=a("",{value:j,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:a.proxy(function(c){c.stopImmediatePropagation(),c.preventDefault();var e=h.children(".jstree-rename-input"),f=e.val(),i=this.settings.core.force_text,m;""===f&&(f=j),k.remove(),h.replaceWith(g),h.remove(),j=i?j:a("
      ").append(a.parseHTML(j)).html(),b=this.get_node(b),this.set_text(b,j),m=!!this.rename_node(b,i?a("
      ").text(f).text():a("
      ").append(a.parseHTML(f)).html()),m||this.set_text(b,j),this._data.core.focused=n.id,setTimeout(a.proxy(function(){var a=this.get_node(n.id,!0);a.length&&(this._data.core.focused=n.id,a.children(".jstree-anchor").focus())},this),0),d&&d.call(this,n,m,o),l=null},this),keydown:function(a){var b=a.which;27===b&&(o=!0,this.value=j),(27===b||13===b||37===b||38===b||39===b||40===b||32===b)&&a.stopImmediatePropagation(),(27===b||13===b)&&(a.preventDefault(),this.blur())},click:function(a){a.stopImmediatePropagation()},mousedown:function(a){a.stopImmediatePropagation()},keyup:function(a){l.width(Math.min(k.text("pW"+this.value).width(),f))},keypress:function(a){return 13===a.which?!1:void 0}}),m={fontFamily:g.css("fontFamily")||"",fontSize:g.css("fontSize")||"",fontWeight:g.css("fontWeight")||"",fontStyle:g.css("fontStyle")||"",fontStretch:g.css("fontStretch")||"",fontVariant:g.css("fontVariant")||"",letterSpacing:g.css("letterSpacing")||"",wordSpacing:g.css("wordSpacing")||""},h.attr("class",g.attr("class")).append(g.contents().clone()).append(l),g.replaceWith(h),k.css(m),l.css(m).width(Math.min(k.text("pW"+l[0].value).width(),f))[0].select(),void a(i).one("mousedown.jstree touchstart.jstree dnd_start.vakata",function(b){l&&b.target!==l&&a(l).blur()})):(this.settings.core.error.call(this,this._data.core.last_error),!1):!1},set_theme:function(b,c){if(!b)return!1;if(c===!0){var d=this.settings.core.themes.dir;d||(d=a.jstree.path+"/themes"),c=d+"/"+b+"/style.css"}c&&-1===a.inArray(c,g)&&(a("head").append(''),g.push(c)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=b,this.element.addClass("jstree-"+b),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+b+"-responsive"),this.trigger("set_theme",{theme:b})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(a){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=a,a&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped"),this.trigger("show_stripes")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped"),this.trigger("hide_stripes")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots"),this.trigger("show_dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots"),this.trigger("hide_dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons"),this.trigger("show_icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons"),this.trigger("hide_icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},show_ellipsis:function(){this._data.core.themes.ellipsis=!0,this.get_container_ul().addClass("jstree-ellipsis"),this.trigger("show_ellipsis")},hide_ellipsis:function(){this._data.core.themes.ellipsis=!1,this.get_container_ul().removeClass("jstree-ellipsis"),this.trigger("hide_ellipsis")},toggle_ellipsis:function(){this._data.core.themes.ellipsis?this.hide_ellipsis():this.show_ellipsis()},set_icon:function(c,d){var e,f,g,h;if(a.isArray(c)){for(c=c.slice(),e=0,f=c.length;f>e;e++)this.set_icon(c[e],d);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?(h=c.icon,c.icon=d===!0||null===d||d===b||""===d?!0:d,g=this.get_node(c,!0).children(".jstree-anchor").children(".jstree-themeicon"),d===!1?(g.removeClass("jstree-themeicon-custom "+h).css("background","").removeAttr("rel"),this.hide_icon(c)):d===!0||null===d||d===b||""===d?(g.removeClass("jstree-themeicon-custom "+h).css("background","").removeAttr("rel"),h===!1&&this.show_icon(c)):-1===d.indexOf("/")&&-1===d.indexOf(".")?(g.removeClass(h).css("background",""),g.addClass(d+" jstree-themeicon-custom").attr("rel",d),h===!1&&this.show_icon(c)):(g.removeClass(h).css("background",""),g.addClass("jstree-themeicon-custom").css("background","url('"+d+"') center center no-repeat").attr("rel",d),h===!1&&this.show_icon(c)),!0):!1},get_icon:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.icon:!1},hide_icon:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.hide_icon(b[c]);return!0}return b=this.get_node(b),b&&b!==a.jstree.root?(b.icon=!1,this.get_node(b,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0):!1},show_icon:function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.show_icon(b[c]);return!0}return b=this.get_node(b),b&&b!==a.jstree.root?(e=this.get_node(b,!0),b.icon=e.length?e.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"):!0,b.icon||(b.icon=!0),e.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0):!1}},a.vakata={},a.vakata.attributes=function(b,c){b=a(b)[0];var d=c?{}:[];return b&&b.attributes&&a.each(b.attributes,function(b,e){-1===a.inArray(e.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==e.value&&""!==a.trim(e.value)&&(c?d[e.name]=e.value:d.push(e.name))}),d},a.vakata.array_unique=function(a){var c=[],d,e,f,g={};for(d=0,f=a.length;f>d;d++)g[a[d]]===b&&(c.push(a[d]),g[a[d]]=!0);return c},a.vakata.array_remove=function(a,b){return a.splice(b,1),a},a.vakata.array_remove_item=function(b,c){var d=a.inArray(c,b);return-1!==d?a.vakata.array_remove(b,d):b},a.vakata.array_filter=function(a,b,c,d,e){if(a.filter)return a.filter(b,c);d=[];for(e in a)~~e+""==e+""&&e>=0&&b.call(c,a[e],+e,a)&&d.push(a[e]);return d},a.jstree.plugins.changed=function(a,b){var c=[];this.trigger=function(a,d){var e,f;if(d||(d={}),"changed"===a.replace(".jstree","")){d.changed={selected:[],deselected:[]};var g={};for(e=0,f=c.length;f>e;e++)g[c[e]]=1;for(e=0,f=d.selected.length;f>e;e++)g[d.selected[e]]?g[d.selected[e]]=2:d.changed.selected.push(d.selected[e]);for(e=0,f=c.length;f>e;e++)1===g[c[e]]&&d.changed.deselected.push(c[e]);c=d.selected.slice()}b.trigger.call(this,a,d)},this.refresh=function(a,d){return c=[],b.refresh.apply(this,arguments)}};var j=i.createElement("I");j.className="jstree-icon jstree-checkbox",j.setAttribute("role","presentation"),a.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0,cascade:"",tie_selection:!0,cascade_to_disabled:!0,cascade_to_hidden:!0},a.jstree.plugins.checkbox=function(c,d){this.bind=function(){d.bind.call(this),this._data.checkbox.uto=!1,this._data.checkbox.selected=[],this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined"),this.element.on("init.jstree",a.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked"),this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")},this)).on("loading.jstree",a.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this)),-1!==this.settings.checkbox.cascade.indexOf("undetermined")&&this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",a.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(a.proxy(this._undetermined,this),50)},this)),this.settings.checkbox.tie_selection||this.element.on("model.jstree",a.proxy(function(a,b){var c=this._model.data,d=c[b.parent],e=b.nodes,f,g;for(f=0,g=e.length;g>f;f++)c[e[f]].state.checked=c[e[f]].state.checked||c[e[f]].original&&c[e[f]].original.state&&c[e[f]].original.state.checked,c[e[f]].state.checked&&this._data.checkbox.selected.push(e[f])},this)),(-1!==this.settings.checkbox.cascade.indexOf("up")||-1!==this.settings.checkbox.cascade.indexOf("down"))&&this.element.on("model.jstree",a.proxy(function(b,c){var d=this._model.data,e=d[c.parent],f=c.nodes,g=[],h,i,j,k,l,m,n=this.settings.checkbox.cascade,o=this.settings.checkbox.tie_selection;if(-1!==n.indexOf("down"))if(e.state[o?"selected":"checked"]){for(i=0,j=f.length;j>i;i++)d[f[i]].state[o?"selected":"checked"]=!0;this._data[o?"core":"checkbox"].selected=this._data[o?"core":"checkbox"].selected.concat(f)}else for(i=0,j=f.length;j>i;i++)if(d[f[i]].state[o?"selected":"checked"]){for(k=0,l=d[f[i]].children_d.length;l>k;k++)d[d[f[i]].children_d[k]].state[o?"selected":"checked"]=!0;this._data[o?"core":"checkbox"].selected=this._data[o?"core":"checkbox"].selected.concat(d[f[i]].children_d)}if(-1!==n.indexOf("up")){for(i=0,j=e.children_d.length;j>i;i++)d[e.children_d[i]].children.length||g.push(d[e.children_d[i]].parent);for(g=a.vakata.array_unique(g),k=0,l=g.length;l>k;k++){e=d[g[k]];while(e&&e.id!==a.jstree.root){for(h=0,i=0,j=e.children.length;j>i;i++)h+=d[e.children[i]].state[o?"selected":"checked"];if(h!==j)break;e.state[o?"selected":"checked"]=!0,this._data[o?"core":"checkbox"].selected.push(e.id),m=this.get_node(e,!0),m&&m.length&&m.attr("aria-selected",!0).children(".jstree-anchor").addClass(o?"jstree-clicked":"jstree-checked"),e=this.get_node(e.parent)}}}this._data[o?"core":"checkbox"].selected=a.vakata.array_unique(this._data[o?"core":"checkbox"].selected)},this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",a.proxy(function(b,c){var d=this,e=c.node,f=this._model.data,g=this.get_node(e.parent),h,i,j,k,l=this.settings.checkbox.cascade,m=this.settings.checkbox.tie_selection,n={},o=this._data[m?"core":"checkbox"].selected;for(h=0,i=o.length;i>h;h++)n[o[h]]=!0;if(-1!==l.indexOf("down")){var p=this._cascade_new_checked_state(e.id,!0),q=e.children_d.concat(e.id);for(h=0,i=q.length;i>h;h++)p.indexOf(q[h])>-1?n[q[h]]=!0:delete n[q[h]]}if(-1!==l.indexOf("up"))while(g&&g.id!==a.jstree.root){for(j=0,h=0,i=g.children.length;i>h;h++)j+=f[g.children[h]].state[m?"selected":"checked"];if(j!==i)break;g.state[m?"selected":"checked"]=!0,n[g.id]=!0,k=this.get_node(g,!0),k&&k.length&&k.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"),g=this.get_node(g.parent)}o=[];for(h in n)n.hasOwnProperty(h)&&o.push(h);this._data[m?"core":"checkbox"].selected=o},this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",a.proxy(function(b,c){var d=this.get_node(a.jstree.root),e=this._model.data,f,g,h;for(f=0,g=d.children_d.length;g>f;f++)h=e[d.children_d[f]],h&&h.original&&h.original.state&&h.original.state.undetermined&&(h.original.state.undetermined=!1)},this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",a.proxy(function(a,b){var c=this,d=b.node,e=this.get_node(d,!0),f,g,h,i=this.settings.checkbox.cascade,j=this.settings.checkbox.tie_selection,k=this._data[j?"core":"checkbox"].selected,l={},m=[],n=d.children_d.concat(d.id);if(-1!==i.indexOf("down")){var o=this._cascade_new_checked_state(d.id,!1);k=k.filter(function(a){return-1===n.indexOf(a)||o.indexOf(a)>-1})}if(-1!==i.indexOf("up")&&-1===k.indexOf(d.id)){for(f=0,g=d.parents.length;g>f;f++)h=this._model.data[d.parents[f]],h.state[j?"selected":"checked"]=!1,h&&h.original&&h.original.state&&h.original.state.undetermined&&(h.original.state.undetermined=!1),h=this.get_node(d.parents[f],!0),h&&h.length&&h.attr("aria-selected",!1).children(".jstree-anchor").removeClass(j?"jstree-clicked":"jstree-checked");k=k.filter(function(a){return-1===d.parents.indexOf(a)})}this._data[j?"core":"checkbox"].selected=k},this)),-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",a.proxy(function(b,c){var d=this.get_node(c.parent),e=this._model.data,f,g,h,i,j=this.settings.checkbox.tie_selection;while(d&&d.id!==a.jstree.root&&!d.state[j?"selected":"checked"]){for(h=0,f=0,g=d.children.length;g>f;f++)h+=e[d.children[f]].state[j?"selected":"checked"];if(!(g>0&&h===g))break;d.state[j?"selected":"checked"]=!0,this._data[j?"core":"checkbox"].selected.push(d.id),i=this.get_node(d,!0),i&&i.length&&i.attr("aria-selected",!0).children(".jstree-anchor").addClass(j?"jstree-clicked":"jstree-checked"),d=this.get_node(d.parent)}},this)).on("move_node.jstree",a.proxy(function(b,c){var d=c.is_multi,e=c.old_parent,f=this.get_node(c.parent),g=this._model.data,h,i,j,k,l,m=this.settings.checkbox.tie_selection;if(!d){h=this.get_node(e);while(h&&h.id!==a.jstree.root&&!h.state[m?"selected":"checked"]){for(i=0,j=0,k=h.children.length;k>j;j++)i+=g[h.children[j]].state[m?"selected":"checked"];if(!(k>0&&i===k))break;h.state[m?"selected":"checked"]=!0,this._data[m?"core":"checkbox"].selected.push(h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"),h=this.get_node(h.parent)}}h=f;while(h&&h.id!==a.jstree.root){for(i=0,j=0,k=h.children.length;k>j;j++)i+=g[h.children[j]].state[m?"selected":"checked"];if(i===k)h.state[m?"selected":"checked"]||(h.state[m?"selected":"checked"]=!0,this._data[m?"core":"checkbox"].selected.push(h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"));else{if(!h.state[m?"selected":"checked"])break;h.state[m?"selected":"checked"]=!1,this._data[m?"core":"checkbox"].selected=a.vakata.array_remove_item(this._data[m?"core":"checkbox"].selected,h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!1).children(".jstree-anchor").removeClass(m?"jstree-clicked":"jstree-checked")}h=this.get_node(h.parent)}},this))},this.get_undetermined=function(c){if(-1===this.settings.checkbox.cascade.indexOf("undetermined"))return[];var d,e,f,g,h={},i=this._model.data,j=this.settings.checkbox.tie_selection,k=this._data[j?"core":"checkbox"].selected,l=[],m=this,n=[];for(d=0,e=k.length;e>d;d++)if(i[k[d]]&&i[k[d]].parents)for(f=0,g=i[k[d]].parents.length;g>f;f++){if(h[i[k[d]].parents[f]]!==b)break;i[k[d]].parents[f]!==a.jstree.root&&(h[i[k[d]].parents[f]]=!0,l.push(i[k[d]].parents[f]))}for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function(){var c=m.get_node(this),j;if(c)if(c.state.loaded){for(d=0,e=c.children_d.length;e>d;d++)if(j=i[c.children_d[d]],!j.state.loaded&&j.original&&j.original.state&&j.original.state.undetermined&&j.original.state.undetermined===!0)for(h[j.id]===b&&j.id!==a.jstree.root&&(h[j.id]=!0,l.push(j.id)),f=0,g=j.parents.length;g>f;f++)h[j.parents[f]]===b&&j.parents[f]!==a.jstree.root&&(h[j.parents[f]]=!0,l.push(j.parents[f]))}else if(c.original&&c.original.state&&c.original.state.undetermined&&c.original.state.undetermined===!0)for(h[c.id]===b&&c.id!==a.jstree.root&&(h[c.id]=!0,l.push(c.id)),f=0,g=c.parents.length;g>f;f++)h[c.parents[f]]===b&&c.parents[f]!==a.jstree.root&&(h[c.parents[f]]=!0,l.push(c.parents[f]))}),d=0,e=l.length;e>d;d++)i[l[d]].state[j?"selected":"checked"]||n.push(c?i[l[d]]:l[d]);return n},this._undetermined=function(){if(null!==this.element){var a=this.get_undetermined(!1),b,c,d;for(this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),b=0,c=a.length;c>b;b++)d=this.get_node(a[b],!0),d&&d.length&&d.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}},this.redraw_node=function(b,c,e,f){if(b=d.redraw_node.apply(this,arguments)){var g,h,i=null,k=null;for(g=0,h=b.childNodes.length;h>g;g++)if(b.childNodes[g]&&b.childNodes[g].className&&-1!==b.childNodes[g].className.indexOf("jstree-anchor")){i=b.childNodes[g];break}i&&(!this.settings.checkbox.tie_selection&&this._model.data[b.id].state.checked&&(i.className+=" jstree-checked"),k=j.cloneNode(!1),this._model.data[b.id].state.checkbox_disabled&&(k.className+=" jstree-checkbox-disabled"),i.insertBefore(k,i.childNodes[0]))}return e||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(a.proxy(this._undetermined,this),50)),b},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.get_container_ul().removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.get_container_ul().addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()},this.is_undetermined=function(b){b=this.get_node(b);var c=this.settings.checkbox.cascade,d,e,f=this.settings.checkbox.tie_selection,g=this._data[f?"core":"checkbox"].selected,h=this._model.data;if(!b||b.state[f?"selected":"checked"]===!0||-1===c.indexOf("undetermined")||-1===c.indexOf("down")&&-1===c.indexOf("up"))return!1;if(!b.state.loaded&&b.original.state.undetermined===!0)return!0;for(d=0,e=b.children_d.length;e>d;d++)if(-1!==a.inArray(b.children_d[d],g)||!h[b.children_d[d]].state.loaded&&h[b.children_d[d]].original.state.undetermined)return!0;return!1},this.disable_checkbox=function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.disable_checkbox(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(e=this.get_node(b,!0),void(b.state.checkbox_disabled||(b.state.checkbox_disabled=!0,e&&e.length&&e.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:b})))):!1},this.enable_checkbox=function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.enable_checkbox(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(e=this.get_node(b,!0),void(b.state.checkbox_disabled&&(b.state.checkbox_disabled=!1,e&&e.length&&e.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:b})))):!1},this.activate_node=function(b,c){return a(c.target).hasClass("jstree-checkbox-disabled")?!1:(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||a(c.target).hasClass("jstree-checkbox"))&&(c.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!a(c.target).hasClass("jstree-checkbox")?d.activate_node.call(this,b,c):this.is_disabled(b)?!1:(this.is_checked(b)?this.uncheck_node(b,c):this.check_node(b,c),void this.trigger("activate_node",{node:this.get_node(b)})))},this._cascade_new_checked_state=function(a,b){var c=this,d=this.settings.checkbox.tie_selection,e=this._model.data[a],f=[],g=[],h,i,j;if(!this.settings.checkbox.cascade_to_disabled&&e.state.disabled||!this.settings.checkbox.cascade_to_hidden&&e.state.hidden)j=this.get_checked_descendants(a),e.state[d?"selected":"checked"]&&j.push(e.id),f=f.concat(j);else{if(e.children)for(h=0,i=e.children.length;i>h;h++){var k=e.children[h];j=c._cascade_new_checked_state(k,b),f=f.concat(j),j.indexOf(k)>-1&&g.push(k)}var l=c.get_node(e,!0),m=g.length>0&&g.lengthe;e++)this.check_node(b[e],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(d=this.get_node(b,!0),void(b.state.checked||(b.state.checked=!0,this._data.checkbox.selected.push(b.id),d&&d.length&&d.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:b,selected:this._data.checkbox.selected,event:c})))):!1},this.uncheck_node=function(b,c){if(this.settings.checkbox.tie_selection)return this.deselect_node(b,!1,c);var d,e,f;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.uncheck_node(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=this.get_node(b,!0),void(b.state.checked&&(b.state.checked=!1,this._data.checkbox.selected=a.vakata.array_remove_item(this._data.checkbox.selected,b.id),f.length&&f.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:b,selected:this._data.checkbox.selected,event:c})))):!1},this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();var b=this._data.checkbox.selected.concat([]),c,d;for(this._data.checkbox.selected=this._model.data[a.jstree.root].children_d.concat(),c=0,d=this._data.checkbox.selected.length;d>c;c++)this._model.data[this._data.checkbox.selected[c]]&&(this._model.data[this._data.checkbox.selected[c]].state.checked=!0);this.redraw(!0),this.trigger("check_all",{selected:this._data.checkbox.selected})},this.uncheck_all=function(){if(this.settings.checkbox.tie_selection)return this.deselect_all();var a=this._data.checkbox.selected.concat([]),b,c;for(b=0,c=this._data.checkbox.selected.length;c>b;b++)this._model.data[this._data.checkbox.selected[b]]&&(this._model.data[this._data.checkbox.selected[b]].state.checked=!1);this._data.checkbox.selected=[],this.element.find(".jstree-checked").removeClass("jstree-checked"),this.trigger("uncheck_all",{selected:this._data.checkbox.selected,node:a})},this.is_checked=function(b){return this.settings.checkbox.tie_selection?this.is_selected(b):(b=this.get_node(b),b&&b.id!==a.jstree.root?b.state.checked:!1)},this.get_checked=function(b){return this.settings.checkbox.tie_selection?this.get_selected(b):b?a.map(this._data.checkbox.selected,a.proxy(function(a){return this.get_node(a)},this)):this._data.checkbox.selected},this.get_top_checked=function(b){if(this.settings.checkbox.tie_selection)return this.get_top_selected(b);var c=this.get_checked(!0),d={},e,f,g,h;for(e=0,f=c.length;f>e;e++)d[c[e].id]=c[e];for(e=0,f=c.length;f>e;e++)for(g=0,h=c[e].children_d.length;h>g;g++)d[c[e].children_d[g]]&&delete d[c[e].children_d[g]];c=[];for(e in d)d.hasOwnProperty(e)&&c.push(e);return b?a.map(c,a.proxy(function(a){return this.get_node(a)},this)):c},this.get_bottom_checked=function(b){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(b);var c=this.get_checked(!0),d=[],e,f;for(e=0,f=c.length;f>e;e++)c[e].children.length||d.push(c[e].id);return b?a.map(d,a.proxy(function(a){return this.get_node(a)},this)):d},this.load_node=function(b,c){var e,f,g,h,i,j;if(!a.isArray(b)&&!this.settings.checkbox.tie_selection&&(j=this.get_node(b),j&&j.state.loaded))for(e=0,f=j.children_d.length;f>e;e++)this._model.data[j.children_d[e]].state.checked&&(i=!0,this._data.checkbox.selected=a.vakata.array_remove_item(this._data.checkbox.selected,j.children_d[e]));return d.load_node.apply(this,arguments)},this.get_state=function(){var a=d.get_state.apply(this,arguments);return this.settings.checkbox.tie_selection?a:(a.checkbox=this._data.checkbox.selected.slice(),a)},this.set_state=function(b,c){var e=d.set_state.apply(this,arguments);if(e&&b.checkbox){if(!this.settings.checkbox.tie_selection){this.uncheck_all();var f=this;a.each(b.checkbox,function(a,b){f.check_node(b)})}return delete b.checkbox,this.set_state(b,c),!1}return e},this.refresh=function(a,b){return this.settings.checkbox.tie_selection&&(this._data.checkbox.selected=[]),d.refresh.apply(this,arguments)}},a.jstree.defaults.conditionalselect=function(){return!0},a.jstree.plugins.conditionalselect=function(a,b){this.activate_node=function(a,c){return this.settings.conditionalselect.call(this,this.get_node(a),c)?b.activate_node.call(this,a,c):void 0}},a.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(b,c){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.create_node(d,{},"last",function(a){try{c.edit(a)}catch(b){setTimeout(function(){c.edit(a)},0)}})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.edit(d)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.delete_node(c.get_selected()):c.delete_node(d)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.cut(c.get_top_selected()):c.cut(d)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.copy(c.get_top_selected()):c.copy(d)}},paste:{separator_before:!1,icon:!1,_disabled:function(b){return!a.jstree.reference(b.reference).can_paste()},separator_after:!1,label:"Paste",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.paste(d)}}}}}}},a.jstree.plugins.contextmenu=function(c,d){this.bind=function(){d.bind.call(this);var b=0,c=null,e,f;this.element.on("init.jstree loading.jstree ready.jstree",a.proxy(function(){this.get_container_ul().addClass("jstree-contextmenu")},this)).on("contextmenu.jstree",".jstree-anchor",a.proxy(function(a,d){"input"!==a.target.tagName.toLowerCase()&&(a.preventDefault(),b=a.ctrlKey?+new Date:0,(d||c)&&(b=+new Date+1e4),c&&clearTimeout(c),this.is_loading(a.currentTarget)||this.show_contextmenu(a.currentTarget,a.pageX,a.pageY,a))},this)).on("click.jstree",".jstree-anchor",a.proxy(function(c){this._data.contextmenu.visible&&(!b||+new Date-b>250)&&a.vakata.context.hide(),b=0},this)).on("touchstart.jstree",".jstree-anchor",function(b){b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(e=b.originalEvent.changedTouches[0].clientX,f=b.originalEvent.changedTouches[0].clientY,c=setTimeout(function(){a(b.currentTarget).trigger("contextmenu",!0)},750))}).on("touchmove.vakata.jstree",function(b){c&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(Math.abs(e-b.originalEvent.changedTouches[0].clientX)>10||Math.abs(f-b.originalEvent.changedTouches[0].clientY)>10)&&(clearTimeout(c),a.vakata.context.hide())}).on("touchend.vakata.jstree",function(a){c&&clearTimeout(c)}),a(i).on("context_hide.vakata.jstree",a.proxy(function(b,c){this._data.contextmenu.visible=!1,a(c.reference).removeClass("jstree-context")},this))},this.teardown=function(){this._data.contextmenu.visible&&a.vakata.context.hide(),d.teardown.call(this)},this.show_contextmenu=function(c,d,e,f){if(c=this.get_node(c),!c||c.id===a.jstree.root)return!1;var g=this.settings.contextmenu,h=this.get_node(c,!0),i=h.children(".jstree-anchor"),j=!1,k=!1;(g.show_at_node||d===b||e===b)&&(j=i.offset(),d=j.left,e=j.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(c)&&this.activate_node(c,f),k=g.items,a.isFunction(k)&&(k=k.call(this,c,a.proxy(function(a){this._show_contextmenu(c,d,e,a)},this))),a.isPlainObject(k)&&this._show_contextmenu(c,d,e,k)},this._show_contextmenu=function(b,c,d,e){var f=this.get_node(b,!0),g=f.children(".jstree-anchor");a(i).one("context_show.vakata.jstree",a.proxy(function(b,c){var d="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";a(c.element).addClass(d),g.addClass("jstree-context")},this)),this._data.contextmenu.visible=!0,a.vakata.context.show(g,{x:c,y:d},e),this.trigger("show_contextmenu",{node:b,x:c,y:d})}},function(a){var b=!1,c={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};a.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(b){a(i).triggerHandler("context_"+b+".vakata",{reference:c.reference,element:c.element,position:{x:c.position_x,y:c.position_y}})},_execute:function(b){return b=c.items[b],b&&(!b._disabled||a.isFunction(b._disabled)&&!b._disabled({item:b,reference:c.reference,element:c.element}))&&b.action?b.action.call(null,{item:b,reference:c.reference,element:c.element,position:{x:c.position_x,y:c.position_y}}):!1},_parse:function(b,d){if(!b)return!1;d||(c.html="",c.items=[]);var e="",f=!1,g;return d&&(e+=""),d||(c.html=e,a.vakata.context._trigger("parse")),e.length>10?e:!1},_show_submenu:function(c){if(c=a(c),c.length&&c.children("ul").length){var d=c.children("ul"),e=c.offset().left,f=e+c.outerWidth(),g=c.offset().top,h=d.width(),i=d.height(),j=a(window).width()+a(window).scrollLeft(),k=a(window).height()+a(window).scrollTop();b?c[f-(h+10+c.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):c[f+h>j&&e>j-f?"addClass":"removeClass"]("vakata-context-right"),g+i+10>k&&d.css("bottom","-1px"),c.hasClass("vakata-context-right")?h>e&&d.css("margin-right",e-h):h>j-f&&d.css("margin-left",j-f-h),d.show()}},show:function(d,e,f){var g,h,j,k,l,m,n,o,p=!0;switch(c.element&&c.element.length&&c.element.width(""),p){case!e&&!d:return!1;case!!e&&!!d:c.reference=d,c.position_x=e.x,c.position_y=e.y;break;case!e&&!!d:c.reference=d,g=d.offset(),c.position_x=g.left+d.outerHeight(),c.position_y=g.top;break;case!!e&&!d:c.position_x=e.x,c.position_y=e.y}d&&!f&&a(d).data("vakata_contextmenu")&&(f=a(d).data("vakata_contextmenu")),a.vakata.context._parse(f)&&c.element.html(c.html),c.items.length&&(c.element.appendTo(i.body),h=c.element,j=c.position_x,k=c.position_y,l=h.width(),m=h.height(),n=a(window).width()+a(window).scrollLeft(),o=a(window).height()+a(window).scrollTop(),b&&(j-=h.outerWidth()-a(d).outerWidth(),jn&&(j=n-(l+20)),k+m+20>o&&(k=o-(m+20)),c.element.css({left:j,top:k}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),c.is_visible=!0,a.vakata.context._trigger("show"))},hide:function(){c.is_visible&&(c.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),c.is_visible=!1,a.vakata.context._trigger("hide"))}},a(function(){b="rtl"===a(i.body).css("direction");var d=!1;c.element=a("
        "),c.element.on("mouseenter","li",function(b){b.stopImmediatePropagation(),a.contains(this,b.relatedTarget)||(d&&clearTimeout(d),c.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),a(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),a.vakata.context._show_submenu(this))}).on("mouseleave","li",function(b){a.contains(this,b.relatedTarget)||a(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(b){a(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),a.vakata.context.settings.hide_onmouseleave&&(d=setTimeout(function(b){return function(){a.vakata.context.hide()}}(this),a.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(b){b.preventDefault(),a(this).blur().parent().hasClass("vakata-context-disabled")||a.vakata.context._execute(a(this).attr("rel"))===!1||a.vakata.context.hide()}).on("keydown","a",function(b){var d=null;switch(b.which){case 13:case 32:b.type="click",b.preventDefault(),a(b.currentTarget).trigger(b);break;case 37:c.is_visible&&(c.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 38:c.is_visible&&(d=c.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(),d.length||(d=c.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),d.addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 39:c.is_visible&&(c.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 40:c.is_visible&&(d=c.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),d.length||(d=c.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),d.addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 27:a.vakata.context.hide(),b.preventDefault()}}).on("keydown",function(a){a.preventDefault();var b=c.element.find(".vakata-contextmenu-shortcut-"+a.which).parent();b.parent().not(".vakata-context-disabled")&&b.click()}),a(i).on("mousedown.vakata.jstree",function(b){c.is_visible&&c.element[0]!==b.target&&!a.contains(c.element[0],b.target)&&a.vakata.context.hide()}).on("context_show.vakata.jstree",function(a,d){c.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),b&&c.element.addClass("vakata-context-rtl").css("direction","rtl"),c.element.find("ul").hide().end()})})}(a),a.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0,always_copy:!1,inside_pos:0,drag_selection:!0,touch:!0,large_drop_target:!1,large_drag_target:!1,use_html5:!1};var k,l;a.jstree.plugins.dnd=function(b,c){this.init=function(a,b){c.init.call(this,a,b),this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in i.createElement("span")},this.bind=function(){c.bind.call(this),this.element.on(this.settings.dnd.use_html5?"dragstart.jstree":"mousedown.jstree touchstart.jstree",this.settings.dnd.large_drag_target?".jstree-node":".jstree-anchor",a.proxy(function(b){if(this.settings.dnd.large_drag_target&&a(b.target).closest(".jstree-node")[0]!==b.currentTarget)return!0;if("touchstart"===b.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var c=this.get_node(b.target),d=this.is_selected(c)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,e=d>1?d+" "+this.get_string("nodes"):this.get_text(b.currentTarget);if(this.settings.core.force_text&&(e=a.vakata.html.escape(e)),c&&c.id&&c.id!==a.jstree.root&&(1===b.which||"touchstart"===b.type||"dragstart"===b.type)&&(this.settings.dnd.is_draggable===!0||a.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,d>1?this.get_top_selected(!0):[c],b))){if(k={jstree:!0,origin:this,obj:this.get_node(c,!0),nodes:d>1?this.get_top_selected():[c.id]},l=b.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),a.vakata.dnd.start(b,k,'
        '+e+'
        ');a.vakata.dnd._trigger("start",b,{helper:a(),element:l,data:k})}},this)),this.settings.dnd.use_html5&&this.element.on("dragover.jstree",function(b){return b.preventDefault(),a.vakata.dnd._trigger("move",b,{helper:a(),element:l,data:k}),!1}).on("drop.jstree",a.proxy(function(b){return b.preventDefault(),a.vakata.dnd._trigger("stop",b,{helper:a(),element:l,data:k}),!1},this))},this.redraw_node=function(a,b,d,e){if(a=c.redraw_node.apply(this,arguments),a&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)a.setAttribute("draggable",!0);else{var f,g,h=null;for(f=0,g=a.childNodes.length;g>f;f++)if(a.childNodes[f]&&a.childNodes[f].className&&-1!==a.childNodes[f].className.indexOf("jstree-anchor")){h=a.childNodes[f];break}h&&h.setAttribute("draggable",!0)}return a}},a(function(){var c=!1,d=!1,e=!1,f=!1,g=a('
         
        ').hide();a(i).on("dragover.vakata.jstree",function(b){l&&a.vakata.dnd._trigger("move",b,{helper:a(),element:l,data:k})}).on("drop.vakata.jstree",function(b){l&&(a.vakata.dnd._trigger("stop",b,{helper:a(),element:l,data:k}),l=null,k=null)}).on("dnd_start.vakata.jstree",function(a,b){c=!1,e=!1,b&&b.data&&b.data.jstree&&g.appendTo(i.body)}).on("dnd_move.vakata.jstree",function(h,i){var j=i.event.target!==e.target;if(f&&(!i.event||"dragover"!==i.event.type||j)&&clearTimeout(f),i&&i.data&&i.data.jstree&&(!i.event.target.id||"jstree-marker"!==i.event.target.id)){e=i.event;var k=a.jstree.reference(i.event.target),l=!1,m=!1,n=!1,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E;if(k&&k._data&&k._data.dnd)if(g.attr("class","jstree-"+k.get_theme()+(k.settings.core.themes.responsive?" jstree-dnd-responsive":"")),D=i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey)),i.helper.children().attr("class","jstree-"+k.get_theme()+" jstree-"+k.get_theme()+"-"+k.get_theme_variant()+" "+(k.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[D?"show":"hide"](),i.event.target!==k.element[0]&&i.event.target!==k.get_container_ul()[0]||0!==k.get_container_ul().children().length){if(l=k.settings.dnd.large_drop_target?a(i.event.target).closest(".jstree-node").children(".jstree-anchor"):a(i.event.target).closest(".jstree-anchor"),l&&l.length&&l.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(m=l.offset(),n=(i.event.pageY!==b?i.event.pageY:i.event.originalEvent.pageY)-m.top,r=l.outerHeight(),u=r/3>n?["b","i","a"]:n>r-r/3?["a","i","b"]:n>r/2?["i","a","b"]:["i","b","a"],a.each(u,function(b,e){switch(e){case"b":p=m.left-6,q=m.top,s=k.get_parent(l),t=l.parent().index();break;case"i":B=k.settings.dnd.inside_pos,C=k.get_node(l.parent()),p=m.left-2,q=m.top+r/2+1,s=C.id,t="first"===B?0:"last"===B?C.children.length:Math.min(B,C.children.length);break;case"a":p=m.left-6,q=m.top+r,s=k.get_parent(l),t=l.parent().index()+1}for(v=!0,w=0,x=i.data.nodes.length;x>w;w++)if(y=i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey))?"copy_node":"move_node",z=t,"move_node"===y&&"a"===e&&i.data.origin&&i.data.origin===k&&s===k.get_parent(i.data.nodes[w])&&(A=k.get_node(s),z>a.inArray(i.data.nodes[w],A.children)&&(z-=1)),v=v&&(k&&k.settings&&k.settings.dnd&&k.settings.dnd.check_while_dragging===!1||k.check(y,i.data.origin&&i.data.origin!==k?i.data.origin.get_node(i.data.nodes[w]):i.data.nodes[w],s,z,{dnd:!0,ref:k.get_node(l.parent()),pos:e,origin:i.data.origin,is_multi:i.data.origin&&i.data.origin!==k,is_foreign:!i.data.origin})),!v){k&&k.last_error&&(d=k.last_error());break}return"i"===e&&l.parent().is(".jstree-closed")&&k.settings.dnd.open_timeout&&(!i.event||"dragover"!==i.event.type||j)&&(f&&clearTimeout(f),f=setTimeout(function(a,b){return function(){a.open_node(b)}}(k,l),k.settings.dnd.open_timeout)),v?(E=k.get_node(s,!0),E.hasClass(".jstree-dnd-parent")||(a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),E.addClass("jstree-dnd-parent")),c={ins:k,par:s,pos:"i"!==e||"last"!==B||0!==t||k.is_loaded(C)?t:"last"},g.css({left:p+"px",top:q+"px"}).show(),i.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),i.event.originalEvent&&i.event.originalEvent.dataTransfer&&(i.event.originalEvent.dataTransfer.dropEffect=D?"copy":"move"),d={},u=!0,!1):void 0}),u===!0))return}else{for(v=!0,w=0,x=i.data.nodes.length;x>w;w++)if(v=v&&k.check(i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey))?"copy_node":"move_node",i.data.origin&&i.data.origin!==k?i.data.origin.get_node(i.data.nodes[w]):i.data.nodes[w],a.jstree.root,"last",{dnd:!0,ref:k.get_node(a.jstree.root),pos:"i",origin:i.data.origin,is_multi:i.data.origin&&i.data.origin!==k,is_foreign:!i.data.origin}),!v)break;if(v)return c={ins:k,par:a.jstree.root,pos:"last"},g.hide(),i.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(i.event.originalEvent&&i.event.originalEvent.dataTransfer&&(i.event.originalEvent.dataTransfer.dropEffect=D?"copy":"move"))}a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),c=!1,i.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),i.event.originalEvent&&i.event.originalEvent.dataTransfer,g.hide()}}).on("dnd_scroll.vakata.jstree",function(a,b){b&&b.data&&b.data.jstree&&(g.hide(),c=!1,e=!1,b.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))}).on("dnd_stop.vakata.jstree",function(b,h){if(a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),f&&clearTimeout(f),h&&h.data&&h.data.jstree){g.hide().detach();var i,j,k=[];if(c){for(i=0,j=h.data.nodes.length;j>i;i++)k[i]=h.data.origin?h.data.origin.get_node(h.data.nodes[i]):h.data.nodes[i];c.ins[h.data.origin&&(h.data.origin.settings.dnd.always_copy||h.data.origin.settings.dnd.copy&&(h.event.metaKey||h.event.ctrlKey))?"copy_node":"move_node"](k,c.par,c.pos,!1,!1,!1,h.data.origin)}else i=a(h.event.target).closest(".jstree"),i.length&&d&&d.error&&"check"===d.error&&(i=i.jstree(!0),i&&i.settings.core.error.call(this,d));e=!1,c=!1}}).on("keyup.jstree keydown.jstree",function(b,h){h=a.vakata.dnd._get(),h&&h.data&&h.data.jstree&&("keyup"===b.type&&27===b.which?(f&&clearTimeout(f),c=!1,d=!1,e=!1,f=!1,g.hide().detach(),a.vakata.dnd._clean()):(h.helper.find(".jstree-copy").first()[h.data.origin&&(h.data.origin.settings.dnd.always_copy||h.data.origin.settings.dnd.copy&&(b.metaKey||b.ctrlKey))?"show":"hide"](),e&&(e.metaKey=b.metaKey,e.ctrlKey=b.ctrlKey,a.vakata.dnd._trigger("move",e))))})}),function(a){a.vakata.html={div:a("
        "),escape:function(b){return a.vakata.html.div.text(b).html()},strip:function(b){return a.vakata.html.div.empty().append(a.parseHTML(b)).text()}};var c={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1};a.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:10},_trigger:function(c,d,e){e===b&&(e=a.vakata.dnd._get()),e.event=d,a(i).triggerHandler("dnd_"+c+".vakata",e)},_get:function(){return{data:c.data,element:c.element,helper:c.helper}},_clean:function(){c.helper&&c.helper.remove(),c.scroll_i&&(clearInterval(c.scroll_i),c.scroll_i=!1),c={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1},a(i).off("mousemove.vakata.jstree touchmove.vakata.jstree",a.vakata.dnd.drag),a(i).off("mouseup.vakata.jstree touchend.vakata.jstree",a.vakata.dnd.stop)},_scroll:function(b){if(!c.scroll_e||!c.scroll_l&&!c.scroll_t)return c.scroll_i&&(clearInterval(c.scroll_i),c.scroll_i=!1),!1;if(!c.scroll_i)return c.scroll_i=setInterval(a.vakata.dnd._scroll,100),!1;if(b===!0)return!1;var d=c.scroll_e.scrollTop(),e=c.scroll_e.scrollLeft();c.scroll_e.scrollTop(d+c.scroll_t*a.vakata.dnd.settings.scroll_speed),c.scroll_e.scrollLeft(e+c.scroll_l*a.vakata.dnd.settings.scroll_speed),(d!==c.scroll_e.scrollTop()||e!==c.scroll_e.scrollLeft())&&a.vakata.dnd._trigger("scroll",c.scroll_e)},start:function(b,d,e){"touchstart"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_drag&&a.vakata.dnd.stop({});try{b.currentTarget.unselectable="on",b.currentTarget.onselectstart=function(){return!1},b.currentTarget.style&&(b.currentTarget.style.touchAction="none",b.currentTarget.style.msTouchAction="none",b.currentTarget.style.MozUserSelect="none")}catch(f){}return c.init_x=b.pageX,c.init_y=b.pageY,c.data=d,c.is_down=!0,c.element=b.currentTarget,c.target=b.target,c.is_touch="touchstart"===b.type,e!==!1&&(c.helper=a("
        ").html(e).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),a(i).on("mousemove.vakata.jstree touchmove.vakata.jstree",a.vakata.dnd.drag),a(i).on("mouseup.vakata.jstree touchend.vakata.jstree",a.vakata.dnd.stop),!1},drag:function(b){if("touchmove"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_down){if(!c.is_drag){if(!(Math.abs(b.pageX-c.init_x)>(c.is_touch?a.vakata.dnd.settings.threshold_touch:a.vakata.dnd.settings.threshold)||Math.abs(b.pageY-c.init_y)>(c.is_touch?a.vakata.dnd.settings.threshold_touch:a.vakata.dnd.settings.threshold)))return;c.helper&&(c.helper.appendTo(i.body),c.helper_w=c.helper.outerWidth()),c.is_drag=!0,a(c.target).one("click.vakata",!1),a.vakata.dnd._trigger("start",b)}var d=!1,e=!1,f=!1,g=!1,h=!1,j=!1,k=!1,l=!1,m=!1,n=!1;return c.scroll_t=0,c.scroll_l=0,c.scroll_e=!1,a(a(b.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(a(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var d=a(this),e=d.offset();return this.scrollHeight>this.offsetHeight&&(e.top+d.height()-b.pageYthis.offsetWidth&&(e.left+d.width()-b.pageXg&&b.pageY-kg&&g-(b.pageY-k)j&&b.pageX-lj&&j-(b.pageX-l)f&&(m=f-50),h&&n+c.helper_w>h&&(n=h-(c.helper_w+2)),c.helper.css({left:n+"px",top:m+"px"})),a.vakata.dnd._trigger("move",b),!1}},stop:function(b){if("touchend"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_drag)b.target!==c.target&&a(c.target).off("click.vakata"),a.vakata.dnd._trigger("stop",b);else if("touchend"===b.type&&b.target===c.target){var d=setTimeout(function(){a(b.target).click()},100);a(b.target).one("click",function(){d&&clearTimeout(d)})}return a.vakata.dnd._clean(),!1}}}(a),a.jstree.defaults.massload=null,a.jstree.plugins.massload=function(b,c){this.init=function(a,b){this._data.massload={},c.init.call(this,a,b)},this._load_nodes=function(b,d,e,f){var g=this.settings.massload,h=JSON.stringify(b),i=[],j=this._model.data,k,l,m;if(!e){for(k=0,l=b.length;l>k;k++)(!j[b[k]]||!j[b[k]].state.loaded&&!j[b[k]].state.failed||f)&&(i.push(b[k]),m=this.get_node(b[k],!0),m&&m.length&&m.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},i.length){if(a.isFunction(g))return g.call(this,i,a.proxy(function(a){var g,h;if(a)for(g in a)a.hasOwnProperty(g)&&(this._data.massload[g]=a[g]);for(g=0,h=b.length;h>g;g++)m=this.get_node(b[g],!0),m&&m.length&&m.removeClass("jstree-loading").attr("aria-busy",!1);c._load_nodes.call(this,b,d,e,f)},this));if("object"==typeof g&&g&&g.url)return g=a.extend(!0,{},g),a.isFunction(g.url)&&(g.url=g.url.call(this,i)),a.isFunction(g.data)&&(g.data=g.data.call(this,i)),a.ajax(g).done(a.proxy(function(a,g,h){var i,j;if(a)for(i in a)a.hasOwnProperty(i)&&(this._data.massload[i]=a[i]);for(i=0,j=b.length;j>i;i++)m=this.get_node(b[i],!0),m&&m.length&&m.removeClass("jstree-loading").attr("aria-busy",!1);c._load_nodes.call(this,b,d,e,f)},this)).fail(a.proxy(function(a){c._load_nodes.call(this,b,d,e,f)},this))}}return c._load_nodes.call(this,b,d,e,f)},this._load_node=function(b,d){var e=this._data.massload[b.id],f=null,g;return e?(f=this["string"==typeof e?"_append_html_data":"_append_json_data"](b,"string"==typeof e?a(a.parseHTML(e)).filter(function(){return 3!==this.nodeType}):e,function(a){d.call(this,a)}),g=this.get_node(b.id,!0),g&&g.length&&g.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[b.id],f):c._load_node.call(this,b,d)}},a.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,show_only_matches_children:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},a.jstree.plugins.search=function(c,d){this.bind=function(){d.bind.call(this),this._data.search.str="",this._data.search.dom=a(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=!1,this._data.search.smc=!1,this._data.search.hdn=[],this.element.on("search.jstree",a.proxy(function(b,c){if(this._data.search.som&&c.res.length){var d=this._model.data,e,f,g=[],h,i;for(e=0,f=c.res.length;f>e;e++)if(d[c.res[e]]&&!d[c.res[e]].state.hidden&&(g.push(c.res[e]),g=g.concat(d[c.res[e]].parents),this._data.search.smc))for(h=0,i=d[c.res[e]].children_d.length;i>h;h++)d[d[c.res[e]].children_d[h]]&&!d[d[c.res[e]].children_d[h]].state.hidden&&g.push(d[c.res[e]].children_d[h]);g=a.vakata.array_remove_item(a.vakata.array_unique(g),a.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(g,!0),this.redraw(!0)}},this)).on("clear_search.jstree",a.proxy(function(a,b){this._data.search.som&&b.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))},this))},this.search=function(c,d,e,f,g,h){if(c===!1||""===a.trim(c.toString()))return this.clear_search();f=this.get_node(f),f=f&&f.id?f.id:null,c=c.toString();var i=this.settings.search,j=i.ajax?i.ajax:!1,k=this._model.data,l=null,m=[],n=[],o,p;if(this._data.search.res.length&&!g&&this.clear_search(),e===b&&(e=i.show_only_matches),h===b&&(h=i.show_only_matches_children),!d&&j!==!1)return a.isFunction(j)?j.call(this,c,a.proxy(function(b){b&&b.d&&(b=b.d),this._load_nodes(a.isArray(b)?a.vakata.array_unique(b):[],function(){this.search(c,!0,e,f,g,h)})},this),f):(j=a.extend({},j),j.data||(j.data={}),j.data.str=c,f&&(j.data.inside=f),this._data.search.lastRequest&&this._data.search.lastRequest.abort(),this._data.search.lastRequest=a.ajax(j).fail(a.proxy(function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(j)},this.settings.core.error.call(this,this._data.core.last_error)},this)).done(a.proxy(function(b){b&&b.d&&(b=b.d),this._load_nodes(a.isArray(b)?a.vakata.array_unique(b):[],function(){this.search(c,!0,e,f,g,h)})},this)),this._data.search.lastRequest);if(g||(this._data.search.str=c,this._data.search.dom=a(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=e,this._data.search.smc=h),l=new a.vakata.search(c,!0,{caseSensitive:i.case_sensitive,fuzzy:i.fuzzy}),a.each(k[f?f:a.jstree.root].children_d,function(a,b){var d=k[b];d.text&&!d.state.hidden&&(!i.search_leaves_only||d.state.loaded&&0===d.children.length)&&(i.search_callback&&i.search_callback.call(this,c,d)||!i.search_callback&&l.search(d.text).isMatch)&&(m.push(b),n=n.concat(d.parents))}),m.length){for(n=a.vakata.array_unique(n),o=0,p=n.length;p>o;o++)n[o]!==a.jstree.root&&k[n[o]]&&this.open_node(n[o],null,0)===!0&&this._data.search.opn.push(n[o]);g?(this._data.search.dom=this._data.search.dom.add(a(this.element[0].querySelectorAll("#"+a.map(m,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #")))),this._data.search.res=a.vakata.array_unique(this._data.search.res.concat(m))):(this._data.search.dom=a(this.element[0].querySelectorAll("#"+a.map(m,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.res=m),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:c,res:this._data.search.res,show_only_matches:e})},this.clear_search=function(){this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.res.length&&(this._data.search.dom=a(this.element[0].querySelectorAll("#"+a.map(this._data.search.res,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search")),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=a()},this.redraw_node=function(b,c,e,f){if(b=d.redraw_node.apply(this,arguments),b&&-1!==a.inArray(b.id,this._data.search.res)){var g,h,i=null;for(g=0,h=b.childNodes.length;h>g;g++)if(b.childNodes[g]&&b.childNodes[g].className&&-1!==b.childNodes[g].className.indexOf("jstree-anchor")){i=b.childNodes[g];break}i&&(i.className+=" jstree-search")}return b}},function(a){a.vakata.search=function(b,c,d){d=d||{},d=a.extend({},a.vakata.search.defaults,d),d.fuzzy!==!1&&(d.fuzzy=!0),b=d.caseSensitive?b:b.toLowerCase();var e=d.location,f=d.distance,g=d.threshold,h=b.length,i,j,k,l;return h>32&&(d.fuzzy=!1),d.fuzzy&&(i=1<c;c++)a[b.charAt(c)]=0;for(c=0;h>c;c++)a[b.charAt(c)]|=1<c;c++){o=0,p=q;while(p>o)k(c,e+p)<=m?o=p:q=p,p=Math.floor((q-o)/2+o);for(q=p,s=Math.max(1,e-p+1),t=Math.min(e+p,l)+h,u=new Array(t+2),u[t+1]=(1<=s;f--)if(v=j[a.charAt(f-1)],0===c?u[f]=(u[f+1]<<1|1)&v:u[f]=(u[f+1]<<1|1)&v|((r[f+1]|r[f])<<1|1)|r[f+1],u[f]&i&&(w=k(c,f-1),m>=w)){if(m=w,n=f-1,x.push(n),!(n>e))break;s=Math.max(1,2*e-n)}if(k(c+1,e)>m)break;r=u}return{isMatch:n>=0,score:w}},c===!0?{search:l}:l(c)},a.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1}}(a),a.jstree.defaults.sort=function(a,b){return this.get_text(a)>this.get_text(b)?1:-1},a.jstree.plugins.sort=function(b,c){this.bind=function(){c.bind.call(this),this.element.on("model.jstree",a.proxy(function(a,b){this.sort(b.parent,!0)},this)).on("rename_node.jstree create_node.jstree",a.proxy(function(a,b){this.sort(b.parent||b.node.parent,!1),this.redraw_node(b.parent||b.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",a.proxy(function(a,b){this.sort(b.parent,!1),this.redraw_node(b.parent,!0)},this))},this.sort=function(b,c){var d,e;if(b=this.get_node(b),b&&b.children&&b.children.length&&(b.children.sort(a.proxy(this.settings.sort,this)),c))for(d=0,e=b.children_d.length;e>d;d++)this.sort(b.children_d[d],!1)}};var m=!1;a.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1,preserve_loaded:!1},a.jstree.plugins.state=function(b,c){this.bind=function(){c.bind.call(this);var b=a.proxy(function(){this.element.on(this.settings.state.events,a.proxy(function(){m&&clearTimeout(m),m=setTimeout(a.proxy(function(){this.save_state()},this),100)},this)),this.trigger("state_ready")},this);this.element.on("ready.jstree",a.proxy(function(a,c){this.element.one("restore_state.jstree",b),this.restore_state()||b()},this))},this.save_state=function(){var b=this.get_state();this.settings.state.preserve_loaded||delete b.core.loaded;var c={state:b,ttl:this.settings.state.ttl,sec:+new Date};a.vakata.storage.set(this.settings.state.key,JSON.stringify(c))},this.restore_state=function(){var b=a.vakata.storage.get(this.settings.state.key);if(b)try{b=JSON.parse(b)}catch(c){return!1}return b&&b.ttl&&b.sec&&+new Date-b.sec>b.ttl?!1:(b&&b.state&&(b=b.state),b&&a.isFunction(this.settings.state.filter)&&(b=this.settings.state.filter.call(this,b)),b?(this.settings.state.preserve_loaded||delete b.core.loaded,this.element.one("set_state.jstree",function(c,d){d.instance.trigger("restore_state",{state:a.extend(!0,{},b)})}),this.set_state(b),!0):!1)},this.clear_state=function(){return a.vakata.storage.del(this.settings.state.key)}},function(a,b){a.vakata.storage={set:function(a,b){return window.localStorage.setItem(a,b)},get:function(a){return window.localStorage.getItem(a)},del:function(a){return window.localStorage.removeItem(a)}}}(a),a.jstree.defaults.types={"default":{}},a.jstree.defaults.types[a.jstree.root]={},a.jstree.plugins.types=function(c,d){this.init=function(c,e){var f,g;if(e&&e.types&&e.types["default"])for(f in e.types)if("default"!==f&&f!==a.jstree.root&&e.types.hasOwnProperty(f))for(g in e.types["default"])e.types["default"].hasOwnProperty(g)&&e.types[f][g]===b&&(e.types[f][g]=e.types["default"][g]);d.init.call(this,c,e),this._model.data[a.jstree.root].type=a.jstree.root},this.refresh=function(b,c){d.refresh.call(this,b,c),this._model.data[a.jstree.root].type=a.jstree.root},this.bind=function(){this.element.on("model.jstree",a.proxy(function(c,d){var e=this._model.data,f=d.nodes,g=this.settings.types,h,i,j="default",k;for(h=0,i=f.length;i>h;h++){if(j="default",e[f[h]].original&&e[f[h]].original.type&&g[e[f[h]].original.type]&&(j=e[f[h]].original.type),e[f[h]].data&&e[f[h]].data.jstree&&e[f[h]].data.jstree.type&&g[e[f[h]].data.jstree.type]&&(j=e[f[h]].data.jstree.type),e[f[h]].type=j,e[f[h]].icon===!0&&g[j].icon!==b&&(e[f[h]].icon=g[j].icon),g[j].li_attr!==b&&"object"==typeof g[j].li_attr)for(k in g[j].li_attr)if(g[j].li_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].li_attr[k]===b?e[f[h]].li_attr[k]=g[j].li_attr[k]:"class"===k&&(e[f[h]].li_attr["class"]=g[j].li_attr["class"]+" "+e[f[h]].li_attr["class"])}if(g[j].a_attr!==b&&"object"==typeof g[j].a_attr)for(k in g[j].a_attr)if(g[j].a_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].a_attr[k]===b?e[f[h]].a_attr[k]=g[j].a_attr[k]:"href"===k&&"#"===e[f[h]].a_attr[k]?e[f[h]].a_attr.href=g[j].a_attr.href:"class"===k&&(e[f[h]].a_attr["class"]=g[j].a_attr["class"]+" "+e[f[h]].a_attr["class"])}}e[a.jstree.root].type=a.jstree.root},this)),d.bind.call(this)},this.get_json=function(b,c,e){var f,g,h=this._model.data,i=c?a.extend(!0,{},c,{no_id:!1}):{},j=d.get_json.call(this,b,i,e);if(j===!1)return!1;if(a.isArray(j))for(f=0,g=j.length;g>f;f++)j[f].type=j[f].id&&h[j[f].id]&&h[j[f].id].type?h[j[f].id].type:"default",c&&c.no_id&&(delete j[f].id,j[f].li_attr&&j[f].li_attr.id&&delete j[f].li_attr.id,j[f].a_attr&&j[f].a_attr.id&&delete j[f].a_attr.id);else j.type=j.id&&h[j.id]&&h[j.id].type?h[j.id].type:"default",c&&c.no_id&&(j=this._delete_ids(j));return j},this._delete_ids=function(b){if(a.isArray(b)){for(var c=0,d=b.length;d>c;c++)b[c]=this._delete_ids(b[c]);return b}return delete b.id, -b.li_attr&&b.li_attr.id&&delete b.li_attr.id,b.a_attr&&b.a_attr.id&&delete b.a_attr.id,b.children&&a.isArray(b.children)&&(b.children=this._delete_ids(b.children)),b},this.check=function(c,e,f,g,h){if(d.check.call(this,c,e,f,g,h)===!1)return!1;e=e&&e.id?e:this.get_node(e),f=f&&f.id?f:this.get_node(f);var i=e&&e.id?h&&h.origin?h.origin:a.jstree.reference(e.id):null,j,k,l,m;switch(i=i&&i._model&&i._model.data?i._model.data:null,c){case"create_node":case"move_node":case"copy_node":if("move_node"!==c||-1===a.inArray(e.id,f.children)){if(j=this.get_rules(f),j.max_children!==b&&-1!==j.max_children&&j.max_children===f.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;if(j.valid_children!==b&&-1!==j.valid_children&&-1===a.inArray(e.type||"default",j.valid_children))return this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;if(i&&e.children_d&&e.parents){for(k=0,l=0,m=e.children_d.length;m>l;l++)k=Math.max(k,i[e.children_d[l]].parents.length);k=k-e.parents.length+1}(0>=k||k===b)&&(k=1);do{if(j.max_depth!==b&&-1!==j.max_depth&&j.max_depthg;g++)this.set_type(c[g],d);return!0}if(f=this.settings.types,c=this.get_node(c),!f[d]||!c)return!1;if(l=this.get_node(c,!0),l&&l.length&&(m=l.children(".jstree-anchor")),i=c.type,j=this.get_icon(c),c.type=d,(j===!0||!f[i]||f[i].icon!==b&&j===f[i].icon)&&this.set_icon(c,f[d].icon!==b?f[d].icon:!0),f[i]&&f[i].li_attr!==b&&"object"==typeof f[i].li_attr)for(k in f[i].li_attr)if(f[i].li_attr.hasOwnProperty(k)){if("id"===k)continue;"class"===k?(e[c.id].li_attr["class"]=(e[c.id].li_attr["class"]||"").replace(f[i].li_attr[k],""),l&&l.removeClass(f[i].li_attr[k])):e[c.id].li_attr[k]===f[i].li_attr[k]&&(e[c.id].li_attr[k]=null,l&&l.removeAttr(k))}if(f[i]&&f[i].a_attr!==b&&"object"==typeof f[i].a_attr)for(k in f[i].a_attr)if(f[i].a_attr.hasOwnProperty(k)){if("id"===k)continue;"class"===k?(e[c.id].a_attr["class"]=(e[c.id].a_attr["class"]||"").replace(f[i].a_attr[k],""),m&&m.removeClass(f[i].a_attr[k])):e[c.id].a_attr[k]===f[i].a_attr[k]&&("href"===k?(e[c.id].a_attr[k]="#",m&&m.attr("href","#")):(delete e[c.id].a_attr[k],m&&m.removeAttr(k)))}if(f[d].li_attr!==b&&"object"==typeof f[d].li_attr)for(k in f[d].li_attr)if(f[d].li_attr.hasOwnProperty(k)){if("id"===k)continue;e[c.id].li_attr[k]===b?(e[c.id].li_attr[k]=f[d].li_attr[k],l&&("class"===k?l.addClass(f[d].li_attr[k]):l.attr(k,f[d].li_attr[k]))):"class"===k&&(e[c.id].li_attr["class"]=f[d].li_attr[k]+" "+e[c.id].li_attr["class"],l&&l.addClass(f[d].li_attr[k]))}if(f[d].a_attr!==b&&"object"==typeof f[d].a_attr)for(k in f[d].a_attr)if(f[d].a_attr.hasOwnProperty(k)){if("id"===k)continue;e[c.id].a_attr[k]===b?(e[c.id].a_attr[k]=f[d].a_attr[k],m&&("class"===k?m.addClass(f[d].a_attr[k]):m.attr(k,f[d].a_attr[k]))):"href"===k&&"#"===e[c.id].a_attr[k]?(e[c.id].a_attr.href=f[d].a_attr.href,m&&m.attr("href",f[d].a_attr.href)):"class"===k&&(e[c.id].a_attr["class"]=f[d].a_attr["class"]+" "+e[c.id].a_attr["class"],m&&m.addClass(f[d].a_attr[k]))}return!0}},a.jstree.defaults.unique={case_sensitive:!1,trim_whitespace:!1,duplicate:function(a,b){return a+" ("+b+")"}},a.jstree.plugins.unique=function(c,d){this.check=function(b,c,e,f,g){if(d.check.call(this,b,c,e,f,g)===!1)return!1;if(c=c&&c.id?c:this.get_node(c),e=e&&e.id?e:this.get_node(e),!e||!e.children)return!0;var h="rename_node"===b?f:c.text,i=[],j=this.settings.unique.case_sensitive,k=this.settings.unique.trim_whitespace,l=this._model.data,m,n,o;for(m=0,n=e.children.length;n>m;m++)o=l[e.children[m]].text,j||(o=o.toLowerCase()),k&&(o=o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),i.push(o);switch(j||(h=h.toLowerCase()),k&&(h=h.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),b){case"delete_node":return!0;case"rename_node":return o=c.text||"",j||(o=o.toLowerCase()),k&&(o=o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),m=-1===a.inArray(h,i)||c.text&&o===h,m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m;case"create_node":return m=-1===a.inArray(h,i),m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m;case"copy_node":return m=-1===a.inArray(h,i),m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m;case"move_node":return m=c.parent===e.id&&(!g||!g.is_multi)||-1===a.inArray(h,i),m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m}return!0},this.create_node=function(c,e,f,g,h){if(!e||e.text===b){if(null===c&&(c=a.jstree.root),c=this.get_node(c),!c)return d.create_node.call(this,c,e,f,g,h);if(f=f===b?"last":f,!f.toString().match(/^(before|after)$/)&&!h&&!this.is_loaded(c))return d.create_node.call(this,c,e,f,g,h);e||(e={});var i,j,k,l,m,n=this._model.data,o=this.settings.unique.case_sensitive,p=this.settings.unique.trim_whitespace,q=this.settings.unique.duplicate,r;for(j=i=this.get_string("New node"),k=[],l=0,m=c.children.length;m>l;l++)r=n[c.children[l]].text,o||(r=r.toLowerCase()),p&&(r=r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),k.push(r);l=1,r=j,o||(r=r.toLowerCase()),p&&(r=r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));while(-1!==a.inArray(r,k))j=q.call(this,i,++l).toString(),r=j,o||(r=r.toLowerCase()),p&&(r=r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));e.text=j}return d.create_node.call(this,c,e,f,g,h)}};var n=i.createElement("DIV");if(n.setAttribute("unselectable","on"),n.setAttribute("role","presentation"),n.className="jstree-wholerow",n.innerHTML=" ",a.jstree.plugins.wholerow=function(b,c){this.bind=function(){c.bind.call(this),this.element.on("ready.jstree set_state.jstree",a.proxy(function(){this.hide_dots()},this)).on("init.jstree loading.jstree ready.jstree",a.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",a.proxy(function(a,b){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",a.proxy(function(a,b){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var c=!1,d,e;for(d=0,e=b.selected.length;e>d;d++)c=this.get_node(b.selected[d],!0),c&&c.length&&c.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("open_node.jstree",a.proxy(function(a,b){this.get_node(b.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("hover_node.jstree dehover_node.jstree",a.proxy(function(a,b){"hover_node"===a.type&&this.is_disabled(b.node)||this.get_node(b.node,!0).children(".jstree-wholerow")["hover_node"===a.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",a.proxy(function(b){if(this._data.contextmenu){b.preventDefault();var c=a.Event("contextmenu",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey,pageX:b.pageX,pageY:b.pageY});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c)}},this)).on("click.jstree",".jstree-wholerow",function(b){b.stopImmediatePropagation();var c=a.Event("click",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()}).on("dblclick.jstree",".jstree-wholerow",function(b){b.stopImmediatePropagation();var c=a.Event("dblclick",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",a.proxy(function(b){b.stopImmediatePropagation();var c=a.Event("click",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",a.proxy(function(a){return a.stopImmediatePropagation(),this.is_disabled(a.currentTarget)||this.hover_node(a.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",a.proxy(function(a){this.dehover_node(a.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),c.teardown.call(this)},this.redraw_node=function(b,d,e,f){if(b=c.redraw_node.apply(this,arguments)){var g=n.cloneNode(!0);-1!==a.inArray(b.id,this._data.core.selected)&&(g.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===b.id&&(g.className+=" jstree-wholerow-hovered"),b.insertBefore(g,b.childNodes[0])}return b}},window.customElements&&Object&&Object.create){var o=Object.create(HTMLElement.prototype);o.createdCallback=function(){var b={core:{},plugins:[]},c;for(c in a.jstree.plugins)a.jstree.plugins.hasOwnProperty(c)&&this.attributes[c]&&(b.plugins.push(c),this.getAttribute(c)&&JSON.parse(this.getAttribute(c))&&(b[c]=JSON.parse(this.getAttribute(c))));for(c in a.jstree.defaults.core)a.jstree.defaults.core.hasOwnProperty(c)&&this.attributes[c]&&(b.core[c]=JSON.parse(this.getAttribute(c))||this.getAttribute(c));a(this).jstree(b)};try{window.customElements.define("vakata-jstree",function(){},{prototype:o})}catch(p){}}}}); \ No newline at end of file diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/32px.png b/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/32px.png deleted file mode 100644 index 60395729..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/32px.png and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/40px.png b/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/40px.png deleted file mode 100644 index aae89ad3..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/40px.png and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/style.css b/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/style.css deleted file mode 100644 index d8dc188f..00000000 --- a/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/style.css +++ /dev/null @@ -1,1146 +0,0 @@ -/* jsTree default dark theme */ -.jstree-node, -.jstree-children, -.jstree-container-ul { - display: block; - margin: 0; - padding: 0; - list-style-type: none; - list-style-image: none; -} -.jstree-node { - white-space: nowrap; -} -.jstree-anchor { - display: inline-block; - color: black; - white-space: nowrap; - padding: 0 4px 0 1px; - margin: 0; - vertical-align: top; -} -.jstree-anchor:focus { - outline: 0; -} -.jstree-anchor, -.jstree-anchor:link, -.jstree-anchor:visited, -.jstree-anchor:hover, -.jstree-anchor:active { - text-decoration: none; - color: inherit; -} -.jstree-icon { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-icon:empty { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-ocl { - cursor: pointer; -} -.jstree-leaf > .jstree-ocl { - cursor: default; -} -.jstree .jstree-open > .jstree-children { - display: block; -} -.jstree .jstree-closed > .jstree-children, -.jstree .jstree-leaf > .jstree-children { - display: none; -} -.jstree-anchor > .jstree-themeicon { - margin-right: 2px; -} -.jstree-no-icons .jstree-themeicon, -.jstree-anchor > .jstree-themeicon-hidden { - display: none; -} -.jstree-hidden, -.jstree-node.jstree-hidden { - display: none; -} -.jstree-rtl .jstree-anchor { - padding: 0 1px 0 4px; -} -.jstree-rtl .jstree-anchor > .jstree-themeicon { - margin-left: 2px; - margin-right: 0; -} -.jstree-rtl .jstree-node { - margin-left: 0; -} -.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; -} -.jstree-wholerow-ul { - position: relative; - display: inline-block; - min-width: 100%; -} -.jstree-wholerow-ul .jstree-leaf > .jstree-ocl { - cursor: pointer; -} -.jstree-wholerow-ul .jstree-anchor, -.jstree-wholerow-ul .jstree-icon { - position: relative; -} -.jstree-wholerow-ul .jstree-wholerow { - width: 100%; - cursor: pointer; - position: absolute; - left: 0; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.jstree-contextmenu .jstree-anchor { - -webkit-user-select: none; - /* disable selection/Copy of UIWebView */ - -webkit-touch-callout: none; - /* disable the IOS popup when long-press on a link */ -} -.vakata-context { - display: none; -} -.vakata-context, -.vakata-context ul { - margin: 0; - padding: 2px; - position: absolute; - background: #f5f5f5; - border: 1px solid #979797; - box-shadow: 2px 2px 2px #999999; -} -.vakata-context ul { - list-style: none; - left: 100%; - margin-top: -2.7em; - margin-left: -4px; -} -.vakata-context .vakata-context-right ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context li { - list-style: none; -} -.vakata-context li > a { - display: block; - padding: 0 2em 0 2em; - text-decoration: none; - width: auto; - color: black; - white-space: nowrap; - line-height: 2.4em; - text-shadow: 1px 1px 0 white; - border-radius: 1px; -} -.vakata-context li > a:hover { - position: relative; - background-color: #e8eff7; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw=="); - background-position: right center; - background-repeat: no-repeat; -} -.vakata-context li > a:focus { - outline: 0; -} -.vakata-context .vakata-context-hover > a { - position: relative; - background-color: #e8eff7; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context .vakata-context-separator > a, -.vakata-context .vakata-context-separator > a:hover { - background: white; - border: 0; - border-top: 1px solid #e2e3e3; - height: 1px; - min-height: 1px; - max-height: 1px; - padding: 0; - margin: 0 0 0 2.4em; - border-left: 1px solid #e0e0e0; - text-shadow: 0 0 0 transparent; - box-shadow: 0 0 0 transparent; - border-radius: 0; -} -.vakata-context .vakata-contextmenu-disabled a, -.vakata-context .vakata-contextmenu-disabled a:hover { - color: silver; - background-color: transparent; - border: 0; - box-shadow: 0 0 0; -} -.vakata-context .vakata-contextmenu-disabled > a > i { - filter: grayscale(100%); -} -.vakata-context li > a > i { - text-decoration: none; - display: inline-block; - width: 2.4em; - height: 2.4em; - background: transparent; - margin: 0 0 0 -2em; - vertical-align: top; - text-align: center; - line-height: 2.4em; -} -.vakata-context li > a > i:empty { - width: 2.4em; - line-height: 2.4em; -} -.vakata-context li > a .vakata-contextmenu-sep { - display: inline-block; - width: 1px; - height: 2.4em; - background: white; - margin: 0 0.5em 0 0; - border-left: 1px solid #e2e3e3; -} -.vakata-context .vakata-contextmenu-shortcut { - font-size: 0.8em; - color: silver; - opacity: 0.5; - display: none; -} -.vakata-context-rtl ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context-rtl li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7"); - background-position: left center; - background-repeat: no-repeat; -} -.vakata-context-rtl .vakata-context-separator > a { - margin: 0 2.4em 0 0; - border-left: 0; - border-right: 1px solid #e2e3e3; -} -.vakata-context-rtl .vakata-context-left ul { - right: auto; - left: 100%; - margin-left: -4px; - margin-right: auto; -} -.vakata-context-rtl li > a > i { - margin: 0 -2em 0 0; -} -.vakata-context-rtl li > a .vakata-contextmenu-sep { - margin: 0 0 0 0.5em; - border-left-color: white; - background: #e2e3e3; -} -#jstree-marker { - position: absolute; - top: 0; - left: 0; - margin: -5px 0 0 0; - padding: 0; - border-right: 0; - border-top: 5px solid transparent; - border-bottom: 5px solid transparent; - border-left: 5px solid; - width: 0; - height: 0; - font-size: 0; - line-height: 0; -} -#jstree-dnd { - line-height: 16px; - margin: 0; - padding: 4px; -} -#jstree-dnd .jstree-icon, -#jstree-dnd .jstree-copy { - display: inline-block; - text-decoration: none; - margin: 0 2px 0 0; - padding: 0; - width: 16px; - height: 16px; -} -#jstree-dnd .jstree-ok { - background: green; -} -#jstree-dnd .jstree-er { - background: red; -} -#jstree-dnd .jstree-copy { - margin: 0 2px 0 2px; -} -.jstree-default-dark .jstree-node, -.jstree-default-dark .jstree-icon { - background-repeat: no-repeat; - background-color: transparent; -} -.jstree-default-dark .jstree-anchor, -.jstree-default-dark .jstree-animated, -.jstree-default-dark .jstree-wholerow { - transition: background-color 0.15s, box-shadow 0.15s; -} -.jstree-default-dark .jstree-hovered { - background: #555; - border-radius: 2px; - box-shadow: inset 0 0 1px #555; -} -.jstree-default-dark .jstree-context { - background: #555; - border-radius: 2px; - box-shadow: inset 0 0 1px #555; -} -.jstree-default-dark .jstree-clicked { - background: #5fa2db; - border-radius: 2px; - box-shadow: inset 0 0 1px #666666; -} -.jstree-default-dark .jstree-no-icons .jstree-anchor > .jstree-themeicon { - display: none; -} -.jstree-default-dark .jstree-disabled { - background: transparent; - color: #666666; -} -.jstree-default-dark .jstree-disabled.jstree-hovered { - background: transparent; - box-shadow: none; -} -.jstree-default-dark .jstree-disabled.jstree-clicked { - background: #333333; -} -.jstree-default-dark .jstree-disabled > .jstree-icon { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-dark .jstree-search { - font-style: italic; - color: #ffffff; - font-weight: bold; -} -.jstree-default-dark .jstree-no-checkboxes .jstree-checkbox { - display: none !important; -} -.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked { - background: transparent; - box-shadow: none; -} -.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered { - background: #555; -} -.jstree-default-dark.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked { - background: transparent; -} -.jstree-default-dark.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered { - background: #555; -} -.jstree-default-dark > .jstree-striped { - min-width: 100%; - display: inline-block; - background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat; -} -.jstree-default-dark > .jstree-wholerow-ul .jstree-hovered, -.jstree-default-dark > .jstree-wholerow-ul .jstree-clicked { - background: transparent; - box-shadow: none; - border-radius: 0; -} -.jstree-default-dark .jstree-wholerow { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} -.jstree-default-dark .jstree-wholerow-hovered { - background: #555; -} -.jstree-default-dark .jstree-wholerow-clicked { - background: #5fa2db; - background: -webkit-linear-gradient(top, #5fa2db 0%, #5fa2db 100%); - background: linear-gradient(to bottom, #5fa2db 0%, #5fa2db 100%); -} -.jstree-default-dark .jstree-node { - min-height: 24px; - line-height: 24px; - margin-left: 24px; - min-width: 24px; -} -.jstree-default-dark .jstree-anchor { - line-height: 24px; - height: 24px; -} -.jstree-default-dark .jstree-icon { - width: 24px; - height: 24px; - line-height: 24px; -} -.jstree-default-dark .jstree-icon:empty { - width: 24px; - height: 24px; - line-height: 24px; -} -.jstree-default-dark.jstree-rtl .jstree-node { - margin-right: 24px; -} -.jstree-default-dark .jstree-wholerow { - height: 24px; -} -.jstree-default-dark .jstree-node, -.jstree-default-dark .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-dark .jstree-node { - background-position: -292px -4px; - background-repeat: repeat-y; -} -.jstree-default-dark .jstree-last { - background: transparent; -} -.jstree-default-dark .jstree-open > .jstree-ocl { - background-position: -132px -4px; -} -.jstree-default-dark .jstree-closed > .jstree-ocl { - background-position: -100px -4px; -} -.jstree-default-dark .jstree-leaf > .jstree-ocl { - background-position: -68px -4px; -} -.jstree-default-dark .jstree-themeicon { - background-position: -260px -4px; -} -.jstree-default-dark > .jstree-no-dots .jstree-node, -.jstree-default-dark > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -36px -4px; -} -.jstree-default-dark > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -4px -4px; -} -.jstree-default-dark .jstree-disabled { - background: transparent; -} -.jstree-default-dark .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-dark .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-dark .jstree-checkbox { - background-position: -164px -4px; -} -.jstree-default-dark .jstree-checkbox:hover { - background-position: -164px -36px; -} -.jstree-default-dark.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-dark .jstree-checked > .jstree-checkbox { - background-position: -228px -4px; -} -.jstree-default-dark.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-dark .jstree-checked > .jstree-checkbox:hover { - background-position: -228px -36px; -} -.jstree-default-dark .jstree-anchor > .jstree-undetermined { - background-position: -196px -4px; -} -.jstree-default-dark .jstree-anchor > .jstree-undetermined:hover { - background-position: -196px -36px; -} -.jstree-default-dark .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-dark > .jstree-striped { - background-size: auto 48px; -} -.jstree-default-dark.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-dark.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -132px -36px; -} -.jstree-default-dark.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -100px -36px; -} -.jstree-default-dark.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -68px -36px; -} -.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -36px -36px; -} -.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -4px -36px; -} -.jstree-default-dark .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-dark > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-dark .jstree-file { - background: url("32px.png") -100px -68px no-repeat; -} -.jstree-default-dark .jstree-folder { - background: url("32px.png") -260px -4px no-repeat; -} -.jstree-default-dark > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-dark { - line-height: 24px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-dark .jstree-ok, -#jstree-dnd.jstree-default-dark .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-dark i { - background: transparent; - width: 24px; - height: 24px; - line-height: 24px; -} -#jstree-dnd.jstree-default-dark .jstree-ok { - background-position: -4px -68px; -} -#jstree-dnd.jstree-default-dark .jstree-er { - background-position: -36px -68px; -} -.jstree-default-dark .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-dark .jstree-ellipsis .jstree-anchor { - width: calc(100% - 29px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-dark.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); -} -.jstree-default-dark.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-small .jstree-node { - min-height: 18px; - line-height: 18px; - margin-left: 18px; - min-width: 18px; -} -.jstree-default-dark-small .jstree-anchor { - line-height: 18px; - height: 18px; -} -.jstree-default-dark-small .jstree-icon { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-default-dark-small .jstree-icon:empty { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-default-dark-small.jstree-rtl .jstree-node { - margin-right: 18px; -} -.jstree-default-dark-small .jstree-wholerow { - height: 18px; -} -.jstree-default-dark-small .jstree-node, -.jstree-default-dark-small .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-dark-small .jstree-node { - background-position: -295px -7px; - background-repeat: repeat-y; -} -.jstree-default-dark-small .jstree-last { - background: transparent; -} -.jstree-default-dark-small .jstree-open > .jstree-ocl { - background-position: -135px -7px; -} -.jstree-default-dark-small .jstree-closed > .jstree-ocl { - background-position: -103px -7px; -} -.jstree-default-dark-small .jstree-leaf > .jstree-ocl { - background-position: -71px -7px; -} -.jstree-default-dark-small .jstree-themeicon { - background-position: -263px -7px; -} -.jstree-default-dark-small > .jstree-no-dots .jstree-node, -.jstree-default-dark-small > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark-small > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -7px; -} -.jstree-default-dark-small > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -7px; -} -.jstree-default-dark-small .jstree-disabled { - background: transparent; -} -.jstree-default-dark-small .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-dark-small .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-dark-small .jstree-checkbox { - background-position: -167px -7px; -} -.jstree-default-dark-small .jstree-checkbox:hover { - background-position: -167px -39px; -} -.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-dark-small .jstree-checked > .jstree-checkbox { - background-position: -231px -7px; -} -.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-dark-small .jstree-checked > .jstree-checkbox:hover { - background-position: -231px -39px; -} -.jstree-default-dark-small .jstree-anchor > .jstree-undetermined { - background-position: -199px -7px; -} -.jstree-default-dark-small .jstree-anchor > .jstree-undetermined:hover { - background-position: -199px -39px; -} -.jstree-default-dark-small .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-dark-small > .jstree-striped { - background-size: auto 36px; -} -.jstree-default-dark-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-dark-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-small.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -135px -39px; -} -.jstree-default-dark-small.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -103px -39px; -} -.jstree-default-dark-small.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -71px -39px; -} -.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -39px; -} -.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -39px; -} -.jstree-default-dark-small .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-dark-small > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-dark-small .jstree-file { - background: url("32px.png") -103px -71px no-repeat; -} -.jstree-default-dark-small .jstree-folder { - background: url("32px.png") -263px -7px no-repeat; -} -.jstree-default-dark-small > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-dark-small { - line-height: 18px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-dark-small .jstree-ok, -#jstree-dnd.jstree-default-dark-small .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-dark-small i { - background: transparent; - width: 18px; - height: 18px; - line-height: 18px; -} -#jstree-dnd.jstree-default-dark-small .jstree-ok { - background-position: -7px -71px; -} -#jstree-dnd.jstree-default-dark-small .jstree-er { - background-position: -39px -71px; -} -.jstree-default-dark-small .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-dark-small .jstree-ellipsis .jstree-anchor { - width: calc(100% - 23px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-dark-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); -} -.jstree-default-dark-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-large .jstree-node { - min-height: 32px; - line-height: 32px; - margin-left: 32px; - min-width: 32px; -} -.jstree-default-dark-large .jstree-anchor { - line-height: 32px; - height: 32px; -} -.jstree-default-dark-large .jstree-icon { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-default-dark-large .jstree-icon:empty { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-default-dark-large.jstree-rtl .jstree-node { - margin-right: 32px; -} -.jstree-default-dark-large .jstree-wholerow { - height: 32px; -} -.jstree-default-dark-large .jstree-node, -.jstree-default-dark-large .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-dark-large .jstree-node { - background-position: -288px 0px; - background-repeat: repeat-y; -} -.jstree-default-dark-large .jstree-last { - background: transparent; -} -.jstree-default-dark-large .jstree-open > .jstree-ocl { - background-position: -128px 0px; -} -.jstree-default-dark-large .jstree-closed > .jstree-ocl { - background-position: -96px 0px; -} -.jstree-default-dark-large .jstree-leaf > .jstree-ocl { - background-position: -64px 0px; -} -.jstree-default-dark-large .jstree-themeicon { - background-position: -256px 0px; -} -.jstree-default-dark-large > .jstree-no-dots .jstree-node, -.jstree-default-dark-large > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark-large > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px 0px; -} -.jstree-default-dark-large > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px 0px; -} -.jstree-default-dark-large .jstree-disabled { - background: transparent; -} -.jstree-default-dark-large .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-dark-large .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-dark-large .jstree-checkbox { - background-position: -160px 0px; -} -.jstree-default-dark-large .jstree-checkbox:hover { - background-position: -160px -32px; -} -.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-dark-large .jstree-checked > .jstree-checkbox { - background-position: -224px 0px; -} -.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-dark-large .jstree-checked > .jstree-checkbox:hover { - background-position: -224px -32px; -} -.jstree-default-dark-large .jstree-anchor > .jstree-undetermined { - background-position: -192px 0px; -} -.jstree-default-dark-large .jstree-anchor > .jstree-undetermined:hover { - background-position: -192px -32px; -} -.jstree-default-dark-large .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-dark-large > .jstree-striped { - background-size: auto 64px; -} -.jstree-default-dark-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-dark-large.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-large.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -128px -32px; -} -.jstree-default-dark-large.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -96px -32px; -} -.jstree-default-dark-large.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -64px -32px; -} -.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px -32px; -} -.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px -32px; -} -.jstree-default-dark-large .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-dark-large > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-dark-large .jstree-file { - background: url("32px.png") -96px -64px no-repeat; -} -.jstree-default-dark-large .jstree-folder { - background: url("32px.png") -256px 0px no-repeat; -} -.jstree-default-dark-large > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-dark-large { - line-height: 32px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-dark-large .jstree-ok, -#jstree-dnd.jstree-default-dark-large .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-dark-large i { - background: transparent; - width: 32px; - height: 32px; - line-height: 32px; -} -#jstree-dnd.jstree-default-dark-large .jstree-ok { - background-position: 0px -64px; -} -#jstree-dnd.jstree-default-dark-large .jstree-er { - background-position: -32px -64px; -} -.jstree-default-dark-large .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-dark-large .jstree-ellipsis .jstree-anchor { - width: calc(100% - 37px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-dark-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); -} -.jstree-default-dark-large.jstree-rtl .jstree-last { - background: transparent; -} -@media (max-width: 768px) { - #jstree-dnd.jstree-dnd-responsive { - line-height: 40px; - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - #jstree-dnd.jstree-dnd-responsive > i { - background: transparent; - width: 40px; - height: 40px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-ok { - background-image: url("40px.png"); - background-position: 0 -200px; - background-size: 120px 240px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-er { - background-image: url("40px.png"); - background-position: -40px -200px; - background-size: 120px 240px; - } - #jstree-marker.jstree-dnd-responsive { - border-left-width: 10px; - border-top-width: 10px; - border-bottom-width: 10px; - margin-top: -10px; - } -} -@media (max-width: 768px) { - .jstree-default-dark-responsive { - /* - .jstree-open > .jstree-ocl, - .jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; } - */ - } - .jstree-default-dark-responsive .jstree-icon { - background-image: url("40px.png"); - } - .jstree-default-dark-responsive .jstree-node, - .jstree-default-dark-responsive .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-dark-responsive .jstree-node { - min-height: 40px; - line-height: 40px; - margin-left: 40px; - min-width: 40px; - white-space: nowrap; - } - .jstree-default-dark-responsive .jstree-anchor { - line-height: 40px; - height: 40px; - } - .jstree-default-dark-responsive .jstree-icon, - .jstree-default-dark-responsive .jstree-icon:empty { - width: 40px; - height: 40px; - line-height: 40px; - } - .jstree-default-dark-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - } - .jstree-default-dark-responsive.jstree-rtl .jstree-node { - margin-left: 0; - margin-right: 40px; - background: transparent; - } - .jstree-default-dark-responsive.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; - } - .jstree-default-dark-responsive .jstree-ocl, - .jstree-default-dark-responsive .jstree-themeicon, - .jstree-default-dark-responsive .jstree-checkbox { - background-size: 120px 240px; - } - .jstree-default-dark-responsive .jstree-leaf > .jstree-ocl, - .jstree-default-dark-responsive.jstree-rtl .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-dark-responsive .jstree-open > .jstree-ocl { - background-position: 0 0 !important; - } - .jstree-default-dark-responsive .jstree-closed > .jstree-ocl { - background-position: 0 -40px !important; - } - .jstree-default-dark-responsive.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -40px 0 !important; - } - .jstree-default-dark-responsive .jstree-themeicon { - background-position: -40px -40px; - } - .jstree-default-dark-responsive .jstree-checkbox, - .jstree-default-dark-responsive .jstree-checkbox:hover { - background-position: -40px -80px; - } - .jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, - .jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, - .jstree-default-dark-responsive .jstree-checked > .jstree-checkbox, - .jstree-default-dark-responsive .jstree-checked > .jstree-checkbox:hover { - background-position: 0 -80px; - } - .jstree-default-dark-responsive .jstree-anchor > .jstree-undetermined, - .jstree-default-dark-responsive .jstree-anchor > .jstree-undetermined:hover { - background-position: 0 -120px; - } - .jstree-default-dark-responsive .jstree-anchor { - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - .jstree-default-dark-responsive > .jstree-striped { - background: transparent; - } - .jstree-default-dark-responsive .jstree-wholerow { - border-top: 1px solid #666; - border-bottom: 1px solid #000; - background: #333333; - height: 40px; - } - .jstree-default-dark-responsive .jstree-wholerow-hovered { - background: #555; - } - .jstree-default-dark-responsive .jstree-wholerow-clicked { - background: #5fa2db; - } - .jstree-default-dark-responsive .jstree-children .jstree-last > .jstree-wholerow { - box-shadow: inset 0 -6px 3px -5px #111111; - } - .jstree-default-dark-responsive .jstree-children .jstree-open > .jstree-wholerow { - box-shadow: inset 0 6px 3px -5px #111111; - border-top: 0; - } - .jstree-default-dark-responsive .jstree-children .jstree-open + .jstree-open { - box-shadow: none; - } - .jstree-default-dark-responsive .jstree-node, - .jstree-default-dark-responsive .jstree-icon, - .jstree-default-dark-responsive .jstree-node > .jstree-ocl, - .jstree-default-dark-responsive .jstree-themeicon, - .jstree-default-dark-responsive .jstree-checkbox { - background-image: url("40px.png"); - background-size: 120px 240px; - } - .jstree-default-dark-responsive .jstree-node { - background-position: -80px 0; - background-repeat: repeat-y; - } - .jstree-default-dark-responsive .jstree-last { - background: transparent; - } - .jstree-default-dark-responsive .jstree-leaf > .jstree-ocl { - background-position: -40px -120px; - } - .jstree-default-dark-responsive .jstree-last > .jstree-ocl { - background-position: -40px -160px; - } - .jstree-default-dark-responsive .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; - } - .jstree-default-dark-responsive .jstree-file { - background: url("40px.png") 0 -160px no-repeat; - background-size: 120px 240px; - } - .jstree-default-dark-responsive .jstree-folder { - background: url("40px.png") -40px -40px no-repeat; - background-size: 120px 240px; - } - .jstree-default-dark-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; - } -} -.jstree-default-dark { - background: #333; -} -.jstree-default-dark .jstree-anchor { - color: #999; - text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5); -} -.jstree-default-dark .jstree-clicked, -.jstree-default-dark .jstree-checked { - color: white; -} -.jstree-default-dark .jstree-hovered { - color: white; -} -#jstree-marker.jstree-default-dark { - border-left-color: #999; - background: transparent; -} -.jstree-default-dark .jstree-anchor > .jstree-icon { - opacity: 0.75; -} -.jstree-default-dark .jstree-clicked > .jstree-icon, -.jstree-default-dark .jstree-hovered > .jstree-icon, -.jstree-default-dark .jstree-checked > .jstree-icon { - opacity: 1; -} -.jstree-default-dark.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); -} -.jstree-default-dark.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); -} -.jstree-default-dark-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-dark-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); -} -.jstree-default-dark-large.jstree-rtl .jstree-last { - background: transparent; -} diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/style.min.css b/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/style.min.css deleted file mode 100644 index fb1d236f..00000000 --- a/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/style.min.css +++ /dev/null @@ -1 +0,0 @@ -.jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:black;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-icon:empty{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-ocl{cursor:pointer}.jstree-leaf>.jstree-ocl{cursor:default}.jstree .jstree-open>.jstree-children{display:block}.jstree .jstree-closed>.jstree-children,.jstree .jstree-leaf>.jstree-children{display:none}.jstree-anchor>.jstree-themeicon{margin-right:2px}.jstree-no-icons .jstree-themeicon,.jstree-anchor>.jstree-themeicon-hidden{display:none}.jstree-hidden,.jstree-node.jstree-hidden{display:none}.jstree-rtl .jstree-anchor{padding:0 1px 0 4px}.jstree-rtl .jstree-anchor>.jstree-themeicon{margin-left:2px;margin-right:0}.jstree-rtl .jstree-node{margin-left:0}.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-wholerow-ul{position:relative;display:inline-block;min-width:100%}.jstree-wholerow-ul .jstree-leaf>.jstree-ocl{cursor:pointer}.jstree-wholerow-ul .jstree-anchor,.jstree-wholerow-ul .jstree-icon{position:relative}.jstree-wholerow-ul .jstree-wholerow{width:100%;cursor:pointer;position:absolute;left:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.jstree-contextmenu .jstree-anchor{-webkit-user-select:none;-webkit-touch-callout:none}.vakata-context{display:none}.vakata-context,.vakata-context ul{margin:0;padding:2px;position:absolute;background:#f5f5f5;border:1px solid #979797;box-shadow:2px 2px 2px #999999}.vakata-context ul{list-style:none;left:100%;margin-top:-2.7em;margin-left:-4px}.vakata-context .vakata-context-right ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context li{list-style:none}.vakata-context li>a{display:block;padding:0 2em 0 2em;text-decoration:none;width:auto;color:black;white-space:nowrap;line-height:2.4em;text-shadow:1px 1px 0 white;border-radius:1px}.vakata-context li>a:hover{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==");background-position:right center;background-repeat:no-repeat}.vakata-context li>a:focus{outline:0}.vakata-context .vakata-context-hover>a{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context .vakata-context-separator>a,.vakata-context .vakata-context-separator>a:hover{background:white;border:0;border-top:1px solid #e2e3e3;height:1px;min-height:1px;max-height:1px;padding:0;margin:0 0 0 2.4em;border-left:1px solid #e0e0e0;text-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;border-radius:0}.vakata-context .vakata-contextmenu-disabled a,.vakata-context .vakata-contextmenu-disabled a:hover{color:silver;background-color:transparent;border:0;box-shadow:0 0 0}.vakata-context .vakata-contextmenu-disabled>a>i{filter:grayscale(100%)}.vakata-context li>a>i{text-decoration:none;display:inline-block;width:2.4em;height:2.4em;background:transparent;margin:0 0 0 -2em;vertical-align:top;text-align:center;line-height:2.4em}.vakata-context li>a>i:empty{width:2.4em;line-height:2.4em}.vakata-context li>a .vakata-contextmenu-sep{display:inline-block;width:1px;height:2.4em;background:white;margin:0 .5em 0 0;border-left:1px solid #e2e3e3}.vakata-context .vakata-contextmenu-shortcut{font-size:.8em;color:silver;opacity:.5;display:none}.vakata-context-rtl ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context-rtl li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");background-position:left center;background-repeat:no-repeat}.vakata-context-rtl .vakata-context-separator>a{margin:0 2.4em 0 0;border-left:0;border-right:1px solid #e2e3e3}.vakata-context-rtl .vakata-context-left ul{right:auto;left:100%;margin-left:-4px;margin-right:auto}.vakata-context-rtl li>a>i{margin:0 -2em 0 0}.vakata-context-rtl li>a .vakata-contextmenu-sep{margin:0 0 0 .5em;border-left-color:white;background:#e2e3e3}#jstree-marker{position:absolute;top:0;left:0;margin:-5px 0 0 0;padding:0;border-right:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid;width:0;height:0;font-size:0;line-height:0}#jstree-dnd{line-height:16px;margin:0;padding:4px}#jstree-dnd .jstree-icon,#jstree-dnd .jstree-copy{display:inline-block;text-decoration:none;margin:0 2px 0 0;padding:0;width:16px;height:16px}#jstree-dnd .jstree-ok{background:green}#jstree-dnd .jstree-er{background:red}#jstree-dnd .jstree-copy{margin:0 2px 0 2px}.jstree-default-dark .jstree-node,.jstree-default-dark .jstree-icon{background-repeat:no-repeat;background-color:transparent}.jstree-default-dark .jstree-anchor,.jstree-default-dark .jstree-animated,.jstree-default-dark .jstree-wholerow{transition:background-color .15s,box-shadow .15s}.jstree-default-dark .jstree-hovered{background:#555;border-radius:2px;box-shadow:inset 0 0 1px #555}.jstree-default-dark .jstree-context{background:#555;border-radius:2px;box-shadow:inset 0 0 1px #555}.jstree-default-dark .jstree-clicked{background:#5fa2db;border-radius:2px;box-shadow:inset 0 0 1px #666666}.jstree-default-dark .jstree-no-icons .jstree-anchor>.jstree-themeicon{display:none}.jstree-default-dark .jstree-disabled{background:transparent;color:#666666}.jstree-default-dark .jstree-disabled.jstree-hovered{background:transparent;box-shadow:none}.jstree-default-dark .jstree-disabled.jstree-clicked{background:#333333}.jstree-default-dark .jstree-disabled>.jstree-icon{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark .jstree-search{font-style:italic;color:#ffffff;font-weight:bold}.jstree-default-dark .jstree-no-checkboxes .jstree-checkbox{display:none !important}.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked{background:transparent;box-shadow:none}.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered{background:#555}.jstree-default-dark.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked{background:transparent}.jstree-default-dark.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered{background:#555}.jstree-default-dark>.jstree-striped{min-width:100%;display:inline-block;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat}.jstree-default-dark>.jstree-wholerow-ul .jstree-hovered,.jstree-default-dark>.jstree-wholerow-ul .jstree-clicked{background:transparent;box-shadow:none;border-radius:0}.jstree-default-dark .jstree-wholerow{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.jstree-default-dark .jstree-wholerow-hovered{background:#555}.jstree-default-dark .jstree-wholerow-clicked{background:#5fa2db;background:-webkit-linear-gradient(top, #5fa2db 0, #5fa2db 100%);background:linear-gradient(to bottom, #5fa2db 0, #5fa2db 100%)}.jstree-default-dark .jstree-node{min-height:24px;line-height:24px;margin-left:24px;min-width:24px}.jstree-default-dark .jstree-anchor{line-height:24px;height:24px}.jstree-default-dark .jstree-icon{width:24px;height:24px;line-height:24px}.jstree-default-dark .jstree-icon:empty{width:24px;height:24px;line-height:24px}.jstree-default-dark.jstree-rtl .jstree-node{margin-right:24px}.jstree-default-dark .jstree-wholerow{height:24px}.jstree-default-dark .jstree-node,.jstree-default-dark .jstree-icon{background-image:url("32px.png")}.jstree-default-dark .jstree-node{background-position:-292px -4px;background-repeat:repeat-y}.jstree-default-dark .jstree-last{background:transparent}.jstree-default-dark .jstree-open>.jstree-ocl{background-position:-132px -4px}.jstree-default-dark .jstree-closed>.jstree-ocl{background-position:-100px -4px}.jstree-default-dark .jstree-leaf>.jstree-ocl{background-position:-68px -4px}.jstree-default-dark .jstree-themeicon{background-position:-260px -4px}.jstree-default-dark>.jstree-no-dots .jstree-node,.jstree-default-dark>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -4px}.jstree-default-dark>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -4px}.jstree-default-dark .jstree-disabled{background:transparent}.jstree-default-dark .jstree-disabled.jstree-hovered{background:transparent}.jstree-default-dark .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-dark .jstree-checkbox{background-position:-164px -4px}.jstree-default-dark .jstree-checkbox:hover{background-position:-164px -36px}.jstree-default-dark.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark .jstree-checked>.jstree-checkbox{background-position:-228px -4px}.jstree-default-dark.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark .jstree-checked>.jstree-checkbox:hover{background-position:-228px -36px}.jstree-default-dark .jstree-anchor>.jstree-undetermined{background-position:-196px -4px}.jstree-default-dark .jstree-anchor>.jstree-undetermined:hover{background-position:-196px -36px}.jstree-default-dark .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark>.jstree-striped{background-size:auto 48px}.jstree-default-dark.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default-dark.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark.jstree-rtl .jstree-open>.jstree-ocl{background-position:-132px -36px}.jstree-default-dark.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-100px -36px}.jstree-default-dark.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-68px -36px}.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -36px}.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -36px}.jstree-default-dark .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default-dark .jstree-file{background:url("32px.png") -100px -68px no-repeat}.jstree-default-dark .jstree-folder{background:url("32px.png") -260px -4px no-repeat}.jstree-default-dark>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-dark{line-height:24px;padding:0 4px}#jstree-dnd.jstree-default-dark .jstree-ok,#jstree-dnd.jstree-default-dark .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-dark i{background:transparent;width:24px;height:24px;line-height:24px}#jstree-dnd.jstree-default-dark .jstree-ok{background-position:-4px -68px}#jstree-dnd.jstree-default-dark .jstree-er{background-position:-36px -68px}.jstree-default-dark .jstree-ellipsis{overflow:hidden}.jstree-default-dark .jstree-ellipsis .jstree-anchor{width:calc(100% - 29px);text-overflow:ellipsis;overflow:hidden}.jstree-default-dark.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==")}.jstree-default-dark.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-small .jstree-node{min-height:18px;line-height:18px;margin-left:18px;min-width:18px}.jstree-default-dark-small .jstree-anchor{line-height:18px;height:18px}.jstree-default-dark-small .jstree-icon{width:18px;height:18px;line-height:18px}.jstree-default-dark-small .jstree-icon:empty{width:18px;height:18px;line-height:18px}.jstree-default-dark-small.jstree-rtl .jstree-node{margin-right:18px}.jstree-default-dark-small .jstree-wholerow{height:18px}.jstree-default-dark-small .jstree-node,.jstree-default-dark-small .jstree-icon{background-image:url("32px.png")}.jstree-default-dark-small .jstree-node{background-position:-295px -7px;background-repeat:repeat-y}.jstree-default-dark-small .jstree-last{background:transparent}.jstree-default-dark-small .jstree-open>.jstree-ocl{background-position:-135px -7px}.jstree-default-dark-small .jstree-closed>.jstree-ocl{background-position:-103px -7px}.jstree-default-dark-small .jstree-leaf>.jstree-ocl{background-position:-71px -7px}.jstree-default-dark-small .jstree-themeicon{background-position:-263px -7px}.jstree-default-dark-small>.jstree-no-dots .jstree-node,.jstree-default-dark-small>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-small>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -7px}.jstree-default-dark-small>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -7px}.jstree-default-dark-small .jstree-disabled{background:transparent}.jstree-default-dark-small .jstree-disabled.jstree-hovered{background:transparent}.jstree-default-dark-small .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-dark-small .jstree-checkbox{background-position:-167px -7px}.jstree-default-dark-small .jstree-checkbox:hover{background-position:-167px -39px}.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-small .jstree-checked>.jstree-checkbox{background-position:-231px -7px}.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-small .jstree-checked>.jstree-checkbox:hover{background-position:-231px -39px}.jstree-default-dark-small .jstree-anchor>.jstree-undetermined{background-position:-199px -7px}.jstree-default-dark-small .jstree-anchor>.jstree-undetermined:hover{background-position:-199px -39px}.jstree-default-dark-small .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark-small>.jstree-striped{background-size:auto 36px}.jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default-dark-small.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-small.jstree-rtl .jstree-open>.jstree-ocl{background-position:-135px -39px}.jstree-default-dark-small.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-103px -39px}.jstree-default-dark-small.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-71px -39px}.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -39px}.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -39px}.jstree-default-dark-small .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark-small>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default-dark-small .jstree-file{background:url("32px.png") -103px -71px no-repeat}.jstree-default-dark-small .jstree-folder{background:url("32px.png") -263px -7px no-repeat}.jstree-default-dark-small>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-dark-small{line-height:18px;padding:0 4px}#jstree-dnd.jstree-default-dark-small .jstree-ok,#jstree-dnd.jstree-default-dark-small .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-dark-small i{background:transparent;width:18px;height:18px;line-height:18px}#jstree-dnd.jstree-default-dark-small .jstree-ok{background-position:-7px -71px}#jstree-dnd.jstree-default-dark-small .jstree-er{background-position:-39px -71px}.jstree-default-dark-small .jstree-ellipsis{overflow:hidden}.jstree-default-dark-small .jstree-ellipsis .jstree-anchor{width:calc(100% - 23px);text-overflow:ellipsis;overflow:hidden}.jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==")}.jstree-default-dark-small.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-large .jstree-node{min-height:32px;line-height:32px;margin-left:32px;min-width:32px}.jstree-default-dark-large .jstree-anchor{line-height:32px;height:32px}.jstree-default-dark-large .jstree-icon{width:32px;height:32px;line-height:32px}.jstree-default-dark-large .jstree-icon:empty{width:32px;height:32px;line-height:32px}.jstree-default-dark-large.jstree-rtl .jstree-node{margin-right:32px}.jstree-default-dark-large .jstree-wholerow{height:32px}.jstree-default-dark-large .jstree-node,.jstree-default-dark-large .jstree-icon{background-image:url("32px.png")}.jstree-default-dark-large .jstree-node{background-position:-288px 0;background-repeat:repeat-y}.jstree-default-dark-large .jstree-last{background:transparent}.jstree-default-dark-large .jstree-open>.jstree-ocl{background-position:-128px 0}.jstree-default-dark-large .jstree-closed>.jstree-ocl{background-position:-96px 0}.jstree-default-dark-large .jstree-leaf>.jstree-ocl{background-position:-64px 0}.jstree-default-dark-large .jstree-themeicon{background-position:-256px 0}.jstree-default-dark-large>.jstree-no-dots .jstree-node,.jstree-default-dark-large>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-large>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px 0}.jstree-default-dark-large>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 0}.jstree-default-dark-large .jstree-disabled{background:transparent}.jstree-default-dark-large .jstree-disabled.jstree-hovered{background:transparent}.jstree-default-dark-large .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-dark-large .jstree-checkbox{background-position:-160px 0}.jstree-default-dark-large .jstree-checkbox:hover{background-position:-160px -32px}.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-large .jstree-checked>.jstree-checkbox{background-position:-224px 0}.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-large .jstree-checked>.jstree-checkbox:hover{background-position:-224px -32px}.jstree-default-dark-large .jstree-anchor>.jstree-undetermined{background-position:-192px 0}.jstree-default-dark-large .jstree-anchor>.jstree-undetermined:hover{background-position:-192px -32px}.jstree-default-dark-large .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark-large>.jstree-striped{background-size:auto 64px}.jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default-dark-large.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-large.jstree-rtl .jstree-open>.jstree-ocl{background-position:-128px -32px}.jstree-default-dark-large.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-96px -32px}.jstree-default-dark-large.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-64px -32px}.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px -32px}.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 -32px}.jstree-default-dark-large .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark-large>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default-dark-large .jstree-file{background:url("32px.png") -96px -64px no-repeat}.jstree-default-dark-large .jstree-folder{background:url("32px.png") -256px 0 no-repeat}.jstree-default-dark-large>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-dark-large{line-height:32px;padding:0 4px}#jstree-dnd.jstree-default-dark-large .jstree-ok,#jstree-dnd.jstree-default-dark-large .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-dark-large i{background:transparent;width:32px;height:32px;line-height:32px}#jstree-dnd.jstree-default-dark-large .jstree-ok{background-position:0 -64px}#jstree-dnd.jstree-default-dark-large .jstree-er{background-position:-32px -64px}.jstree-default-dark-large .jstree-ellipsis{overflow:hidden}.jstree-default-dark-large .jstree-ellipsis .jstree-anchor{width:calc(100% - 37px);text-overflow:ellipsis;overflow:hidden}.jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==")}.jstree-default-dark-large.jstree-rtl .jstree-last{background:transparent}@media (max-width:768px){#jstree-dnd.jstree-dnd-responsive{line-height:40px;font-weight:bold;font-size:1.1em;text-shadow:1px 1px white}#jstree-dnd.jstree-dnd-responsive>i{background:transparent;width:40px;height:40px}#jstree-dnd.jstree-dnd-responsive>.jstree-ok{background-image:url("40px.png");background-position:0 -200px;background-size:120px 240px}#jstree-dnd.jstree-dnd-responsive>.jstree-er{background-image:url("40px.png");background-position:-40px -200px;background-size:120px 240px}#jstree-marker.jstree-dnd-responsive{border-left-width:10px;border-top-width:10px;border-bottom-width:10px;margin-top:-10px}}@media (max-width:768px){.jstree-default-dark-responsive .jstree-icon{background-image:url("40px.png")}.jstree-default-dark-responsive .jstree-node,.jstree-default-dark-responsive .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-responsive .jstree-node{min-height:40px;line-height:40px;margin-left:40px;min-width:40px;white-space:nowrap}.jstree-default-dark-responsive .jstree-anchor{line-height:40px;height:40px}.jstree-default-dark-responsive .jstree-icon,.jstree-default-dark-responsive .jstree-icon:empty{width:40px;height:40px;line-height:40px}.jstree-default-dark-responsive>.jstree-container-ul>.jstree-node{margin-left:0}.jstree-default-dark-responsive.jstree-rtl .jstree-node{margin-left:0;margin-right:40px;background:transparent}.jstree-default-dark-responsive.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-default-dark-responsive .jstree-ocl,.jstree-default-dark-responsive .jstree-themeicon,.jstree-default-dark-responsive .jstree-checkbox{background-size:120px 240px}.jstree-default-dark-responsive .jstree-leaf>.jstree-ocl,.jstree-default-dark-responsive.jstree-rtl .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-dark-responsive .jstree-open>.jstree-ocl{background-position:0 0 !important}.jstree-default-dark-responsive .jstree-closed>.jstree-ocl{background-position:0 -40px !important}.jstree-default-dark-responsive.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-40px 0 !important}.jstree-default-dark-responsive .jstree-themeicon{background-position:-40px -40px}.jstree-default-dark-responsive .jstree-checkbox,.jstree-default-dark-responsive .jstree-checkbox:hover{background-position:-40px -80px}.jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-responsive .jstree-checked>.jstree-checkbox,.jstree-default-dark-responsive .jstree-checked>.jstree-checkbox:hover{background-position:0 -80px}.jstree-default-dark-responsive .jstree-anchor>.jstree-undetermined,.jstree-default-dark-responsive .jstree-anchor>.jstree-undetermined:hover{background-position:0 -120px}.jstree-default-dark-responsive .jstree-anchor{font-weight:bold;font-size:1.1em;text-shadow:1px 1px white}.jstree-default-dark-responsive>.jstree-striped{background:transparent}.jstree-default-dark-responsive .jstree-wholerow{border-top:1px solid #666;border-bottom:1px solid #000;background:#333333;height:40px}.jstree-default-dark-responsive .jstree-wholerow-hovered{background:#555}.jstree-default-dark-responsive .jstree-wholerow-clicked{background:#5fa2db}.jstree-default-dark-responsive .jstree-children .jstree-last>.jstree-wholerow{box-shadow:inset 0 -6px 3px -5px #111111}.jstree-default-dark-responsive .jstree-children .jstree-open>.jstree-wholerow{box-shadow:inset 0 6px 3px -5px #111111;border-top:0}.jstree-default-dark-responsive .jstree-children .jstree-open+.jstree-open{box-shadow:none}.jstree-default-dark-responsive .jstree-node,.jstree-default-dark-responsive .jstree-icon,.jstree-default-dark-responsive .jstree-node>.jstree-ocl,.jstree-default-dark-responsive .jstree-themeicon,.jstree-default-dark-responsive .jstree-checkbox{background-image:url("40px.png");background-size:120px 240px}.jstree-default-dark-responsive .jstree-node{background-position:-80px 0;background-repeat:repeat-y}.jstree-default-dark-responsive .jstree-last{background:transparent}.jstree-default-dark-responsive .jstree-leaf>.jstree-ocl{background-position:-40px -120px}.jstree-default-dark-responsive .jstree-last>.jstree-ocl{background-position:-40px -160px}.jstree-default-dark-responsive .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-dark-responsive .jstree-file{background:url("40px.png") 0 -160px no-repeat;background-size:120px 240px}.jstree-default-dark-responsive .jstree-folder{background:url("40px.png") -40px -40px no-repeat;background-size:120px 240px}.jstree-default-dark-responsive>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}}.jstree-default-dark{background:#333}.jstree-default-dark .jstree-anchor{color:#999;text-shadow:1px 1px 0 rgba(0,0,0,0.5)}.jstree-default-dark .jstree-clicked,.jstree-default-dark .jstree-checked{color:white}.jstree-default-dark .jstree-hovered{color:white}#jstree-marker.jstree-default-dark{border-left-color:#999;background:transparent}.jstree-default-dark .jstree-anchor>.jstree-icon{opacity:.75}.jstree-default-dark .jstree-clicked>.jstree-icon,.jstree-default-dark .jstree-hovered>.jstree-icon,.jstree-default-dark .jstree-checked>.jstree-icon{opacity:1}.jstree-default-dark.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==")}.jstree-default-dark.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==")}.jstree-default-dark-small.jstree-rtl .jstree-last{background:transparent}.jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==")}.jstree-default-dark-large.jstree-rtl .jstree-last{background:transparent} \ No newline at end of file diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/throbber.gif b/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/throbber.gif deleted file mode 100644 index c6a1c851..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/default-dark/throbber.gif and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/default/32px.png b/src/main/webapp/resources/3rd-party/jstree/themes/default/32px.png deleted file mode 100644 index 4357b910..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/default/32px.png and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/default/40px.png b/src/main/webapp/resources/3rd-party/jstree/themes/default/40px.png deleted file mode 100644 index d0255223..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/default/40px.png and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/default/style.css b/src/main/webapp/resources/3rd-party/jstree/themes/default/style.css deleted file mode 100644 index 0703168b..00000000 --- a/src/main/webapp/resources/3rd-party/jstree/themes/default/style.css +++ /dev/null @@ -1,1102 +0,0 @@ -/* jsTree default theme */ -.jstree-node, -.jstree-children, -.jstree-container-ul { - display: block; - margin: 0; - padding: 0; - list-style-type: none; - list-style-image: none; -} -.jstree-node { - white-space: nowrap; -} -.jstree-anchor { - display: inline-block; - color: black; - white-space: nowrap; - padding: 0 4px 0 1px; - margin: 0; - vertical-align: top; -} -.jstree-anchor:focus { - outline: 0; -} -.jstree-anchor, -.jstree-anchor:link, -.jstree-anchor:visited, -.jstree-anchor:hover, -.jstree-anchor:active { - text-decoration: none; - color: inherit; -} -.jstree-icon { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-icon:empty { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-ocl { - cursor: pointer; -} -.jstree-leaf > .jstree-ocl { - cursor: default; -} -.jstree .jstree-open > .jstree-children { - display: block; -} -.jstree .jstree-closed > .jstree-children, -.jstree .jstree-leaf > .jstree-children { - display: none; -} -.jstree-anchor > .jstree-themeicon { - margin-right: 2px; -} -.jstree-no-icons .jstree-themeicon, -.jstree-anchor > .jstree-themeicon-hidden { - display: none; -} -.jstree-hidden, -.jstree-node.jstree-hidden { - display: none; -} -.jstree-rtl .jstree-anchor { - padding: 0 1px 0 4px; -} -.jstree-rtl .jstree-anchor > .jstree-themeicon { - margin-left: 2px; - margin-right: 0; -} -.jstree-rtl .jstree-node { - margin-left: 0; -} -.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; -} -.jstree-wholerow-ul { - position: relative; - display: inline-block; - min-width: 100%; -} -.jstree-wholerow-ul .jstree-leaf > .jstree-ocl { - cursor: pointer; -} -.jstree-wholerow-ul .jstree-anchor, -.jstree-wholerow-ul .jstree-icon { - position: relative; -} -.jstree-wholerow-ul .jstree-wholerow { - width: 100%; - cursor: pointer; - position: absolute; - left: 0; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.jstree-contextmenu .jstree-anchor { - -webkit-user-select: none; - /* disable selection/Copy of UIWebView */ - -webkit-touch-callout: none; - /* disable the IOS popup when long-press on a link */ -} -.vakata-context { - display: none; -} -.vakata-context, -.vakata-context ul { - margin: 0; - padding: 2px; - position: absolute; - background: #f5f5f5; - border: 1px solid #979797; - box-shadow: 2px 2px 2px #999999; -} -.vakata-context ul { - list-style: none; - left: 100%; - margin-top: -2.7em; - margin-left: -4px; -} -.vakata-context .vakata-context-right ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context li { - list-style: none; -} -.vakata-context li > a { - display: block; - padding: 0 2em 0 2em; - text-decoration: none; - width: auto; - color: black; - white-space: nowrap; - line-height: 2.4em; - text-shadow: 1px 1px 0 white; - border-radius: 1px; -} -.vakata-context li > a:hover { - position: relative; - background-color: #e8eff7; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw=="); - background-position: right center; - background-repeat: no-repeat; -} -.vakata-context li > a:focus { - outline: 0; -} -.vakata-context .vakata-context-hover > a { - position: relative; - background-color: #e8eff7; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context .vakata-context-separator > a, -.vakata-context .vakata-context-separator > a:hover { - background: white; - border: 0; - border-top: 1px solid #e2e3e3; - height: 1px; - min-height: 1px; - max-height: 1px; - padding: 0; - margin: 0 0 0 2.4em; - border-left: 1px solid #e0e0e0; - text-shadow: 0 0 0 transparent; - box-shadow: 0 0 0 transparent; - border-radius: 0; -} -.vakata-context .vakata-contextmenu-disabled a, -.vakata-context .vakata-contextmenu-disabled a:hover { - color: silver; - background-color: transparent; - border: 0; - box-shadow: 0 0 0; -} -.vakata-context .vakata-contextmenu-disabled > a > i { - filter: grayscale(100%); -} -.vakata-context li > a > i { - text-decoration: none; - display: inline-block; - width: 2.4em; - height: 2.4em; - background: transparent; - margin: 0 0 0 -2em; - vertical-align: top; - text-align: center; - line-height: 2.4em; -} -.vakata-context li > a > i:empty { - width: 2.4em; - line-height: 2.4em; -} -.vakata-context li > a .vakata-contextmenu-sep { - display: inline-block; - width: 1px; - height: 2.4em; - background: white; - margin: 0 0.5em 0 0; - border-left: 1px solid #e2e3e3; -} -.vakata-context .vakata-contextmenu-shortcut { - font-size: 0.8em; - color: silver; - opacity: 0.5; - display: none; -} -.vakata-context-rtl ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context-rtl li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7"); - background-position: left center; - background-repeat: no-repeat; -} -.vakata-context-rtl .vakata-context-separator > a { - margin: 0 2.4em 0 0; - border-left: 0; - border-right: 1px solid #e2e3e3; -} -.vakata-context-rtl .vakata-context-left ul { - right: auto; - left: 100%; - margin-left: -4px; - margin-right: auto; -} -.vakata-context-rtl li > a > i { - margin: 0 -2em 0 0; -} -.vakata-context-rtl li > a .vakata-contextmenu-sep { - margin: 0 0 0 0.5em; - border-left-color: white; - background: #e2e3e3; -} -#jstree-marker { - position: absolute; - top: 0; - left: 0; - margin: -5px 0 0 0; - padding: 0; - border-right: 0; - border-top: 5px solid transparent; - border-bottom: 5px solid transparent; - border-left: 5px solid; - width: 0; - height: 0; - font-size: 0; - line-height: 0; -} -#jstree-dnd { - line-height: 16px; - margin: 0; - padding: 4px; -} -#jstree-dnd .jstree-icon, -#jstree-dnd .jstree-copy { - display: inline-block; - text-decoration: none; - margin: 0 2px 0 0; - padding: 0; - width: 16px; - height: 16px; -} -#jstree-dnd .jstree-ok { - background: green; -} -#jstree-dnd .jstree-er { - background: red; -} -#jstree-dnd .jstree-copy { - margin: 0 2px 0 2px; -} -.jstree-default .jstree-node, -.jstree-default .jstree-icon { - background-repeat: no-repeat; - background-color: transparent; -} -.jstree-default .jstree-anchor, -.jstree-default .jstree-animated, -.jstree-default .jstree-wholerow { - transition: background-color 0.15s, box-shadow 0.15s; -} -.jstree-default .jstree-hovered { - background: #e7f4f9; - border-radius: 2px; - box-shadow: inset 0 0 1px #cccccc; -} -.jstree-default .jstree-context { - background: #e7f4f9; - border-radius: 2px; - box-shadow: inset 0 0 1px #cccccc; -} -.jstree-default .jstree-clicked { - background: #beebff; - border-radius: 2px; - box-shadow: inset 0 0 1px #999999; -} -.jstree-default .jstree-no-icons .jstree-anchor > .jstree-themeicon { - display: none; -} -.jstree-default .jstree-disabled { - background: transparent; - color: #666666; -} -.jstree-default .jstree-disabled.jstree-hovered { - background: transparent; - box-shadow: none; -} -.jstree-default .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default .jstree-disabled > .jstree-icon { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default .jstree-search { - font-style: italic; - color: #8b0000; - font-weight: bold; -} -.jstree-default .jstree-no-checkboxes .jstree-checkbox { - display: none !important; -} -.jstree-default.jstree-checkbox-no-clicked .jstree-clicked { - background: transparent; - box-shadow: none; -} -.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered { - background: #e7f4f9; -} -.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked { - background: transparent; -} -.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered { - background: #e7f4f9; -} -.jstree-default > .jstree-striped { - min-width: 100%; - display: inline-block; - background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat; -} -.jstree-default > .jstree-wholerow-ul .jstree-hovered, -.jstree-default > .jstree-wholerow-ul .jstree-clicked { - background: transparent; - box-shadow: none; - border-radius: 0; -} -.jstree-default .jstree-wholerow { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} -.jstree-default .jstree-wholerow-hovered { - background: #e7f4f9; -} -.jstree-default .jstree-wholerow-clicked { - background: #beebff; - background: -webkit-linear-gradient(top, #beebff 0%, #a8e4ff 100%); - background: linear-gradient(to bottom, #beebff 0%, #a8e4ff 100%); -} -.jstree-default .jstree-node { - min-height: 24px; - line-height: 24px; - margin-left: 24px; - min-width: 24px; -} -.jstree-default .jstree-anchor { - line-height: 24px; - height: 24px; -} -.jstree-default .jstree-icon { - width: 24px; - height: 24px; - line-height: 24px; -} -.jstree-default .jstree-icon:empty { - width: 24px; - height: 24px; - line-height: 24px; -} -.jstree-default.jstree-rtl .jstree-node { - margin-right: 24px; -} -.jstree-default .jstree-wholerow { - height: 24px; -} -.jstree-default .jstree-node, -.jstree-default .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default .jstree-node { - background-position: -292px -4px; - background-repeat: repeat-y; -} -.jstree-default .jstree-last { - background: transparent; -} -.jstree-default .jstree-open > .jstree-ocl { - background-position: -132px -4px; -} -.jstree-default .jstree-closed > .jstree-ocl { - background-position: -100px -4px; -} -.jstree-default .jstree-leaf > .jstree-ocl { - background-position: -68px -4px; -} -.jstree-default .jstree-themeicon { - background-position: -260px -4px; -} -.jstree-default > .jstree-no-dots .jstree-node, -.jstree-default > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -36px -4px; -} -.jstree-default > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -4px -4px; -} -.jstree-default .jstree-disabled { - background: transparent; -} -.jstree-default .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default .jstree-checkbox { - background-position: -164px -4px; -} -.jstree-default .jstree-checkbox:hover { - background-position: -164px -36px; -} -.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default .jstree-checked > .jstree-checkbox { - background-position: -228px -4px; -} -.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default .jstree-checked > .jstree-checkbox:hover { - background-position: -228px -36px; -} -.jstree-default .jstree-anchor > .jstree-undetermined { - background-position: -196px -4px; -} -.jstree-default .jstree-anchor > .jstree-undetermined:hover { - background-position: -196px -36px; -} -.jstree-default .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default > .jstree-striped { - background-size: auto 48px; -} -.jstree-default.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -132px -36px; -} -.jstree-default.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -100px -36px; -} -.jstree-default.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -68px -36px; -} -.jstree-default.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -36px -36px; -} -.jstree-default.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -4px -36px; -} -.jstree-default .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default .jstree-file { - background: url("32px.png") -100px -68px no-repeat; -} -.jstree-default .jstree-folder { - background: url("32px.png") -260px -4px no-repeat; -} -.jstree-default > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default { - line-height: 24px; - padding: 0 4px; -} -#jstree-dnd.jstree-default .jstree-ok, -#jstree-dnd.jstree-default .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default i { - background: transparent; - width: 24px; - height: 24px; - line-height: 24px; -} -#jstree-dnd.jstree-default .jstree-ok { - background-position: -4px -68px; -} -#jstree-dnd.jstree-default .jstree-er { - background-position: -36px -68px; -} -.jstree-default .jstree-ellipsis { - overflow: hidden; -} -.jstree-default .jstree-ellipsis .jstree-anchor { - width: calc(100% - 29px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); -} -.jstree-default.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-small .jstree-node { - min-height: 18px; - line-height: 18px; - margin-left: 18px; - min-width: 18px; -} -.jstree-default-small .jstree-anchor { - line-height: 18px; - height: 18px; -} -.jstree-default-small .jstree-icon { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-default-small .jstree-icon:empty { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-default-small.jstree-rtl .jstree-node { - margin-right: 18px; -} -.jstree-default-small .jstree-wholerow { - height: 18px; -} -.jstree-default-small .jstree-node, -.jstree-default-small .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-small .jstree-node { - background-position: -295px -7px; - background-repeat: repeat-y; -} -.jstree-default-small .jstree-last { - background: transparent; -} -.jstree-default-small .jstree-open > .jstree-ocl { - background-position: -135px -7px; -} -.jstree-default-small .jstree-closed > .jstree-ocl { - background-position: -103px -7px; -} -.jstree-default-small .jstree-leaf > .jstree-ocl { - background-position: -71px -7px; -} -.jstree-default-small .jstree-themeicon { - background-position: -263px -7px; -} -.jstree-default-small > .jstree-no-dots .jstree-node, -.jstree-default-small > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-small > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -7px; -} -.jstree-default-small > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -7px; -} -.jstree-default-small .jstree-disabled { - background: transparent; -} -.jstree-default-small .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-small .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-small .jstree-checkbox { - background-position: -167px -7px; -} -.jstree-default-small .jstree-checkbox:hover { - background-position: -167px -39px; -} -.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-small .jstree-checked > .jstree-checkbox { - background-position: -231px -7px; -} -.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-small .jstree-checked > .jstree-checkbox:hover { - background-position: -231px -39px; -} -.jstree-default-small .jstree-anchor > .jstree-undetermined { - background-position: -199px -7px; -} -.jstree-default-small .jstree-anchor > .jstree-undetermined:hover { - background-position: -199px -39px; -} -.jstree-default-small .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-small > .jstree-striped { - background-size: auto 36px; -} -.jstree-default-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-small.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -135px -39px; -} -.jstree-default-small.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -103px -39px; -} -.jstree-default-small.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -71px -39px; -} -.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -39px; -} -.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -39px; -} -.jstree-default-small .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-small > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-small .jstree-file { - background: url("32px.png") -103px -71px no-repeat; -} -.jstree-default-small .jstree-folder { - background: url("32px.png") -263px -7px no-repeat; -} -.jstree-default-small > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-small { - line-height: 18px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-small .jstree-ok, -#jstree-dnd.jstree-default-small .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-small i { - background: transparent; - width: 18px; - height: 18px; - line-height: 18px; -} -#jstree-dnd.jstree-default-small .jstree-ok { - background-position: -7px -71px; -} -#jstree-dnd.jstree-default-small .jstree-er { - background-position: -39px -71px; -} -.jstree-default-small .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-small .jstree-ellipsis .jstree-anchor { - width: calc(100% - 23px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); -} -.jstree-default-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-large .jstree-node { - min-height: 32px; - line-height: 32px; - margin-left: 32px; - min-width: 32px; -} -.jstree-default-large .jstree-anchor { - line-height: 32px; - height: 32px; -} -.jstree-default-large .jstree-icon { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-default-large .jstree-icon:empty { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-default-large.jstree-rtl .jstree-node { - margin-right: 32px; -} -.jstree-default-large .jstree-wholerow { - height: 32px; -} -.jstree-default-large .jstree-node, -.jstree-default-large .jstree-icon { - background-image: url("32px.png"); -} -.jstree-default-large .jstree-node { - background-position: -288px 0px; - background-repeat: repeat-y; -} -.jstree-default-large .jstree-last { - background: transparent; -} -.jstree-default-large .jstree-open > .jstree-ocl { - background-position: -128px 0px; -} -.jstree-default-large .jstree-closed > .jstree-ocl { - background-position: -96px 0px; -} -.jstree-default-large .jstree-leaf > .jstree-ocl { - background-position: -64px 0px; -} -.jstree-default-large .jstree-themeicon { - background-position: -256px 0px; -} -.jstree-default-large > .jstree-no-dots .jstree-node, -.jstree-default-large > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-large > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px 0px; -} -.jstree-default-large > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px 0px; -} -.jstree-default-large .jstree-disabled { - background: transparent; -} -.jstree-default-large .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-default-large .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-default-large .jstree-checkbox { - background-position: -160px 0px; -} -.jstree-default-large .jstree-checkbox:hover { - background-position: -160px -32px; -} -.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-default-large .jstree-checked > .jstree-checkbox { - background-position: -224px 0px; -} -.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-default-large .jstree-checked > .jstree-checkbox:hover { - background-position: -224px -32px; -} -.jstree-default-large .jstree-anchor > .jstree-undetermined { - background-position: -192px 0px; -} -.jstree-default-large .jstree-anchor > .jstree-undetermined:hover { - background-position: -192px -32px; -} -.jstree-default-large .jstree-checkbox-disabled { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ */ - filter: gray; - /* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-default-large > .jstree-striped { - background-size: auto 64px; -} -.jstree-default-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-default-large.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-default-large.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -128px -32px; -} -.jstree-default-large.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -96px -32px; -} -.jstree-default-large.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -64px -32px; -} -.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px -32px; -} -.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px -32px; -} -.jstree-default-large .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; -} -.jstree-default-large > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-default-large .jstree-file { - background: url("32px.png") -96px -64px no-repeat; -} -.jstree-default-large .jstree-folder { - background: url("32px.png") -256px 0px no-repeat; -} -.jstree-default-large > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-default-large { - line-height: 32px; - padding: 0 4px; -} -#jstree-dnd.jstree-default-large .jstree-ok, -#jstree-dnd.jstree-default-large .jstree-er { - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-default-large i { - background: transparent; - width: 32px; - height: 32px; - line-height: 32px; -} -#jstree-dnd.jstree-default-large .jstree-ok { - background-position: 0px -64px; -} -#jstree-dnd.jstree-default-large .jstree-er { - background-position: -32px -64px; -} -.jstree-default-large .jstree-ellipsis { - overflow: hidden; -} -.jstree-default-large .jstree-ellipsis .jstree-anchor { - width: calc(100% - 37px); - text-overflow: ellipsis; - overflow: hidden; -} -.jstree-default-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); -} -.jstree-default-large.jstree-rtl .jstree-last { - background: transparent; -} -@media (max-width: 768px) { - #jstree-dnd.jstree-dnd-responsive { - line-height: 40px; - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - #jstree-dnd.jstree-dnd-responsive > i { - background: transparent; - width: 40px; - height: 40px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-ok { - background-image: url("40px.png"); - background-position: 0 -200px; - background-size: 120px 240px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-er { - background-image: url("40px.png"); - background-position: -40px -200px; - background-size: 120px 240px; - } - #jstree-marker.jstree-dnd-responsive { - border-left-width: 10px; - border-top-width: 10px; - border-bottom-width: 10px; - margin-top: -10px; - } -} -@media (max-width: 768px) { - .jstree-default-responsive { - /* - .jstree-open > .jstree-ocl, - .jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; } - */ - } - .jstree-default-responsive .jstree-icon { - background-image: url("40px.png"); - } - .jstree-default-responsive .jstree-node, - .jstree-default-responsive .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-responsive .jstree-node { - min-height: 40px; - line-height: 40px; - margin-left: 40px; - min-width: 40px; - white-space: nowrap; - } - .jstree-default-responsive .jstree-anchor { - line-height: 40px; - height: 40px; - } - .jstree-default-responsive .jstree-icon, - .jstree-default-responsive .jstree-icon:empty { - width: 40px; - height: 40px; - line-height: 40px; - } - .jstree-default-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - } - .jstree-default-responsive.jstree-rtl .jstree-node { - margin-left: 0; - margin-right: 40px; - background: transparent; - } - .jstree-default-responsive.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; - } - .jstree-default-responsive .jstree-ocl, - .jstree-default-responsive .jstree-themeicon, - .jstree-default-responsive .jstree-checkbox { - background-size: 120px 240px; - } - .jstree-default-responsive .jstree-leaf > .jstree-ocl, - .jstree-default-responsive.jstree-rtl .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-default-responsive .jstree-open > .jstree-ocl { - background-position: 0 0 !important; - } - .jstree-default-responsive .jstree-closed > .jstree-ocl { - background-position: 0 -40px !important; - } - .jstree-default-responsive.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -40px 0 !important; - } - .jstree-default-responsive .jstree-themeicon { - background-position: -40px -40px; - } - .jstree-default-responsive .jstree-checkbox, - .jstree-default-responsive .jstree-checkbox:hover { - background-position: -40px -80px; - } - .jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, - .jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, - .jstree-default-responsive .jstree-checked > .jstree-checkbox, - .jstree-default-responsive .jstree-checked > .jstree-checkbox:hover { - background-position: 0 -80px; - } - .jstree-default-responsive .jstree-anchor > .jstree-undetermined, - .jstree-default-responsive .jstree-anchor > .jstree-undetermined:hover { - background-position: 0 -120px; - } - .jstree-default-responsive .jstree-anchor { - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - .jstree-default-responsive > .jstree-striped { - background: transparent; - } - .jstree-default-responsive .jstree-wholerow { - border-top: 1px solid rgba(255, 255, 255, 0.7); - border-bottom: 1px solid rgba(64, 64, 64, 0.2); - background: #ebebeb; - height: 40px; - } - .jstree-default-responsive .jstree-wholerow-hovered { - background: #e7f4f9; - } - .jstree-default-responsive .jstree-wholerow-clicked { - background: #beebff; - } - .jstree-default-responsive .jstree-children .jstree-last > .jstree-wholerow { - box-shadow: inset 0 -6px 3px -5px #666666; - } - .jstree-default-responsive .jstree-children .jstree-open > .jstree-wholerow { - box-shadow: inset 0 6px 3px -5px #666666; - border-top: 0; - } - .jstree-default-responsive .jstree-children .jstree-open + .jstree-open { - box-shadow: none; - } - .jstree-default-responsive .jstree-node, - .jstree-default-responsive .jstree-icon, - .jstree-default-responsive .jstree-node > .jstree-ocl, - .jstree-default-responsive .jstree-themeicon, - .jstree-default-responsive .jstree-checkbox { - background-image: url("40px.png"); - background-size: 120px 240px; - } - .jstree-default-responsive .jstree-node { - background-position: -80px 0; - background-repeat: repeat-y; - } - .jstree-default-responsive .jstree-last { - background: transparent; - } - .jstree-default-responsive .jstree-leaf > .jstree-ocl { - background-position: -40px -120px; - } - .jstree-default-responsive .jstree-last > .jstree-ocl { - background-position: -40px -160px; - } - .jstree-default-responsive .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; - } - .jstree-default-responsive .jstree-file { - background: url("40px.png") 0 -160px no-repeat; - background-size: 120px 240px; - } - .jstree-default-responsive .jstree-folder { - background: url("40px.png") -40px -40px no-repeat; - background-size: 120px 240px; - } - .jstree-default-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; - } -} diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/default/style.min.css b/src/main/webapp/resources/3rd-party/jstree/themes/default/style.min.css deleted file mode 100644 index 93f80e91..00000000 --- a/src/main/webapp/resources/3rd-party/jstree/themes/default/style.min.css +++ /dev/null @@ -1 +0,0 @@ -.jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:black;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-icon:empty{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-ocl{cursor:pointer}.jstree-leaf>.jstree-ocl{cursor:default}.jstree .jstree-open>.jstree-children{display:block}.jstree .jstree-closed>.jstree-children,.jstree .jstree-leaf>.jstree-children{display:none}.jstree-anchor>.jstree-themeicon{margin-right:2px}.jstree-no-icons .jstree-themeicon,.jstree-anchor>.jstree-themeicon-hidden{display:none}.jstree-hidden,.jstree-node.jstree-hidden{display:none}.jstree-rtl .jstree-anchor{padding:0 1px 0 4px}.jstree-rtl .jstree-anchor>.jstree-themeicon{margin-left:2px;margin-right:0}.jstree-rtl .jstree-node{margin-left:0}.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-wholerow-ul{position:relative;display:inline-block;min-width:100%}.jstree-wholerow-ul .jstree-leaf>.jstree-ocl{cursor:pointer}.jstree-wholerow-ul .jstree-anchor,.jstree-wholerow-ul .jstree-icon{position:relative}.jstree-wholerow-ul .jstree-wholerow{width:100%;cursor:pointer;position:absolute;left:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.jstree-contextmenu .jstree-anchor{-webkit-user-select:none;-webkit-touch-callout:none}.vakata-context{display:none}.vakata-context,.vakata-context ul{margin:0;padding:2px;position:absolute;background:#f5f5f5;border:1px solid #979797;box-shadow:2px 2px 2px #999999}.vakata-context ul{list-style:none;left:100%;margin-top:-2.7em;margin-left:-4px}.vakata-context .vakata-context-right ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context li{list-style:none}.vakata-context li>a{display:block;padding:0 2em 0 2em;text-decoration:none;width:auto;color:black;white-space:nowrap;line-height:2.4em;text-shadow:1px 1px 0 white;border-radius:1px}.vakata-context li>a:hover{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==");background-position:right center;background-repeat:no-repeat}.vakata-context li>a:focus{outline:0}.vakata-context .vakata-context-hover>a{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context .vakata-context-separator>a,.vakata-context .vakata-context-separator>a:hover{background:white;border:0;border-top:1px solid #e2e3e3;height:1px;min-height:1px;max-height:1px;padding:0;margin:0 0 0 2.4em;border-left:1px solid #e0e0e0;text-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;border-radius:0}.vakata-context .vakata-contextmenu-disabled a,.vakata-context .vakata-contextmenu-disabled a:hover{color:silver;background-color:transparent;border:0;box-shadow:0 0 0}.vakata-context .vakata-contextmenu-disabled>a>i{filter:grayscale(100%)}.vakata-context li>a>i{text-decoration:none;display:inline-block;width:2.4em;height:2.4em;background:transparent;margin:0 0 0 -2em;vertical-align:top;text-align:center;line-height:2.4em}.vakata-context li>a>i:empty{width:2.4em;line-height:2.4em}.vakata-context li>a .vakata-contextmenu-sep{display:inline-block;width:1px;height:2.4em;background:white;margin:0 .5em 0 0;border-left:1px solid #e2e3e3}.vakata-context .vakata-contextmenu-shortcut{font-size:.8em;color:silver;opacity:.5;display:none}.vakata-context-rtl ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context-rtl li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");background-position:left center;background-repeat:no-repeat}.vakata-context-rtl .vakata-context-separator>a{margin:0 2.4em 0 0;border-left:0;border-right:1px solid #e2e3e3}.vakata-context-rtl .vakata-context-left ul{right:auto;left:100%;margin-left:-4px;margin-right:auto}.vakata-context-rtl li>a>i{margin:0 -2em 0 0}.vakata-context-rtl li>a .vakata-contextmenu-sep{margin:0 0 0 .5em;border-left-color:white;background:#e2e3e3}#jstree-marker{position:absolute;top:0;left:0;margin:-5px 0 0 0;padding:0;border-right:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid;width:0;height:0;font-size:0;line-height:0}#jstree-dnd{line-height:16px;margin:0;padding:4px}#jstree-dnd .jstree-icon,#jstree-dnd .jstree-copy{display:inline-block;text-decoration:none;margin:0 2px 0 0;padding:0;width:16px;height:16px}#jstree-dnd .jstree-ok{background:green}#jstree-dnd .jstree-er{background:red}#jstree-dnd .jstree-copy{margin:0 2px 0 2px}.jstree-default .jstree-node,.jstree-default .jstree-icon{background-repeat:no-repeat;background-color:transparent}.jstree-default .jstree-anchor,.jstree-default .jstree-animated,.jstree-default .jstree-wholerow{transition:background-color .15s,box-shadow .15s}.jstree-default .jstree-hovered{background:#e7f4f9;border-radius:2px;box-shadow:inset 0 0 1px #cccccc}.jstree-default .jstree-context{background:#e7f4f9;border-radius:2px;box-shadow:inset 0 0 1px #cccccc}.jstree-default .jstree-clicked{background:#beebff;border-radius:2px;box-shadow:inset 0 0 1px #999999}.jstree-default .jstree-no-icons .jstree-anchor>.jstree-themeicon{display:none}.jstree-default .jstree-disabled{background:transparent;color:#666666}.jstree-default .jstree-disabled.jstree-hovered{background:transparent;box-shadow:none}.jstree-default .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default .jstree-disabled>.jstree-icon{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default .jstree-search{font-style:italic;color:#8b0000;font-weight:bold}.jstree-default .jstree-no-checkboxes .jstree-checkbox{display:none !important}.jstree-default.jstree-checkbox-no-clicked .jstree-clicked{background:transparent;box-shadow:none}.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered{background:#e7f4f9}.jstree-default.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked{background:transparent}.jstree-default.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered{background:#e7f4f9}.jstree-default>.jstree-striped{min-width:100%;display:inline-block;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat}.jstree-default>.jstree-wholerow-ul .jstree-hovered,.jstree-default>.jstree-wholerow-ul .jstree-clicked{background:transparent;box-shadow:none;border-radius:0}.jstree-default .jstree-wholerow{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.jstree-default .jstree-wholerow-hovered{background:#e7f4f9}.jstree-default .jstree-wholerow-clicked{background:#beebff;background:-webkit-linear-gradient(top, #beebff 0, #a8e4ff 100%);background:linear-gradient(to bottom, #beebff 0, #a8e4ff 100%)}.jstree-default .jstree-node{min-height:24px;line-height:24px;margin-left:24px;min-width:24px}.jstree-default .jstree-anchor{line-height:24px;height:24px}.jstree-default .jstree-icon{width:24px;height:24px;line-height:24px}.jstree-default .jstree-icon:empty{width:24px;height:24px;line-height:24px}.jstree-default.jstree-rtl .jstree-node{margin-right:24px}.jstree-default .jstree-wholerow{height:24px}.jstree-default .jstree-node,.jstree-default .jstree-icon{background-image:url("32px.png")}.jstree-default .jstree-node{background-position:-292px -4px;background-repeat:repeat-y}.jstree-default .jstree-last{background:transparent}.jstree-default .jstree-open>.jstree-ocl{background-position:-132px -4px}.jstree-default .jstree-closed>.jstree-ocl{background-position:-100px -4px}.jstree-default .jstree-leaf>.jstree-ocl{background-position:-68px -4px}.jstree-default .jstree-themeicon{background-position:-260px -4px}.jstree-default>.jstree-no-dots .jstree-node,.jstree-default>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -4px}.jstree-default>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -4px}.jstree-default .jstree-disabled{background:transparent}.jstree-default .jstree-disabled.jstree-hovered{background:transparent}.jstree-default .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default .jstree-checkbox{background-position:-164px -4px}.jstree-default .jstree-checkbox:hover{background-position:-164px -36px}.jstree-default.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default .jstree-checked>.jstree-checkbox{background-position:-228px -4px}.jstree-default.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default .jstree-checked>.jstree-checkbox:hover{background-position:-228px -36px}.jstree-default .jstree-anchor>.jstree-undetermined{background-position:-196px -4px}.jstree-default .jstree-anchor>.jstree-undetermined:hover{background-position:-196px -36px}.jstree-default .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default>.jstree-striped{background-size:auto 48px}.jstree-default.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default.jstree-rtl .jstree-last{background:transparent}.jstree-default.jstree-rtl .jstree-open>.jstree-ocl{background-position:-132px -36px}.jstree-default.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-100px -36px}.jstree-default.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-68px -36px}.jstree-default.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -36px}.jstree-default.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -36px}.jstree-default .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default .jstree-file{background:url("32px.png") -100px -68px no-repeat}.jstree-default .jstree-folder{background:url("32px.png") -260px -4px no-repeat}.jstree-default>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default{line-height:24px;padding:0 4px}#jstree-dnd.jstree-default .jstree-ok,#jstree-dnd.jstree-default .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default i{background:transparent;width:24px;height:24px;line-height:24px}#jstree-dnd.jstree-default .jstree-ok{background-position:-4px -68px}#jstree-dnd.jstree-default .jstree-er{background-position:-36px -68px}.jstree-default .jstree-ellipsis{overflow:hidden}.jstree-default .jstree-ellipsis .jstree-anchor{width:calc(100% - 29px);text-overflow:ellipsis;overflow:hidden}.jstree-default.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==")}.jstree-default.jstree-rtl .jstree-last{background:transparent}.jstree-default-small .jstree-node{min-height:18px;line-height:18px;margin-left:18px;min-width:18px}.jstree-default-small .jstree-anchor{line-height:18px;height:18px}.jstree-default-small .jstree-icon{width:18px;height:18px;line-height:18px}.jstree-default-small .jstree-icon:empty{width:18px;height:18px;line-height:18px}.jstree-default-small.jstree-rtl .jstree-node{margin-right:18px}.jstree-default-small .jstree-wholerow{height:18px}.jstree-default-small .jstree-node,.jstree-default-small .jstree-icon{background-image:url("32px.png")}.jstree-default-small .jstree-node{background-position:-295px -7px;background-repeat:repeat-y}.jstree-default-small .jstree-last{background:transparent}.jstree-default-small .jstree-open>.jstree-ocl{background-position:-135px -7px}.jstree-default-small .jstree-closed>.jstree-ocl{background-position:-103px -7px}.jstree-default-small .jstree-leaf>.jstree-ocl{background-position:-71px -7px}.jstree-default-small .jstree-themeicon{background-position:-263px -7px}.jstree-default-small>.jstree-no-dots .jstree-node,.jstree-default-small>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-small>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -7px}.jstree-default-small>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -7px}.jstree-default-small .jstree-disabled{background:transparent}.jstree-default-small .jstree-disabled.jstree-hovered{background:transparent}.jstree-default-small .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-small .jstree-checkbox{background-position:-167px -7px}.jstree-default-small .jstree-checkbox:hover{background-position:-167px -39px}.jstree-default-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-small .jstree-checked>.jstree-checkbox{background-position:-231px -7px}.jstree-default-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-small .jstree-checked>.jstree-checkbox:hover{background-position:-231px -39px}.jstree-default-small .jstree-anchor>.jstree-undetermined{background-position:-199px -7px}.jstree-default-small .jstree-anchor>.jstree-undetermined:hover{background-position:-199px -39px}.jstree-default-small .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-small>.jstree-striped{background-size:auto 36px}.jstree-default-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default-small.jstree-rtl .jstree-last{background:transparent}.jstree-default-small.jstree-rtl .jstree-open>.jstree-ocl{background-position:-135px -39px}.jstree-default-small.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-103px -39px}.jstree-default-small.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-71px -39px}.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -39px}.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -39px}.jstree-default-small .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-small>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default-small .jstree-file{background:url("32px.png") -103px -71px no-repeat}.jstree-default-small .jstree-folder{background:url("32px.png") -263px -7px no-repeat}.jstree-default-small>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-small{line-height:18px;padding:0 4px}#jstree-dnd.jstree-default-small .jstree-ok,#jstree-dnd.jstree-default-small .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-small i{background:transparent;width:18px;height:18px;line-height:18px}#jstree-dnd.jstree-default-small .jstree-ok{background-position:-7px -71px}#jstree-dnd.jstree-default-small .jstree-er{background-position:-39px -71px}.jstree-default-small .jstree-ellipsis{overflow:hidden}.jstree-default-small .jstree-ellipsis .jstree-anchor{width:calc(100% - 23px);text-overflow:ellipsis;overflow:hidden}.jstree-default-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==")}.jstree-default-small.jstree-rtl .jstree-last{background:transparent}.jstree-default-large .jstree-node{min-height:32px;line-height:32px;margin-left:32px;min-width:32px}.jstree-default-large .jstree-anchor{line-height:32px;height:32px}.jstree-default-large .jstree-icon{width:32px;height:32px;line-height:32px}.jstree-default-large .jstree-icon:empty{width:32px;height:32px;line-height:32px}.jstree-default-large.jstree-rtl .jstree-node{margin-right:32px}.jstree-default-large .jstree-wholerow{height:32px}.jstree-default-large .jstree-node,.jstree-default-large .jstree-icon{background-image:url("32px.png")}.jstree-default-large .jstree-node{background-position:-288px 0;background-repeat:repeat-y}.jstree-default-large .jstree-last{background:transparent}.jstree-default-large .jstree-open>.jstree-ocl{background-position:-128px 0}.jstree-default-large .jstree-closed>.jstree-ocl{background-position:-96px 0}.jstree-default-large .jstree-leaf>.jstree-ocl{background-position:-64px 0}.jstree-default-large .jstree-themeicon{background-position:-256px 0}.jstree-default-large>.jstree-no-dots .jstree-node,.jstree-default-large>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-large>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px 0}.jstree-default-large>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 0}.jstree-default-large .jstree-disabled{background:transparent}.jstree-default-large .jstree-disabled.jstree-hovered{background:transparent}.jstree-default-large .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-large .jstree-checkbox{background-position:-160px 0}.jstree-default-large .jstree-checkbox:hover{background-position:-160px -32px}.jstree-default-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-large .jstree-checked>.jstree-checkbox{background-position:-224px 0}.jstree-default-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-large .jstree-checked>.jstree-checkbox:hover{background-position:-224px -32px}.jstree-default-large .jstree-anchor>.jstree-undetermined{background-position:-192px 0}.jstree-default-large .jstree-anchor>.jstree-undetermined:hover{background-position:-192px -32px}.jstree-default-large .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-large>.jstree-striped{background-size:auto 64px}.jstree-default-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-default-large.jstree-rtl .jstree-last{background:transparent}.jstree-default-large.jstree-rtl .jstree-open>.jstree-ocl{background-position:-128px -32px}.jstree-default-large.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-96px -32px}.jstree-default-large.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-64px -32px}.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px -32px}.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 -32px}.jstree-default-large .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-large>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat}.jstree-default-large .jstree-file{background:url("32px.png") -96px -64px no-repeat}.jstree-default-large .jstree-folder{background:url("32px.png") -256px 0 no-repeat}.jstree-default-large>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-default-large{line-height:32px;padding:0 4px}#jstree-dnd.jstree-default-large .jstree-ok,#jstree-dnd.jstree-default-large .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-default-large i{background:transparent;width:32px;height:32px;line-height:32px}#jstree-dnd.jstree-default-large .jstree-ok{background-position:0 -64px}#jstree-dnd.jstree-default-large .jstree-er{background-position:-32px -64px}.jstree-default-large .jstree-ellipsis{overflow:hidden}.jstree-default-large .jstree-ellipsis .jstree-anchor{width:calc(100% - 37px);text-overflow:ellipsis;overflow:hidden}.jstree-default-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==")}.jstree-default-large.jstree-rtl .jstree-last{background:transparent}@media (max-width:768px){#jstree-dnd.jstree-dnd-responsive{line-height:40px;font-weight:bold;font-size:1.1em;text-shadow:1px 1px white}#jstree-dnd.jstree-dnd-responsive>i{background:transparent;width:40px;height:40px}#jstree-dnd.jstree-dnd-responsive>.jstree-ok{background-image:url("40px.png");background-position:0 -200px;background-size:120px 240px}#jstree-dnd.jstree-dnd-responsive>.jstree-er{background-image:url("40px.png");background-position:-40px -200px;background-size:120px 240px}#jstree-marker.jstree-dnd-responsive{border-left-width:10px;border-top-width:10px;border-bottom-width:10px;margin-top:-10px}}@media (max-width:768px){.jstree-default-responsive .jstree-icon{background-image:url("40px.png")}.jstree-default-responsive .jstree-node,.jstree-default-responsive .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-responsive .jstree-node{min-height:40px;line-height:40px;margin-left:40px;min-width:40px;white-space:nowrap}.jstree-default-responsive .jstree-anchor{line-height:40px;height:40px}.jstree-default-responsive .jstree-icon,.jstree-default-responsive .jstree-icon:empty{width:40px;height:40px;line-height:40px}.jstree-default-responsive>.jstree-container-ul>.jstree-node{margin-left:0}.jstree-default-responsive.jstree-rtl .jstree-node{margin-left:0;margin-right:40px;background:transparent}.jstree-default-responsive.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-default-responsive .jstree-ocl,.jstree-default-responsive .jstree-themeicon,.jstree-default-responsive .jstree-checkbox{background-size:120px 240px}.jstree-default-responsive .jstree-leaf>.jstree-ocl,.jstree-default-responsive.jstree-rtl .jstree-leaf>.jstree-ocl{background:transparent}.jstree-default-responsive .jstree-open>.jstree-ocl{background-position:0 0 !important}.jstree-default-responsive .jstree-closed>.jstree-ocl{background-position:0 -40px !important}.jstree-default-responsive.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-40px 0 !important}.jstree-default-responsive .jstree-themeicon{background-position:-40px -40px}.jstree-default-responsive .jstree-checkbox,.jstree-default-responsive .jstree-checkbox:hover{background-position:-40px -80px}.jstree-default-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-responsive .jstree-checked>.jstree-checkbox,.jstree-default-responsive .jstree-checked>.jstree-checkbox:hover{background-position:0 -80px}.jstree-default-responsive .jstree-anchor>.jstree-undetermined,.jstree-default-responsive .jstree-anchor>.jstree-undetermined:hover{background-position:0 -120px}.jstree-default-responsive .jstree-anchor{font-weight:bold;font-size:1.1em;text-shadow:1px 1px white}.jstree-default-responsive>.jstree-striped{background:transparent}.jstree-default-responsive .jstree-wholerow{border-top:1px solid rgba(255,255,255,0.7);border-bottom:1px solid rgba(64,64,64,0.2);background:#ebebeb;height:40px}.jstree-default-responsive .jstree-wholerow-hovered{background:#e7f4f9}.jstree-default-responsive .jstree-wholerow-clicked{background:#beebff}.jstree-default-responsive .jstree-children .jstree-last>.jstree-wholerow{box-shadow:inset 0 -6px 3px -5px #666666}.jstree-default-responsive .jstree-children .jstree-open>.jstree-wholerow{box-shadow:inset 0 6px 3px -5px #666666;border-top:0}.jstree-default-responsive .jstree-children .jstree-open+.jstree-open{box-shadow:none}.jstree-default-responsive .jstree-node,.jstree-default-responsive .jstree-icon,.jstree-default-responsive .jstree-node>.jstree-ocl,.jstree-default-responsive .jstree-themeicon,.jstree-default-responsive .jstree-checkbox{background-image:url("40px.png");background-size:120px 240px}.jstree-default-responsive .jstree-node{background-position:-80px 0;background-repeat:repeat-y}.jstree-default-responsive .jstree-last{background:transparent}.jstree-default-responsive .jstree-leaf>.jstree-ocl{background-position:-40px -120px}.jstree-default-responsive .jstree-last>.jstree-ocl{background-position:-40px -160px}.jstree-default-responsive .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-responsive .jstree-file{background:url("40px.png") 0 -160px no-repeat;background-size:120px 240px}.jstree-default-responsive .jstree-folder{background:url("40px.png") -40px -40px no-repeat;background-size:120px 240px}.jstree-default-responsive>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}} \ No newline at end of file diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/default/throbber.gif b/src/main/webapp/resources/3rd-party/jstree/themes/default/throbber.gif deleted file mode 100644 index 64c8eebb..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/default/throbber.gif and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/30px.png b/src/main/webapp/resources/3rd-party/jstree/themes/proton/30px.png deleted file mode 100644 index 55821540..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/proton/30px.png and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/32px.png b/src/main/webapp/resources/3rd-party/jstree/themes/proton/32px.png deleted file mode 100644 index eb1db46f..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/proton/32px.png and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.eot b/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.eot deleted file mode 100644 index ec01fc36..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.eot and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.svg b/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.svg deleted file mode 100644 index e6308463..00000000 --- a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.svg +++ /dev/null @@ -1,2377 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.ttf b/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.ttf deleted file mode 100644 index ea4ca803..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.ttf and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.woff b/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.woff deleted file mode 100644 index 35ca59ec..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-bold-webfont.woff and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.eot b/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.eot deleted file mode 100644 index e6b9784f..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.eot and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.svg b/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.svg deleted file mode 100644 index f6417b73..00000000 --- a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.svg +++ /dev/null @@ -1,2410 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.ttf b/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.ttf deleted file mode 100644 index e0b6ec33..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.ttf and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.woff b/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.woff deleted file mode 100644 index 0f297dbe..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-extralight-webfont.woff and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.eot b/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.eot deleted file mode 100644 index 5c9e81aa..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.eot and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.svg b/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.svg deleted file mode 100644 index ce508397..00000000 --- a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.svg +++ /dev/null @@ -1,2725 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.ttf b/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.ttf deleted file mode 100644 index f3adc9f1..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.ttf and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.woff b/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.woff deleted file mode 100644 index 47586780..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/proton/fonts/titillium/titilliumweb-regular-webfont.woff and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/style.css b/src/main/webapp/resources/3rd-party/jstree/themes/proton/style.css deleted file mode 100644 index 5df363a1..00000000 --- a/src/main/webapp/resources/3rd-party/jstree/themes/proton/style.css +++ /dev/null @@ -1,1122 +0,0 @@ -/* jsTree default theme */ -.jstree-node, -.jstree-children, -.jstree-container-ul { - display: block; - margin: 0; - padding: 0; - list-style-type: none; - list-style-image: none; -} -.jstree-node { - white-space: nowrap; -} -.jstree-anchor { - display: inline-block; - color: #333; - white-space: nowrap; - padding: 0 4px 0 1px; - margin: 0; - vertical-align: top; -} -.jstree-anchor:focus { - outline: 0; -} -.jstree-anchor, -.jstree-anchor:link, -.jstree-anchor:visited, -.jstree-anchor:hover, -.jstree-anchor:active { - text-decoration: none; - color: inherit; -} -.jstree-icon { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-icon:empty { - display: inline-block; - text-decoration: none; - margin: 0; - padding: 0; - vertical-align: top; - text-align: center; -} -.jstree-ocl { - cursor: pointer; -} -.jstree-leaf > .jstree-ocl { - cursor: default; -} -.jstree .jstree-open > .jstree-children { - display: block; -} -.jstree .jstree-closed > .jstree-children, -.jstree .jstree-leaf > .jstree-children { - display: none; -} -.jstree-anchor > .jstree-themeicon { - margin-right: 2px; -} -.jstree-no-icons .jstree-themeicon, -.jstree-anchor > .jstree-themeicon-hidden { - display: none; -} -.jstree-rtl .jstree-anchor { - padding: 0 1px 0 4px; -} -.jstree-rtl .jstree-anchor > .jstree-themeicon { - margin-left: 2px; - margin-right: 0; -} -.jstree-rtl .jstree-node { - margin-left: 0; -} -.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; -} -.jstree-wholerow-ul { - position: relative; - display: inline-block; - min-width: 100%; -} -.jstree-wholerow-ul .jstree-leaf > .jstree-ocl { - cursor: pointer; -} -.jstree-wholerow-ul .jstree-anchor, -.jstree-wholerow-ul .jstree-icon { - position: relative; -} -.jstree-wholerow-ul .jstree-wholerow { - width: 100%; - cursor: pointer; - position: absolute; - left: 0; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.vakata-context { - display: none; -} -.vakata-context, -.vakata-context ul { - margin: 0; - padding: 2px; - position: absolute; - background: #f5f5f5; - border: 1px solid #979797; - -moz-box-shadow: 5px 5px 4px -4px #666666; - -webkit-box-shadow: 2px 2px 2px #999999; - box-shadow: 2px 2px 2px #999999; -} -.vakata-context ul { - list-style: none; - left: 100%; - margin-top: -2.7em; - margin-left: -4px; -} -.vakata-context .vakata-context-right ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context li { - list-style: none; - display: inline; -} -.vakata-context li > a { - display: block; - padding: 0 2em 0 2em; - text-decoration: none; - width: auto; - color: black; - white-space: nowrap; - line-height: 2.4em; - -moz-text-shadow: 1px 1px 0 white; - -webkit-text-shadow: 1px 1px 0 white; - text-shadow: 1px 1px 0 white; - -moz-border-radius: 1px; - -webkit-border-radius: 1px; - border-radius: 1px; -} -.vakata-context li > a:hover { - position: relative; - background-color: #e8eff7; - -moz-box-shadow: 0 0 2px #0a6aa1; - -webkit-box-shadow: 0 0 2px #0a6aa1; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw=="); - background-position: right center; - background-repeat: no-repeat; -} -.vakata-context li > a:focus { - outline: 0; -} -.vakata-context .vakata-context-hover > a { - position: relative; - background-color: #e8eff7; - -moz-box-shadow: 0 0 2px #0a6aa1; - -webkit-box-shadow: 0 0 2px #0a6aa1; - box-shadow: 0 0 2px #0a6aa1; -} -.vakata-context .vakata-context-separator > a, -.vakata-context .vakata-context-separator > a:hover { - background: white; - border: 0; - border-top: 1px solid #e2e3e3; - height: 1px; - min-height: 1px; - max-height: 1px; - padding: 0; - margin: 0 0 0 2.4em; - border-left: 1px solid #e0e0e0; - -moz-text-shadow: 0 0 0 transparent; - -webkit-text-shadow: 0 0 0 transparent; - text-shadow: 0 0 0 transparent; - -moz-box-shadow: 0 0 0 transparent; - -webkit-box-shadow: 0 0 0 transparent; - box-shadow: 0 0 0 transparent; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; -} -.vakata-context .vakata-contextmenu-disabled a, -.vakata-context .vakata-contextmenu-disabled a:hover { - color: silver; - background-color: transparent; - border: 0; - box-shadow: 0 0 0; -} -.vakata-context li > a > i { - text-decoration: none; - display: inline-block; - width: 2.4em; - height: 2.4em; - background: transparent; - margin: 0 0 0 -2em; - vertical-align: top; - text-align: center; - line-height: 2.4em; -} -.vakata-context li > a > i:empty { - width: 2.4em; - line-height: 2.4em; -} -.vakata-context li > a .vakata-contextmenu-sep { - display: inline-block; - width: 1px; - height: 2.4em; - background: white; - margin: 0 0.5em 0 0; - border-left: 1px solid #e2e3e3; -} -.vakata-context .vakata-contextmenu-shortcut { - font-size: 0.8em; - color: silver; - opacity: 0.5; - display: none; -} -.vakata-context-rtl ul { - left: auto; - right: 100%; - margin-left: auto; - margin-right: -4px; -} -.vakata-context-rtl li > a.vakata-context-parent { - background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7"); - background-position: left center; - background-repeat: no-repeat; -} -.vakata-context-rtl .vakata-context-separator > a { - margin: 0 2.4em 0 0; - border-left: 0; - border-right: 1px solid #e2e3e3; -} -.vakata-context-rtl .vakata-context-left ul { - right: auto; - left: 100%; - margin-left: -4px; - margin-right: auto; -} -.vakata-context-rtl li > a > i { - margin: 0 -2em 0 0; -} -.vakata-context-rtl li > a .vakata-contextmenu-sep { - margin: 0 0 0 0.5em; - border-left-color: white; - background: #e2e3e3; -} -#jstree-marker { - position: absolute; - top: 0; - left: 0; - margin: -5px 0 0 0; - padding: 0; - border-right: 0; - border-top: 5px solid transparent; - border-bottom: 5px solid transparent; - border-left: 5px solid; - width: 0; - height: 0; - font-size: 0; - line-height: 0; -} -#jstree-dnd { - line-height: 16px; - margin: 0; - padding: 4px; -} -#jstree-dnd .jstree-icon, -#jstree-dnd .jstree-copy { - display: inline-block; - text-decoration: none; - margin: 0 2px 0 0; - padding: 0; - width: 16px; - height: 16px; -} -#jstree-dnd .jstree-ok { - background: green; -} -#jstree-dnd .jstree-er { - background: red; -} -#jstree-dnd .jstree-copy { - margin: 0 2px 0 2px; -} -.jstree-proton .jstree-node, -.jstree-proton .jstree-icon { - background-repeat: no-repeat; - background-color: transparent; -} -.jstree-proton .jstree-anchor, -.jstree-proton .jstree-wholerow { - transition: background-color 0.15s, box-shadow 0.15s, color 0.15s; -} -.jstree-proton .jstree-hovered { - background: #76b6ec; - color: #ffffff; - border-radius: 3px; - box-shadow: inset 0 0 1px #76b6ec; -} -.jstree-proton .jstree-clicked { - background: #3392e3; - color: #ffffff; - border-radius: 3px; - box-shadow: inset 0 0 1px #3392e3; -} -.jstree-proton .jstree-no-icons .jstree-anchor > .jstree-themeicon { - display: none; -} -.jstree-proton .jstree-disabled { - background: transparent; - color: #666666; -} -.jstree-proton .jstree-disabled.jstree-hovered { - background: transparent; - box-shadow: none; -} -.jstree-proton .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-proton .jstree-disabled > .jstree-icon { - opacity: 0.8; - filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); - /* Firefox 10+ * -filter: gray; -/* IE6-9 */ - -webkit-filter: grayscale(100%); - /* Chrome 19+ & Safari 6+ */ -} -.jstree-proton .jstree-search { - font-style: italic; - color: #8b0000; - font-weight: bold; -} -.jstree-proton .jstree-no-checkboxes .jstree-checkbox { - display: none !important; -} -.jstree-proton.jstree-checkbox-no-clicked .jstree-clicked { - background: transparent; - color: inherit; - box-shadow: none; -} -.jstree-proton.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered { - background: #76b6ec; - color: #ffffff; -} -.jstree-proton.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked { - background: transparent; - color: inherit; -} -.jstree-proton.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered { - background: #76b6ec; - color: #ffffff; -} -.jstree-proton > .jstree-striped { - background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat; -} -.jstree-proton > .jstree-wholerow-ul .jstree-hovered, -.jstree-proton > .jstree-wholerow-ul .jstree-clicked { - background: transparent; - box-shadow: none; - border-radius: 0; -} -.jstree-proton .jstree-wholerow { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} -.jstree-proton .jstree-wholerow-hovered { - background: #76b6ec; -} -.jstree-proton .jstree-wholerow-clicked { - background: #3392e3; - background: -moz-linear-gradient(top, #3392e3 0%, #3392e3 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #3392e3), color-stop(100%, #3392e3)); - background: -webkit-linear-gradient(top, #3392e3 0%, #3392e3 100%); - background: -o-linear-gradient(top, #3392e3 0%, #3392e3 100%); - background: -ms-linear-gradient(top, #3392e3 0%, #3392e3 100%); - background: linear-gradient(to bottom, #3392e3 0%, #3392e3 100%); - /*filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='@color1', endColorstr='@color2',GradientType=0 );*/ -} -.jstree-proton .jstree-node { - min-height: 22px; - line-height: 22px; - margin-left: 22px; - min-width: 22px; -} -.jstree-proton .jstree-anchor { - line-height: 22px; - margin: 1px 0 2px; - height: 22px; -} -.jstree-proton .jstree-icon { - width: 22px; - height: 22px; - line-height: 22px; -} -.jstree-proton .jstree-icon:empty { - width: 22px; - height: 22px; - line-height: 22px; -} -.jstree-proton.jstree-rtl .jstree-node { - margin-right: 22px; -} -.jstree-proton .jstree-wholerow { - height: 22px; -} -.jstree-proton .jstree-node, -.jstree-proton .jstree-icon { - background-size: 320px 96px; - background-image: url("32px.png"); -} -.jstree-proton .jstree-node { - background-position: -293px -5px; - background-repeat: repeat-y; -} -.jstree-proton .jstree-last { - background: transparent; -} -.jstree-proton .jstree-open > .jstree-ocl { - background-position: -133px -5px; -} -.jstree-proton .jstree-closed > .jstree-ocl { - background-position: -101px -5px; -} -.jstree-proton .jstree-leaf > .jstree-ocl { - background-position: -69px -5px; -} -.jstree-proton .jstree-themeicon { - background-position: -261px -7px; -} -.jstree-proton > .jstree-no-dots .jstree-node, -.jstree-proton > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-proton > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -37px -5px; -} -.jstree-proton > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -5px -5px; -} -.jstree-proton .jstree-disabled { - background: transparent; -} -.jstree-proton .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-proton .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-proton .jstree-checkbox { - background-position: -165px -5px; -} -.jstree-proton .jstree-checkbox:hover { - background-position: -165px -37px; -} -.jstree-proton.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-proton .jstree-checked > .jstree-checkbox { - background-position: -229px -5px; -} -.jstree-proton.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-proton .jstree-checked > .jstree-checkbox:hover { - background-position: -229px -37px; -} -.jstree-proton .jstree-anchor > .jstree-undetermined { - background-position: -197px -5px; -} -.jstree-proton .jstree-anchor > .jstree-undetermined:hover { - background-position: -197px -37px; -} -.jstree-proton > .jstree-striped { - background-size: auto 44px; -} -.jstree-proton.jstree-rtl .jstree-node { - background-size: 320px 96px; - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-proton.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-proton.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -133px -37px; -} -.jstree-proton.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -101px -37px; -} -.jstree-proton.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -69px -37px; -} -.jstree-proton.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-proton.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-proton.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -37px -37px; -} -.jstree-proton.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -5px -37px; -} -.jstree-proton .jstree-themeicon-custom { - background-color: transparent; - background-size: 320px 96px; - background-image: none; - background-position: 0 0; -} -.jstree-proton > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-proton .jstree-file { - background: url("32px.png") -101px -69px no-repeat; -} -.jstree-proton .jstree-folder { - background: url("32px.png") -261px -5px no-repeat; -} -.jstree-proton > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-proton { - line-height: 22px; - padding: 0 4px; -} -#jstree-dnd.jstree-proton .jstree-ok, -#jstree-dnd.jstree-proton .jstree-er { - background-size: 320px 96px; - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-proton i { - background: transparent; - width: 22px; - height: 22px; - line-height: 22px; -} -#jstree-dnd.jstree-proton .jstree-ok { - background-position: -5px -69px; -} -#jstree-dnd.jstree-proton .jstree-er { - background-position: -37px -69px; -} -.jstree-proton.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); -} -.jstree-proton.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-proton-small .jstree-node { - min-height: 18px; - line-height: 18px; - margin-left: 18px; - min-width: 18px; -} -.jstree-proton-small .jstree-anchor { - line-height: 18px; - margin: 1px 0 2px; - height: 18px; -} -.jstree-proton-small .jstree-icon { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-proton-small .jstree-icon:empty { - width: 18px; - height: 18px; - line-height: 18px; -} -.jstree-proton-small.jstree-rtl .jstree-node { - margin-right: 18px; -} -.jstree-proton-small .jstree-wholerow { - height: 18px; -} -.jstree-proton-small .jstree-node, -.jstree-proton-small .jstree-icon { - background-size: 320px 96px; - background-image: url("32px.png"); -} -.jstree-proton-small .jstree-node { - background-position: -295px -7px; - background-repeat: repeat-y; -} -.jstree-proton-small .jstree-last { - background: transparent; -} -.jstree-proton-small .jstree-open > .jstree-ocl { - background-position: -135px -7px; -} -.jstree-proton-small .jstree-closed > .jstree-ocl { - background-position: -103px -7px; -} -.jstree-proton-small .jstree-leaf > .jstree-ocl { - background-position: -71px -7px; -} -.jstree-proton-small .jstree-themeicon { - background-position: -263px -9px; -} -.jstree-proton-small > .jstree-no-dots .jstree-node, -.jstree-proton-small > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-proton-small > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -7px; -} -.jstree-proton-small > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -7px; -} -.jstree-proton-small .jstree-disabled { - background: transparent; -} -.jstree-proton-small .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-proton-small .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-proton-small .jstree-checkbox { - background-position: -167px -7px; -} -.jstree-proton-small .jstree-checkbox:hover { - background-position: -167px -39px; -} -.jstree-proton-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-proton-small .jstree-checked > .jstree-checkbox { - background-position: -231px -7px; -} -.jstree-proton-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-proton-small .jstree-checked > .jstree-checkbox:hover { - background-position: -231px -39px; -} -.jstree-proton-small .jstree-anchor > .jstree-undetermined { - background-position: -199px -7px; -} -.jstree-proton-small .jstree-anchor > .jstree-undetermined:hover { - background-position: -199px -39px; -} -.jstree-proton-small > .jstree-striped { - background-size: auto 36px; -} -.jstree-proton-small.jstree-rtl .jstree-node { - background-size: 320px 96px; - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-proton-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-proton-small.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -135px -39px; -} -.jstree-proton-small.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -103px -39px; -} -.jstree-proton-small.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -71px -39px; -} -.jstree-proton-small.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-proton-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-proton-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -39px -39px; -} -.jstree-proton-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: -7px -39px; -} -.jstree-proton-small .jstree-themeicon-custom { - background-color: transparent; - background-size: 320px 96px; - background-image: none; - background-position: 0 0; -} -.jstree-proton-small > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-proton-small .jstree-file { - background: url("32px.png") -103px -71px no-repeat; -} -.jstree-proton-small .jstree-folder { - background: url("32px.png") -263px -7px no-repeat; -} -.jstree-proton-small > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-proton-small { - line-height: 18px; - padding: 0 4px; -} -#jstree-dnd.jstree-proton-small .jstree-ok, -#jstree-dnd.jstree-proton-small .jstree-er { - background-size: 320px 96px; - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-proton-small i { - background: transparent; - width: 18px; - height: 18px; - line-height: 18px; -} -#jstree-dnd.jstree-proton-small .jstree-ok { - background-position: -7px -71px; -} -#jstree-dnd.jstree-proton-small .jstree-er { - background-position: -39px -71px; -} -.jstree-proton-small.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); -} -.jstree-proton-small.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-proton-large .jstree-node { - min-height: 32px; - line-height: 32px; - margin-left: 32px; - min-width: 32px; -} -.jstree-proton-large .jstree-anchor { - line-height: 32px; - margin: 1px 0 2px; - height: 32px; -} -.jstree-proton-large .jstree-icon { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-proton-large .jstree-icon:empty { - width: 32px; - height: 32px; - line-height: 32px; -} -.jstree-proton-large.jstree-rtl .jstree-node { - margin-right: 32px; -} -.jstree-proton-large .jstree-wholerow { - height: 32px; -} -.jstree-proton-large .jstree-node, -.jstree-proton-large .jstree-icon { - background-size: 320px 96px; - background-image: url("32px.png"); -} -.jstree-proton-large .jstree-node { - background-position: -288px 0px; - background-repeat: repeat-y; -} -.jstree-proton-large .jstree-last { - background: transparent; -} -.jstree-proton-large .jstree-open > .jstree-ocl { - background-position: -128px 0px; -} -.jstree-proton-large .jstree-closed > .jstree-ocl { - background-position: -96px 0px; -} -.jstree-proton-large .jstree-leaf > .jstree-ocl { - background-position: -64px 0px; -} -.jstree-proton-large .jstree-themeicon { - background-position: -256px -2px; -} -.jstree-proton-large > .jstree-no-dots .jstree-node, -.jstree-proton-large > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-proton-large > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px 0px; -} -.jstree-proton-large > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px 0px; -} -.jstree-proton-large .jstree-disabled { - background: transparent; -} -.jstree-proton-large .jstree-disabled.jstree-hovered { - background: transparent; -} -.jstree-proton-large .jstree-disabled.jstree-clicked { - background: #efefef; -} -.jstree-proton-large .jstree-checkbox { - background-position: -160px 0px; -} -.jstree-proton-large .jstree-checkbox:hover { - background-position: -160px -32px; -} -.jstree-proton-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, -.jstree-proton-large .jstree-checked > .jstree-checkbox { - background-position: -224px 0px; -} -.jstree-proton-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, -.jstree-proton-large .jstree-checked > .jstree-checkbox:hover { - background-position: -224px -32px; -} -.jstree-proton-large .jstree-anchor > .jstree-undetermined { - background-position: -192px 0px; -} -.jstree-proton-large .jstree-anchor > .jstree-undetermined:hover { - background-position: -192px -32px; -} -.jstree-proton-large > .jstree-striped { - background-size: auto 64px; -} -.jstree-proton-large.jstree-rtl .jstree-node { - background-size: 320px 96px; - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); - background-position: 100% 1px; - background-repeat: repeat-y; -} -.jstree-proton-large.jstree-rtl .jstree-last { - background: transparent; -} -.jstree-proton-large.jstree-rtl .jstree-open > .jstree-ocl { - background-position: -128px -32px; -} -.jstree-proton-large.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -96px -32px; -} -.jstree-proton-large.jstree-rtl .jstree-leaf > .jstree-ocl { - background-position: -64px -32px; -} -.jstree-proton-large.jstree-rtl > .jstree-no-dots .jstree-node, -.jstree-proton-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { - background: transparent; -} -.jstree-proton-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { - background-position: -32px -32px; -} -.jstree-proton-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { - background-position: 0px -32px; -} -.jstree-proton-large .jstree-themeicon-custom { - background-color: transparent; - background-size: 320px 96px; - background-image: none; - background-position: 0 0; -} -.jstree-proton-large > .jstree-container-ul .jstree-loading > .jstree-ocl { - background: url("throbber.gif") center center no-repeat; -} -.jstree-proton-large .jstree-file { - background: url("32px.png") -96px -64px no-repeat; -} -.jstree-proton-large .jstree-folder { - background: url("32px.png") -256px 0px no-repeat; -} -.jstree-proton-large > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; -} -#jstree-dnd.jstree-proton-large { - line-height: 32px; - padding: 0 4px; -} -#jstree-dnd.jstree-proton-large .jstree-ok, -#jstree-dnd.jstree-proton-large .jstree-er { - background-size: 320px 96px; - background-image: url("32px.png"); - background-repeat: no-repeat; - background-color: transparent; -} -#jstree-dnd.jstree-proton-large i { - background: transparent; - width: 32px; - height: 32px; - line-height: 32px; -} -#jstree-dnd.jstree-proton-large .jstree-ok { - background-position: 0px -64px; -} -#jstree-dnd.jstree-proton-large .jstree-er { - background-position: -32px -64px; -} -.jstree-proton-large.jstree-rtl .jstree-node { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); -} -.jstree-proton-large.jstree-rtl .jstree-last { - background: transparent; -} -@media (max-width: 768px) { - #jstree-dnd.jstree-dnd-responsive { - line-height: 30px; - font-weight: bold; - font-size: 1.1em; - text-shadow: 1px 1px white; - } - #jstree-dnd.jstree-dnd-responsive > i { - background: transparent; - width: 30px; - height: 30px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-ok { - background-image: url("30px.png"); - background-position: 0 -150px; - background-size: 90px 180px; - } - #jstree-dnd.jstree-dnd-responsive > .jstree-er { - background-image: url("30px.png"); - background-position: -30px -150px; - background-size: 90px 180px; - } - #jstree-marker.jstree-dnd-responsive { - border-left-width: 10px; - border-top-width: 10px; - border-bottom-width: 10px; - margin-top: -10px; - } -} -@media (max-width: 768px) { - .jstree-proton-responsive { - /* - .jstree-open > .jstree-ocl, - .jstree-closed > .jstree-ocl { - border-radius:20px; - background-color:white; - } - */ - } - .jstree-proton-responsive .jstree-container-ul { - overflow: hidden; - } - .jstree-proton-responsive .jstree-icon { - background-image: url("30px.png"); - background-size: 90px 180px; - } - .jstree-proton-responsive .jstree-node, - .jstree-proton-responsive .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-proton-responsive .jstree-node { - min-height: 30px; - line-height: 30px; - margin-left: 30px; - min-width: 30px; - white-space: nowrap; - } - .jstree-proton-responsive .jstree-anchor { - line-height: 38px; - height: 38px; - margin: 0; - } - .jstree-proton-responsive .jstree-icon, - .jstree-proton-responsive .jstree-icon:empty { - margin-top: 4px; - width: 30px; - height: 30px; - line-height: 30px; - } - .jstree-proton-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - } - .jstree-proton-responsive.jstree-rtl .jstree-node { - margin-left: 0; - margin-right: 30px; - } - .jstree-proton-responsive.jstree-rtl .jstree-container-ul > .jstree-node { - margin-right: 0; - } - .jstree-proton-responsive .jstree-ocl, - .jstree-proton-responsive .jstree-themeicon, - .jstree-proton-responsive .jstree-checkbox { - background-size: 90px 180px; - } - .jstree-proton-responsive .jstree-leaf > .jstree-ocl { - background: transparent; - } - .jstree-proton-responsive .jstree-open > .jstree-ocl { - background-position: 0 0px !important; - } - .jstree-proton-responsive .jstree-closed > .jstree-ocl { - background-position: 0 -30px !important; - } - .jstree-proton-responsive.jstree-rtl .jstree-closed > .jstree-ocl { - background-position: -30px 0px !important; - } - .jstree-proton-responsive .jstree-themeicon { - background-position: -30px -30px; - } - .jstree-proton-responsive .jstree-checkbox, - .jstree-proton-responsive .jstree-checkbox:hover { - background-position: -30px -60px; - } - .jstree-proton-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, - .jstree-proton-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, - .jstree-proton-responsive .jstree-checked > .jstree-checkbox, - .jstree-proton-responsive .jstree-checked > .jstree-checkbox:hover { - background-position: 0 -60px; - } - .jstree-proton-responsive .jstree-anchor > .jstree-undetermined, - .jstree-proton-responsive .jstree-anchor > .jstree-undetermined:hover { - background-position: 0 -90px; - } - .jstree-proton-responsive > .jstree-striped { - background: transparent; - } - .jstree-proton-responsive .jstree-wholerow-ul li { - position: relative; - } - .jstree-proton-responsive .jstree-wholerow-ul .jstree-wholerow { - position: absolute; - top: 0; - left: -1000px; - right: -1000px; - width: auto; - height: 100%; - } - .jstree-proton-responsive .jstree-wholerow { - border-top: 1px solid rgba(0, 0, 0, 0.05); - background: rgba(0, 0, 0, 0.02); - height: 30px; - } - .jstree-proton-responsive .jstree-wholerow-hovered { - background: #76b6ec; - } - .jstree-proton-responsive .jstree-wholerow-clicked { - background: #3392e3; - } - .jstree-proton-responsive .jstree-children .jstree-open + .jstree-open { - box-shadow: none; - } - .jstree-proton-responsive .jstree-node, - .jstree-proton-responsive .jstree-icon, - .jstree-proton-responsive .jstree-node > .jstree-ocl, - .jstree-proton-responsive .jstree-themeicon, - .jstree-proton-responsive .jstree-checkbox { - background-image: url("30px.png"); - background-size: 90px 180px; - } - .jstree-proton-responsive .jstree-node { - background-position: -60px 0; - background-repeat: repeat-y; - } - .jstree-proton-responsive .jstree-last { - background: transparent; - } - .jstree-proton-responsive .jstree-leaf > .jstree-ocl { - background-position: -30px -90px; - } - .jstree-proton-responsive .jstree-last > .jstree-ocl { - background-position: -30px -120px; - } - .jstree-proton-responsive .jstree-themeicon-custom { - background-color: transparent; - background-image: none; - background-position: 0 0; - } - .jstree-proton-responsive .jstree-file { - background: url("30px.png") 0 -120px no-repeat; - background-size: 90px 180px; - } - .jstree-proton-responsive .jstree-folder { - background: url("30px.png") -30px -30px no-repeat; - background-size: 90px 180px; - } - .jstree-proton-responsive > .jstree-container-ul > .jstree-node { - margin-left: 0; - margin-right: 0; - } -} -@font-face { - font-family: 'Titillium Web'; - src: url('fonts/titillium/titilliumweb-extralight-webfont.eot'); - src: url('fonts/titillium/titilliumweb-extralight-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/titillium/titilliumweb-extralight-webfont.woff') format('woff'), url('fonts/titillium/titilliumweb-extralight-webfont.ttf') format('truetype'), url('fonts/titillium/titilliumweb-extralight-webfont.svg#titillium_webthin') format('svg'); - font-weight: 300; - font-style: normal; -} -@font-face { - font-family: 'Titillium Web'; - src: url('fonts/titillium/titilliumweb-regular-webfont.eot'); - src: url('fonts/titillium/titilliumweb-regular-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/titillium/titilliumweb-regular-webfont.woff') format('woff'), url('fonts/titillium/titilliumweb-regular-webfont.ttf') format('truetype'), url('fonts/titillium/titilliumweb-regular-webfont.svg#titillium_webregular') format('svg'); - font-weight: 400; - font-style: normal; -} -@font-face { - font-family: 'Titillium Web'; - src: url('fonts/titillium/titilliumweb-bold-webfont.eot'); - src: url('fonts/titillium/titilliumweb-bold-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/titillium/titilliumweb-bold-webfont.woff') format('woff'), url('fonts/titillium/titilliumweb-bold-webfont.ttf') format('truetype'), url('fonts/titillium/titilliumweb-bold-webfont.svg#titillium_webbold') format('svg'); - font-weight: 700; - font-style: normal; -} -@media screen and (-webkit-min-device-pixel-ratio: 0) { - @font-face { - font-family: 'Titillium Web'; - src: url('fonts/titillium/titilliumweb-extralight-webfont.svg#titillium_webthin') format('svg'); - font-weight: 300; - font-style: normal; - } - @font-face { - font-family: 'Titillium Web'; - src: url('fonts/titillium/titilliumweb-regular-webfont.svg#titillium_webregular') format('svg'); - font-weight: 400; - font-style: normal; - } - @font-face { - font-family: 'Titillium Web'; - src: url('fonts/titillium/titilliumweb-bold-webfont.svg#titillium_webbold') format('svg'); - font-weight: 700; - font-style: normal; - } -} -.jstree-proton { - font-family: 'Titillium Web', sans-serif, Arial, sans-serif; -} diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/style.min.css b/src/main/webapp/resources/3rd-party/jstree/themes/proton/style.min.css deleted file mode 100644 index 5024e5c9..00000000 --- a/src/main/webapp/resources/3rd-party/jstree/themes/proton/style.min.css +++ /dev/null @@ -1 +0,0 @@ -.jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:#333;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-icon:empty{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-ocl{cursor:pointer}.jstree-leaf>.jstree-ocl{cursor:default}.jstree .jstree-open>.jstree-children{display:block}.jstree .jstree-closed>.jstree-children,.jstree .jstree-leaf>.jstree-children{display:none}.jstree-anchor>.jstree-themeicon{margin-right:2px}.jstree-no-icons .jstree-themeicon,.jstree-anchor>.jstree-themeicon-hidden{display:none}.jstree-rtl .jstree-anchor{padding:0 1px 0 4px}.jstree-rtl .jstree-anchor>.jstree-themeicon{margin-left:2px;margin-right:0}.jstree-rtl .jstree-node{margin-left:0}.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-wholerow-ul{position:relative;display:inline-block;min-width:100%}.jstree-wholerow-ul .jstree-leaf>.jstree-ocl{cursor:pointer}.jstree-wholerow-ul .jstree-anchor,.jstree-wholerow-ul .jstree-icon{position:relative}.jstree-wholerow-ul .jstree-wholerow{width:100%;cursor:pointer;position:absolute;left:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vakata-context{display:none}.vakata-context,.vakata-context ul{margin:0;padding:2px;position:absolute;background:#f5f5f5;border:1px solid #979797;-moz-box-shadow:5px 5px 4px -4px #666;-webkit-box-shadow:2px 2px 2px #999;box-shadow:2px 2px 2px #999}.vakata-context ul{list-style:none;left:100%;margin-top:-2.7em;margin-left:-4px}.vakata-context .vakata-context-right ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context li{list-style:none;display:inline}.vakata-context li>a{display:block;padding:0 2em;text-decoration:none;width:auto;color:#000;white-space:nowrap;line-height:2.4em;-moz-text-shadow:1px 1px 0 #fff;-webkit-text-shadow:1px 1px 0 #fff;text-shadow:1px 1px 0 #fff;-moz-border-radius:1px;-webkit-border-radius:1px;border-radius:1px}.vakata-context li>a:hover{position:relative;background-color:#e8eff7;-moz-box-shadow:0 0 2px #0a6aa1;-webkit-box-shadow:0 0 2px #0a6aa1;box-shadow:0 0 2px #0a6aa1}.vakata-context li>a.vakata-context-parent{background-image:url(data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==);background-position:right center;background-repeat:no-repeat}.vakata-context li>a:focus{outline:0}.vakata-context .vakata-context-hover>a{position:relative;background-color:#e8eff7;-moz-box-shadow:0 0 2px #0a6aa1;-webkit-box-shadow:0 0 2px #0a6aa1;box-shadow:0 0 2px #0a6aa1}.vakata-context .vakata-context-separator>a,.vakata-context .vakata-context-separator>a:hover{background:#fff;border:0;border-top:1px solid #e2e3e3;height:1px;min-height:1px;max-height:1px;padding:0;margin:0 0 0 2.4em;border-left:1px solid #e0e0e0;-moz-text-shadow:0 0 0 transparent;-webkit-text-shadow:0 0 0 transparent;text-shadow:0 0 0 transparent;-moz-box-shadow:0 0 0 transparent;-webkit-box-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.vakata-context .vakata-contextmenu-disabled a,.vakata-context .vakata-contextmenu-disabled a:hover{color:silver;background-color:transparent;border:0;box-shadow:0 0 0}.vakata-context li>a>i{text-decoration:none;display:inline-block;width:2.4em;height:2.4em;background:0 0;margin:0 0 0 -2em;vertical-align:top;text-align:center;line-height:2.4em}.vakata-context li>a>i:empty{width:2.4em;line-height:2.4em}.vakata-context li>a .vakata-contextmenu-sep{display:inline-block;width:1px;height:2.4em;background:#fff;margin:0 .5em 0 0;border-left:1px solid #e2e3e3}.vakata-context .vakata-contextmenu-shortcut{font-size:.8em;color:silver;opacity:.5;display:none}.vakata-context-rtl ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context-rtl li>a.vakata-context-parent{background-image:url(data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7);background-position:left center;background-repeat:no-repeat}.vakata-context-rtl .vakata-context-separator>a{margin:0 2.4em 0 0;border-left:0;border-right:1px solid #e2e3e3}.vakata-context-rtl .vakata-context-left ul{right:auto;left:100%;margin-left:-4px;margin-right:auto}.vakata-context-rtl li>a>i{margin:0 -2em 0 0}.vakata-context-rtl li>a .vakata-contextmenu-sep{margin:0 0 0 .5em;border-left-color:#fff;background:#e2e3e3}#jstree-marker{position:absolute;top:0;left:0;margin:-5px 0 0 0;padding:0;border-right:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid;width:0;height:0;font-size:0;line-height:0}#jstree-dnd{line-height:16px;margin:0;padding:4px}#jstree-dnd .jstree-icon,#jstree-dnd .jstree-copy{display:inline-block;text-decoration:none;margin:0 2px 0 0;padding:0;width:16px;height:16px}#jstree-dnd .jstree-ok{background:green}#jstree-dnd .jstree-er{background:red}#jstree-dnd .jstree-copy{margin:0 2px}.jstree-proton .jstree-node,.jstree-proton .jstree-icon{background-repeat:no-repeat;background-color:transparent}.jstree-proton .jstree-anchor,.jstree-proton .jstree-wholerow{transition:background-color .15s,box-shadow .15s,color .15s}.jstree-proton .jstree-hovered{background:#76b6ec;color:#fff;border-radius:3px;box-shadow:inset 0 0 1px #76b6ec}.jstree-proton .jstree-clicked{background:#3392e3;color:#fff;border-radius:3px;box-shadow:inset 0 0 1px #3392e3}.jstree-proton .jstree-no-icons .jstree-anchor>.jstree-themeicon{display:none}.jstree-proton .jstree-disabled{background:0 0;color:#666}.jstree-proton .jstree-disabled.jstree-hovered{background:0 0;box-shadow:none}.jstree-proton .jstree-disabled.jstree-clicked{background:#efefef}.jstree-proton .jstree-disabled>.jstree-icon{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");-webkit-filter:grayscale(100%)}.jstree-proton .jstree-search{font-style:italic;color:#8b0000;font-weight:700}.jstree-proton .jstree-no-checkboxes .jstree-checkbox{display:none!important}.jstree-proton.jstree-checkbox-no-clicked .jstree-clicked{background:0 0;color:inherit;box-shadow:none}.jstree-proton.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered{background:#76b6ec;color:#fff}.jstree-proton.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked{background:0 0;color:inherit}.jstree-proton.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered{background:#76b6ec;color:#fff}.jstree-proton>.jstree-striped{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==) left top repeat}.jstree-proton>.jstree-wholerow-ul .jstree-hovered,.jstree-proton>.jstree-wholerow-ul .jstree-clicked{background:0 0;box-shadow:none;border-radius:0}.jstree-proton .jstree-wholerow{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.jstree-proton .jstree-wholerow-hovered{background:#76b6ec}.jstree-proton .jstree-wholerow-clicked{background:#3392e3;background:-moz-linear-gradient(top,#3392e3 0,#3392e3 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#3392e3),color-stop(100%,#3392e3));background:-webkit-linear-gradient(top,#3392e3 0,#3392e3 100%);background:-o-linear-gradient(top,#3392e3 0,#3392e3 100%);background:-ms-linear-gradient(top,#3392e3 0,#3392e3 100%);background:linear-gradient(to bottom,#3392e3 0,#3392e3 100%)}.jstree-proton .jstree-node{min-height:22px;line-height:22px;margin-left:22px;min-width:22px}.jstree-proton .jstree-anchor{line-height:22px;margin:1px 0 2px;height:22px}.jstree-proton .jstree-icon{width:22px;height:22px;line-height:22px}.jstree-proton .jstree-icon:empty{width:22px;height:22px;line-height:22px}.jstree-proton.jstree-rtl .jstree-node{margin-right:22px}.jstree-proton .jstree-wholerow{height:22px}.jstree-proton .jstree-node,.jstree-proton .jstree-icon{background-size:320px 96px;background-image:url(32px.png)}.jstree-proton .jstree-node{background-position:-293px -5px;background-repeat:repeat-y}.jstree-proton .jstree-last{background:0 0}.jstree-proton .jstree-open>.jstree-ocl{background-position:-133px -5px}.jstree-proton .jstree-closed>.jstree-ocl{background-position:-101px -5px}.jstree-proton .jstree-leaf>.jstree-ocl{background-position:-69px -5px}.jstree-proton .jstree-themeicon{background-position:-261px -7px}.jstree-proton>.jstree-no-dots .jstree-node,.jstree-proton>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-proton>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-37px -5px}.jstree-proton>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-5px -5px}.jstree-proton .jstree-disabled{background:0 0}.jstree-proton .jstree-disabled.jstree-hovered{background:0 0}.jstree-proton .jstree-disabled.jstree-clicked{background:#efefef}.jstree-proton .jstree-checkbox{background-position:-165px -5px}.jstree-proton .jstree-checkbox:hover{background-position:-165px -37px}.jstree-proton.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-proton .jstree-checked>.jstree-checkbox{background-position:-229px -5px}.jstree-proton.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-proton .jstree-checked>.jstree-checkbox:hover{background-position:-229px -37px}.jstree-proton .jstree-anchor>.jstree-undetermined{background-position:-197px -5px}.jstree-proton .jstree-anchor>.jstree-undetermined:hover{background-position:-197px -37px}.jstree-proton>.jstree-striped{background-size:auto 44px}.jstree-proton.jstree-rtl .jstree-node{background-size:320px 96px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==);background-position:100% 1px;background-repeat:repeat-y}.jstree-proton.jstree-rtl .jstree-last{background:0 0}.jstree-proton.jstree-rtl .jstree-open>.jstree-ocl{background-position:-133px -37px}.jstree-proton.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-101px -37px}.jstree-proton.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-69px -37px}.jstree-proton.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-proton.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-proton.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-37px -37px}.jstree-proton.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-5px -37px}.jstree-proton .jstree-themeicon-custom{background-color:transparent;background-size:320px 96px;background-image:none;background-position:0 0}.jstree-proton>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url(throbber.gif) center center no-repeat}.jstree-proton .jstree-file{background:url(32px.png) -101px -69px no-repeat}.jstree-proton .jstree-folder{background:url(32px.png) -261px -5px no-repeat}.jstree-proton>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-proton{line-height:22px;padding:0 4px}#jstree-dnd.jstree-proton .jstree-ok,#jstree-dnd.jstree-proton .jstree-er{background-size:320px 96px;background-image:url(32px.png);background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-proton i{background:0 0;width:22px;height:22px;line-height:22px}#jstree-dnd.jstree-proton .jstree-ok{background-position:-5px -69px}#jstree-dnd.jstree-proton .jstree-er{background-position:-37px -69px}.jstree-proton.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==)}.jstree-proton.jstree-rtl .jstree-last{background:0 0}.jstree-proton-small .jstree-node{min-height:18px;line-height:18px;margin-left:18px;min-width:18px}.jstree-proton-small .jstree-anchor{line-height:18px;margin:1px 0 2px;height:18px}.jstree-proton-small .jstree-icon{width:18px;height:18px;line-height:18px}.jstree-proton-small .jstree-icon:empty{width:18px;height:18px;line-height:18px}.jstree-proton-small.jstree-rtl .jstree-node{margin-right:18px}.jstree-proton-small .jstree-wholerow{height:18px}.jstree-proton-small .jstree-node,.jstree-proton-small .jstree-icon{background-size:320px 96px;background-image:url(32px.png)}.jstree-proton-small .jstree-node{background-position:-295px -7px;background-repeat:repeat-y}.jstree-proton-small .jstree-last{background:0 0}.jstree-proton-small .jstree-open>.jstree-ocl{background-position:-135px -7px}.jstree-proton-small .jstree-closed>.jstree-ocl{background-position:-103px -7px}.jstree-proton-small .jstree-leaf>.jstree-ocl{background-position:-71px -7px}.jstree-proton-small .jstree-themeicon{background-position:-263px -9px}.jstree-proton-small>.jstree-no-dots .jstree-node,.jstree-proton-small>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-proton-small>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -7px}.jstree-proton-small>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -7px}.jstree-proton-small .jstree-disabled{background:0 0}.jstree-proton-small .jstree-disabled.jstree-hovered{background:0 0}.jstree-proton-small .jstree-disabled.jstree-clicked{background:#efefef}.jstree-proton-small .jstree-checkbox{background-position:-167px -7px}.jstree-proton-small .jstree-checkbox:hover{background-position:-167px -39px}.jstree-proton-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-proton-small .jstree-checked>.jstree-checkbox{background-position:-231px -7px}.jstree-proton-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-proton-small .jstree-checked>.jstree-checkbox:hover{background-position:-231px -39px}.jstree-proton-small .jstree-anchor>.jstree-undetermined{background-position:-199px -7px}.jstree-proton-small .jstree-anchor>.jstree-undetermined:hover{background-position:-199px -39px}.jstree-proton-small>.jstree-striped{background-size:auto 36px}.jstree-proton-small.jstree-rtl .jstree-node{background-size:320px 96px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==);background-position:100% 1px;background-repeat:repeat-y}.jstree-proton-small.jstree-rtl .jstree-last{background:0 0}.jstree-proton-small.jstree-rtl .jstree-open>.jstree-ocl{background-position:-135px -39px}.jstree-proton-small.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-103px -39px}.jstree-proton-small.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-71px -39px}.jstree-proton-small.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-proton-small.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-proton-small.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -39px}.jstree-proton-small.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -39px}.jstree-proton-small .jstree-themeicon-custom{background-color:transparent;background-size:320px 96px;background-image:none;background-position:0 0}.jstree-proton-small>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url(throbber.gif) center center no-repeat}.jstree-proton-small .jstree-file{background:url(32px.png) -103px -71px no-repeat}.jstree-proton-small .jstree-folder{background:url(32px.png) -263px -7px no-repeat}.jstree-proton-small>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-proton-small{line-height:18px;padding:0 4px}#jstree-dnd.jstree-proton-small .jstree-ok,#jstree-dnd.jstree-proton-small .jstree-er{background-size:320px 96px;background-image:url(32px.png);background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-proton-small i{background:0 0;width:18px;height:18px;line-height:18px}#jstree-dnd.jstree-proton-small .jstree-ok{background-position:-7px -71px}#jstree-dnd.jstree-proton-small .jstree-er{background-position:-39px -71px}.jstree-proton-small.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==)}.jstree-proton-small.jstree-rtl .jstree-last{background:0 0}.jstree-proton-large .jstree-node{min-height:32px;line-height:32px;margin-left:32px;min-width:32px}.jstree-proton-large .jstree-anchor{line-height:32px;margin:1px 0 2px;height:32px}.jstree-proton-large .jstree-icon{width:32px;height:32px;line-height:32px}.jstree-proton-large .jstree-icon:empty{width:32px;height:32px;line-height:32px}.jstree-proton-large.jstree-rtl .jstree-node{margin-right:32px}.jstree-proton-large .jstree-wholerow{height:32px}.jstree-proton-large .jstree-node,.jstree-proton-large .jstree-icon{background-size:320px 96px;background-image:url(32px.png)}.jstree-proton-large .jstree-node{background-position:-288px 0;background-repeat:repeat-y}.jstree-proton-large .jstree-last{background:0 0}.jstree-proton-large .jstree-open>.jstree-ocl{background-position:-128px 0}.jstree-proton-large .jstree-closed>.jstree-ocl{background-position:-96px 0}.jstree-proton-large .jstree-leaf>.jstree-ocl{background-position:-64px 0}.jstree-proton-large .jstree-themeicon{background-position:-256px -2px}.jstree-proton-large>.jstree-no-dots .jstree-node,.jstree-proton-large>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-proton-large>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px 0}.jstree-proton-large>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 0}.jstree-proton-large .jstree-disabled{background:0 0}.jstree-proton-large .jstree-disabled.jstree-hovered{background:0 0}.jstree-proton-large .jstree-disabled.jstree-clicked{background:#efefef}.jstree-proton-large .jstree-checkbox{background-position:-160px 0}.jstree-proton-large .jstree-checkbox:hover{background-position:-160px -32px}.jstree-proton-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-proton-large .jstree-checked>.jstree-checkbox{background-position:-224px 0}.jstree-proton-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-proton-large .jstree-checked>.jstree-checkbox:hover{background-position:-224px -32px}.jstree-proton-large .jstree-anchor>.jstree-undetermined{background-position:-192px 0}.jstree-proton-large .jstree-anchor>.jstree-undetermined:hover{background-position:-192px -32px}.jstree-proton-large>.jstree-striped{background-size:auto 64px}.jstree-proton-large.jstree-rtl .jstree-node{background-size:320px 96px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==);background-position:100% 1px;background-repeat:repeat-y}.jstree-proton-large.jstree-rtl .jstree-last{background:0 0}.jstree-proton-large.jstree-rtl .jstree-open>.jstree-ocl{background-position:-128px -32px}.jstree-proton-large.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-96px -32px}.jstree-proton-large.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-64px -32px}.jstree-proton-large.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-proton-large.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:0 0}.jstree-proton-large.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px -32px}.jstree-proton-large.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 -32px}.jstree-proton-large .jstree-themeicon-custom{background-color:transparent;background-size:320px 96px;background-image:none;background-position:0 0}.jstree-proton-large>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url(throbber.gif) center center no-repeat}.jstree-proton-large .jstree-file{background:url(32px.png) -96px -64px no-repeat}.jstree-proton-large .jstree-folder{background:url(32px.png) -256px 0 no-repeat}.jstree-proton-large>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-proton-large{line-height:32px;padding:0 4px}#jstree-dnd.jstree-proton-large .jstree-ok,#jstree-dnd.jstree-proton-large .jstree-er{background-size:320px 96px;background-image:url(32px.png);background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-proton-large i{background:0 0;width:32px;height:32px;line-height:32px}#jstree-dnd.jstree-proton-large .jstree-ok{background-position:0 -64px}#jstree-dnd.jstree-proton-large .jstree-er{background-position:-32px -64px}.jstree-proton-large.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==)}.jstree-proton-large.jstree-rtl .jstree-last{background:0 0}@media (max-width:768px){#jstree-dnd.jstree-dnd-responsive{line-height:30px;font-weight:700;font-size:1.1em;text-shadow:1px 1px #fff}#jstree-dnd.jstree-dnd-responsive>i{background:0 0;width:30px;height:30px}#jstree-dnd.jstree-dnd-responsive>.jstree-ok{background-image:url(30px.png);background-position:0 -150px;background-size:90px 180px}#jstree-dnd.jstree-dnd-responsive>.jstree-er{background-image:url(30px.png);background-position:-30px -150px;background-size:90px 180px}#jstree-marker.jstree-dnd-responsive{border-left-width:10px;border-top-width:10px;border-bottom-width:10px;margin-top:-10px}}@media (max-width:768px){.jstree-proton-responsive .jstree-container-ul{overflow:hidden}.jstree-proton-responsive .jstree-icon{background-image:url(30px.png);background-size:90px 180px}.jstree-proton-responsive .jstree-node,.jstree-proton-responsive .jstree-leaf>.jstree-ocl{background:0 0}.jstree-proton-responsive .jstree-node{min-height:30px;line-height:30px;margin-left:30px;min-width:30px;white-space:nowrap}.jstree-proton-responsive .jstree-anchor{line-height:38px;height:38px;margin:0}.jstree-proton-responsive .jstree-icon,.jstree-proton-responsive .jstree-icon:empty{margin-top:4px;width:30px;height:30px;line-height:30px}.jstree-proton-responsive>.jstree-container-ul>.jstree-node{margin-left:0}.jstree-proton-responsive.jstree-rtl .jstree-node{margin-left:0;margin-right:30px}.jstree-proton-responsive.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-proton-responsive .jstree-ocl,.jstree-proton-responsive .jstree-themeicon,.jstree-proton-responsive .jstree-checkbox{background-size:90px 180px}.jstree-proton-responsive .jstree-leaf>.jstree-ocl{background:0 0}.jstree-proton-responsive .jstree-open>.jstree-ocl{background-position:0 0!important}.jstree-proton-responsive .jstree-closed>.jstree-ocl{background-position:0 -30px!important}.jstree-proton-responsive.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-30px 0!important}.jstree-proton-responsive .jstree-themeicon{background-position:-30px -30px}.jstree-proton-responsive .jstree-checkbox,.jstree-proton-responsive .jstree-checkbox:hover{background-position:-30px -60px}.jstree-proton-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-proton-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-proton-responsive .jstree-checked>.jstree-checkbox,.jstree-proton-responsive .jstree-checked>.jstree-checkbox:hover{background-position:0 -60px}.jstree-proton-responsive .jstree-anchor>.jstree-undetermined,.jstree-proton-responsive .jstree-anchor>.jstree-undetermined:hover{background-position:0 -90px}.jstree-proton-responsive>.jstree-striped{background:0 0}.jstree-proton-responsive .jstree-wholerow-ul li{position:relative}.jstree-proton-responsive .jstree-wholerow-ul .jstree-wholerow{position:absolute;top:0;left:-1000px;right:-1000px;width:auto;height:100%}.jstree-proton-responsive .jstree-wholerow{border-top:1px solid rgba(0,0,0,.05);background:rgba(0,0,0,.02);height:30px}.jstree-proton-responsive .jstree-wholerow-hovered{background:#76b6ec}.jstree-proton-responsive .jstree-wholerow-clicked{background:#3392e3}.jstree-proton-responsive .jstree-children .jstree-open+.jstree-open{box-shadow:none}.jstree-proton-responsive .jstree-node,.jstree-proton-responsive .jstree-icon,.jstree-proton-responsive .jstree-node>.jstree-ocl,.jstree-proton-responsive .jstree-themeicon,.jstree-proton-responsive .jstree-checkbox{background-image:url(30px.png);background-size:90px 180px}.jstree-proton-responsive .jstree-node{background-position:-60px 0;background-repeat:repeat-y}.jstree-proton-responsive .jstree-last{background:0 0}.jstree-proton-responsive .jstree-leaf>.jstree-ocl{background-position:-30px -90px}.jstree-proton-responsive .jstree-last>.jstree-ocl{background-position:-30px -120px}.jstree-proton-responsive .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-proton-responsive .jstree-file{background:url(30px.png) 0 -120px no-repeat;background-size:90px 180px}.jstree-proton-responsive .jstree-folder{background:url(30px.png) -30px -30px no-repeat;background-size:90px 180px}.jstree-proton-responsive>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}}@font-face{font-family:'Titillium Web';src:url(fonts/titillium/titilliumweb-extralight-webfont.eot);src:url(fonts/titillium/titilliumweb-extralight-webfont.eot?#iefix) format('embedded-opentype'),url(fonts/titillium/titilliumweb-extralight-webfont.woff) format('woff'),url(fonts/titillium/titilliumweb-extralight-webfont.ttf) format('truetype'),url(fonts/titillium/titilliumweb-extralight-webfont.svg#titillium_webthin) format('svg');font-weight:300;font-style:normal}@font-face{font-family:'Titillium Web';src:url(fonts/titillium/titilliumweb-regular-webfont.eot);src:url(fonts/titillium/titilliumweb-regular-webfont.eot?#iefix) format('embedded-opentype'),url(fonts/titillium/titilliumweb-regular-webfont.woff) format('woff'),url(fonts/titillium/titilliumweb-regular-webfont.ttf) format('truetype'),url(fonts/titillium/titilliumweb-regular-webfont.svg#titillium_webregular) format('svg');font-weight:400;font-style:normal}@font-face{font-family:'Titillium Web';src:url(fonts/titillium/titilliumweb-bold-webfont.eot);src:url(fonts/titillium/titilliumweb-bold-webfont.eot?#iefix) format('embedded-opentype'),url(fonts/titillium/titilliumweb-bold-webfont.woff) format('woff'),url(fonts/titillium/titilliumweb-bold-webfont.ttf) format('truetype'),url(fonts/titillium/titilliumweb-bold-webfont.svg#titillium_webbold) format('svg');font-weight:700;font-style:normal}@media screen and (-webkit-min-device-pixel-ratio:0){@font-face{font-family:'Titillium Web';src:url(fonts/titillium/titilliumweb-extralight-webfont.svg#titillium_webthin) format('svg');font-weight:300;font-style:normal}@font-face{font-family:'Titillium Web';src:url(fonts/titillium/titilliumweb-regular-webfont.svg#titillium_webregular) format('svg');font-weight:400;font-style:normal}@font-face{font-family:'Titillium Web';src:url(fonts/titillium/titilliumweb-bold-webfont.svg#titillium_webbold) format('svg');font-weight:700;font-style:normal}}.jstree-proton{font-family:'Titillium Web',sans-serif,Arial,sans-serif} \ No newline at end of file diff --git a/src/main/webapp/resources/3rd-party/jstree/themes/proton/throbber.gif b/src/main/webapp/resources/3rd-party/jstree/themes/proton/throbber.gif deleted file mode 100644 index 1b5b2fde..00000000 Binary files a/src/main/webapp/resources/3rd-party/jstree/themes/proton/throbber.gif and /dev/null differ diff --git a/src/main/webapp/resources/3rd-party/sneat/libs/jstree/jstree.js b/src/main/webapp/resources/3rd-party/sneat/libs/jstree/jstree.js index 9f6e20cc..00617ef6 100644 --- a/src/main/webapp/resources/3rd-party/sneat/libs/jstree/jstree.js +++ b/src/main/webapp/resources/3rd-party/sneat/libs/jstree/jstree.js @@ -1,134 +1,8605 @@ -/* - * ATTENTION: An "eval-source-map" devtool has been used. - * This devtool is neither made for production nor for readable output files. - * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools. - * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) - * or disable the default devtool with "devtool: false". - * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). - */ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(require("jQuery")); - else if(typeof define === 'function' && define.amd) - define(["jQuery"], factory); +/*globals jQuery, define, module, exports, require, window, document, postMessage */ +(function (factory) { + "use strict"; + if (typeof define === 'function' && define.amd) { + define(['jquery'], factory); + } + else if(typeof module !== 'undefined' && module.exports) { + module.exports = factory(require('jquery')); + } else { - var a = typeof exports === 'object' ? factory(require("jQuery")) : factory(root["jQuery"]); - for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; + factory(jQuery); + } +}(function ($, undefined) { + "use strict"; +/*! + * jsTree 3.3.7 + * http://jstree.com/ + * + * Copyright (c) 2014 Ivan Bozhanov (http://vakata.com) + * + * Licensed same as jquery - under the terms of the MIT License + * http://www.opensource.org/licenses/mit-license.php + */ +/*! + * if using jslint please allow for the jQuery global and use following options: + * jslint: loopfunc: true, browser: true, ass: true, bitwise: true, continue: true, nomen: true, plusplus: true, regexp: true, unparam: true, todo: true, white: true + */ +/*jshint -W083 */ + + // prevent another load? maybe there is a better way? + if($.jstree) { + return; } -})(self, function(__WEBPACK_EXTERNAL_MODULE_jquery__) { -return /******/ (function() { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ "./libs/jstree/jstree.js": -/*!*******************************!*\ - !*** ./libs/jstree/jstree.js ***! - \*******************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var jstree_dist_jstree__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jstree/dist/jstree */ "./node_modules/jstree/dist/jstree.js"); -/* harmony import */ var jstree_dist_jstree__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jstree_dist_jstree__WEBPACK_IMPORTED_MODULE_0__); - - -/***/ }), - -/***/ "./node_modules/jstree/dist/jstree.js": -/*!********************************************!*\ - !*** ./node_modules/jstree/dist/jstree.js ***! - \********************************************/ -/***/ (function(module, exports, __webpack_require__) { - -eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*globals jQuery, define, module, exports, require, window, document, postMessage */\n(function (factory) {\n\t\"use strict\";\n\tif (true) {\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ \"jquery\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t}\n\telse {}\n}(function ($, undefined) {\n\t\"use strict\";\n/*!\n * jsTree 3.3.14\n * http://jstree.com/\n *\n * Copyright (c) 2014 Ivan Bozhanov (http://vakata.com)\n *\n * Licensed same as jquery - under the terms of the MIT License\n * http://www.opensource.org/licenses/mit-license.php\n */\n/*!\n * if using jslint please allow for the jQuery global and use following options:\n * jslint: loopfunc: true, browser: true, ass: true, bitwise: true, continue: true, nomen: true, plusplus: true, regexp: true, unparam: true, todo: true, white: true\n */\n/*jshint -W083 */\n\n\t// prevent another load? maybe there is a better way?\n\tif($.jstree) {\n\t\treturn;\n\t}\n\n\t/**\n\t * ### jsTree core functionality\n\t */\n\n\t// internal variables\n\tvar instance_counter = 0,\n\t\tccp_node = false,\n\t\tccp_mode = false,\n\t\tccp_inst = false,\n\t\tthemes_loaded = [],\n\t\tsrc = $('script:last').attr('src'),\n\t\tdocument = window.document; // local variable is always faster to access then a global\n\n\tvar setImmediate = window.setImmediate;\n\tvar Promise = window.Promise;\n\tif (!setImmediate && Promise) {\n\t\t// Good enough approximation of setImmediate\n\t\tsetImmediate = function (cb, arg) {\n\t\t\tPromise.resolve(arg).then(cb);\n\t\t};\n\t}\n\n\t/**\n\t * holds all jstree related functions and variables, including the actual class and methods to create, access and manipulate instances.\n\t * @name $.jstree\n\t */\n\t$.jstree = {\n\t\t/**\n\t\t * specifies the jstree version in use\n\t\t * @name $.jstree.version\n\t\t */\n\t\tversion : '3.3.14',\n\t\t/**\n\t\t * holds all the default options used when creating new instances\n\t\t * @name $.jstree.defaults\n\t\t */\n\t\tdefaults : {\n\t\t\t/**\n\t\t\t * configure which plugins will be active on an instance. Should be an array of strings, where each element is a plugin name. The default is `[]`\n\t\t\t * @name $.jstree.defaults.plugins\n\t\t\t */\n\t\t\tplugins : []\n\t\t},\n\t\t/**\n\t\t * stores all loaded jstree plugins (used internally)\n\t\t * @name $.jstree.plugins\n\t\t */\n\t\tplugins : {},\n\t\tpath : src && src.indexOf('/') !== -1 ? src.replace(/\\/[^\\/]+$/,'') : '',\n\t\tidregex : /[\\\\:&!^|()\\[\\]<>@*'+~#\";.,=\\- \\/${}%?`]/g,\n\t\troot : '#'\n\t};\n\t\n\t/**\n\t * creates a jstree instance\n\t * @name $.jstree.create(el [, options])\n\t * @param {DOMElement|jQuery|String} el the element to create the instance on, can be jQuery extended or a selector\n\t * @param {Object} options options for this instance (extends `$.jstree.defaults`)\n\t * @return {jsTree} the new instance\n\t */\n\t$.jstree.create = function (el, options) {\n\t\tvar tmp = new $.jstree.core(++instance_counter),\n\t\t\topt = options;\n\t\toptions = $.extend(true, {}, $.jstree.defaults, options);\n\t\tif(opt && opt.plugins) {\n\t\t\toptions.plugins = opt.plugins;\n\t\t}\n\t\t$.each(options.plugins, function (i, k) {\n\t\t\tif(i !== 'core') {\n\t\t\t\ttmp = tmp.plugin(k, options[k]);\n\t\t\t}\n\t\t});\n\t\t$(el).data('jstree', tmp);\n\t\ttmp.init(el, options);\n\t\treturn tmp;\n\t};\n\t/**\n\t * remove all traces of jstree from the DOM and destroy all instances\n\t * @name $.jstree.destroy()\n\t */\n\t$.jstree.destroy = function () {\n\t\t$('.jstree:jstree').jstree('destroy');\n\t\t$(document).off('.jstree');\n\t};\n\t/**\n\t * the jstree class constructor, used only internally\n\t * @private\n\t * @name $.jstree.core(id)\n\t * @param {Number} id this instance's index\n\t */\n\t$.jstree.core = function (id) {\n\t\tthis._id = id;\n\t\tthis._cnt = 0;\n\t\tthis._wrk = null;\n\t\tthis._data = {\n\t\t\tcore : {\n\t\t\t\tthemes : {\n\t\t\t\t\tname : false,\n\t\t\t\t\tdots : false,\n\t\t\t\t\ticons : false,\n\t\t\t\t\tellipsis : false\n\t\t\t\t},\n\t\t\t\tselected : [],\n\t\t\t\tlast_error : {},\n\t\t\t\tworking : false,\n\t\t\t\tworker_queue : [],\n\t\t\t\tfocused : null\n\t\t\t}\n\t\t};\n\t};\n\t/**\n\t * get a reference to an existing instance\n\t *\n\t * __Examples__\n\t *\n\t *\t// provided a container with an ID of \"tree\", and a nested node with an ID of \"branch\"\n\t *\t// all of there will return the same instance\n\t *\t$.jstree.reference('tree');\n\t *\t$.jstree.reference('#tree');\n\t *\t$.jstree.reference($('#tree'));\n\t *\t$.jstree.reference(document.getElementByID('tree'));\n\t *\t$.jstree.reference('branch');\n\t *\t$.jstree.reference('#branch');\n\t *\t$.jstree.reference($('#branch'));\n\t *\t$.jstree.reference(document.getElementByID('branch'));\n\t *\n\t * @name $.jstree.reference(needle)\n\t * @param {DOMElement|jQuery|String} needle\n\t * @return {jsTree|null} the instance or `null` if not found\n\t */\n\t$.jstree.reference = function (needle) {\n\t\tvar tmp = null,\n\t\t\tobj = null;\n\t\tif(needle && needle.id && (!needle.tagName || !needle.nodeType)) { needle = needle.id; }\n\n\t\tif(!obj || !obj.length) {\n\t\t\ttry { obj = $(needle); } catch (ignore) { }\n\t\t}\n\t\tif(!obj || !obj.length) {\n\t\t\ttry { obj = $('#' + needle.replace($.jstree.idregex,'\\\\$&')); } catch (ignore) { }\n\t\t}\n\t\tif(obj && obj.length && (obj = obj.closest('.jstree')).length && (obj = obj.data('jstree'))) {\n\t\t\ttmp = obj;\n\t\t}\n\t\telse {\n\t\t\t$('.jstree').each(function () {\n\t\t\t\tvar inst = $(this).data('jstree');\n\t\t\t\tif(inst && inst._model.data[needle]) {\n\t\t\t\t\ttmp = inst;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn tmp;\n\t};\n\t/**\n\t * Create an instance, get an instance or invoke a command on a instance.\n\t *\n\t * If there is no instance associated with the current node a new one is created and `arg` is used to extend `$.jstree.defaults` for this new instance. There would be no return value (chaining is not broken).\n\t *\n\t * If there is an existing instance and `arg` is a string the command specified by `arg` is executed on the instance, with any additional arguments passed to the function. If the function returns a value it will be returned (chaining could break depending on function).\n\t *\n\t * If there is an existing instance and `arg` is not a string the instance itself is returned (similar to `$.jstree.reference`).\n\t *\n\t * In any other case - nothing is returned and chaining is not broken.\n\t *\n\t * __Examples__\n\t *\n\t *\t$('#tree1').jstree(); // creates an instance\n\t *\t$('#tree2').jstree({ plugins : [] }); // create an instance with some options\n\t *\t$('#tree1').jstree('open_node', '#branch_1'); // call a method on an existing instance, passing additional arguments\n\t *\t$('#tree2').jstree(); // get an existing instance (or create an instance)\n\t *\t$('#tree2').jstree(true); // get an existing instance (will not create new instance)\n\t *\t$('#branch_1').jstree().select_node('#branch_1'); // get an instance (using a nested element and call a method)\n\t *\n\t * @name $().jstree([arg])\n\t * @param {String|Object} arg\n\t * @return {Mixed}\n\t */\n\t$.fn.jstree = function (arg) {\n\t\t// check for string argument\n\t\tvar is_method\t= (typeof arg === 'string'),\n\t\t\targs\t\t= Array.prototype.slice.call(arguments, 1),\n\t\t\tresult\t\t= null;\n\t\tif(arg === true && !this.length) { return false; }\n\t\tthis.each(function () {\n\t\t\t// get the instance (if there is one) and method (if it exists)\n\t\t\tvar instance = $.jstree.reference(this),\n\t\t\t\tmethod = is_method && instance ? instance[arg] : null;\n\t\t\t// if calling a method, and method is available - execute on the instance\n\t\t\tresult = is_method && method ?\n\t\t\t\tmethod.apply(instance, args) :\n\t\t\t\tnull;\n\t\t\t// if there is no instance and no method is being called - create one\n\t\t\tif(!instance && !is_method && (arg === undefined || $.isPlainObject(arg))) {\n\t\t\t\t$.jstree.create(this, arg);\n\t\t\t}\n\t\t\t// if there is an instance and no method is called - return the instance\n\t\t\tif( (instance && !is_method) || arg === true ) {\n\t\t\t\tresult = instance || false;\n\t\t\t}\n\t\t\t// if there was a method call which returned a result - break and return the value\n\t\t\tif(result !== null && result !== undefined) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t\t// if there was a method call with a valid return value - return that, otherwise continue the chain\n\t\treturn result !== null && result !== undefined ?\n\t\t\tresult : this;\n\t};\n\t/**\n\t * used to find elements containing an instance\n\t *\n\t * __Examples__\n\t *\n\t *\t$('div:jstree').each(function () {\n\t *\t\t$(this).jstree('destroy');\n\t *\t});\n\t *\n\t * @name $(':jstree')\n\t * @return {jQuery}\n\t */\n\t$.expr.pseudos.jstree = $.expr.createPseudo(function(search) {\n\t\treturn function(a) {\n\t\t\treturn $(a).hasClass('jstree') &&\n\t\t\t\t$(a).data('jstree') !== undefined;\n\t\t};\n\t});\n\n\t/**\n\t * stores all defaults for the core\n\t * @name $.jstree.defaults.core\n\t */\n\t$.jstree.defaults.core = {\n\t\t/**\n\t\t * data configuration\n\t\t *\n\t\t * If left as `false` the HTML inside the jstree container element is used to populate the tree (that should be an unordered list with list items).\n\t\t *\n\t\t * You can also pass in a HTML string or a JSON array here.\n\t\t *\n\t\t * It is possible to pass in a standard jQuery-like AJAX config and jstree will automatically determine if the response is JSON or HTML and use that to populate the tree.\n\t\t * In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node is being loaded, the return value of those functions will be used.\n\t\t *\n\t\t * The last option is to specify a function, that function will receive the node being loaded as argument and a second param which is a function which should be called with the result.\n\t\t *\n\t\t * __Examples__\n\t\t *\n\t\t *\t// AJAX\n\t\t *\t$('#tree').jstree({\n\t\t *\t\t'core' : {\n\t\t *\t\t\t'data' : {\n\t\t *\t\t\t\t'url' : '/get/children/',\n\t\t *\t\t\t\t'data' : function (node) {\n\t\t *\t\t\t\t\treturn { 'id' : node.id };\n\t\t *\t\t\t\t}\n\t\t *\t\t\t}\n\t\t *\t\t});\n\t\t *\n\t\t *\t// direct data\n\t\t *\t$('#tree').jstree({\n\t\t *\t\t'core' : {\n\t\t *\t\t\t'data' : [\n\t\t *\t\t\t\t'Simple root node',\n\t\t *\t\t\t\t{\n\t\t *\t\t\t\t\t'id' : 'node_2',\n\t\t *\t\t\t\t\t'text' : 'Root node with options',\n\t\t *\t\t\t\t\t'state' : { 'opened' : true, 'selected' : true },\n\t\t *\t\t\t\t\t'children' : [ { 'text' : 'Child 1' }, 'Child 2']\n\t\t *\t\t\t\t}\n\t\t *\t\t\t]\n\t\t *\t\t}\n\t\t *\t});\n\t\t *\n\t\t *\t// function\n\t\t *\t$('#tree').jstree({\n\t\t *\t\t'core' : {\n\t\t *\t\t\t'data' : function (obj, callback) {\n\t\t *\t\t\t\tcallback.call(this, ['Root 1', 'Root 2']);\n\t\t *\t\t\t}\n\t\t *\t\t});\n\t\t *\n\t\t * @name $.jstree.defaults.core.data\n\t\t */\n\t\tdata\t\t\t: false,\n\t\t/**\n\t\t * configure the various strings used throughout the tree\n\t\t *\n\t\t * You can use an object where the key is the string you need to replace and the value is your replacement.\n\t\t * Another option is to specify a function which will be called with an argument of the needed string and should return the replacement.\n\t\t * If left as `false` no replacement is made.\n\t\t *\n\t\t * __Examples__\n\t\t *\n\t\t *\t$('#tree').jstree({\n\t\t *\t\t'core' : {\n\t\t *\t\t\t'strings' : {\n\t\t *\t\t\t\t'Loading ...' : 'Please wait ...'\n\t\t *\t\t\t}\n\t\t *\t\t}\n\t\t *\t});\n\t\t *\n\t\t * @name $.jstree.defaults.core.strings\n\t\t */\n\t\tstrings\t\t\t: false,\n\t\t/**\n\t\t * determines what happens when a user tries to modify the structure of the tree\n\t\t * If left as `false` all operations like create, rename, delete, move or copy are prevented.\n\t\t * You can set this to `true` to allow all interactions or use a function to have better control.\n\t\t *\n\t\t * __Examples__\n\t\t *\n\t\t *\t$('#tree').jstree({\n\t\t *\t\t'core' : {\n\t\t *\t\t\t'check_callback' : function (operation, node, node_parent, node_position, more) {\n\t\t *\t\t\t\t// operation can be 'create_node', 'rename_node', 'delete_node', 'move_node', 'copy_node' or 'edit'\n\t\t *\t\t\t\t// in case of 'rename_node' node_position is filled with the new node name\n\t\t *\t\t\t\treturn operation === 'rename_node' ? true : false;\n\t\t *\t\t\t}\n\t\t *\t\t}\n\t\t *\t});\n\t\t *\n\t\t * @name $.jstree.defaults.core.check_callback\n\t\t */\n\t\tcheck_callback\t: false,\n\t\t/**\n\t\t * a callback called with a single object parameter in the instance's scope when something goes wrong (operation prevented, ajax failed, etc)\n\t\t * @name $.jstree.defaults.core.error\n\t\t */\n\t\terror\t\t\t: $.noop,\n\t\t/**\n\t\t * the open / close animation duration in milliseconds - set this to `false` to disable the animation (default is `200`)\n\t\t * @name $.jstree.defaults.core.animation\n\t\t */\n\t\tanimation\t\t: 200,\n\t\t/**\n\t\t * a boolean indicating if multiple nodes can be selected\n\t\t * @name $.jstree.defaults.core.multiple\n\t\t */\n\t\tmultiple\t\t: true,\n\t\t/**\n\t\t * theme configuration object\n\t\t * @name $.jstree.defaults.core.themes\n\t\t */\n\t\tthemes\t\t\t: {\n\t\t\t/**\n\t\t\t * the name of the theme to use (if left as `false` the default theme is used)\n\t\t\t * @name $.jstree.defaults.core.themes.name\n\t\t\t */\n\t\t\tname\t\t\t: false,\n\t\t\t/**\n\t\t\t * the URL of the theme's CSS file, leave this as `false` if you have manually included the theme CSS (recommended). You can set this to `true` too which will try to autoload the theme.\n\t\t\t * @name $.jstree.defaults.core.themes.url\n\t\t\t */\n\t\t\turl\t\t\t\t: false,\n\t\t\t/**\n\t\t\t * the location of all jstree themes - only used if `url` is set to `true`\n\t\t\t * @name $.jstree.defaults.core.themes.dir\n\t\t\t */\n\t\t\tdir\t\t\t\t: false,\n\t\t\t/**\n\t\t\t * a boolean indicating if connecting dots are shown\n\t\t\t * @name $.jstree.defaults.core.themes.dots\n\t\t\t */\n\t\t\tdots\t\t\t: true,\n\t\t\t/**\n\t\t\t * a boolean indicating if node icons are shown\n\t\t\t * @name $.jstree.defaults.core.themes.icons\n\t\t\t */\n\t\t\ticons\t\t\t: true,\n\t\t\t/**\n\t\t\t * a boolean indicating if node ellipsis should be shown - this only works with a fixed with on the container\n\t\t\t * @name $.jstree.defaults.core.themes.ellipsis\n\t\t\t */\n\t\t\tellipsis\t\t: false,\n\t\t\t/**\n\t\t\t * a boolean indicating if the tree background is striped\n\t\t\t * @name $.jstree.defaults.core.themes.stripes\n\t\t\t */\n\t\t\tstripes\t\t\t: false,\n\t\t\t/**\n\t\t\t * a string (or boolean `false`) specifying the theme variant to use (if the theme supports variants)\n\t\t\t * @name $.jstree.defaults.core.themes.variant\n\t\t\t */\n\t\t\tvariant\t\t\t: false,\n\t\t\t/**\n\t\t\t * a boolean specifying if a reponsive version of the theme should kick in on smaller screens (if the theme supports it). Defaults to `false`.\n\t\t\t * @name $.jstree.defaults.core.themes.responsive\n\t\t\t */\n\t\t\tresponsive\t\t: false\n\t\t},\n\t\t/**\n\t\t * if left as `true` all parents of all selected nodes will be opened once the tree loads (so that all selected nodes are visible to the user)\n\t\t * @name $.jstree.defaults.core.expand_selected_onload\n\t\t */\n\t\texpand_selected_onload : true,\n\t\t/**\n\t\t * if left as `true` web workers will be used to parse incoming JSON data where possible, so that the UI will not be blocked by large requests. Workers are however about 30% slower. Defaults to `true`\n\t\t * @name $.jstree.defaults.core.worker\n\t\t */\n\t\tworker : true,\n\t\t/**\n\t\t * Force node text to plain text (and escape HTML). Defaults to `false`\n\t\t * @name $.jstree.defaults.core.force_text\n\t\t */\n\t\tforce_text : false,\n\t\t/**\n\t\t * Should the node be toggled if the text is double clicked. Defaults to `true`\n\t\t * @name $.jstree.defaults.core.dblclick_toggle\n\t\t */\n\t\tdblclick_toggle : true,\n\t\t/**\n\t\t * Should the loaded nodes be part of the state. Defaults to `false`\n\t\t * @name $.jstree.defaults.core.loaded_state\n\t\t */\n\t\tloaded_state : false,\n\t\t/**\n\t\t * Should the last active node be focused when the tree container is blurred and the focused again. This helps working with screen readers. Defaults to `true`\n\t\t * @name $.jstree.defaults.core.restore_focus\n\t\t */\n\t\trestore_focus : true,\n\t\t/**\n\t\t * Force to compute and set \"aria-setsize\" and \"aria-posinset\" explicitly for each treeitem. \n\t\t * Some browsers may compute incorrect elements position and produce wrong announcements for screen readers. Defaults to `false`\n\t\t * @name $.jstree.defaults.core.compute_elements_positions\n\t\t */\n\t\tcompute_elements_positions : false,\n\t\t/**\n\t\t * Default keyboard shortcuts (an object where each key is the button name or combo - like 'enter', 'ctrl-space', 'p', etc and the value is the function to execute in the instance's scope)\n\t\t * @name $.jstree.defaults.core.keyboard\n\t\t */\n\t\tkeyboard : {\n\t\t\t'ctrl-space': function (e) {\n\t\t\t\t// aria defines space only with Ctrl\n\t\t\t\te.type = \"click\";\n\t\t\t\t$(e.currentTarget).trigger(e);\n\t\t\t},\n\t\t\t'enter': function (e) {\n\t\t\t\t// enter\n\t\t\t\te.type = \"click\";\n\t\t\t\t$(e.currentTarget).trigger(e);\n\t\t\t},\n\t\t\t'left': function (e) {\n\t\t\t\t// left\n\t\t\t\te.preventDefault();\n\t\t\t\tif(this.is_open(e.currentTarget)) {\n\t\t\t\t\tthis.close_node(e.currentTarget);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvar o = this.get_parent(e.currentTarget);\n\t\t\t\t\tif(o && o.id !== $.jstree.root) { this.get_node(o, true).children('.jstree-anchor').trigger('focus'); }\n\t\t\t\t}\n\t\t\t},\n\t\t\t'up': function (e) {\n\t\t\t\t// up\n\t\t\t\te.preventDefault();\n\t\t\t\tvar o = this.get_prev_dom(e.currentTarget);\n\t\t\t\tif(o && o.length) { o.children('.jstree-anchor').trigger('focus'); }\n\t\t\t},\n\t\t\t'right': function (e) {\n\t\t\t\t// right\n\t\t\t\te.preventDefault();\n\t\t\t\tif(this.is_closed(e.currentTarget)) {\n\t\t\t\t\tthis.open_node(e.currentTarget, function (o) { this.get_node(o, true).children('.jstree-anchor').trigger('focus'); });\n\t\t\t\t}\n\t\t\t\telse if (this.is_open(e.currentTarget)) {\n\t\t\t\t\tvar o = this.get_node(e.currentTarget, true).children('.jstree-children')[0];\n\t\t\t\t\tif(o) { $(this._firstChild(o)).children('.jstree-anchor').trigger('focus'); }\n\t\t\t\t}\n\t\t\t},\n\t\t\t'down': function (e) {\n\t\t\t\t// down\n\t\t\t\te.preventDefault();\n\t\t\t\tvar o = this.get_next_dom(e.currentTarget);\n\t\t\t\tif(o && o.length) { o.children('.jstree-anchor').trigger('focus'); }\n\t\t\t},\n\t\t\t'*': function (e) {\n\t\t\t\t// aria defines * on numpad as open_all - not very common\n\t\t\t\tthis.open_all();\n\t\t\t},\n\t\t\t'home': function (e) {\n\t\t\t\t// home\n\t\t\t\te.preventDefault();\n\t\t\t\tvar o = this._firstChild(this.get_container_ul()[0]);\n\t\t\t\tif(o) { $(o).children('.jstree-anchor').filter(':visible').trigger('focus'); }\n\t\t\t},\n\t\t\t'end': function (e) {\n\t\t\t\t// end\n\t\t\t\te.preventDefault();\n\t\t\t\tthis.element.find('.jstree-anchor').filter(':visible').last().trigger('focus');\n\t\t\t},\n\t\t\t'f2': function (e) {\n\t\t\t\t// f2 - safe to include - if check_callback is false it will fail\n\t\t\t\te.preventDefault();\n\t\t\t\tthis.edit(e.currentTarget);\n\t\t\t}\n\t\t}\n\t};\n\t$.jstree.core.prototype = {\n\t\t/**\n\t\t * used to decorate an instance with a plugin. Used internally.\n\t\t * @private\n\t\t * @name plugin(deco [, opts])\n\t\t * @param {String} deco the plugin to decorate with\n\t\t * @param {Object} opts options for the plugin\n\t\t * @return {jsTree}\n\t\t */\n\t\tplugin : function (deco, opts) {\n\t\t\tvar Child = $.jstree.plugins[deco];\n\t\t\tif(Child) {\n\t\t\t\tthis._data[deco] = {};\n\t\t\t\tChild.prototype = this;\n\t\t\t\treturn new Child(opts, this);\n\t\t\t}\n\t\t\treturn this;\n\t\t},\n\t\t/**\n\t\t * initialize the instance. Used internally.\n\t\t * @private\n\t\t * @name init(el, optons)\n\t\t * @param {DOMElement|jQuery|String} el the element we are transforming\n\t\t * @param {Object} options options for this instance\n\t\t * @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree\n\t\t */\n\t\tinit : function (el, options) {\n\t\t\tthis._model = {\n\t\t\t\tdata : {},\n\t\t\t\tchanged : [],\n\t\t\t\tforce_full_redraw : false,\n\t\t\t\tredraw_timeout : false,\n\t\t\t\tdefault_state : {\n\t\t\t\t\tloaded : true,\n\t\t\t\t\topened : false,\n\t\t\t\t\tselected : false,\n\t\t\t\t\tdisabled : false\n\t\t\t\t}\n\t\t\t};\n\t\t\tthis._model.data[$.jstree.root] = {\n\t\t\t\tid : $.jstree.root,\n\t\t\t\tparent : null,\n\t\t\t\tparents : [],\n\t\t\t\tchildren : [],\n\t\t\t\tchildren_d : [],\n\t\t\t\tstate : { loaded : false }\n\t\t\t};\n\n\t\t\tthis.element = $(el).addClass('jstree jstree-' + this._id);\n\t\t\tthis.settings = options;\n\n\t\t\tthis._data.core.ready = false;\n\t\t\tthis._data.core.loaded = false;\n\t\t\tthis._data.core.rtl = (this.element.css(\"direction\") === \"rtl\");\n\t\t\tthis.element[this._data.core.rtl ? 'addClass' : 'removeClass'](\"jstree-rtl\");\n\t\t\tthis.element.attr('role','tree');\n\t\t\tif(this.settings.core.multiple) {\n\t\t\t\tthis.element.attr('aria-multiselectable', true);\n\t\t\t}\n\t\t\tif(!this.element.attr('tabindex')) {\n\t\t\t\tthis.element.attr('tabindex','0');\n\t\t\t}\n\n\t\t\tthis.bind();\n\t\t\t/**\n\t\t\t * triggered after all events are bound\n\t\t\t * @event\n\t\t\t * @name init.jstree\n\t\t\t */\n\t\t\tthis.trigger(\"init\");\n\n\t\t\tthis._data.core.original_container_html = this.element.find(\" > ul > li\").clone(true);\n\t\t\tthis._data.core.original_container_html\n\t\t\t\t.find(\"li\").addBack()\n\t\t\t\t.contents().filter(function() {\n\t\t\t\t\treturn this.nodeType === 3 && (!this.nodeValue || /^\\s+$/.test(this.nodeValue));\n\t\t\t\t})\n\t\t\t\t.remove();\n\t\t\tthis.element.html(\"<\"+\"ul class='jstree-container-ul jstree-children' role='group'><\"+\"li id='j\"+this._id+\"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='none'><\"+\"a class='jstree-anchor' role='treeitem' href='#'>\" + this.get_string(\"Loading ...\") + \"
      • \");\n\t\t\tthis.element.attr('aria-activedescendant','j' + this._id + '_loading');\n\t\t\tthis._data.core.li_height = this.get_container_ul().children(\"li\").first().outerHeight() || 24;\n\t\t\tthis._data.core.node = this._create_prototype_node();\n\t\t\t/**\n\t\t\t * triggered after the loading text is shown and before loading starts\n\t\t\t * @event\n\t\t\t * @name loading.jstree\n\t\t\t */\n\t\t\tthis.trigger(\"loading\");\n\t\t\tthis.load_node($.jstree.root);\n\t\t},\n\t\t/**\n\t\t * destroy an instance\n\t\t * @name destroy()\n\t\t * @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact\n\t\t */\n\t\tdestroy : function (keep_html) {\n\t\t\t/**\n\t\t\t * triggered before the tree is destroyed\n\t\t\t * @event\n\t\t\t * @name destroy.jstree\n\t\t\t */\n\t\t\tthis.trigger(\"destroy\");\n\t\t\tif(this._wrk) {\n\t\t\t\ttry {\n\t\t\t\t\twindow.URL.revokeObjectURL(this._wrk);\n\t\t\t\t\tthis._wrk = null;\n\t\t\t\t}\n\t\t\t\tcatch (ignore) { }\n\t\t\t}\n\t\t\tif(!keep_html) { this.element.empty(); }\n\t\t\tthis.teardown();\n\t\t},\n\t\t/**\n\t\t * Create a prototype node\n\t\t * @name _create_prototype_node()\n\t\t * @return {DOMElement}\n\t\t */\n\t\t_create_prototype_node : function () {\n\t\t\tvar _node = document.createElement('LI'), _temp1, _temp2;\n\t\t\t_node.setAttribute('role', 'none');\n\t\t\t_temp1 = document.createElement('I');\n\t\t\t_temp1.className = 'jstree-icon jstree-ocl';\n\t\t\t_temp1.setAttribute('role', 'presentation');\n\t\t\t_node.appendChild(_temp1);\n\t\t\t_temp1 = document.createElement('A');\n\t\t\t_temp1.className = 'jstree-anchor';\n\t\t\t_temp1.setAttribute('href','#');\n\t\t\t_temp1.setAttribute('tabindex','-1');\n\t\t\t_temp1.setAttribute('role', 'treeitem');\n\t\t\t_temp2 = document.createElement('I');\n\t\t\t_temp2.className = 'jstree-icon jstree-themeicon';\n\t\t\t_temp2.setAttribute('role', 'presentation');\n\t\t\t_temp1.appendChild(_temp2);\n\t\t\t_node.appendChild(_temp1);\n\t\t\t_temp1 = _temp2 = null;\n\n\t\t\treturn _node;\n\t\t},\n\t\t_kbevent_to_func : function (e) {\n\t\t\tvar keys = {\n\t\t\t\t8: \"Backspace\", 9: \"Tab\", 13: \"Enter\", 19: \"Pause\", 27: \"Esc\",\n\t\t\t\t32: \"Space\", 33: \"PageUp\", 34: \"PageDown\", 35: \"End\", 36: \"Home\",\n\t\t\t\t37: \"Left\", 38: \"Up\", 39: \"Right\", 40: \"Down\", 44: \"Print\", 45: \"Insert\",\n\t\t\t\t46: \"Delete\", 96: \"Numpad0\", 97: \"Numpad1\", 98: \"Numpad2\", 99 : \"Numpad3\",\n\t\t\t\t100: \"Numpad4\", 101: \"Numpad5\", 102: \"Numpad6\", 103: \"Numpad7\",\n\t\t\t\t104: \"Numpad8\", 105: \"Numpad9\", '-13': \"NumpadEnter\", 112: \"F1\",\n\t\t\t\t113: \"F2\", 114: \"F3\", 115: \"F4\", 116: \"F5\", 117: \"F6\", 118: \"F7\",\n\t\t\t\t119: \"F8\", 120: \"F9\", 121: \"F10\", 122: \"F11\", 123: \"F12\", 144: \"Numlock\",\n\t\t\t\t145: \"Scrolllock\", 16: 'Shift', 17: 'Ctrl', 18: 'Alt',\n\t\t\t\t48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5',\n\t\t\t\t54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a',\n\t\t\t\t66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h',\n\t\t\t\t73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',\n\t\t\t\t80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',\n\t\t\t\t87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',\n\t\t\t\t186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`',\n\t\t\t\t219: '[', 220: '\\\\',221: ']', 222: \"'\", 111: '/', 106: '*', 173: '-'\n\t\t\t};\n\t\t\tvar parts = [];\n\t\t\tif (e.ctrlKey) { parts.push('ctrl'); }\n\t\t\tif (e.altKey) { parts.push('alt'); }\n if (e.shiftKey) { parts.push('shift'); }\n\t\t\tparts.push(keys[e.which] ? keys[e.which].toLowerCase() : e.which);\n parts = parts.sort().join('-').toLowerCase();\n if (parts === 'shift-shift' || parts === 'ctrl-ctrl' || parts === 'alt-alt') {\n return null;\n }\n\n\t\t\tvar kb = this.settings.core.keyboard, i, tmp;\n\t\t\tfor (i in kb) {\n\t\t\t\tif (kb.hasOwnProperty(i)) {\n\t\t\t\t\ttmp = i;\n\t\t\t\t\tif (tmp !== '-' && tmp !== '+') {\n\t\t\t\t\t\ttmp = tmp.replace('--', '-MINUS').replace('+-', '-MINUS').replace('++', '-PLUS').replace('-+', '-PLUS');\n\t\t\t\t\t\ttmp = tmp.split(/-|\\+/).sort().join('-').replace('MINUS', '-').replace('PLUS', '+').toLowerCase();\n\t\t\t\t\t}\n\t\t\t\t\tif (tmp === parts) {\n\t\t\t\t\t\treturn kb[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t\t/**\n\t\t * part of the destroying of an instance. Used internally.\n\t\t * @private\n\t\t * @name teardown()\n\t\t */\n\t\tteardown : function () {\n\t\t\tthis.unbind();\n\t\t\tthis.element\n\t\t\t\t.removeClass('jstree')\n\t\t\t\t.removeData('jstree')\n\t\t\t\t.find(\"[class^='jstree']\")\n\t\t\t\t\t.addBack()\n\t\t\t\t\t.attr(\"class\", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });\n\t\t\tthis.element = null;\n\t\t},\n\t\t/**\n\t\t * bind all events. Used internally.\n\t\t * @private\n\t\t * @name bind()\n\t\t */\n\t\tbind : function () {\n\t\t\tvar word = '',\n\t\t\t\ttout = null,\n\t\t\t\twas_click = 0;\n\t\t\tthis.element\n\t\t\t\t.on(\"dblclick.jstree\", function (e) {\n\t\t\t\t\t\tif(e.target.tagName && e.target.tagName.toLowerCase() === \"input\") { return true; }\n\t\t\t\t\t\tif(document.selection && document.selection.empty) {\n\t\t\t\t\t\t\tdocument.selection.empty();\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tif(window.getSelection) {\n\t\t\t\t\t\t\t\tvar sel = window.getSelection();\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tsel.removeAllRanges();\n\t\t\t\t\t\t\t\t\tsel.collapse();\n\t\t\t\t\t\t\t\t} catch (ignore) { }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t.on(\"mousedown.jstree\", function (e) {\n\t\t\t\t\t\tif(e.target === this.element[0]) {\n\t\t\t\t\t\t\te.preventDefault(); // prevent losing focus when clicking scroll arrows (FF, Chrome)\n\t\t\t\t\t\t\twas_click = +(new Date()); // ie does not allow to prevent losing focus\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"mousedown.jstree\", \".jstree-ocl\", function (e) {\n\t\t\t\t\t\te.preventDefault(); // prevent any node inside from losing focus when clicking the open/close icon\n\t\t\t\t\t})\n\t\t\t\t.on(\"click.jstree\", \".jstree-ocl\", function (e) {\n\t\t\t\t\t\tthis.toggle_node(e.target);\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"dblclick.jstree\", \".jstree-anchor\", function (e) {\n\t\t\t\t\t\tif(e.target.tagName && e.target.tagName.toLowerCase() === \"input\") { return true; }\n\t\t\t\t\t\tif(this.settings.core.dblclick_toggle) {\n\t\t\t\t\t\t\tthis.toggle_node(e.target);\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"click.jstree\", \".jstree-anchor\", function (e) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tif(e.currentTarget !== document.activeElement) { $(e.currentTarget).trigger('focus'); }\n\t\t\t\t\t\tthis.activate_node(e.currentTarget, e);\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on('keydown.jstree', '.jstree-anchor', function (e) {\n\t\t\t\t\t\tif(e.target.tagName && e.target.tagName.toLowerCase() === \"input\") { return true; }\n\t\t\t\t\t\tif(this._data.core.rtl) {\n\t\t\t\t\t\t\tif(e.which === 37) { e.which = 39; }\n\t\t\t\t\t\t\telse if(e.which === 39) { e.which = 37; }\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar f = this._kbevent_to_func(e);\n\t\t\t\t\t\tif (f) {\n\t\t\t\t\t\t\tvar r = f.call(this, e);\n\t\t\t\t\t\t\tif (r === false || r === true) {\n\t\t\t\t\t\t\t\treturn r;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"load_node.jstree\", function (e, data) {\n\t\t\t\t\t\tif(data.status) {\n\t\t\t\t\t\t\tif(data.node.id === $.jstree.root && !this._data.core.loaded) {\n\t\t\t\t\t\t\t\tthis._data.core.loaded = true;\n\t\t\t\t\t\t\t\tif(this._firstChild(this.get_container_ul()[0])) {\n\t\t\t\t\t\t\t\t\tthis.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * triggered after the root node is loaded for the first time\n\t\t\t\t\t\t\t\t * @event\n\t\t\t\t\t\t\t\t * @name loaded.jstree\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tthis.trigger(\"loaded\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(!this._data.core.ready) {\n\t\t\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\t\t\tif(this.element && !this.get_container_ul().find('.jstree-loading').length) {\n\t\t\t\t\t\t\t\t\t\tthis._data.core.ready = true;\n\t\t\t\t\t\t\t\t\t\tif(this._data.core.selected.length) {\n\t\t\t\t\t\t\t\t\t\t\tif(this.settings.core.expand_selected_onload) {\n\t\t\t\t\t\t\t\t\t\t\t\tvar tmp = [], i, j;\n\t\t\t\t\t\t\t\t\t\t\t\tfor(i = 0, j = this._data.core.selected.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\t\t\t\t\ttmp = tmp.concat(this._model.data[this._data.core.selected[i]].parents);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\ttmp = $.vakata.array_unique(tmp);\n\t\t\t\t\t\t\t\t\t\t\t\tfor(i = 0, j = tmp.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tthis.open_node(tmp[i], false, 0);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tthis.trigger('changed', { 'action' : 'ready', 'selected' : this._data.core.selected });\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t\t\t * triggered after all nodes are finished loading\n\t\t\t\t\t\t\t\t\t\t * @event\n\t\t\t\t\t\t\t\t\t\t * @name ready.jstree\n\t\t\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t\t\tthis.trigger(\"ready\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}.bind(this), 0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this))\n\t\t\t\t// quick searching when the tree is focused\n\t\t\t\t.on('keypress.jstree', function (e) {\n\t\t\t\t\t\tif(e.target.tagName && e.target.tagName.toLowerCase() === \"input\") { return true; }\n\t\t\t\t\t\tif(tout) { clearTimeout(tout); }\n\t\t\t\t\t\ttout = setTimeout(function () {\n\t\t\t\t\t\t\tword = '';\n\t\t\t\t\t\t}, 500);\n\n\t\t\t\t\t\tvar chr = String.fromCharCode(e.which).toLowerCase(),\n\t\t\t\t\t\t\tcol = this.element.find('.jstree-anchor').filter(':visible'),\n\t\t\t\t\t\t\tind = col.index(document.activeElement) || 0,\n\t\t\t\t\t\t\tend = false;\n\t\t\t\t\t\tword += chr;\n\n\t\t\t\t\t\t// match for whole word from current node down (including the current node)\n\t\t\t\t\t\tif(word.length > 1) {\n\t\t\t\t\t\t\tcol.slice(ind).each(function (i, v) {\n\t\t\t\t\t\t\t\tif($(v).text().toLowerCase().indexOf(word) === 0) {\n\t\t\t\t\t\t\t\t\t$(v).trigger('focus');\n\t\t\t\t\t\t\t\t\tend = true;\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}.bind(this));\n\t\t\t\t\t\t\tif(end) { return; }\n\n\t\t\t\t\t\t\t// match for whole word from the beginning of the tree\n\t\t\t\t\t\t\tcol.slice(0, ind).each(function (i, v) {\n\t\t\t\t\t\t\t\tif($(v).text().toLowerCase().indexOf(word) === 0) {\n\t\t\t\t\t\t\t\t\t$(v).trigger('focus');\n\t\t\t\t\t\t\t\t\tend = true;\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}.bind(this));\n\t\t\t\t\t\t\tif(end) { return; }\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// list nodes that start with that letter (only if word consists of a single char)\n\t\t\t\t\t\tif(new RegExp('^' + chr.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&') + '+$').test(word)) {\n\t\t\t\t\t\t\t// search for the next node starting with that letter\n\t\t\t\t\t\t\tcol.slice(ind + 1).each(function (i, v) {\n\t\t\t\t\t\t\t\tif($(v).text().toLowerCase().charAt(0) === chr) {\n\t\t\t\t\t\t\t\t\t$(v).trigger('focus');\n\t\t\t\t\t\t\t\t\tend = true;\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}.bind(this));\n\t\t\t\t\t\t\tif(end) { return; }\n\n\t\t\t\t\t\t\t// search from the beginning\n\t\t\t\t\t\t\tcol.slice(0, ind + 1).each(function (i, v) {\n\t\t\t\t\t\t\t\tif($(v).text().toLowerCase().charAt(0) === chr) {\n\t\t\t\t\t\t\t\t\t$(v).trigger('focus');\n\t\t\t\t\t\t\t\t\tend = true;\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}.bind(this));\n\t\t\t\t\t\t\tif(end) { return; }\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this))\n\t\t\t\t// THEME RELATED\n\t\t\t\t.on(\"init.jstree\", function () {\n\t\t\t\t\t\tvar s = this.settings.core.themes;\n\t\t\t\t\t\tthis._data.core.themes.dots\t\t\t= s.dots;\n\t\t\t\t\t\tthis._data.core.themes.stripes\t\t= s.stripes;\n\t\t\t\t\t\tthis._data.core.themes.icons\t\t= s.icons;\n\t\t\t\t\t\tthis._data.core.themes.ellipsis\t\t= s.ellipsis;\n\t\t\t\t\t\tthis.set_theme(s.name || \"default\", s.url);\n\t\t\t\t\t\tthis.set_theme_variant(s.variant);\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"loading.jstree\", function () {\n\t\t\t\t\t\tthis[ this._data.core.themes.dots ? \"show_dots\" : \"hide_dots\" ]();\n\t\t\t\t\t\tthis[ this._data.core.themes.icons ? \"show_icons\" : \"hide_icons\" ]();\n\t\t\t\t\t\tthis[ this._data.core.themes.stripes ? \"show_stripes\" : \"hide_stripes\" ]();\n\t\t\t\t\t\tthis[ this._data.core.themes.ellipsis ? \"show_ellipsis\" : \"hide_ellipsis\" ]();\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on('blur.jstree', '.jstree-anchor', function (e) {\n\t\t\t\t\t\tthis._data.core.focused = null;\n\t\t\t\t\t\t$(e.currentTarget).filter('.jstree-hovered').trigger('mouseleave');\n\t\t\t\t\t\tthis.element.attr('tabindex', '0');\n\t\t\t\t\t\t$(e.currentTarget).attr('tabindex', '-1');\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on('focus.jstree', '.jstree-anchor', function (e) {\n\t\t\t\t\t\tvar tmp = this.get_node(e.currentTarget);\n\t\t\t\t\t\tif(tmp && tmp.id) {\n\t\t\t\t\t\t\tthis._data.core.focused = tmp.id;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.element.find('.jstree-hovered').not(e.currentTarget).trigger('mouseleave');\n\t\t\t\t\t\t$(e.currentTarget).trigger('mouseenter');\n\t\t\t\t\t\tthis.element.attr('tabindex', '-1');\n\t\t\t\t\t\t$(e.currentTarget).attr('tabindex', '0');\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on('focus.jstree', function () {\n\t\t\t\t\t\tif(+(new Date()) - was_click > 500 && !this._data.core.focused && this.settings.core.restore_focus) {\n\t\t\t\t\t\t\twas_click = 0;\n\t\t\t\t\t\t\tvar act = this.get_node(this.element.attr('aria-activedescendant'), true);\n\t\t\t\t\t\t\tif(act) {\n\t\t\t\t\t\t\t\tact.find('> .jstree-anchor').trigger('focus');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on('mouseenter.jstree', '.jstree-anchor', function (e) {\n\t\t\t\t\t\tthis.hover_node(e.currentTarget);\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on('mouseleave.jstree', '.jstree-anchor', function (e) {\n\t\t\t\t\t\tthis.dehover_node(e.currentTarget);\n\t\t\t\t\t}.bind(this));\n\t\t},\n\t\t/**\n\t\t * part of the destroying of an instance. Used internally.\n\t\t * @private\n\t\t * @name unbind()\n\t\t */\n\t\tunbind : function () {\n\t\t\tthis.element.off('.jstree');\n\t\t\t$(document).off('.jstree-' + this._id);\n\t\t},\n\t\t/**\n\t\t * trigger an event. Used internally.\n\t\t * @private\n\t\t * @name trigger(ev [, data])\n\t\t * @param {String} ev the name of the event to trigger\n\t\t * @param {Object} data additional data to pass with the event\n\t\t */\n\t\ttrigger : function (ev, data) {\n\t\t\tif(!data) {\n\t\t\t\tdata = {};\n\t\t\t}\n\t\t\tdata.instance = this;\n\t\t\tthis.element.triggerHandler(ev.replace('.jstree','') + '.jstree', data);\n\t\t},\n\t\t/**\n\t\t * returns the jQuery extended instance container\n\t\t * @name get_container()\n\t\t * @return {jQuery}\n\t\t */\n\t\tget_container : function () {\n\t\t\treturn this.element;\n\t\t},\n\t\t/**\n\t\t * returns the jQuery extended main UL node inside the instance container. Used internally.\n\t\t * @private\n\t\t * @name get_container_ul()\n\t\t * @return {jQuery}\n\t\t */\n\t\tget_container_ul : function () {\n\t\t\treturn this.element.children(\".jstree-children\").first();\n\t\t},\n\t\t/**\n\t\t * gets string replacements (localization). Used internally.\n\t\t * @private\n\t\t * @name get_string(key)\n\t\t * @param {String} key\n\t\t * @return {String}\n\t\t */\n\t\tget_string : function (key) {\n\t\t\tvar a = this.settings.core.strings;\n\t\t\tif($.vakata.is_function(a)) { return a.call(this, key); }\n\t\t\tif(a && a[key]) { return a[key]; }\n\t\t\treturn key;\n\t\t},\n\t\t/**\n\t\t * gets the first child of a DOM node. Used internally.\n\t\t * @private\n\t\t * @name _firstChild(dom)\n\t\t * @param {DOMElement} dom\n\t\t * @return {DOMElement}\n\t\t */\n\t\t_firstChild : function (dom) {\n\t\t\tdom = dom ? dom.firstChild : null;\n\t\t\twhile(dom !== null && dom.nodeType !== 1) {\n\t\t\t\tdom = dom.nextSibling;\n\t\t\t}\n\t\t\treturn dom;\n\t\t},\n\t\t/**\n\t\t * gets the next sibling of a DOM node. Used internally.\n\t\t * @private\n\t\t * @name _nextSibling(dom)\n\t\t * @param {DOMElement} dom\n\t\t * @return {DOMElement}\n\t\t */\n\t\t_nextSibling : function (dom) {\n\t\t\tdom = dom ? dom.nextSibling : null;\n\t\t\twhile(dom !== null && dom.nodeType !== 1) {\n\t\t\t\tdom = dom.nextSibling;\n\t\t\t}\n\t\t\treturn dom;\n\t\t},\n\t\t/**\n\t\t * gets the previous sibling of a DOM node. Used internally.\n\t\t * @private\n\t\t * @name _previousSibling(dom)\n\t\t * @param {DOMElement} dom\n\t\t * @return {DOMElement}\n\t\t */\n\t\t_previousSibling : function (dom) {\n\t\t\tdom = dom ? dom.previousSibling : null;\n\t\t\twhile(dom !== null && dom.nodeType !== 1) {\n\t\t\t\tdom = dom.previousSibling;\n\t\t\t}\n\t\t\treturn dom;\n\t\t},\n\t\t/**\n\t\t * get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc)\n\t\t * @name get_node(obj [, as_dom])\n\t\t * @param {mixed} obj\n\t\t * @param {Boolean} as_dom\n\t\t * @return {Object|jQuery}\n\t\t */\n\t\tget_node : function (obj, as_dom) {\n\t\t\tif(obj && obj.id) {\n\t\t\t\tobj = obj.id;\n\t\t\t}\n\t\t\tif (obj instanceof $ && obj.length && obj[0].id) {\n\t\t\t\tobj = obj[0].id;\n\t\t\t}\n\t\t\tvar dom;\n\t\t\ttry {\n\t\t\t\tif(this._model.data[obj]) {\n\t\t\t\t\tobj = this._model.data[obj];\n\t\t\t\t}\n\t\t\t\telse if(typeof obj === \"string\" && this._model.data[obj.replace(/^#/, '')]) {\n\t\t\t\t\tobj = this._model.data[obj.replace(/^#/, '')];\n\t\t\t\t}\n\t\t\t\telse if(typeof obj === \"string\" && (dom = $('#' + obj.replace($.jstree.idregex,'\\\\$&'), this.element)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) {\n\t\t\t\t\tobj = this._model.data[dom.closest('.jstree-node').attr('id')];\n\t\t\t\t}\n\t\t\t\telse if((dom = this.element.find(obj)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) {\n\t\t\t\t\tobj = this._model.data[dom.closest('.jstree-node').attr('id')];\n\t\t\t\t}\n\t\t\t\telse if((dom = this.element.find(obj)).length && dom.hasClass('jstree')) {\n\t\t\t\t\tobj = this._model.data[$.jstree.root];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif(as_dom) {\n\t\t\t\t\tobj = obj.id === $.jstree.root ? this.element : $('#' + obj.id.replace($.jstree.idregex,'\\\\$&'), this.element);\n\t\t\t\t}\n\t\t\t\treturn obj;\n\t\t\t} catch (ex) { return false; }\n\t\t},\n\t\t/**\n\t\t * get the path to a node, either consisting of node texts, or of node IDs, optionally glued together (otherwise an array)\n\t\t * @name get_path(obj [, glue, ids])\n\t\t * @param {mixed} obj the node\n\t\t * @param {String} glue if you want the path as a string - pass the glue here (for example '/'), if a falsy value is supplied here, an array is returned\n\t\t * @param {Boolean} ids if set to true build the path using ID, otherwise node text is used\n\t\t * @return {mixed}\n\t\t */\n\t\tget_path : function (obj, glue, ids) {\n\t\t\tobj = obj.parents ? obj : this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root || !obj.parents) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar i, j, p = [];\n\t\t\tp.push(ids ? obj.id : obj.text);\n\t\t\tfor(i = 0, j = obj.parents.length; i < j; i++) {\n\t\t\t\tp.push(ids ? obj.parents[i] : this.get_text(obj.parents[i]));\n\t\t\t}\n\t\t\tp = p.reverse().slice(1);\n\t\t\treturn glue ? p.join(glue) : p;\n\t\t},\n\t\t/**\n\t\t * get the next visible node that is below the `obj` node. If `strict` is set to `true` only sibling nodes are returned.\n\t\t * @name get_next_dom(obj [, strict])\n\t\t * @param {mixed} obj\n\t\t * @param {Boolean} strict\n\t\t * @return {jQuery}\n\t\t */\n\t\tget_next_dom : function (obj, strict) {\n\t\t\tvar tmp;\n\t\t\tobj = this.get_node(obj, true);\n\t\t\tif(obj[0] === this.element[0]) {\n\t\t\t\ttmp = this._firstChild(this.get_container_ul()[0]);\n\t\t\t\twhile (tmp && tmp.offsetHeight === 0) {\n\t\t\t\t\ttmp = this._nextSibling(tmp);\n\t\t\t\t}\n\t\t\t\treturn tmp ? $(tmp) : false;\n\t\t\t}\n\t\t\tif(!obj || !obj.length) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(strict) {\n\t\t\t\ttmp = obj[0];\n\t\t\t\tdo {\n\t\t\t\t\ttmp = this._nextSibling(tmp);\n\t\t\t\t} while (tmp && tmp.offsetHeight === 0);\n\t\t\t\treturn tmp ? $(tmp) : false;\n\t\t\t}\n\t\t\tif(obj.hasClass(\"jstree-open\")) {\n\t\t\t\ttmp = this._firstChild(obj.children('.jstree-children')[0]);\n\t\t\t\twhile (tmp && tmp.offsetHeight === 0) {\n\t\t\t\t\ttmp = this._nextSibling(tmp);\n\t\t\t\t}\n\t\t\t\tif(tmp !== null) {\n\t\t\t\t\treturn $(tmp);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttmp = obj[0];\n\t\t\tdo {\n\t\t\t\ttmp = this._nextSibling(tmp);\n\t\t\t} while (tmp && tmp.offsetHeight === 0);\n\t\t\tif(tmp !== null) {\n\t\t\t\treturn $(tmp);\n\t\t\t}\n\t\t\treturn obj.parentsUntil(\".jstree\",\".jstree-node\").nextAll(\".jstree-node:visible\").first();\n\t\t},\n\t\t/**\n\t\t * get the previous visible node that is above the `obj` node. If `strict` is set to `true` only sibling nodes are returned.\n\t\t * @name get_prev_dom(obj [, strict])\n\t\t * @param {mixed} obj\n\t\t * @param {Boolean} strict\n\t\t * @return {jQuery}\n\t\t */\n\t\tget_prev_dom : function (obj, strict) {\n\t\t\tvar tmp;\n\t\t\tobj = this.get_node(obj, true);\n\t\t\tif(obj[0] === this.element[0]) {\n\t\t\t\ttmp = this.get_container_ul()[0].lastChild;\n\t\t\t\twhile (tmp && tmp.offsetHeight === 0) {\n\t\t\t\t\ttmp = this._previousSibling(tmp);\n\t\t\t\t}\n\t\t\t\treturn tmp ? $(tmp) : false;\n\t\t\t}\n\t\t\tif(!obj || !obj.length) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(strict) {\n\t\t\t\ttmp = obj[0];\n\t\t\t\tdo {\n\t\t\t\t\ttmp = this._previousSibling(tmp);\n\t\t\t\t} while (tmp && tmp.offsetHeight === 0);\n\t\t\t\treturn tmp ? $(tmp) : false;\n\t\t\t}\n\t\t\ttmp = obj[0];\n\t\t\tdo {\n\t\t\t\ttmp = this._previousSibling(tmp);\n\t\t\t} while (tmp && tmp.offsetHeight === 0);\n\t\t\tif(tmp !== null) {\n\t\t\t\tobj = $(tmp);\n\t\t\t\twhile(obj.hasClass(\"jstree-open\")) {\n\t\t\t\t\tobj = obj.children(\".jstree-children\").first().children(\".jstree-node:visible:last\");\n\t\t\t\t}\n\t\t\t\treturn obj;\n\t\t\t}\n\t\t\ttmp = obj[0].parentNode.parentNode;\n\t\t\treturn tmp && tmp.className && tmp.className.indexOf('jstree-node') !== -1 ? $(tmp) : false;\n\t\t},\n\t\t/**\n\t\t * get the parent ID of a node\n\t\t * @name get_parent(obj)\n\t\t * @param {mixed} obj\n\t\t * @return {String}\n\t\t */\n\t\tget_parent : function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn obj.parent;\n\t\t},\n\t\t/**\n\t\t * get a jQuery collection of all the children of a node (node must be rendered), returns false on error\n\t\t * @name get_children_dom(obj)\n\t\t * @param {mixed} obj\n\t\t * @return {jQuery}\n\t\t */\n\t\tget_children_dom : function (obj) {\n\t\t\tobj = this.get_node(obj, true);\n\t\t\tif(obj[0] === this.element[0]) {\n\t\t\t\treturn this.get_container_ul().children(\".jstree-node\");\n\t\t\t}\n\t\t\tif(!obj || !obj.length) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn obj.children(\".jstree-children\").children(\".jstree-node\");\n\t\t},\n\t\t/**\n\t\t * checks if a node has children\n\t\t * @name is_parent(obj)\n\t\t * @param {mixed} obj\n\t\t * @return {Boolean}\n\t\t */\n\t\tis_parent : function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\treturn obj && (obj.state.loaded === false || obj.children.length > 0);\n\t\t},\n\t\t/**\n\t\t * checks if a node is loaded (its children are available)\n\t\t * @name is_loaded(obj)\n\t\t * @param {mixed} obj\n\t\t * @return {Boolean}\n\t\t */\n\t\tis_loaded : function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\treturn obj && obj.state.loaded;\n\t\t},\n\t\t/**\n\t\t * check if a node is currently loading (fetching children)\n\t\t * @name is_loading(obj)\n\t\t * @param {mixed} obj\n\t\t * @return {Boolean}\n\t\t */\n\t\tis_loading : function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\treturn obj && obj.state && obj.state.loading;\n\t\t},\n\t\t/**\n\t\t * check if a node is opened\n\t\t * @name is_open(obj)\n\t\t * @param {mixed} obj\n\t\t * @return {Boolean}\n\t\t */\n\t\tis_open : function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\treturn obj && obj.state.opened;\n\t\t},\n\t\t/**\n\t\t * check if a node is in a closed state\n\t\t * @name is_closed(obj)\n\t\t * @param {mixed} obj\n\t\t * @return {Boolean}\n\t\t */\n\t\tis_closed : function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\treturn obj && this.is_parent(obj) && !obj.state.opened;\n\t\t},\n\t\t/**\n\t\t * check if a node has no children\n\t\t * @name is_leaf(obj)\n\t\t * @param {mixed} obj\n\t\t * @return {Boolean}\n\t\t */\n\t\tis_leaf : function (obj) {\n\t\t\treturn !this.is_parent(obj);\n\t\t},\n\t\t/**\n\t\t * loads a node (fetches its children using the `core.data` setting). Multiple nodes can be passed to by using an array.\n\t\t * @name load_node(obj [, callback])\n\t\t * @param {mixed} obj\n\t\t * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives two arguments - the node and a boolean status\n\t\t * @return {Boolean}\n\t\t * @trigger load_node.jstree\n\t\t */\n\t\tload_node : function (obj, callback) {\n\t\t\tvar dom = this.get_node(obj, true), k, l, i, j, c;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tthis._load_nodes(obj.slice(), callback);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj) {\n\t\t\t\tif(callback) { callback.call(this, obj, false); }\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// if(obj.state.loading) { } // the node is already loading - just wait for it to load and invoke callback? but if called implicitly it should be loaded again?\n\t\t\tif(obj.state.loaded) {\n\t\t\t\tobj.state.loaded = false;\n\t\t\t\tfor(i = 0, j = obj.parents.length; i < j; i++) {\n\t\t\t\t\tthis._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) {\n\t\t\t\t\t\treturn $.inArray(v, obj.children_d) === -1;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tfor(k = 0, l = obj.children_d.length; k < l; k++) {\n\t\t\t\t\tif(this._model.data[obj.children_d[k]].state.selected) {\n\t\t\t\t\t\tc = true;\n\t\t\t\t\t}\n\t\t\t\t\tdelete this._model.data[obj.children_d[k]];\n\t\t\t\t}\n\t\t\t\tif (c) {\n\t\t\t\t\tthis._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) {\n\t\t\t\t\t\treturn $.inArray(v, obj.children_d) === -1;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tobj.children = [];\n\t\t\t\tobj.children_d = [];\n\t\t\t\tif(c) {\n\t\t\t\t\tthis.trigger('changed', { 'action' : 'load_node', 'node' : obj, 'selected' : this._data.core.selected });\n\t\t\t\t}\n\t\t\t}\n\t\t\tobj.state.failed = false;\n\t\t\tobj.state.loading = true;\n\t\t\tif (obj.id !== $.jstree.root) {\n\t\t\t\tdom.children(\".jstree-anchor\").attr('aria-busy', true);\n\t\t\t} else {\n\t\t\t\tdom.attr('aria-busy', true);\n\t\t\t}\n\t\t\tdom.addClass(\"jstree-loading\");\n\t\t\tthis._load_node(obj, function (status) {\n\t\t\t\tobj = this._model.data[obj.id];\n\t\t\t\tobj.state.loading = false;\n\t\t\t\tobj.state.loaded = status;\n\t\t\t\tobj.state.failed = !obj.state.loaded;\n\t\t\t\tvar dom = this.get_node(obj, true), i = 0, j = 0, m = this._model.data, has_children = false;\n\t\t\t\tfor(i = 0, j = obj.children.length; i < j; i++) {\n\t\t\t\t\tif(m[obj.children[i]] && !m[obj.children[i]].state.hidden) {\n\t\t\t\t\t\thas_children = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(obj.state.loaded && dom && dom.length) {\n\t\t\t\t\tdom.removeClass('jstree-closed jstree-open jstree-leaf');\n\t\t\t\t\tif (!has_children) {\n\t\t\t\t\t\tdom.addClass('jstree-leaf');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (obj.id !== '#') {\n\t\t\t\t\t\t\tdom.addClass(obj.state.opened ? 'jstree-open' : 'jstree-closed');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (obj.id !== $.jstree.root) {\n\t\t\t\t\tdom.children(\".jstree-anchor\").attr('aria-busy', false);\n\t\t\t\t} else {\n\t\t\t\t\tdom.attr('aria-busy', false);\n\t\t\t\t}\n\t\t\t\tdom.removeClass(\"jstree-loading\");\n\t\t\t\t/**\n\t\t\t\t * triggered after a node is loaded\n\t\t\t\t * @event\n\t\t\t\t * @name load_node.jstree\n\t\t\t\t * @param {Object} node the node that was loading\n\t\t\t\t * @param {Boolean} status was the node loaded successfully\n\t\t\t\t */\n\t\t\t\tthis.trigger('load_node', { \"node\" : obj, \"status\" : status });\n\t\t\t\tif(callback) {\n\t\t\t\t\tcallback.call(this, obj, status);\n\t\t\t\t}\n\t\t\t}.bind(this));\n\t\t\treturn true;\n\t\t},\n\t\t/**\n\t\t * load an array of nodes (will also load unavailable nodes as soon as they appear in the structure). Used internally.\n\t\t * @private\n\t\t * @name _load_nodes(nodes [, callback])\n\t\t * @param {array} nodes\n\t\t * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes\n\t\t */\n\t\t_load_nodes : function (nodes, callback, is_callback, force_reload) {\n\t\t\tvar r = true,\n\t\t\t\tc = function () { this._load_nodes(nodes, callback, true); },\n\t\t\t\tm = this._model.data, i, j, tmp = [];\n\t\t\tfor(i = 0, j = nodes.length; i < j; i++) {\n\t\t\t\tif(m[nodes[i]] && ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || (!is_callback && force_reload) )) {\n\t\t\t\t\tif(!this.is_loading(nodes[i])) {\n\t\t\t\t\t\tthis.load_node(nodes[i], c);\n\t\t\t\t\t}\n\t\t\t\t\tr = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(r) {\n\t\t\t\tfor(i = 0, j = nodes.length; i < j; i++) {\n\t\t\t\t\tif(m[nodes[i]] && m[nodes[i]].state.loaded) {\n\t\t\t\t\t\ttmp.push(nodes[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(callback && !callback.done) {\n\t\t\t\t\tcallback.call(this, tmp);\n\t\t\t\t\tcallback.done = true;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * loads all unloaded nodes\n\t\t * @name load_all([obj, callback])\n\t\t * @param {mixed} obj the node to load recursively, omit to load all nodes in the tree\n\t\t * @param {function} callback a function to be executed once loading all the nodes is complete,\n\t\t * @trigger load_all.jstree\n\t\t */\n\t\tload_all : function (obj, callback) {\n\t\t\tif(!obj) { obj = $.jstree.root; }\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj) { return false; }\n\t\t\tvar to_load = [],\n\t\t\t\tm = this._model.data,\n\t\t\t\tc = m[obj.id].children_d,\n\t\t\t\ti, j;\n\t\t\tif(obj.state && !obj.state.loaded) {\n\t\t\t\tto_load.push(obj.id);\n\t\t\t}\n\t\t\tfor(i = 0, j = c.length; i < j; i++) {\n\t\t\t\tif(m[c[i]] && m[c[i]].state && !m[c[i]].state.loaded) {\n\t\t\t\t\tto_load.push(c[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(to_load.length) {\n\t\t\t\tthis._load_nodes(to_load, function () {\n\t\t\t\t\tthis.load_all(obj, callback);\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\t/**\n\t\t\t\t * triggered after a load_all call completes\n\t\t\t\t * @event\n\t\t\t\t * @name load_all.jstree\n\t\t\t\t * @param {Object} node the recursively loaded node\n\t\t\t\t */\n\t\t\t\tif(callback) { callback.call(this, obj); }\n\t\t\t\tthis.trigger('load_all', { \"node\" : obj });\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * handles the actual loading of a node. Used only internally.\n\t\t * @private\n\t\t * @name _load_node(obj [, callback])\n\t\t * @param {mixed} obj\n\t\t * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status\n\t\t * @return {Boolean}\n\t\t */\n\t\t_load_node : function (obj, callback) {\n\t\t\tvar s = this.settings.core.data, t;\n\t\t\tvar notTextOrCommentNode = function notTextOrCommentNode () {\n\t\t\t\treturn this.nodeType !== 3 && this.nodeType !== 8;\n\t\t\t};\n\t\t\t// use original HTML\n\t\t\tif(!s) {\n\t\t\t\tif(obj.id === $.jstree.root) {\n\t\t\t\t\treturn this._append_html_data(obj, this._data.core.original_container_html.clone(true), function (status) {\n\t\t\t\t\t\tcallback.call(this, status);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn callback.call(this, false);\n\t\t\t\t}\n\t\t\t\t// return callback.call(this, obj.id === $.jstree.root ? this._append_html_data(obj, this._data.core.original_container_html.clone(true)) : false);\n\t\t\t}\n\t\t\tif($.vakata.is_function(s)) {\n\t\t\t\treturn s.call(this, obj, function (d) {\n\t\t\t\t\tif(d === false) {\n\t\t\t\t\t\tcallback.call(this, false);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $($.parseHTML(d)).filter(notTextOrCommentNode) : d, function (status) {\n\t\t\t\t\t\t\tcallback.call(this, status);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\t// return d === false ? callback.call(this, false) : callback.call(this, this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $(d) : d));\n\t\t\t\t}.bind(this));\n\t\t\t}\n\t\t\tif(typeof s === 'object') {\n\t\t\t\tif(s.url) {\n\t\t\t\t\ts = $.extend(true, {}, s);\n\t\t\t\t\tif($.vakata.is_function(s.url)) {\n\t\t\t\t\t\ts.url = s.url.call(this, obj);\n\t\t\t\t\t}\n\t\t\t\t\tif($.vakata.is_function(s.data)) {\n\t\t\t\t\t\ts.data = s.data.call(this, obj);\n\t\t\t\t\t}\n\t\t\t\t\treturn $.ajax(s)\n\t\t\t\t\t\t.done(function (d,t,x) {\n\t\t\t\t\t\t\t\tvar type = x.getResponseHeader('Content-Type');\n\t\t\t\t\t\t\t\tif((type && type.indexOf('json') !== -1) || typeof d === \"object\") {\n\t\t\t\t\t\t\t\t\treturn this._append_json_data(obj, d, function (status) { callback.call(this, status); });\n\t\t\t\t\t\t\t\t\t//return callback.call(this, this._append_json_data(obj, d));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif((type && type.indexOf('html') !== -1) || typeof d === \"string\") {\n\t\t\t\t\t\t\t\t\treturn this._append_html_data(obj, $($.parseHTML(d)).filter(notTextOrCommentNode), function (status) { callback.call(this, status); });\n\t\t\t\t\t\t\t\t\t// return callback.call(this, this._append_html_data(obj, $(d)));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthis._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : x }) };\n\t\t\t\t\t\t\t\tthis.settings.core.error.call(this, this._data.core.last_error);\n\t\t\t\t\t\t\t\treturn callback.call(this, false);\n\t\t\t\t\t\t\t}.bind(this))\n\t\t\t\t\t\t.fail(function (f) {\n\t\t\t\t\t\t\t\tthis._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : f }) };\n\t\t\t\t\t\t\t\tcallback.call(this, false);\n\t\t\t\t\t\t\t\tthis.settings.core.error.call(this, this._data.core.last_error);\n\t\t\t\t\t\t\t}.bind(this));\n\t\t\t\t}\n\t\t\t\tif ($.vakata.is_array(s)) {\n\t\t\t\t\tt = $.extend(true, [], s);\n\t\t\t\t} else if ($.isPlainObject(s)) {\n\t\t\t\t\tt = $.extend(true, {}, s);\n\t\t\t\t} else {\n\t\t\t\t\tt = s;\n\t\t\t\t}\n\t\t\t\tif(obj.id === $.jstree.root) {\n\t\t\t\t\treturn this._append_json_data(obj, t, function (status) {\n\t\t\t\t\t\tcallback.call(this, status);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_05', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) };\n\t\t\t\t\tthis.settings.core.error.call(this, this._data.core.last_error);\n\t\t\t\t\treturn callback.call(this, false);\n\t\t\t\t}\n\t\t\t\t//return callback.call(this, (obj.id === $.jstree.root ? this._append_json_data(obj, t) : false) );\n\t\t\t}\n\t\t\tif(typeof s === 'string') {\n\t\t\t\tif(obj.id === $.jstree.root) {\n\t\t\t\t\treturn this._append_html_data(obj, $($.parseHTML(s)).filter(notTextOrCommentNode), function (status) {\n\t\t\t\t\t\tcallback.call(this, status);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_06', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) };\n\t\t\t\t\tthis.settings.core.error.call(this, this._data.core.last_error);\n\t\t\t\t\treturn callback.call(this, false);\n\t\t\t\t}\n\t\t\t\t//return callback.call(this, (obj.id === $.jstree.root ? this._append_html_data(obj, $(s)) : false) );\n\t\t\t}\n\t\t\treturn callback.call(this, false);\n\t\t},\n\t\t/**\n\t\t * adds a node to the list of nodes to redraw. Used only internally.\n\t\t * @private\n\t\t * @name _node_changed(obj [, callback])\n\t\t * @param {mixed} obj\n\t\t */\n\t\t_node_changed : function (obj) {\n\t\t\tobj = this.get_node(obj);\n if (obj && $.inArray(obj.id, this._model.changed) === -1) {\n\t\t\t\tthis._model.changed.push(obj.id);\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * appends HTML content to the tree. Used internally.\n\t\t * @private\n\t\t * @name _append_html_data(obj, data)\n\t\t * @param {mixed} obj the node to append to\n\t\t * @param {String} data the HTML string to parse and append\n\t\t * @trigger model.jstree, changed.jstree\n\t\t */\n\t\t_append_html_data : function (dom, data, cb) {\n\t\t\tdom = this.get_node(dom);\n\t\t\tdom.children = [];\n\t\t\tdom.children_d = [];\n\t\t\tvar dat = data.is('ul') ? data.children() : data,\n\t\t\t\tpar = dom.id,\n\t\t\t\tchd = [],\n\t\t\t\tdpc = [],\n\t\t\t\tm = this._model.data,\n\t\t\t\tp = m[par],\n\t\t\t\ts = this._data.core.selected.length,\n\t\t\t\ttmp, i, j;\n\t\t\tdat.each(function (i, v) {\n\t\t\t\ttmp = this._parse_model_from_html($(v), par, p.parents.concat());\n\t\t\t\tif(tmp) {\n\t\t\t\t\tchd.push(tmp);\n\t\t\t\t\tdpc.push(tmp);\n\t\t\t\t\tif(m[tmp].children_d.length) {\n\t\t\t\t\t\tdpc = dpc.concat(m[tmp].children_d);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}.bind(this));\n\t\t\tp.children = chd;\n\t\t\tp.children_d = dpc;\n\t\t\tfor(i = 0, j = p.parents.length; i < j; i++) {\n\t\t\t\tm[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc);\n\t\t\t}\n\t\t\t/**\n\t\t\t * triggered when new data is inserted to the tree model\n\t\t\t * @event\n\t\t\t * @name model.jstree\n\t\t\t * @param {Array} nodes an array of node IDs\n\t\t\t * @param {String} parent the parent ID of the nodes\n\t\t\t */\n\t\t\tthis.trigger('model', { \"nodes\" : dpc, 'parent' : par });\n\t\t\tif(par !== $.jstree.root) {\n\t\t\t\tthis._node_changed(par);\n\t\t\t\tthis.redraw();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.get_container_ul().children('.jstree-initial-node').remove();\n\t\t\t\tthis.redraw(true);\n\t\t\t}\n\t\t\tif(this._data.core.selected.length !== s) {\n\t\t\t\tthis.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected });\n\t\t\t}\n\t\t\tcb.call(this, true);\n\t\t},\n\t\t/**\n\t\t * appends JSON content to the tree. Used internally.\n\t\t * @private\n\t\t * @name _append_json_data(obj, data)\n\t\t * @param {mixed} obj the node to append to\n\t\t * @param {String} data the JSON object to parse and append\n\t\t * @param {Boolean} force_processing internal param - do not set\n\t\t * @trigger model.jstree, changed.jstree\n\t\t */\n\t\t_append_json_data : function (dom, data, cb, force_processing) {\n\t\t\tif(this.element === null) { return; }\n\t\t\tdom = this.get_node(dom);\n\t\t\tdom.children = [];\n\t\t\tdom.children_d = [];\n\t\t\t// *%$@!!!\n\t\t\tif(data.d) {\n\t\t\t\tdata = data.d;\n\t\t\t\tif(typeof data === \"string\") {\n\t\t\t\t\tdata = JSON.parse(data);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!$.vakata.is_array(data)) { data = [data]; }\n\t\t\tvar w = null,\n\t\t\t\targs = {\n\t\t\t\t\t'df'\t: this._model.default_state,\n\t\t\t\t\t'dat'\t: data,\n\t\t\t\t\t'par'\t: dom.id,\n\t\t\t\t\t'm'\t\t: this._model.data,\n\t\t\t\t\t't_id'\t: this._id,\n\t\t\t\t\t't_cnt'\t: this._cnt,\n\t\t\t\t\t'sel'\t: this._data.core.selected\n\t\t\t\t},\n\t\t\t\tinst = this,\n\t\t\t\tfunc = function (data, undefined) {\n\t\t\t\t\tif(data.data) { data = data.data; }\n\t\t\t\t\tvar dat = data.dat,\n\t\t\t\t\t\tpar = data.par,\n\t\t\t\t\t\tchd = [],\n\t\t\t\t\t\tdpc = [],\n\t\t\t\t\t\tadd = [],\n\t\t\t\t\t\tdf = data.df,\n\t\t\t\t\t\tt_id = data.t_id,\n\t\t\t\t\t\tt_cnt = data.t_cnt,\n\t\t\t\t\t\tm = data.m,\n\t\t\t\t\t\tp = m[par],\n\t\t\t\t\t\tsel = data.sel,\n\t\t\t\t\t\ttmp, i, j, rslt,\n\t\t\t\t\t\tparse_flat = function (d, p, ps) {\n\t\t\t\t\t\t\tif(!ps) { ps = []; }\n\t\t\t\t\t\t\telse { ps = ps.concat(); }\n\t\t\t\t\t\t\tif(p) { ps.unshift(p); }\n\t\t\t\t\t\t\tvar tid = d.id.toString(),\n\t\t\t\t\t\t\t\ti, j, c, e,\n\t\t\t\t\t\t\t\ttmp = {\n\t\t\t\t\t\t\t\t\tid\t\t\t: tid,\n\t\t\t\t\t\t\t\t\ttext\t\t: d.text || '',\n\t\t\t\t\t\t\t\t\ticon\t\t: d.icon !== undefined ? d.icon : true,\n\t\t\t\t\t\t\t\t\tparent\t\t: p,\n\t\t\t\t\t\t\t\t\tparents\t\t: ps,\n\t\t\t\t\t\t\t\t\tchildren\t: d.children || [],\n\t\t\t\t\t\t\t\t\tchildren_d\t: d.children_d || [],\n\t\t\t\t\t\t\t\t\tdata\t\t: d.data,\n\t\t\t\t\t\t\t\t\tstate\t\t: { },\n\t\t\t\t\t\t\t\t\tli_attr\t\t: { id : false },\n\t\t\t\t\t\t\t\t\ta_attr\t\t: { href : '#' },\n\t\t\t\t\t\t\t\t\toriginal\t: false\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tfor(i in df) {\n\t\t\t\t\t\t\t\tif(df.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\ttmp.state[i] = df[i];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d && d.data && d.data.jstree && d.data.jstree.icon) {\n\t\t\t\t\t\t\t\ttmp.icon = d.data.jstree.icon;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(tmp.icon === undefined || tmp.icon === null || tmp.icon === \"\") {\n\t\t\t\t\t\t\t\ttmp.icon = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d && d.data) {\n\t\t\t\t\t\t\t\ttmp.data = d.data;\n\t\t\t\t\t\t\t\tif(d.data.jstree) {\n\t\t\t\t\t\t\t\t\tfor(i in d.data.jstree) {\n\t\t\t\t\t\t\t\t\t\tif(d.data.jstree.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\t\t\ttmp.state[i] = d.data.jstree[i];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d && typeof d.state === 'object') {\n\t\t\t\t\t\t\t\tfor (i in d.state) {\n\t\t\t\t\t\t\t\t\tif(d.state.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\t\ttmp.state[i] = d.state[i];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d && typeof d.li_attr === 'object') {\n\t\t\t\t\t\t\t\tfor (i in d.li_attr) {\n\t\t\t\t\t\t\t\t\tif(d.li_attr.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\t\ttmp.li_attr[i] = d.li_attr[i];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(!tmp.li_attr.id) {\n\t\t\t\t\t\t\t\ttmp.li_attr.id = tid;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d && typeof d.a_attr === 'object') {\n\t\t\t\t\t\t\t\tfor (i in d.a_attr) {\n\t\t\t\t\t\t\t\t\tif(d.a_attr.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\t\ttmp.a_attr[i] = d.a_attr[i];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d && d.children && d.children === true) {\n\t\t\t\t\t\t\t\ttmp.state.loaded = false;\n\t\t\t\t\t\t\t\ttmp.children = [];\n\t\t\t\t\t\t\t\ttmp.children_d = [];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tm[tmp.id] = tmp;\n\t\t\t\t\t\t\tfor(i = 0, j = tmp.children.length; i < j; i++) {\n\t\t\t\t\t\t\t\tc = parse_flat(m[tmp.children[i]], tmp.id, ps);\n\t\t\t\t\t\t\t\te = m[c];\n\t\t\t\t\t\t\t\ttmp.children_d.push(c);\n\t\t\t\t\t\t\t\tif(e.children_d.length) {\n\t\t\t\t\t\t\t\t\ttmp.children_d = tmp.children_d.concat(e.children_d);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdelete d.data;\n\t\t\t\t\t\t\tdelete d.children;\n\t\t\t\t\t\t\tm[tmp.id].original = d;\n\t\t\t\t\t\t\tif(tmp.state.selected) {\n\t\t\t\t\t\t\t\tadd.push(tmp.id);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn tmp.id;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tparse_nest = function (d, p, ps) {\n\t\t\t\t\t\t\tif(!ps) { ps = []; }\n\t\t\t\t\t\t\telse { ps = ps.concat(); }\n\t\t\t\t\t\t\tif(p) { ps.unshift(p); }\n\t\t\t\t\t\t\tvar tid = false, i, j, c, e, tmp;\n\t\t\t\t\t\t\tdo {\n\t\t\t\t\t\t\t\ttid = 'j' + t_id + '_' + (++t_cnt);\n\t\t\t\t\t\t\t} while(m[tid]);\n\n\t\t\t\t\t\t\ttmp = {\n\t\t\t\t\t\t\t\tid\t\t\t: false,\n\t\t\t\t\t\t\t\ttext\t\t: typeof d === 'string' ? d : '',\n\t\t\t\t\t\t\t\ticon\t\t: typeof d === 'object' && d.icon !== undefined ? d.icon : true,\n\t\t\t\t\t\t\t\tparent\t\t: p,\n\t\t\t\t\t\t\t\tparents\t\t: ps,\n\t\t\t\t\t\t\t\tchildren\t: [],\n\t\t\t\t\t\t\t\tchildren_d\t: [],\n\t\t\t\t\t\t\t\tdata\t\t: null,\n\t\t\t\t\t\t\t\tstate\t\t: { },\n\t\t\t\t\t\t\t\tli_attr\t\t: { id : false },\n\t\t\t\t\t\t\t\ta_attr\t\t: { href : '#' },\n\t\t\t\t\t\t\t\toriginal\t: false\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tfor(i in df) {\n\t\t\t\t\t\t\t\tif(df.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\ttmp.state[i] = df[i];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d && d.id) { tmp.id = d.id.toString(); }\n\t\t\t\t\t\t\tif(d && d.text) { tmp.text = d.text; }\n\t\t\t\t\t\t\tif(d && d.data && d.data.jstree && d.data.jstree.icon) {\n\t\t\t\t\t\t\t\ttmp.icon = d.data.jstree.icon;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(tmp.icon === undefined || tmp.icon === null || tmp.icon === \"\") {\n\t\t\t\t\t\t\t\ttmp.icon = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d && d.data) {\n\t\t\t\t\t\t\t\ttmp.data = d.data;\n\t\t\t\t\t\t\t\tif(d.data.jstree) {\n\t\t\t\t\t\t\t\t\tfor(i in d.data.jstree) {\n\t\t\t\t\t\t\t\t\t\tif(d.data.jstree.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\t\t\ttmp.state[i] = d.data.jstree[i];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d && typeof d.state === 'object') {\n\t\t\t\t\t\t\t\tfor (i in d.state) {\n\t\t\t\t\t\t\t\t\tif(d.state.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\t\ttmp.state[i] = d.state[i];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d && typeof d.li_attr === 'object') {\n\t\t\t\t\t\t\t\tfor (i in d.li_attr) {\n\t\t\t\t\t\t\t\t\tif(d.li_attr.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\t\ttmp.li_attr[i] = d.li_attr[i];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(tmp.li_attr.id && !tmp.id) {\n\t\t\t\t\t\t\t\ttmp.id = tmp.li_attr.id.toString();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(!tmp.id) {\n\t\t\t\t\t\t\t\ttmp.id = tid;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(!tmp.li_attr.id) {\n\t\t\t\t\t\t\t\ttmp.li_attr.id = tmp.id;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d && typeof d.a_attr === 'object') {\n\t\t\t\t\t\t\t\tfor (i in d.a_attr) {\n\t\t\t\t\t\t\t\t\tif(d.a_attr.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\t\ttmp.a_attr[i] = d.a_attr[i];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d && d.children && d.children.length) {\n\t\t\t\t\t\t\t\tfor(i = 0, j = d.children.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\tc = parse_nest(d.children[i], tmp.id, ps);\n\t\t\t\t\t\t\t\t\te = m[c];\n\t\t\t\t\t\t\t\t\ttmp.children.push(c);\n\t\t\t\t\t\t\t\t\tif(e.children_d.length) {\n\t\t\t\t\t\t\t\t\t\ttmp.children_d = tmp.children_d.concat(e.children_d);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttmp.children_d = tmp.children_d.concat(tmp.children);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(d && d.children && d.children === true) {\n\t\t\t\t\t\t\t\ttmp.state.loaded = false;\n\t\t\t\t\t\t\t\ttmp.children = [];\n\t\t\t\t\t\t\t\ttmp.children_d = [];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdelete d.data;\n\t\t\t\t\t\t\tdelete d.children;\n\t\t\t\t\t\t\ttmp.original = d;\n\t\t\t\t\t\t\tm[tmp.id] = tmp;\n\t\t\t\t\t\t\tif(tmp.state.selected) {\n\t\t\t\t\t\t\t\tadd.push(tmp.id);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn tmp.id;\n\t\t\t\t\t\t};\n\n\t\t\t\t\tif(dat.length && dat[0].id !== undefined && dat[0].parent !== undefined) {\n\t\t\t\t\t\t// Flat JSON support (for easy import from DB):\n\t\t\t\t\t\t// 1) convert to object (foreach)\n\t\t\t\t\t\tfor(i = 0, j = dat.length; i < j; i++) {\n\t\t\t\t\t\t\tif(!dat[i].children) {\n\t\t\t\t\t\t\t\tdat[i].children = [];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(!dat[i].state) {\n\t\t\t\t\t\t\t\tdat[i].state = {};\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tm[dat[i].id.toString()] = dat[i];\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 2) populate children (foreach)\n\t\t\t\t\t\tfor(i = 0, j = dat.length; i < j; i++) {\n\t\t\t\t\t\t\tif (!m[dat[i].parent.toString()]) {\n\t\t\t\t\t\t\t\tif (typeof inst !== \"undefined\") {\n\t\t\t\t\t\t\t\t\tinst._data.core.last_error = { 'error' : 'parse', 'plugin' : 'core', 'id' : 'core_07', 'reason' : 'Node with invalid parent', 'data' : JSON.stringify({ 'id' : dat[i].id.toString(), 'parent' : dat[i].parent.toString() }) };\n\t\t\t\t\t\t\t\t\tinst.settings.core.error.call(inst, inst._data.core.last_error);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tm[dat[i].parent.toString()].children.push(dat[i].id.toString());\n\t\t\t\t\t\t\t// populate parent.children_d\n\t\t\t\t\t\t\tp.children_d.push(dat[i].id.toString());\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 3) normalize && populate parents and children_d with recursion\n\t\t\t\t\t\tfor(i = 0, j = p.children.length; i < j; i++) {\n\t\t\t\t\t\t\ttmp = parse_flat(m[p.children[i]], par, p.parents.concat());\n\t\t\t\t\t\t\tdpc.push(tmp);\n\t\t\t\t\t\t\tif(m[tmp].children_d.length) {\n\t\t\t\t\t\t\t\tdpc = dpc.concat(m[tmp].children_d);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor(i = 0, j = p.parents.length; i < j; i++) {\n\t\t\t\t\t\t\tm[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// ?) three_state selection - p.state.selected && t - (if three_state foreach(dat => ch) -> foreach(parents) if(parent.selected) child.selected = true;\n\t\t\t\t\t\trslt = {\n\t\t\t\t\t\t\t'cnt' : t_cnt,\n\t\t\t\t\t\t\t'mod' : m,\n\t\t\t\t\t\t\t'sel' : sel,\n\t\t\t\t\t\t\t'par' : par,\n\t\t\t\t\t\t\t'dpc' : dpc,\n\t\t\t\t\t\t\t'add' : add\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tfor(i = 0, j = dat.length; i < j; i++) {\n\t\t\t\t\t\t\ttmp = parse_nest(dat[i], par, p.parents.concat());\n\t\t\t\t\t\t\tif(tmp) {\n\t\t\t\t\t\t\t\tchd.push(tmp);\n\t\t\t\t\t\t\t\tdpc.push(tmp);\n\t\t\t\t\t\t\t\tif(m[tmp].children_d.length) {\n\t\t\t\t\t\t\t\t\tdpc = dpc.concat(m[tmp].children_d);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tp.children = chd;\n\t\t\t\t\t\tp.children_d = dpc;\n\t\t\t\t\t\tfor(i = 0, j = p.parents.length; i < j; i++) {\n\t\t\t\t\t\t\tm[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc);\n\t\t\t\t\t\t}\n\t\t\t\t\t\trslt = {\n\t\t\t\t\t\t\t'cnt' : t_cnt,\n\t\t\t\t\t\t\t'mod' : m,\n\t\t\t\t\t\t\t'sel' : sel,\n\t\t\t\t\t\t\t'par' : par,\n\t\t\t\t\t\t\t'dpc' : dpc,\n\t\t\t\t\t\t\t'add' : add\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tif(typeof window === 'undefined' || typeof window.document === 'undefined') {\n\t\t\t\t\t\tpostMessage(rslt);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\treturn rslt;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\trslt = function (rslt, worker) {\n\t\t\t\t\tif(this.element === null) { return; }\n\t\t\t\t\tthis._cnt = rslt.cnt;\n\t\t\t\t\tvar i, m = this._model.data;\n\t\t\t\t\tfor (i in m) {\n\t\t\t\t\t\tif (m.hasOwnProperty(i) && m[i].state && m[i].state.loading && rslt.mod[i]) {\n\t\t\t\t\t\t\trslt.mod[i].state.loading = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis._model.data = rslt.mod; // breaks the reference in load_node - careful\n\n\t\t\t\t\tif(worker) {\n\t\t\t\t\t\tvar j, a = rslt.add, r = rslt.sel, s = this._data.core.selected.slice();\n\t\t\t\t\t\tm = this._model.data;\n\t\t\t\t\t\t// if selection was changed while calculating in worker\n\t\t\t\t\t\tif(r.length !== s.length || $.vakata.array_unique(r.concat(s)).length !== r.length) {\n\t\t\t\t\t\t\t// deselect nodes that are no longer selected\n\t\t\t\t\t\t\tfor(i = 0, j = r.length; i < j; i++) {\n\t\t\t\t\t\t\t\tif($.inArray(r[i], a) === -1 && $.inArray(r[i], s) === -1) {\n\t\t\t\t\t\t\t\t\tm[r[i]].state.selected = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// select nodes that were selected in the mean time\n\t\t\t\t\t\t\tfor(i = 0, j = s.length; i < j; i++) {\n\t\t\t\t\t\t\t\tif($.inArray(s[i], r) === -1) {\n\t\t\t\t\t\t\t\t\tm[s[i]].state.selected = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(rslt.add.length) {\n\t\t\t\t\t\tthis._data.core.selected = this._data.core.selected.concat(rslt.add);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.trigger('model', { \"nodes\" : rslt.dpc, 'parent' : rslt.par });\n\n\t\t\t\t\tif(rslt.par !== $.jstree.root) {\n\t\t\t\t\t\tthis._node_changed(rslt.par);\n\t\t\t\t\t\tthis.redraw();\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// this.get_container_ul().children('.jstree-initial-node').remove();\n\t\t\t\t\t\tthis.redraw(true);\n\t\t\t\t\t}\n\t\t\t\t\tif(rslt.add.length) {\n\t\t\t\t\t\tthis.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected });\n\t\t\t\t\t}\n\n\t\t\t\t\t// If no worker, try to mimic worker behavioour, by invoking cb asynchronously\n\t\t\t\t\tif (!worker && setImmediate) {\n\t\t\t\t\t\tsetImmediate(function(){\n\t\t\t\t\t\t\tcb.call(inst, true);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tcb.call(inst, true);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\tif(this.settings.core.worker && window.Blob && window.URL && window.Worker) {\n\t\t\t\ttry {\n\t\t\t\t\tif(this._wrk === null) {\n\t\t\t\t\t\tthis._wrk = window.URL.createObjectURL(\n\t\t\t\t\t\t\tnew window.Blob(\n\t\t\t\t\t\t\t\t['self.onmessage = ' + func.toString()],\n\t\t\t\t\t\t\t\t{type:\"text/javascript\"}\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif(!this._data.core.working || force_processing) {\n\t\t\t\t\t\tthis._data.core.working = true;\n\t\t\t\t\t\tw = new window.Worker(this._wrk);\n\t\t\t\t\t\tw.onmessage = function (e) {\n\t\t\t\t\t\t\trslt.call(this, e.data, true);\n\t\t\t\t\t\t\ttry { w.terminate(); w = null; } catch(ignore) { }\n\t\t\t\t\t\t\tif(this._data.core.worker_queue.length) {\n\t\t\t\t\t\t\t\tthis._append_json_data.apply(this, this._data.core.worker_queue.shift());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tthis._data.core.working = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}.bind(this);\n\t\t\t\t\t\tw.onerror = function (e) {\n\t\t\t\t\t\t\trslt.call(this, func(args), false);\n\t\t\t\t\t\t\tif(this._data.core.worker_queue.length) {\n\t\t\t\t\t\t\t\tthis._append_json_data.apply(this, this._data.core.worker_queue.shift());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tthis._data.core.working = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}.bind(this);\n\t\t\t\t\t\tif(!args.par) {\n\t\t\t\t\t\t\tif(this._data.core.worker_queue.length) {\n\t\t\t\t\t\t\t\tthis._append_json_data.apply(this, this._data.core.worker_queue.shift());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tthis._data.core.working = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tw.postMessage(args);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis._data.core.worker_queue.push([dom, data, cb, true]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch(e) {\n\t\t\t\t\trslt.call(this, func(args), false);\n\t\t\t\t\tif(this._data.core.worker_queue.length) {\n\t\t\t\t\t\tthis._append_json_data.apply(this, this._data.core.worker_queue.shift());\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis._data.core.working = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\trslt.call(this, func(args), false);\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * parses a node from a jQuery object and appends them to the in memory tree model. Used internally.\n\t\t * @private\n\t\t * @name _parse_model_from_html(d [, p, ps])\n\t\t * @param {jQuery} d the jQuery object to parse\n\t\t * @param {String} p the parent ID\n\t\t * @param {Array} ps list of all parents\n\t\t * @return {String} the ID of the object added to the model\n\t\t */\n\t\t_parse_model_from_html : function (d, p, ps) {\n\t\t\tif(!ps) { ps = []; }\n\t\t\telse { ps = [].concat(ps); }\n\t\t\tif(p) { ps.unshift(p); }\n\t\t\tvar c, e, m = this._model.data,\n\t\t\t\tdata = {\n\t\t\t\t\tid\t\t\t: false,\n\t\t\t\t\ttext\t\t: false,\n\t\t\t\t\ticon\t\t: true,\n\t\t\t\t\tparent\t\t: p,\n\t\t\t\t\tparents\t\t: ps,\n\t\t\t\t\tchildren\t: [],\n\t\t\t\t\tchildren_d\t: [],\n\t\t\t\t\tdata\t\t: null,\n\t\t\t\t\tstate\t\t: { },\n\t\t\t\t\tli_attr\t\t: { id : false },\n\t\t\t\t\ta_attr\t\t: { href : '#' },\n\t\t\t\t\toriginal\t: false\n\t\t\t\t}, i, tmp, tid;\n\t\t\tfor(i in this._model.default_state) {\n\t\t\t\tif(this._model.default_state.hasOwnProperty(i)) {\n\t\t\t\t\tdata.state[i] = this._model.default_state[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\ttmp = $.vakata.attributes(d, true);\n\t\t\t$.each(tmp, function (i, v) {\n\t\t\t\tv = $.vakata.trim(v);\n\t\t\t\tif(!v.length) { return true; }\n\t\t\t\tdata.li_attr[i] = v;\n\t\t\t\tif(i === 'id') {\n\t\t\t\t\tdata.id = v.toString();\n\t\t\t\t}\n\t\t\t});\n\t\t\ttmp = d.children('a').first();\n\t\t\tif(tmp.length) {\n\t\t\t\ttmp = $.vakata.attributes(tmp, true);\n\t\t\t\t$.each(tmp, function (i, v) {\n\t\t\t\t\tv = $.vakata.trim(v);\n\t\t\t\t\tif(v.length) {\n\t\t\t\t\t\tdata.a_attr[i] = v;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\ttmp = d.children(\"a\").first().length ? d.children(\"a\").first().clone() : d.clone();\n\t\t\ttmp.children(\"ins, i, ul\").remove();\n\t\t\ttmp = tmp.html();\n\t\t\ttmp = $('
        ').html(tmp);\n\t\t\tdata.text = this.settings.core.force_text ? tmp.text() : tmp.html();\n\t\t\ttmp = d.data();\n\t\t\tdata.data = tmp ? $.extend(true, {}, tmp) : null;\n\t\t\tdata.state.opened = d.hasClass('jstree-open');\n\t\t\tdata.state.selected = d.children('a').hasClass('jstree-clicked');\n\t\t\tdata.state.disabled = d.children('a').hasClass('jstree-disabled');\n\t\t\tif(data.data && data.data.jstree) {\n\t\t\t\tfor(i in data.data.jstree) {\n\t\t\t\t\tif(data.data.jstree.hasOwnProperty(i)) {\n\t\t\t\t\t\tdata.state[i] = data.data.jstree[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttmp = d.children(\"a\").children(\".jstree-themeicon\");\n\t\t\tif(tmp.length) {\n\t\t\t\tdata.icon = tmp.hasClass('jstree-themeicon-hidden') ? false : tmp.attr('rel');\n\t\t\t}\n\t\t\tif(data.state.icon !== undefined) {\n\t\t\t\tdata.icon = data.state.icon;\n\t\t\t}\n\t\t\tif(data.icon === undefined || data.icon === null || data.icon === \"\") {\n\t\t\t\tdata.icon = true;\n\t\t\t}\n\t\t\ttmp = d.children(\"ul\").children(\"li\");\n\t\t\tdo {\n\t\t\t\ttid = 'j' + this._id + '_' + (++this._cnt);\n\t\t\t} while(m[tid]);\n\t\t\tdata.id = data.li_attr.id ? data.li_attr.id.toString() : tid;\n\t\t\tif(tmp.length) {\n\t\t\t\ttmp.each(function (i, v) {\n\t\t\t\t\tc = this._parse_model_from_html($(v), data.id, ps);\n\t\t\t\t\te = this._model.data[c];\n\t\t\t\t\tdata.children.push(c);\n\t\t\t\t\tif(e.children_d.length) {\n\t\t\t\t\t\tdata.children_d = data.children_d.concat(e.children_d);\n\t\t\t\t\t}\n\t\t\t\t}.bind(this));\n\t\t\t\tdata.children_d = data.children_d.concat(data.children);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(d.hasClass('jstree-closed')) {\n\t\t\t\t\tdata.state.loaded = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(data.li_attr['class']) {\n\t\t\t\tdata.li_attr['class'] = data.li_attr['class'].replace('jstree-closed','').replace('jstree-open','');\n\t\t\t}\n\t\t\tif(data.a_attr['class']) {\n\t\t\t\tdata.a_attr['class'] = data.a_attr['class'].replace('jstree-clicked','').replace('jstree-disabled','');\n\t\t\t}\n\t\t\tm[data.id] = data;\n\t\t\tif(data.state.selected) {\n\t\t\t\tthis._data.core.selected.push(data.id);\n\t\t\t}\n\t\t\treturn data.id;\n\t\t},\n\t\t/**\n\t\t * parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally.\n\t\t * @private\n\t\t * @name _parse_model_from_flat_json(d [, p, ps])\n\t\t * @param {Object} d the JSON object to parse\n\t\t * @param {String} p the parent ID\n\t\t * @param {Array} ps list of all parents\n\t\t * @return {String} the ID of the object added to the model\n\t\t */\n\t\t_parse_model_from_flat_json : function (d, p, ps) {\n\t\t\tif(!ps) { ps = []; }\n\t\t\telse { ps = ps.concat(); }\n\t\t\tif(p) { ps.unshift(p); }\n\t\t\tvar tid = d.id.toString(),\n\t\t\t\tm = this._model.data,\n\t\t\t\tdf = this._model.default_state,\n\t\t\t\ti, j, c, e,\n\t\t\t\ttmp = {\n\t\t\t\t\tid\t\t\t: tid,\n\t\t\t\t\ttext\t\t: d.text || '',\n\t\t\t\t\ticon\t\t: d.icon !== undefined ? d.icon : true,\n\t\t\t\t\tparent\t\t: p,\n\t\t\t\t\tparents\t\t: ps,\n\t\t\t\t\tchildren\t: d.children || [],\n\t\t\t\t\tchildren_d\t: d.children_d || [],\n\t\t\t\t\tdata\t\t: d.data,\n\t\t\t\t\tstate\t\t: { },\n\t\t\t\t\tli_attr\t\t: { id : false },\n\t\t\t\t\ta_attr\t\t: { href : '#' },\n\t\t\t\t\toriginal\t: false\n\t\t\t\t};\n\t\t\tfor(i in df) {\n\t\t\t\tif(df.hasOwnProperty(i)) {\n\t\t\t\t\ttmp.state[i] = df[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(d && d.data && d.data.jstree && d.data.jstree.icon) {\n\t\t\t\ttmp.icon = d.data.jstree.icon;\n\t\t\t}\n\t\t\tif(tmp.icon === undefined || tmp.icon === null || tmp.icon === \"\") {\n\t\t\t\ttmp.icon = true;\n\t\t\t}\n\t\t\tif(d && d.data) {\n\t\t\t\ttmp.data = d.data;\n\t\t\t\tif(d.data.jstree) {\n\t\t\t\t\tfor(i in d.data.jstree) {\n\t\t\t\t\t\tif(d.data.jstree.hasOwnProperty(i)) {\n\t\t\t\t\t\t\ttmp.state[i] = d.data.jstree[i];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(d && typeof d.state === 'object') {\n\t\t\t\tfor (i in d.state) {\n\t\t\t\t\tif(d.state.hasOwnProperty(i)) {\n\t\t\t\t\t\ttmp.state[i] = d.state[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(d && typeof d.li_attr === 'object') {\n\t\t\t\tfor (i in d.li_attr) {\n\t\t\t\t\tif(d.li_attr.hasOwnProperty(i)) {\n\t\t\t\t\t\ttmp.li_attr[i] = d.li_attr[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!tmp.li_attr.id) {\n\t\t\t\ttmp.li_attr.id = tid;\n\t\t\t}\n\t\t\tif(d && typeof d.a_attr === 'object') {\n\t\t\t\tfor (i in d.a_attr) {\n\t\t\t\t\tif(d.a_attr.hasOwnProperty(i)) {\n\t\t\t\t\t\ttmp.a_attr[i] = d.a_attr[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(d && d.children && d.children === true) {\n\t\t\t\ttmp.state.loaded = false;\n\t\t\t\ttmp.children = [];\n\t\t\t\ttmp.children_d = [];\n\t\t\t}\n\t\t\tm[tmp.id] = tmp;\n\t\t\tfor(i = 0, j = tmp.children.length; i < j; i++) {\n\t\t\t\tc = this._parse_model_from_flat_json(m[tmp.children[i]], tmp.id, ps);\n\t\t\t\te = m[c];\n\t\t\t\ttmp.children_d.push(c);\n\t\t\t\tif(e.children_d.length) {\n\t\t\t\t\ttmp.children_d = tmp.children_d.concat(e.children_d);\n\t\t\t\t}\n\t\t\t}\n\t\t\tdelete d.data;\n\t\t\tdelete d.children;\n\t\t\tm[tmp.id].original = d;\n\t\t\tif(tmp.state.selected) {\n\t\t\t\tthis._data.core.selected.push(tmp.id);\n\t\t\t}\n\t\t\treturn tmp.id;\n\t\t},\n\t\t/**\n\t\t * parses a node from a JSON object and appends it to the in memory tree model. Used internally.\n\t\t * @private\n\t\t * @name _parse_model_from_json(d [, p, ps])\n\t\t * @param {Object} d the JSON object to parse\n\t\t * @param {String} p the parent ID\n\t\t * @param {Array} ps list of all parents\n\t\t * @return {String} the ID of the object added to the model\n\t\t */\n\t\t_parse_model_from_json : function (d, p, ps) {\n\t\t\tif(!ps) { ps = []; }\n\t\t\telse { ps = ps.concat(); }\n\t\t\tif(p) { ps.unshift(p); }\n\t\t\tvar tid = false, i, j, c, e, m = this._model.data, df = this._model.default_state, tmp;\n\t\t\tdo {\n\t\t\t\ttid = 'j' + this._id + '_' + (++this._cnt);\n\t\t\t} while(m[tid]);\n\n\t\t\ttmp = {\n\t\t\t\tid\t\t\t: false,\n\t\t\t\ttext\t\t: typeof d === 'string' ? d : '',\n\t\t\t\ticon\t\t: typeof d === 'object' && d.icon !== undefined ? d.icon : true,\n\t\t\t\tparent\t\t: p,\n\t\t\t\tparents\t\t: ps,\n\t\t\t\tchildren\t: [],\n\t\t\t\tchildren_d\t: [],\n\t\t\t\tdata\t\t: null,\n\t\t\t\tstate\t\t: { },\n\t\t\t\tli_attr\t\t: { id : false },\n\t\t\t\ta_attr\t\t: { href : '#' },\n\t\t\t\toriginal\t: false\n\t\t\t};\n\t\t\tfor(i in df) {\n\t\t\t\tif(df.hasOwnProperty(i)) {\n\t\t\t\t\ttmp.state[i] = df[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(d && d.id) { tmp.id = d.id.toString(); }\n\t\t\tif(d && d.text) { tmp.text = d.text; }\n\t\t\tif(d && d.data && d.data.jstree && d.data.jstree.icon) {\n\t\t\t\ttmp.icon = d.data.jstree.icon;\n\t\t\t}\n\t\t\tif(tmp.icon === undefined || tmp.icon === null || tmp.icon === \"\") {\n\t\t\t\ttmp.icon = true;\n\t\t\t}\n\t\t\tif(d && d.data) {\n\t\t\t\ttmp.data = d.data;\n\t\t\t\tif(d.data.jstree) {\n\t\t\t\t\tfor(i in d.data.jstree) {\n\t\t\t\t\t\tif(d.data.jstree.hasOwnProperty(i)) {\n\t\t\t\t\t\t\ttmp.state[i] = d.data.jstree[i];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(d && typeof d.state === 'object') {\n\t\t\t\tfor (i in d.state) {\n\t\t\t\t\tif(d.state.hasOwnProperty(i)) {\n\t\t\t\t\t\ttmp.state[i] = d.state[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(d && typeof d.li_attr === 'object') {\n\t\t\t\tfor (i in d.li_attr) {\n\t\t\t\t\tif(d.li_attr.hasOwnProperty(i)) {\n\t\t\t\t\t\ttmp.li_attr[i] = d.li_attr[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(tmp.li_attr.id && !tmp.id) {\n\t\t\t\ttmp.id = tmp.li_attr.id.toString();\n\t\t\t}\n\t\t\tif(!tmp.id) {\n\t\t\t\ttmp.id = tid;\n\t\t\t}\n\t\t\tif(!tmp.li_attr.id) {\n\t\t\t\ttmp.li_attr.id = tmp.id;\n\t\t\t}\n\t\t\tif(d && typeof d.a_attr === 'object') {\n\t\t\t\tfor (i in d.a_attr) {\n\t\t\t\t\tif(d.a_attr.hasOwnProperty(i)) {\n\t\t\t\t\t\ttmp.a_attr[i] = d.a_attr[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(d && d.children && d.children.length) {\n\t\t\t\tfor(i = 0, j = d.children.length; i < j; i++) {\n\t\t\t\t\tc = this._parse_model_from_json(d.children[i], tmp.id, ps);\n\t\t\t\t\te = m[c];\n\t\t\t\t\ttmp.children.push(c);\n\t\t\t\t\tif(e.children_d.length) {\n\t\t\t\t\t\ttmp.children_d = tmp.children_d.concat(e.children_d);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttmp.children_d = tmp.children.concat(tmp.children_d);\n\t\t\t}\n\t\t\tif(d && d.children && d.children === true) {\n\t\t\t\ttmp.state.loaded = false;\n\t\t\t\ttmp.children = [];\n\t\t\t\ttmp.children_d = [];\n\t\t\t}\n\t\t\tdelete d.data;\n\t\t\tdelete d.children;\n\t\t\ttmp.original = d;\n\t\t\tm[tmp.id] = tmp;\n\t\t\tif(tmp.state.selected) {\n\t\t\t\tthis._data.core.selected.push(tmp.id);\n\t\t\t}\n\t\t\treturn tmp.id;\n\t\t},\n\t\t/**\n\t\t * redraws all nodes that need to be redrawn. Used internally.\n\t\t * @private\n\t\t * @name _redraw()\n\t\t * @trigger redraw.jstree\n\t\t */\n\t\t_redraw : function () {\n\t\t\tvar nodes = this._model.force_full_redraw ? this._model.data[$.jstree.root].children.concat([]) : this._model.changed.concat([]),\n\t\t\t\tf = document.createElement('UL'), tmp, i, j, fe = this._data.core.focused;\n\t\t\tfor(i = 0, j = nodes.length; i < j; i++) {\n\t\t\t\ttmp = this.redraw_node(nodes[i], true, this._model.force_full_redraw);\n\t\t\t\tif(tmp && this._model.force_full_redraw) {\n\t\t\t\t\tf.appendChild(tmp);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(this._model.force_full_redraw) {\n\t\t\t\tf.className = this.get_container_ul()[0].className;\n\t\t\t\tf.setAttribute('role','presentation');\n\t\t\t\tthis.element.empty().append(f);\n\t\t\t\t//this.get_container_ul()[0].appendChild(f);\n\t\t\t}\n\t\t\tif(fe !== null && this.settings.core.restore_focus) {\n\t\t\t\ttmp = this.get_node(fe, true);\n\t\t\t\tif(tmp && tmp.length && tmp.children('.jstree-anchor')[0] !== document.activeElement) {\n\t\t\t\t\ttmp.children('.jstree-anchor').trigger('focus');\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis._data.core.focused = null;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._model.force_full_redraw = false;\n\t\t\tthis._model.changed = [];\n\t\t\t/**\n\t\t\t * triggered after nodes are redrawn\n\t\t\t * @event\n\t\t\t * @name redraw.jstree\n\t\t\t * @param {array} nodes the redrawn nodes\n\t\t\t */\n\t\t\tthis.trigger('redraw', { \"nodes\" : nodes });\n\t\t},\n\t\t/**\n\t\t * redraws all nodes that need to be redrawn or optionally - the whole tree\n\t\t * @name redraw([full])\n\t\t * @param {Boolean} full if set to `true` all nodes are redrawn.\n\t\t */\n\t\tredraw : function (full) {\n\t\t\tif(full) {\n\t\t\t\tthis._model.force_full_redraw = true;\n\t\t\t}\n\t\t\t//if(this._model.redraw_timeout) {\n\t\t\t//\tclearTimeout(this._model.redraw_timeout);\n\t\t\t//}\n\t\t\t//this._model.redraw_timeout = setTimeout($.proxy(this._redraw, this),0);\n\t\t\tthis._redraw();\n\t\t},\n\t\t/**\n\t\t * redraws a single node's children. Used internally.\n\t\t * @private\n\t\t * @name draw_children(node)\n\t\t * @param {mixed} node the node whose children will be redrawn\n\t\t */\n\t\tdraw_children : function (node) {\n\t\t\tvar obj = this.get_node(node),\n\t\t\t\ti = false,\n\t\t\t\tj = false,\n\t\t\t\tk = false,\n\t\t\t\td = document;\n\t\t\tif(!obj) { return false; }\n\t\t\tif(obj.id === $.jstree.root) { return this.redraw(true); }\n\t\t\tnode = this.get_node(node, true);\n\t\t\tif(!node || !node.length) { return false; } // TODO: quick toggle\n\n\t\t\tnode.children('.jstree-children').remove();\n\t\t\tnode = node[0];\n\t\t\tif(obj.children.length && obj.state.loaded) {\n\t\t\t\tk = d.createElement('UL');\n\t\t\t\tk.setAttribute('role', 'group');\n\t\t\t\tk.className = 'jstree-children';\n\t\t\t\tfor(i = 0, j = obj.children.length; i < j; i++) {\n\t\t\t\t\tk.appendChild(this.redraw_node(obj.children[i], true, true));\n\t\t\t\t}\n\t\t\t\tnode.appendChild(k);\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * redraws a single node. Used internally.\n\t\t * @private\n\t\t * @name redraw_node(node, deep, is_callback, force_render)\n\t\t * @param {mixed} node the node to redraw\n\t\t * @param {Boolean} deep should child nodes be redrawn too\n\t\t * @param {Boolean} is_callback is this a recursion call\n\t\t * @param {Boolean} force_render should children of closed parents be drawn anyway\n\t\t */\n\t\tredraw_node : function (node, deep, is_callback, force_render) {\n\t\t\tvar obj = this.get_node(node),\n\t\t\t\tpar = false,\n\t\t\t\tind = false,\n\t\t\t\told = false,\n\t\t\t\ti = false,\n\t\t\t\tj = false,\n\t\t\t\tk = false,\n\t\t\t\tc = '',\n\t\t\t\td = document,\n\t\t\t\tm = this._model.data,\n\t\t\t\tf = false,\n\t\t\t\ts = false,\n\t\t\t\ttmp = null,\n\t\t\t\tt = 0,\n\t\t\t\tl = 0,\n\t\t\t\thas_children = false,\n\t\t\t\tlast_sibling = false;\n\t\t\tif(!obj) { return false; }\n\t\t\tif(obj.id === $.jstree.root) { return this.redraw(true); }\n\t\t\tdeep = deep || obj.children.length === 0;\n\t\t\tnode = !document.querySelector ? document.getElementById(obj.id) : this.element[0].querySelector('#' + (\"0123456789\".indexOf(obj.id[0]) !== -1 ? '\\\\3' + obj.id[0] + ' ' + obj.id.substr(1).replace($.jstree.idregex,'\\\\$&') : obj.id.replace($.jstree.idregex,'\\\\$&')) ); //, this.element);\n\t\t\tif(!node) {\n\t\t\t\tdeep = true;\n\t\t\t\t//node = d.createElement('LI');\n\t\t\t\tif(!is_callback) {\n\t\t\t\t\tpar = obj.parent !== $.jstree.root ? $('#' + obj.parent.replace($.jstree.idregex,'\\\\$&'), this.element)[0] : null;\n\t\t\t\t\tif(par !== null && (!par || !m[obj.parent].state.opened)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tind = $.inArray(obj.id, par === null ? m[$.jstree.root].children : m[obj.parent].children);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnode = $(node);\n\t\t\t\tif(!is_callback) {\n\t\t\t\t\tpar = node.parent().parent()[0];\n\t\t\t\t\tif(par === this.element[0]) {\n\t\t\t\t\t\tpar = null;\n\t\t\t\t\t}\n\t\t\t\t\tind = node.index();\n\t\t\t\t}\n\t\t\t\t// m[obj.id].data = node.data(); // use only node's data, no need to touch jquery storage\n\t\t\t\tif(!deep && obj.children.length && !node.children('.jstree-children').length) {\n\t\t\t\t\tdeep = true;\n\t\t\t\t}\n\t\t\t\tif(!deep) {\n\t\t\t\t\told = node.children('.jstree-children')[0];\n\t\t\t\t}\n\t\t\t\tf = node.children('.jstree-anchor')[0] === document.activeElement;\n\t\t\t\tnode.remove();\n\t\t\t\t//node = d.createElement('LI');\n\t\t\t\t//node = node[0];\n\t\t\t}\n\t\t\tnode = this._data.core.node.cloneNode(true);\n\t\t\t// node is DOM, deep is boolean\n\n\t\t\tc = 'jstree-node ';\n\t\t\tfor(i in obj.li_attr) {\n\t\t\t\tif(obj.li_attr.hasOwnProperty(i)) {\n\t\t\t\t\tif(i === 'id') { continue; }\n\t\t\t\t\tif(i !== 'class') {\n\t\t\t\t\t\tnode.setAttribute(i, obj.li_attr[i]);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tc += obj.li_attr[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!obj.a_attr.id) {\n\t\t\t\tobj.a_attr.id = obj.id + '_anchor';\n\t\t\t}\n\t\t\tnode.childNodes[1].setAttribute('aria-selected', !!obj.state.selected);\n\t\t\tnode.childNodes[1].setAttribute('aria-level', obj.parents.length);\n\t\t\tif(this.settings.core.compute_elements_positions) {\n\t\t\t\tnode.childNodes[1].setAttribute('aria-setsize', m[obj.parent].children.length);\n\t\t\t\tnode.childNodes[1].setAttribute('aria-posinset', m[obj.parent].children.indexOf(obj.id) + 1);\n\t\t\t}\n\t\t\tif(obj.state.disabled) {\n\t\t\t\tnode.childNodes[1].setAttribute('aria-disabled', true);\n\t\t\t}\n\n\t\t\tfor(i = 0, j = obj.children.length; i < j; i++) {\n\t\t\t\tif(!m[obj.children[i]].state.hidden) {\n\t\t\t\t\thas_children = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(obj.parent !== null && m[obj.parent] && !obj.state.hidden) {\n\t\t\t\ti = $.inArray(obj.id, m[obj.parent].children);\n\t\t\t\tlast_sibling = obj.id;\n\t\t\t\tif(i !== -1) {\n\t\t\t\t\ti++;\n\t\t\t\t\tfor(j = m[obj.parent].children.length; i < j; i++) {\n\t\t\t\t\t\tif(!m[m[obj.parent].children[i]].state.hidden) {\n\t\t\t\t\t\t\tlast_sibling = m[obj.parent].children[i];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(last_sibling !== obj.id) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(obj.state.hidden) {\n\t\t\t\tc += ' jstree-hidden';\n\t\t\t}\n\t\t\tif (obj.state.loading) {\n\t\t\t\tc += ' jstree-loading';\n\t\t\t}\n\t\t\tif(obj.state.loaded && !has_children) {\n\t\t\t\tc += ' jstree-leaf';\n\t\t\t}\n\t\t\telse {\n\t\t\t\tc += obj.state.opened && obj.state.loaded ? ' jstree-open' : ' jstree-closed';\n\t\t\t\tnode.childNodes[1].setAttribute('aria-expanded', (obj.state.opened && obj.state.loaded) );\n\t\t\t}\n\t\t\tif(last_sibling === obj.id) {\n\t\t\t\tc += ' jstree-last';\n\t\t\t}\n\t\t\tnode.id = obj.id;\n\t\t\tnode.className = c;\n\t\t\tc = ( obj.state.selected ? ' jstree-clicked' : '') + ( obj.state.disabled ? ' jstree-disabled' : '');\n\t\t\tfor(j in obj.a_attr) {\n\t\t\t\tif(obj.a_attr.hasOwnProperty(j)) {\n\t\t\t\t\tif(j === 'href' && obj.a_attr[j] === '#') { continue; }\n\t\t\t\t\tif(j !== 'class') {\n\t\t\t\t\t\tnode.childNodes[1].setAttribute(j, obj.a_attr[j]);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tc += ' ' + obj.a_attr[j];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(c.length) {\n\t\t\t\tnode.childNodes[1].className = 'jstree-anchor ' + c;\n\t\t\t}\n\t\t\tif((obj.icon && obj.icon !== true) || obj.icon === false) {\n\t\t\t\tif(obj.icon === false) {\n\t\t\t\t\tnode.childNodes[1].childNodes[0].className += ' jstree-themeicon-hidden';\n\t\t\t\t}\n\t\t\t\telse if(obj.icon.indexOf('/') === -1 && obj.icon.indexOf('.') === -1) {\n\t\t\t\t\tnode.childNodes[1].childNodes[0].className += ' ' + obj.icon + ' jstree-themeicon-custom';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnode.childNodes[1].childNodes[0].style.backgroundImage = 'url(\"'+obj.icon+'\")';\n\t\t\t\t\tnode.childNodes[1].childNodes[0].style.backgroundPosition = 'center center';\n\t\t\t\t\tnode.childNodes[1].childNodes[0].style.backgroundSize = 'auto';\n\t\t\t\t\tnode.childNodes[1].childNodes[0].className += ' jstree-themeicon-custom';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(this.settings.core.force_text) {\n\t\t\t\tnode.childNodes[1].appendChild(d.createTextNode(obj.text));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnode.childNodes[1].innerHTML += obj.text;\n\t\t\t}\n\n\n\t\t\tif(deep && obj.children.length && (obj.state.opened || force_render) && obj.state.loaded) {\n\t\t\t\tk = d.createElement('UL');\n\t\t\t\tk.setAttribute('role', 'group');\n\t\t\t\tk.className = 'jstree-children';\n\t\t\t\tfor(i = 0, j = obj.children.length; i < j; i++) {\n\t\t\t\t\tk.appendChild(this.redraw_node(obj.children[i], deep, true));\n\t\t\t\t}\n\t\t\t\tnode.appendChild(k);\n\t\t\t}\n\t\t\tif(old) {\n\t\t\t\tnode.appendChild(old);\n\t\t\t}\n\t\t\tif(!is_callback) {\n\t\t\t\t// append back using par / ind\n\t\t\t\tif(!par) {\n\t\t\t\t\tpar = this.element[0];\n\t\t\t\t}\n\t\t\t\tfor(i = 0, j = par.childNodes.length; i < j; i++) {\n\t\t\t\t\tif(par.childNodes[i] && par.childNodes[i].className && par.childNodes[i].className.indexOf('jstree-children') !== -1) {\n\t\t\t\t\t\ttmp = par.childNodes[i];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!tmp) {\n\t\t\t\t\ttmp = d.createElement('UL');\n\t\t\t\t\ttmp.setAttribute('role', 'group');\n\t\t\t\t\ttmp.className = 'jstree-children';\n\t\t\t\t\tpar.appendChild(tmp);\n\t\t\t\t}\n\t\t\t\tpar = tmp;\n\n\t\t\t\tif(ind < par.childNodes.length) {\n\t\t\t\t\tpar.insertBefore(node, par.childNodes[ind]);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tpar.appendChild(node);\n\t\t\t\t}\n\t\t\t\tif(f) {\n\t\t\t\t\tt = this.element[0].scrollTop;\n\t\t\t\t\tl = this.element[0].scrollLeft;\n\t\t\t\t\tnode.childNodes[1].focus();\n\t\t\t\t\tthis.element[0].scrollTop = t;\n\t\t\t\t\tthis.element[0].scrollLeft = l;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(obj.state.opened && !obj.state.loaded) {\n\t\t\t\tobj.state.opened = false;\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\tthis.open_node(obj.id, false, 0);\n\t\t\t\t}.bind(this), 0);\n\t\t\t}\n\t\t\treturn node;\n\t\t},\n\t\t/**\n\t\t * opens a node, revealing its children. If the node is not loaded it will be loaded and opened once ready.\n\t\t * @name open_node(obj [, callback, animation])\n\t\t * @param {mixed} obj the node to open\n\t\t * @param {Function} callback a function to execute once the node is opened\n\t\t * @param {Number} animation the animation duration in milliseconds when opening the node (overrides the `core.animation` setting). Use `false` for no animation.\n\t\t * @trigger open_node.jstree, after_open.jstree, before_open.jstree\n\t\t */\n\t\topen_node : function (obj, callback, animation) {\n\t\t\tvar t1, t2, d, t;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.open_node(obj[t1], callback, animation);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tanimation = animation === undefined ? this.settings.core.animation : animation;\n\t\t\tif(!this.is_closed(obj)) {\n\t\t\t\tif(callback) {\n\t\t\t\t\tcallback.call(this, obj, false);\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(!this.is_loaded(obj)) {\n\t\t\t\tif(this.is_loading(obj)) {\n\t\t\t\t\treturn setTimeout(function () {\n\t\t\t\t\t\tthis.open_node(obj, callback, animation);\n\t\t\t\t\t}.bind(this), 500);\n\t\t\t\t}\n\t\t\t\tthis.load_node(obj, function (o, ok) {\n\t\t\t\t\treturn ok ? this.open_node(o, callback, animation) : (callback ? callback.call(this, o, false) : false);\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\td = this.get_node(obj, true);\n\t\t\t\tt = this;\n\t\t\t\tif(d.length) {\n\t\t\t\t\tif(animation && d.children(\".jstree-children\").length) {\n\t\t\t\t\t\td.children(\".jstree-children\").stop(true, true);\n\t\t\t\t\t}\n\t\t\t\t\tif(obj.children.length && !this._firstChild(d.children('.jstree-children')[0])) {\n\t\t\t\t\t\tthis.draw_children(obj);\n\t\t\t\t\t\t//d = this.get_node(obj, true);\n\t\t\t\t\t}\n\t\t\t\t\tif(!animation) {\n\t\t\t\t\t\tthis.trigger('before_open', { \"node\" : obj });\n\t\t\t\t\t\td[0].className = d[0].className.replace('jstree-closed', 'jstree-open');\n\t\t\t\t\t\td[0].childNodes[1].setAttribute(\"aria-expanded\", true);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis.trigger('before_open', { \"node\" : obj });\n\t\t\t\t\t\td\n\t\t\t\t\t\t\t.children(\".jstree-children\").css(\"display\",\"none\").end()\n\t\t\t\t\t\t\t.removeClass(\"jstree-closed\").addClass(\"jstree-open\")\n\t\t\t\t\t\t\t\t.children('.jstree-anchor').attr(\"aria-expanded\", true).end()\n\t\t\t\t\t\t\t.children(\".jstree-children\").stop(true, true)\n\t\t\t\t\t\t\t\t.slideDown(animation, function () {\n\t\t\t\t\t\t\t\t\tthis.style.display = \"\";\n\t\t\t\t\t\t\t\t\tif (t.element) {\n\t\t\t\t\t\t\t\t\t\tt.trigger(\"after_open\", { \"node\" : obj });\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tobj.state.opened = true;\n\t\t\t\tif(callback) {\n\t\t\t\t\tcallback.call(this, obj, true);\n\t\t\t\t}\n\t\t\t\tif(!d.length) {\n\t\t\t\t\t/**\n\t\t\t\t\t * triggered when a node is about to be opened (if the node is supposed to be in the DOM, it will be, but it won't be visible yet)\n\t\t\t\t\t * @event\n\t\t\t\t\t * @name before_open.jstree\n\t\t\t\t\t * @param {Object} node the opened node\n\t\t\t\t\t */\n\t\t\t\t\tthis.trigger('before_open', { \"node\" : obj });\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * triggered when a node is opened (if there is an animation it will not be completed yet)\n\t\t\t\t * @event\n\t\t\t\t * @name open_node.jstree\n\t\t\t\t * @param {Object} node the opened node\n\t\t\t\t */\n\t\t\t\tthis.trigger('open_node', { \"node\" : obj });\n\t\t\t\tif(!animation || !d.length) {\n\t\t\t\t\t/**\n\t\t\t\t\t * triggered when a node is opened and the animation is complete\n\t\t\t\t\t * @event\n\t\t\t\t\t * @name after_open.jstree\n\t\t\t\t\t * @param {Object} node the opened node\n\t\t\t\t\t */\n\t\t\t\t\tthis.trigger(\"after_open\", { \"node\" : obj });\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * opens every parent of a node (node should be loaded)\n\t\t * @name _open_to(obj)\n\t\t * @param {mixed} obj the node to reveal\n\t\t * @private\n\t\t */\n\t\t_open_to : function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar i, j, p = obj.parents;\n\t\t\tfor(i = 0, j = p.length; i < j; i+=1) {\n\t\t\t\tif(i !== $.jstree.root) {\n\t\t\t\t\tthis.open_node(p[i], false, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $('#' + obj.id.replace($.jstree.idregex,'\\\\$&'), this.element);\n\t\t},\n\t\t/**\n\t\t * closes a node, hiding its children\n\t\t * @name close_node(obj [, animation])\n\t\t * @param {mixed} obj the node to close\n\t\t * @param {Number} animation the animation duration in milliseconds when closing the node (overrides the `core.animation` setting). Use `false` for no animation.\n\t\t * @trigger close_node.jstree, after_close.jstree\n\t\t */\n\t\tclose_node : function (obj, animation) {\n\t\t\tvar t1, t2, t, d;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.close_node(obj[t1], animation);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(this.is_closed(obj)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tanimation = animation === undefined ? this.settings.core.animation : animation;\n\t\t\tt = this;\n\t\t\td = this.get_node(obj, true);\n\n\t\t\tobj.state.opened = false;\n\t\t\t/**\n\t\t\t * triggered when a node is closed (if there is an animation it will not be complete yet)\n\t\t\t * @event\n\t\t\t * @name close_node.jstree\n\t\t\t * @param {Object} node the closed node\n\t\t\t */\n\t\t\tthis.trigger('close_node',{ \"node\" : obj });\n\t\t\tif(!d.length) {\n\t\t\t\t/**\n\t\t\t\t * triggered when a node is closed and the animation is complete\n\t\t\t\t * @event\n\t\t\t\t * @name after_close.jstree\n\t\t\t\t * @param {Object} node the closed node\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"after_close\", { \"node\" : obj });\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(!animation) {\n\t\t\t\t\td[0].className = d[0].className.replace('jstree-open', 'jstree-closed');\n\t\t\t\t\td.children('.jstree-anchor').attr(\"aria-expanded\", false);\n\t\t\t\t\td.children('.jstree-children').remove();\n\t\t\t\t\tthis.trigger(\"after_close\", { \"node\" : obj });\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\td\n\t\t\t\t\t\t.children(\".jstree-children\").attr(\"style\",\"display:block !important\").end()\n\t\t\t\t\t\t.removeClass(\"jstree-open\").addClass(\"jstree-closed\")\n\t\t\t\t\t\t\t.children('.jstree-anchor').attr(\"aria-expanded\", false).end()\n\t\t\t\t\t\t.children(\".jstree-children\").stop(true, true).slideUp(animation, function () {\n\t\t\t\t\t\t\tthis.style.display = \"\";\n\t\t\t\t\t\t\td.children('.jstree-children').remove();\n\t\t\t\t\t\t\tif (t.element) {\n\t\t\t\t\t\t\t\tt.trigger(\"after_close\", { \"node\" : obj });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * toggles a node - closing it if it is open, opening it if it is closed\n\t\t * @name toggle_node(obj)\n\t\t * @param {mixed} obj the node to toggle\n\t\t */\n\t\ttoggle_node : function (obj) {\n\t\t\tvar t1, t2;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.toggle_node(obj[t1]);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif(this.is_closed(obj)) {\n\t\t\t\treturn this.open_node(obj);\n\t\t\t}\n\t\t\tif(this.is_open(obj)) {\n\t\t\t\treturn this.close_node(obj);\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * opens all nodes within a node (or the tree), revealing their children. If the node is not loaded it will be loaded and opened once ready.\n\t\t * @name open_all([obj, animation, original_obj])\n\t\t * @param {mixed} obj the node to open recursively, omit to open all nodes in the tree\n\t\t * @param {Number} animation the animation duration in milliseconds when opening the nodes, the default is no animation\n\t\t * @param {jQuery} reference to the node that started the process (internal use)\n\t\t * @trigger open_all.jstree\n\t\t */\n\t\topen_all : function (obj, animation, original_obj) {\n\t\t\tif(!obj) { obj = $.jstree.root; }\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj) { return false; }\n\t\t\tvar dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), i, j, _this;\n\t\t\tif(!dom.length) {\n\t\t\t\tfor(i = 0, j = obj.children_d.length; i < j; i++) {\n\t\t\t\t\tif(this.is_closed(this._model.data[obj.children_d[i]])) {\n\t\t\t\t\t\tthis._model.data[obj.children_d[i]].state.opened = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this.trigger('open_all', { \"node\" : obj });\n\t\t\t}\n\t\t\toriginal_obj = original_obj || dom;\n\t\t\t_this = this;\n\t\t\tdom = this.is_closed(obj) ? dom.find('.jstree-closed').addBack() : dom.find('.jstree-closed');\n\t\t\tdom.each(function () {\n\t\t\t\t_this.open_node(\n\t\t\t\t\tthis,\n\t\t\t\t\tfunction(node, status) { if(status && this.is_parent(node)) { this.open_all(node, animation, original_obj); } },\n\t\t\t\t\tanimation || 0\n\t\t\t\t);\n\t\t\t});\n\t\t\tif(original_obj.find('.jstree-closed').length === 0) {\n\t\t\t\t/**\n\t\t\t\t * triggered when an `open_all` call completes\n\t\t\t\t * @event\n\t\t\t\t * @name open_all.jstree\n\t\t\t\t * @param {Object} node the opened node\n\t\t\t\t */\n\t\t\t\tthis.trigger('open_all', { \"node\" : this.get_node(original_obj) });\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * closes all nodes within a node (or the tree), revealing their children\n\t\t * @name close_all([obj, animation])\n\t\t * @param {mixed} obj the node to close recursively, omit to close all nodes in the tree\n\t\t * @param {Number} animation the animation duration in milliseconds when closing the nodes, the default is no animation\n\t\t * @trigger close_all.jstree\n\t\t */\n\t\tclose_all : function (obj, animation) {\n\t\t\tif(!obj) { obj = $.jstree.root; }\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj) { return false; }\n\t\t\tvar dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true),\n\t\t\t\t_this = this, i, j;\n\t\t\tif(dom.length) {\n\t\t\t\tdom = this.is_open(obj) ? dom.find('.jstree-open').addBack() : dom.find('.jstree-open');\n\t\t\t\t$(dom.get().reverse()).each(function () { _this.close_node(this, animation || 0); });\n\t\t\t}\n\t\t\tfor(i = 0, j = obj.children_d.length; i < j; i++) {\n\t\t\t\tthis._model.data[obj.children_d[i]].state.opened = false;\n\t\t\t}\n\t\t\t/**\n\t\t\t * triggered when an `close_all` call completes\n\t\t\t * @event\n\t\t\t * @name close_all.jstree\n\t\t\t * @param {Object} node the closed node\n\t\t\t */\n\t\t\tthis.trigger('close_all', { \"node\" : obj });\n\t\t},\n\t\t/**\n\t\t * checks if a node is disabled (not selectable)\n\t\t * @name is_disabled(obj)\n\t\t * @param {mixed} obj\n\t\t * @return {Boolean}\n\t\t */\n\t\tis_disabled : function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\treturn obj && obj.state && obj.state.disabled;\n\t\t},\n\t\t/**\n\t\t * enables a node - so that it can be selected\n\t\t * @name enable_node(obj)\n\t\t * @param {mixed} obj the node to enable\n\t\t * @trigger enable_node.jstree\n\t\t */\n\t\tenable_node : function (obj) {\n\t\t\tvar t1, t2;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.enable_node(obj[t1]);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tobj.state.disabled = false;\n\t\t\tthis.get_node(obj,true).children('.jstree-anchor').removeClass('jstree-disabled').attr('aria-disabled', false);\n\t\t\t/**\n\t\t\t * triggered when an node is enabled\n\t\t\t * @event\n\t\t\t * @name enable_node.jstree\n\t\t\t * @param {Object} node the enabled node\n\t\t\t */\n\t\t\tthis.trigger('enable_node', { 'node' : obj });\n\t\t},\n\t\t/**\n\t\t * disables a node - so that it can not be selected\n\t\t * @name disable_node(obj)\n\t\t * @param {mixed} obj the node to disable\n\t\t * @trigger disable_node.jstree\n\t\t */\n\t\tdisable_node : function (obj) {\n\t\t\tvar t1, t2;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.disable_node(obj[t1]);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tobj.state.disabled = true;\n\t\t\tthis.get_node(obj,true).children('.jstree-anchor').addClass('jstree-disabled').attr('aria-disabled', true);\n\t\t\t/**\n\t\t\t * triggered when an node is disabled\n\t\t\t * @event\n\t\t\t * @name disable_node.jstree\n\t\t\t * @param {Object} node the disabled node\n\t\t\t */\n\t\t\tthis.trigger('disable_node', { 'node' : obj });\n\t\t},\n\t\t/**\n\t\t * determines if a node is hidden\n\t\t * @name is_hidden(obj)\n\t\t * @param {mixed} obj the node\n\t\t */\n\t\tis_hidden : function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\treturn obj.state.hidden === true;\n\t\t},\n\t\t/**\n\t\t * hides a node - it is still in the structure but will not be visible\n\t\t * @name hide_node(obj)\n\t\t * @param {mixed} obj the node to hide\n\t\t * @param {Boolean} skip_redraw internal parameter controlling if redraw is called\n\t\t * @trigger hide_node.jstree\n\t\t */\n\t\thide_node : function (obj, skip_redraw) {\n\t\t\tvar t1, t2;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.hide_node(obj[t1], true);\n\t\t\t\t}\n\t\t\t\tif (!skip_redraw) {\n\t\t\t\t\tthis.redraw();\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(!obj.state.hidden) {\n\t\t\t\tobj.state.hidden = true;\n\t\t\t\tthis._node_changed(obj.parent);\n\t\t\t\tif(!skip_redraw) {\n\t\t\t\t\tthis.redraw();\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * triggered when an node is hidden\n\t\t\t\t * @event\n\t\t\t\t * @name hide_node.jstree\n\t\t\t\t * @param {Object} node the hidden node\n\t\t\t\t */\n\t\t\t\tthis.trigger('hide_node', { 'node' : obj });\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * shows a node\n\t\t * @name show_node(obj)\n\t\t * @param {mixed} obj the node to show\n\t\t * @param {Boolean} skip_redraw internal parameter controlling if redraw is called\n\t\t * @trigger show_node.jstree\n\t\t */\n\t\tshow_node : function (obj, skip_redraw) {\n\t\t\tvar t1, t2;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.show_node(obj[t1], true);\n\t\t\t\t}\n\t\t\t\tif (!skip_redraw) {\n\t\t\t\t\tthis.redraw();\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(obj.state.hidden) {\n\t\t\t\tobj.state.hidden = false;\n\t\t\t\tthis._node_changed(obj.parent);\n\t\t\t\tif(!skip_redraw) {\n\t\t\t\t\tthis.redraw();\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * triggered when an node is shown\n\t\t\t\t * @event\n\t\t\t\t * @name show_node.jstree\n\t\t\t\t * @param {Object} node the shown node\n\t\t\t\t */\n\t\t\t\tthis.trigger('show_node', { 'node' : obj });\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * hides all nodes\n\t\t * @name hide_all()\n\t\t * @trigger hide_all.jstree\n\t\t */\n\t\thide_all : function (skip_redraw) {\n\t\t\tvar i, m = this._model.data, ids = [];\n\t\t\tfor(i in m) {\n\t\t\t\tif(m.hasOwnProperty(i) && i !== $.jstree.root && !m[i].state.hidden) {\n\t\t\t\t\tm[i].state.hidden = true;\n\t\t\t\t\tids.push(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._model.force_full_redraw = true;\n\t\t\tif(!skip_redraw) {\n\t\t\t\tthis.redraw();\n\t\t\t}\n\t\t\t/**\n\t\t\t * triggered when all nodes are hidden\n\t\t\t * @event\n\t\t\t * @name hide_all.jstree\n\t\t\t * @param {Array} nodes the IDs of all hidden nodes\n\t\t\t */\n\t\t\tthis.trigger('hide_all', { 'nodes' : ids });\n\t\t\treturn ids;\n\t\t},\n\t\t/**\n\t\t * shows all nodes\n\t\t * @name show_all()\n\t\t * @trigger show_all.jstree\n\t\t */\n\t\tshow_all : function (skip_redraw) {\n\t\t\tvar i, m = this._model.data, ids = [];\n\t\t\tfor(i in m) {\n\t\t\t\tif(m.hasOwnProperty(i) && i !== $.jstree.root && m[i].state.hidden) {\n\t\t\t\t\tm[i].state.hidden = false;\n\t\t\t\t\tids.push(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._model.force_full_redraw = true;\n\t\t\tif(!skip_redraw) {\n\t\t\t\tthis.redraw();\n\t\t\t}\n\t\t\t/**\n\t\t\t * triggered when all nodes are shown\n\t\t\t * @event\n\t\t\t * @name show_all.jstree\n\t\t\t * @param {Array} nodes the IDs of all shown nodes\n\t\t\t */\n\t\t\tthis.trigger('show_all', { 'nodes' : ids });\n\t\t\treturn ids;\n\t\t},\n\t\t/**\n\t\t * called when a node is selected by the user. Used internally.\n\t\t * @private\n\t\t * @name activate_node(obj, e)\n\t\t * @param {mixed} obj the node\n\t\t * @param {Object} e the related event\n\t\t * @trigger activate_node.jstree, changed.jstree\n\t\t */\n\t\tactivate_node : function (obj, e) {\n\t\t\tif(this.is_disabled(obj)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(!e || typeof e !== 'object') {\n\t\t\t\te = {};\n\t\t\t}\n\n\t\t\t// ensure last_clicked is still in the DOM, make it fresh (maybe it was moved?) and make sure it is still selected, if not - make last_clicked the last selected node\n\t\t\tthis._data.core.last_clicked = this._data.core.last_clicked && this._data.core.last_clicked.id !== undefined ? this.get_node(this._data.core.last_clicked.id) : null;\n\t\t\tif(this._data.core.last_clicked && !this._data.core.last_clicked.state.selected) { this._data.core.last_clicked = null; }\n\t\t\tif(!this._data.core.last_clicked && this._data.core.selected.length) { this._data.core.last_clicked = this.get_node(this._data.core.selected[this._data.core.selected.length - 1]); }\n\n\t\t\tif(!this.settings.core.multiple || (!e.metaKey && !e.ctrlKey && !e.shiftKey) || (e.shiftKey && (!this._data.core.last_clicked || !this.get_parent(obj) || this.get_parent(obj) !== this._data.core.last_clicked.parent ) )) {\n\t\t\t\tif(!this.settings.core.multiple && (e.metaKey || e.ctrlKey || e.shiftKey) && this.is_selected(obj)) {\n\t\t\t\t\tthis.deselect_node(obj, false, e);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!this.is_selected(obj) || this._data.core.selected.length !== 1) {\n\t\t\t\t\t\tthis.deselect_all(true);\n\t\t\t\t\t\tthis.select_node(obj, false, false, e);\n\t\t\t\t\t}\n\t\t\t\t\tthis._data.core.last_clicked = this.get_node(obj);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif(e.shiftKey) {\n\t\t\t\t\tvar o = this.get_node(obj).id,\n\t\t\t\t\t\tl = this._data.core.last_clicked.id,\n\t\t\t\t\t\tp = this.get_node(this._data.core.last_clicked.parent).children,\n\t\t\t\t\t\tc = false,\n\t\t\t\t\t\ti, j;\n\t\t\t\t\tfor(i = 0, j = p.length; i < j; i += 1) {\n\t\t\t\t\t\t// separate IFs work whem o and l are the same\n\t\t\t\t\t\tif(p[i] === o) {\n\t\t\t\t\t\t\tc = !c;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(p[i] === l) {\n\t\t\t\t\t\t\tc = !c;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(!this.is_disabled(p[i]) && (c || p[i] === o || p[i] === l)) {\n\t\t\t\t\t\t\tif (!this.is_hidden(p[i])) {\n\t\t\t\t\t\t\t\tthis.select_node(p[i], true, false, e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tif (!e.ctrlKey) {\n\t\t\t\t\t\t\t\tthis.deselect_node(p[i], true, e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.trigger('changed', { 'action' : 'select_node', 'node' : this.get_node(obj), 'selected' : this._data.core.selected, 'event' : e });\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(!this.is_selected(obj)) {\n\t\t\t\t\t\tif (e.ctrlKey) {\n\t\t\t\t\t\t\tthis._data.core.last_clicked = this.get_node(obj);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.select_node(obj, false, false, e);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis.deselect_node(obj, false, e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t/**\n\t\t\t * triggered when an node is clicked or intercated with by the user\n\t\t\t * @event\n\t\t\t * @name activate_node.jstree\n\t\t\t * @param {Object} node\n\t\t\t * @param {Object} event the ooriginal event (if any) which triggered the call (may be an empty object)\n\t\t\t */\n\t\t\tthis.trigger('activate_node', { 'node' : this.get_node(obj), 'event' : e });\n\t\t},\n\t\t/**\n\t\t * applies the hover state on a node, called when a node is hovered by the user. Used internally.\n\t\t * @private\n\t\t * @name hover_node(obj)\n\t\t * @param {mixed} obj\n\t\t * @trigger hover_node.jstree\n\t\t */\n\t\thover_node : function (obj) {\n\t\t\tobj = this.get_node(obj, true);\n\t\t\tif(!obj || !obj.length || obj.children('.jstree-hovered').length) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar o = this.element.find('.jstree-hovered'), t = this.element;\n\t\t\tif(o && o.length) { this.dehover_node(o); }\n\n\t\t\tobj.children('.jstree-anchor').addClass('jstree-hovered');\n\t\t\t/**\n\t\t\t * triggered when an node is hovered\n\t\t\t * @event\n\t\t\t * @name hover_node.jstree\n\t\t\t * @param {Object} node\n\t\t\t */\n\t\t\tthis.trigger('hover_node', { 'node' : this.get_node(obj) });\n\t\t\tsetTimeout(function () { t.attr('aria-activedescendant', obj[0].id); }, 0);\n\t\t},\n\t\t/**\n\t\t * removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally.\n\t\t * @private\n\t\t * @name dehover_node(obj)\n\t\t * @param {mixed} obj\n\t\t * @trigger dehover_node.jstree\n\t\t */\n\t\tdehover_node : function (obj) {\n\t\t\tobj = this.get_node(obj, true);\n\t\t\tif(!obj || !obj.length || !obj.children('.jstree-hovered').length) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tobj.children('.jstree-anchor').removeClass('jstree-hovered');\n\t\t\t/**\n\t\t\t * triggered when an node is no longer hovered\n\t\t\t * @event\n\t\t\t * @name dehover_node.jstree\n\t\t\t * @param {Object} node\n\t\t\t */\n\t\t\tthis.trigger('dehover_node', { 'node' : this.get_node(obj) });\n\t\t},\n\t\t/**\n\t\t * select a node\n\t\t * @name select_node(obj [, supress_event, prevent_open])\n\t\t * @param {mixed} obj an array can be used to select multiple nodes\n\t\t * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered\n\t\t * @param {Boolean} prevent_open if set to `true` parents of the selected node won't be opened\n\t\t * @trigger select_node.jstree, changed.jstree\n\t\t */\n\t\tselect_node : function (obj, supress_event, prevent_open, e) {\n\t\t\tvar dom, t1, t2, th;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.select_node(obj[t1], supress_event, prevent_open, e);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tdom = this.get_node(obj, true);\n\t\t\tif(!obj.state.selected) {\n\t\t\t\tobj.state.selected = true;\n\t\t\t\tthis._data.core.selected.push(obj.id);\n\t\t\t\tif(!prevent_open) {\n\t\t\t\t\tdom = this._open_to(obj);\n\t\t\t\t}\n\t\t\t\tif(dom && dom.length) {\n\t\t\t\t\tdom.children('.jstree-anchor').addClass('jstree-clicked').attr('aria-selected', true);\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * triggered when an node is selected\n\t\t\t\t * @event\n\t\t\t\t * @name select_node.jstree\n\t\t\t\t * @param {Object} node\n\t\t\t\t * @param {Array} selected the current selection\n\t\t\t\t * @param {Object} event the event (if any) that triggered this select_node\n\t\t\t\t */\n\t\t\t\tthis.trigger('select_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e });\n\t\t\t\tif(!supress_event) {\n\t\t\t\t\t/**\n\t\t\t\t\t * triggered when selection changes\n\t\t\t\t\t * @event\n\t\t\t\t\t * @name changed.jstree\n\t\t\t\t\t * @param {Object} node\n\t\t\t\t\t * @param {Object} action the action that caused the selection to change\n\t\t\t\t\t * @param {Array} selected the current selection\n\t\t\t\t\t * @param {Object} event the event (if any) that triggered this changed event\n\t\t\t\t\t */\n\t\t\t\t\tthis.trigger('changed', { 'action' : 'select_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e });\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * deselect a node\n\t\t * @name deselect_node(obj [, supress_event])\n\t\t * @param {mixed} obj an array can be used to deselect multiple nodes\n\t\t * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered\n\t\t * @trigger deselect_node.jstree, changed.jstree\n\t\t */\n\t\tdeselect_node : function (obj, supress_event, e) {\n\t\t\tvar t1, t2, dom;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.deselect_node(obj[t1], supress_event, e);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tdom = this.get_node(obj, true);\n\t\t\tif(obj.state.selected) {\n\t\t\t\tobj.state.selected = false;\n\t\t\t\tthis._data.core.selected = $.vakata.array_remove_item(this._data.core.selected, obj.id);\n\t\t\t\tif(dom.length) {\n\t\t\t\t\tdom.children('.jstree-anchor').removeClass('jstree-clicked').attr('aria-selected', false);\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * triggered when an node is deselected\n\t\t\t\t * @event\n\t\t\t\t * @name deselect_node.jstree\n\t\t\t\t * @param {Object} node\n\t\t\t\t * @param {Array} selected the current selection\n\t\t\t\t * @param {Object} event the event (if any) that triggered this deselect_node\n\t\t\t\t */\n\t\t\t\tthis.trigger('deselect_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e });\n\t\t\t\tif(!supress_event) {\n\t\t\t\t\tthis.trigger('changed', { 'action' : 'deselect_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e });\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * select all nodes in the tree\n\t\t * @name select_all([supress_event])\n\t\t * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered\n\t\t * @trigger select_all.jstree, changed.jstree\n\t\t */\n\t\tselect_all : function (supress_event) {\n\t\t\tvar tmp = this._data.core.selected.concat([]), i, j;\n\t\t\tthis._data.core.selected = this._model.data[$.jstree.root].children_d.concat();\n\t\t\tfor(i = 0, j = this._data.core.selected.length; i < j; i++) {\n\t\t\t\tif(this._model.data[this._data.core.selected[i]]) {\n\t\t\t\t\tthis._model.data[this._data.core.selected[i]].state.selected = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.redraw(true);\n\t\t\t/**\n\t\t\t * triggered when all nodes are selected\n\t\t\t * @event\n\t\t\t * @name select_all.jstree\n\t\t\t * @param {Array} selected the current selection\n\t\t\t */\n\t\t\tthis.trigger('select_all', { 'selected' : this._data.core.selected });\n\t\t\tif(!supress_event) {\n\t\t\t\tthis.trigger('changed', { 'action' : 'select_all', 'selected' : this._data.core.selected, 'old_selection' : tmp });\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * deselect all selected nodes\n\t\t * @name deselect_all([supress_event])\n\t\t * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered\n\t\t * @trigger deselect_all.jstree, changed.jstree\n\t\t */\n\t\tdeselect_all : function (supress_event) {\n\t\t\tvar tmp = this._data.core.selected.concat([]), i, j;\n\t\t\tfor(i = 0, j = this._data.core.selected.length; i < j; i++) {\n\t\t\t\tif(this._model.data[this._data.core.selected[i]]) {\n\t\t\t\t\tthis._model.data[this._data.core.selected[i]].state.selected = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._data.core.selected = [];\n\t\t\tthis.element.find('.jstree-clicked').removeClass('jstree-clicked').attr('aria-selected', false);\n\t\t\t/**\n\t\t\t * triggered when all nodes are deselected\n\t\t\t * @event\n\t\t\t * @name deselect_all.jstree\n\t\t\t * @param {Object} node the previous selection\n\t\t\t * @param {Array} selected the current selection\n\t\t\t */\n\t\t\tthis.trigger('deselect_all', { 'selected' : this._data.core.selected, 'node' : tmp });\n\t\t\tif(!supress_event) {\n\t\t\t\tthis.trigger('changed', { 'action' : 'deselect_all', 'selected' : this._data.core.selected, 'old_selection' : tmp });\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * checks if a node is selected\n\t\t * @name is_selected(obj)\n\t\t * @param {mixed} obj\n\t\t * @return {Boolean}\n\t\t */\n\t\tis_selected : function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn obj.state.selected;\n\t\t},\n\t\t/**\n\t\t * get an array of all selected nodes\n\t\t * @name get_selected([full])\n\t\t * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned\n\t\t * @return {Array}\n\t\t */\n\t\tget_selected : function (full) {\n\t\t\treturn full ? $.map(this._data.core.selected, function (i) { return this.get_node(i); }.bind(this)) : this._data.core.selected.slice();\n\t\t},\n\t\t/**\n\t\t * get an array of all top level selected nodes (ignoring children of selected nodes)\n\t\t * @name get_top_selected([full])\n\t\t * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned\n\t\t * @return {Array}\n\t\t */\n\t\tget_top_selected : function (full) {\n\t\t\tvar tmp = this.get_selected(true),\n\t\t\t\tobj = {}, i, j, k, l;\n\t\t\tfor(i = 0, j = tmp.length; i < j; i++) {\n\t\t\t\tobj[tmp[i].id] = tmp[i];\n\t\t\t}\n\t\t\tfor(i = 0, j = tmp.length; i < j; i++) {\n\t\t\t\tfor(k = 0, l = tmp[i].children_d.length; k < l; k++) {\n\t\t\t\t\tif(obj[tmp[i].children_d[k]]) {\n\t\t\t\t\t\tdelete obj[tmp[i].children_d[k]];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttmp = [];\n\t\t\tfor(i in obj) {\n\t\t\t\tif(obj.hasOwnProperty(i)) {\n\t\t\t\t\ttmp.push(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn full ? $.map(tmp, function (i) { return this.get_node(i); }.bind(this)) : tmp;\n\t\t},\n\t\t/**\n\t\t * get an array of all bottom level selected nodes (ignoring selected parents)\n\t\t * @name get_bottom_selected([full])\n\t\t * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned\n\t\t * @return {Array}\n\t\t */\n\t\tget_bottom_selected : function (full) {\n\t\t\tvar tmp = this.get_selected(true),\n\t\t\t\tobj = [], i, j;\n\t\t\tfor(i = 0, j = tmp.length; i < j; i++) {\n\t\t\t\tif(!tmp[i].children.length) {\n\t\t\t\t\tobj.push(tmp[i].id);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn full ? $.map(obj, function (i) { return this.get_node(i); }.bind(this)) : obj;\n\t\t},\n\t\t/**\n\t\t * gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally.\n\t\t * @name get_state()\n\t\t * @private\n\t\t * @return {Object}\n\t\t */\n\t\tget_state : function () {\n\t\t\tvar state\t= {\n\t\t\t\t'core' : {\n\t\t\t\t\t'open' : [],\n\t\t\t\t\t'loaded' : [],\n\t\t\t\t\t'scroll' : {\n\t\t\t\t\t\t'left' : this.element.scrollLeft(),\n\t\t\t\t\t\t'top' : this.element.scrollTop()\n\t\t\t\t\t},\n\t\t\t\t\t/*!\n\t\t\t\t\t'themes' : {\n\t\t\t\t\t\t'name' : this.get_theme(),\n\t\t\t\t\t\t'icons' : this._data.core.themes.icons,\n\t\t\t\t\t\t'dots' : this._data.core.themes.dots\n\t\t\t\t\t},\n\t\t\t\t\t*/\n\t\t\t\t\t'selected' : []\n\t\t\t\t}\n\t\t\t}, i;\n\t\t\tfor(i in this._model.data) {\n\t\t\t\tif(this._model.data.hasOwnProperty(i)) {\n\t\t\t\t\tif(i !== $.jstree.root) {\n\t\t\t\t\t\tif(this._model.data[i].state.loaded && this.settings.core.loaded_state) {\n\t\t\t\t\t\t\tstate.core.loaded.push(i);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(this._model.data[i].state.opened) {\n\t\t\t\t\t\t\tstate.core.open.push(i);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(this._model.data[i].state.selected) {\n\t\t\t\t\t\t\tstate.core.selected.push(i);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn state;\n\t\t},\n\t\t/**\n\t\t * sets the state of the tree. Used internally.\n\t\t * @name set_state(state [, callback])\n\t\t * @private\n\t\t * @param {Object} state the state to restore. Keep in mind this object is passed by reference and jstree will modify it.\n\t\t * @param {Function} callback an optional function to execute once the state is restored.\n\t\t * @trigger set_state.jstree\n\t\t */\n\t\tset_state : function (state, callback) {\n\t\t\tif(state) {\n\t\t\t\tif(state.core && state.core.selected && state.core.initial_selection === undefined) {\n\t\t\t\t\tstate.core.initial_selection = this._data.core.selected.concat([]).sort().join(',');\n\t\t\t\t}\n\t\t\t\tif(state.core) {\n\t\t\t\t\tvar res, n, t, _this, i;\n\t\t\t\t\tif(state.core.loaded) {\n\t\t\t\t\t\tif(!this.settings.core.loaded_state || !$.vakata.is_array(state.core.loaded) || !state.core.loaded.length) {\n\t\t\t\t\t\t\tdelete state.core.loaded;\n\t\t\t\t\t\t\tthis.set_state(state, callback);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthis._load_nodes(state.core.loaded, function (nodes) {\n\t\t\t\t\t\t\t\tdelete state.core.loaded;\n\t\t\t\t\t\t\t\tthis.set_state(state, callback);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif(state.core.open) {\n\t\t\t\t\t\tif(!$.vakata.is_array(state.core.open) || !state.core.open.length) {\n\t\t\t\t\t\t\tdelete state.core.open;\n\t\t\t\t\t\t\tthis.set_state(state, callback);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthis._load_nodes(state.core.open, function (nodes) {\n\t\t\t\t\t\t\t\tthis.open_node(nodes, false, 0);\n\t\t\t\t\t\t\t\tdelete state.core.open;\n\t\t\t\t\t\t\t\tthis.set_state(state, callback);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif(state.core.scroll) {\n\t\t\t\t\t\tif(state.core.scroll && state.core.scroll.left !== undefined) {\n\t\t\t\t\t\t\tthis.element.scrollLeft(state.core.scroll.left);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(state.core.scroll && state.core.scroll.top !== undefined) {\n\t\t\t\t\t\t\tthis.element.scrollTop(state.core.scroll.top);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdelete state.core.scroll;\n\t\t\t\t\t\tthis.set_state(state, callback);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif(state.core.selected) {\n\t\t\t\t\t\t_this = this;\n\t\t\t\t\t\tif (state.core.initial_selection === undefined ||\n\t\t\t\t\t\t\tstate.core.initial_selection === this._data.core.selected.concat([]).sort().join(',')\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthis.deselect_all();\n\t\t\t\t\t\t\t$.each(state.core.selected, function (i, v) {\n\t\t\t\t\t\t\t\t_this.select_node(v, false, true);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdelete state.core.initial_selection;\n\t\t\t\t\t\tdelete state.core.selected;\n\t\t\t\t\t\tthis.set_state(state, callback);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tfor(i in state) {\n\t\t\t\t\t\tif(state.hasOwnProperty(i) && i !== \"core\" && $.inArray(i, this.settings.plugins) === -1) {\n\t\t\t\t\t\t\tdelete state[i];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif($.isEmptyObject(state.core)) {\n\t\t\t\t\t\tdelete state.core;\n\t\t\t\t\t\tthis.set_state(state, callback);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif($.isEmptyObject(state)) {\n\t\t\t\t\tstate = null;\n\t\t\t\t\tif(callback) { callback.call(this); }\n\t\t\t\t\t/**\n\t\t\t\t\t * triggered when a `set_state` call completes\n\t\t\t\t\t * @event\n\t\t\t\t\t * @name set_state.jstree\n\t\t\t\t\t */\n\t\t\t\t\tthis.trigger('set_state');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\t/**\n\t\t * refreshes the tree - all nodes are reloaded with calls to `load_node`.\n\t\t * @name refresh()\n\t\t * @param {Boolean} skip_loading an option to skip showing the loading indicator\n\t\t * @param {Mixed} forget_state if set to `true` state will not be reapplied, if set to a function (receiving the current state as argument) the result of that function will be used as state\n\t\t * @trigger refresh.jstree\n\t\t */\n\t\trefresh : function (skip_loading, forget_state) {\n\t\t\tthis._data.core.state = forget_state === true ? {} : this.get_state();\n\t\t\tif(forget_state && $.vakata.is_function(forget_state)) { this._data.core.state = forget_state.call(this, this._data.core.state); }\n\t\t\tthis._cnt = 0;\n\t\t\tthis._model.data = {};\n\t\t\tthis._model.data[$.jstree.root] = {\n\t\t\t\tid : $.jstree.root,\n\t\t\t\tparent : null,\n\t\t\t\tparents : [],\n\t\t\t\tchildren : [],\n\t\t\t\tchildren_d : [],\n\t\t\t\tstate : { loaded : false }\n\t\t\t};\n\t\t\tthis._data.core.selected = [];\n\t\t\tthis._data.core.last_clicked = null;\n\t\t\tthis._data.core.focused = null;\n\n\t\t\tvar c = this.get_container_ul()[0].className;\n\t\t\tif(!skip_loading) {\n\t\t\t\tthis.element.html(\"<\"+\"ul class='\"+c+\"' role='group'><\"+\"li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='none' id='j\"+this._id+\"_loading'><\"+\"a class='jstree-anchor' role='treeitem' href='#'>\" + this.get_string(\"Loading ...\") + \"\");\n\t\t\t\tthis.element.attr('aria-activedescendant','j'+this._id+'_loading');\n\t\t\t}\n\t\t\tthis.load_node($.jstree.root, function (o, s) {\n\t\t\t\tif(s) {\n\t\t\t\t\tthis.get_container_ul()[0].className = c;\n\t\t\t\t\tif(this._firstChild(this.get_container_ul()[0])) {\n\t\t\t\t\t\tthis.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id);\n\t\t\t\t\t}\n\t\t\t\t\tthis.set_state($.extend(true, {}, this._data.core.state), function () {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * triggered when a `refresh` call completes\n\t\t\t\t\t\t * @event\n\t\t\t\t\t\t * @name refresh.jstree\n\t\t\t\t\t\t */\n\t\t\t\t\t\tthis.trigger('refresh');\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis._data.core.state = null;\n\t\t\t});\n\t\t},\n\t\t/**\n\t\t * refreshes a node in the tree (reload its children) all opened nodes inside that node are reloaded with calls to `load_node`.\n\t\t * @name refresh_node(obj)\n\t\t * @param {mixed} obj the node\n\t\t * @trigger refresh_node.jstree\n\t\t */\n\t\trefresh_node : function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) { return false; }\n\t\t\tvar opened = [], to_load = [], s = this._data.core.selected.concat([]);\n\t\t\tto_load.push(obj.id);\n\t\t\tif(obj.state.opened === true) { opened.push(obj.id); }\n\t\t\tthis.get_node(obj, true).find('.jstree-open').each(function() { to_load.push(this.id); opened.push(this.id); });\n\t\t\tthis._load_nodes(to_load, function (nodes) {\n\t\t\t\tthis.open_node(opened, false, 0);\n\t\t\t\tthis.select_node(s);\n\t\t\t\t/**\n\t\t\t\t * triggered when a node is refreshed\n\t\t\t\t * @event\n\t\t\t\t * @name refresh_node.jstree\n\t\t\t\t * @param {Object} node - the refreshed node\n\t\t\t\t * @param {Array} nodes - an array of the IDs of the nodes that were reloaded\n\t\t\t\t */\n\t\t\t\tthis.trigger('refresh_node', { 'node' : obj, 'nodes' : nodes });\n\t\t\t}.bind(this), false, true);\n\t\t},\n\t\t/**\n\t\t * set (change) the ID of a node\n\t\t * @name set_id(obj, id)\n\t\t * @param {mixed} obj the node\n\t\t * @param {String} id the new ID\n\t\t * @return {Boolean}\n\t\t * @trigger set_id.jstree\n\t\t */\n\t\tset_id : function (obj, id) {\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) { return false; }\n\t\t\tvar i, j, m = this._model.data, old = obj.id;\n\t\t\tid = id.toString();\n\t\t\t// update parents (replace current ID with new one in children and children_d)\n\t\t\tm[obj.parent].children[$.inArray(obj.id, m[obj.parent].children)] = id;\n\t\t\tfor(i = 0, j = obj.parents.length; i < j; i++) {\n\t\t\t\tm[obj.parents[i]].children_d[$.inArray(obj.id, m[obj.parents[i]].children_d)] = id;\n\t\t\t}\n\t\t\t// update children (replace current ID with new one in parent and parents)\n\t\t\tfor(i = 0, j = obj.children.length; i < j; i++) {\n\t\t\t\tm[obj.children[i]].parent = id;\n\t\t\t}\n\t\t\tfor(i = 0, j = obj.children_d.length; i < j; i++) {\n\t\t\t\tm[obj.children_d[i]].parents[$.inArray(obj.id, m[obj.children_d[i]].parents)] = id;\n\t\t\t}\n\t\t\ti = $.inArray(obj.id, this._data.core.selected);\n\t\t\tif(i !== -1) { this._data.core.selected[i] = id; }\n\t\t\t// update model and obj itself (obj.id, this._model.data[KEY])\n\t\t\ti = this.get_node(obj.id, true);\n\t\t\tif(i) {\n\t\t\t\ti.attr('id', id); //.children('.jstree-anchor').attr('id', id + '_anchor').end().attr('aria-labelledby', id + '_anchor');\n\t\t\t\tif(this.element.attr('aria-activedescendant') === obj.id) {\n\t\t\t\t\tthis.element.attr('aria-activedescendant', id);\n\t\t\t\t}\n\t\t\t}\n\t\t\tdelete m[obj.id];\n\t\t\tobj.id = id;\n\t\t\tobj.li_attr.id = id;\n\t\t\tm[id] = obj;\n\t\t\t/**\n\t\t\t * triggered when a node id value is changed\n\t\t\t * @event\n\t\t\t * @name set_id.jstree\n\t\t\t * @param {Object} node\n\t\t\t * @param {String} old the old id\n\t\t\t */\n\t\t\tthis.trigger('set_id',{ \"node\" : obj, \"new\" : obj.id, \"old\" : old });\n\t\t\treturn true;\n\t\t},\n\t\t/**\n\t\t * get the text value of a node\n\t\t * @name get_text(obj)\n\t\t * @param {mixed} obj the node\n\t\t * @return {String}\n\t\t */\n\t\tget_text : function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\treturn (!obj || obj.id === $.jstree.root) ? false : obj.text;\n\t\t},\n\t\t/**\n\t\t * set the text value of a node. Used internally, please use `rename_node(obj, val)`.\n\t\t * @private\n\t\t * @name set_text(obj, val)\n\t\t * @param {mixed} obj the node, you can pass an array to set the text on multiple nodes\n\t\t * @param {String} val the new text value\n\t\t * @return {Boolean}\n\t\t * @trigger set_text.jstree\n\t\t */\n\t\tset_text : function (obj, val) {\n\t\t\tvar t1, t2;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.set_text(obj[t1], val);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) { return false; }\n\t\t\tobj.text = val;\n\t\t\tif(this.get_node(obj, true).length) {\n\t\t\t\tthis.redraw_node(obj.id);\n\t\t\t}\n\t\t\t/**\n\t\t\t * triggered when a node text value is changed\n\t\t\t * @event\n\t\t\t * @name set_text.jstree\n\t\t\t * @param {Object} obj\n\t\t\t * @param {String} text the new value\n\t\t\t */\n\t\t\tthis.trigger('set_text',{ \"obj\" : obj, \"text\" : val });\n\t\t\treturn true;\n\t\t},\n\t\t/**\n\t\t * gets a JSON representation of a node (or the whole tree)\n\t\t * @name get_json([obj, options])\n\t\t * @param {mixed} obj\n\t\t * @param {Object} options\n\t\t * @param {Boolean} options.no_state do not return state information\n\t\t * @param {Boolean} options.no_id do not return ID\n\t\t * @param {Boolean} options.no_children do not include children\n\t\t * @param {Boolean} options.no_data do not include node data\n\t\t * @param {Boolean} options.no_li_attr do not include LI attributes\n\t\t * @param {Boolean} options.no_a_attr do not include A attributes\n\t\t * @param {Boolean} options.flat return flat JSON instead of nested\n\t\t * @return {Object}\n\t\t */\n\t\tget_json : function (obj, options, flat) {\n\t\t\tobj = this.get_node(obj || $.jstree.root);\n\t\t\tif(!obj) { return false; }\n\t\t\tif(options && options.flat && !flat) { flat = []; }\n\t\t\tvar tmp = {\n\t\t\t\t'id' : obj.id,\n\t\t\t\t'text' : obj.text,\n\t\t\t\t'icon' : this.get_icon(obj),\n\t\t\t\t'li_attr' : $.extend(true, {}, obj.li_attr),\n\t\t\t\t'a_attr' : $.extend(true, {}, obj.a_attr),\n\t\t\t\t'state' : {},\n\t\t\t\t'data' : options && options.no_data ? false : $.extend(true, $.vakata.is_array(obj.data)?[]:{}, obj.data)\n\t\t\t\t//( this.get_node(obj, true).length ? this.get_node(obj, true).data() : obj.data ),\n\t\t\t}, i, j;\n\t\t\tif(options && options.flat) {\n\t\t\t\ttmp.parent = obj.parent;\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttmp.children = [];\n\t\t\t}\n\t\t\tif(!options || !options.no_state) {\n\t\t\t\tfor(i in obj.state) {\n\t\t\t\t\tif(obj.state.hasOwnProperty(i)) {\n\t\t\t\t\t\ttmp.state[i] = obj.state[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdelete tmp.state;\n\t\t\t}\n\t\t\tif(options && options.no_li_attr) {\n\t\t\t\tdelete tmp.li_attr;\n\t\t\t}\n\t\t\tif(options && options.no_a_attr) {\n\t\t\t\tdelete tmp.a_attr;\n\t\t\t}\n\t\t\tif(options && options.no_id) {\n\t\t\t\tdelete tmp.id;\n\t\t\t\tif(tmp.li_attr && tmp.li_attr.id) {\n\t\t\t\t\tdelete tmp.li_attr.id;\n\t\t\t\t}\n\t\t\t\tif(tmp.a_attr && tmp.a_attr.id) {\n\t\t\t\t\tdelete tmp.a_attr.id;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(options && options.flat && obj.id !== $.jstree.root) {\n\t\t\t\tflat.push(tmp);\n\t\t\t}\n\t\t\tif(!options || !options.no_children) {\n\t\t\t\tfor(i = 0, j = obj.children.length; i < j; i++) {\n\t\t\t\t\tif(options && options.flat) {\n\t\t\t\t\t\tthis.get_json(obj.children[i], options, flat);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\ttmp.children.push(this.get_json(obj.children[i], options));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn options && options.flat ? flat : (obj.id === $.jstree.root ? tmp.children : tmp);\n\t\t},\n\t\t/**\n\t\t * create a new node (do not confuse with load_node)\n\t\t * @name create_node([par, node, pos, callback, is_loaded])\n\t\t * @param {mixed} par the parent node (to create a root node use either \"#\" (string) or `null`)\n\t\t * @param {mixed} node the data for the new node (a valid JSON object, or a simple string with the name)\n\t\t * @param {mixed} pos the index at which to insert the node, \"first\" and \"last\" are also supported, default is \"last\"\n\t\t * @param {Function} callback a function to be called once the node is created\n\t\t * @param {Boolean} is_loaded internal argument indicating if the parent node was succesfully loaded\n\t\t * @return {String} the ID of the newly create node\n\t\t * @trigger model.jstree, create_node.jstree\n\t\t */\n\t\tcreate_node : function (par, node, pos, callback, is_loaded) {\n\t\t\tif(par === null) { par = $.jstree.root; }\n\t\t\tpar = this.get_node(par);\n\t\t\tif(!par) { return false; }\n\t\t\tpos = pos === undefined ? \"last\" : pos;\n\t\t\tif(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {\n\t\t\t\treturn this.load_node(par, function () { this.create_node(par, node, pos, callback, true); });\n\t\t\t}\n\t\t\tif(!node) { node = { \"text\" : this.get_string('New node') }; }\n\t\t\tif(typeof node === \"string\") {\n\t\t\t\tnode = { \"text\" : node };\n\t\t\t} else {\n\t\t\t\tnode = $.extend(true, {}, node);\n\t\t\t}\n\t\t\tif(node.text === undefined) { node.text = this.get_string('New node'); }\n\t\t\tvar tmp, dpc, i, j;\n\n\t\t\tif(par.id === $.jstree.root) {\n\t\t\t\tif(pos === \"before\") { pos = \"first\"; }\n\t\t\t\tif(pos === \"after\") { pos = \"last\"; }\n\t\t\t}\n\t\t\tswitch(pos) {\n\t\t\t\tcase \"before\":\n\t\t\t\t\ttmp = this.get_node(par.parent);\n\t\t\t\t\tpos = $.inArray(par.id, tmp.children);\n\t\t\t\t\tpar = tmp;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"after\" :\n\t\t\t\t\ttmp = this.get_node(par.parent);\n\t\t\t\t\tpos = $.inArray(par.id, tmp.children) + 1;\n\t\t\t\t\tpar = tmp;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"inside\":\n\t\t\t\tcase \"first\":\n\t\t\t\t\tpos = 0;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"last\":\n\t\t\t\t\tpos = par.children.length;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tif(!pos) { pos = 0; }\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(pos > par.children.length) { pos = par.children.length; }\n\t\t\tif(!node.id) { node.id = true; }\n\t\t\tif(!this.check(\"create_node\", node, par, pos)) {\n\t\t\t\tthis.settings.core.error.call(this, this._data.core.last_error);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(node.id === true) { delete node.id; }\n\t\t\tnode = this._parse_model_from_json(node, par.id, par.parents.concat());\n\t\t\tif(!node) { return false; }\n\t\t\ttmp = this.get_node(node);\n\t\t\tdpc = [];\n\t\t\tdpc.push(node);\n\t\t\tdpc = dpc.concat(tmp.children_d);\n\t\t\tthis.trigger('model', { \"nodes\" : dpc, \"parent\" : par.id });\n\n\t\t\tpar.children_d = par.children_d.concat(dpc);\n\t\t\tfor(i = 0, j = par.parents.length; i < j; i++) {\n\t\t\t\tthis._model.data[par.parents[i]].children_d = this._model.data[par.parents[i]].children_d.concat(dpc);\n\t\t\t}\n\t\t\tnode = tmp;\n\t\t\ttmp = [];\n\t\t\tfor(i = 0, j = par.children.length; i < j; i++) {\n\t\t\t\ttmp[i >= pos ? i+1 : i] = par.children[i];\n\t\t\t}\n\t\t\ttmp[pos] = node.id;\n\t\t\tpar.children = tmp;\n\n\t\t\tthis.redraw_node(par, true);\n\t\t\t/**\n\t\t\t * triggered when a node is created\n\t\t\t * @event\n\t\t\t * @name create_node.jstree\n\t\t\t * @param {Object} node\n\t\t\t * @param {String} parent the parent's ID\n\t\t\t * @param {Number} position the position of the new node among the parent's children\n\t\t\t */\n\t\t\tthis.trigger('create_node', { \"node\" : this.get_node(node), \"parent\" : par.id, \"position\" : pos });\n\t\t\tif(callback) { callback.call(this, this.get_node(node)); }\n\t\t\treturn node.id;\n\t\t},\n\t\t/**\n\t\t * set the text value of a node\n\t\t * @name rename_node(obj, val)\n\t\t * @param {mixed} obj the node, you can pass an array to rename multiple nodes to the same name\n\t\t * @param {String} val the new text value\n\t\t * @return {Boolean}\n\t\t * @trigger rename_node.jstree\n\t\t */\n\t\trename_node : function (obj, val) {\n\t\t\tvar t1, t2, old;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.rename_node(obj[t1], val);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) { return false; }\n\t\t\told = obj.text;\n\t\t\tif(!this.check(\"rename_node\", obj, this.get_parent(obj), val)) {\n\t\t\t\tthis.settings.core.error.call(this, this._data.core.last_error);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tthis.set_text(obj, val); // .apply(this, Array.prototype.slice.call(arguments))\n\t\t\t/**\n\t\t\t * triggered when a node is renamed\n\t\t\t * @event\n\t\t\t * @name rename_node.jstree\n\t\t\t * @param {Object} node\n\t\t\t * @param {String} text the new value\n\t\t\t * @param {String} old the old value\n\t\t\t */\n\t\t\tthis.trigger('rename_node', { \"node\" : obj, \"text\" : val, \"old\" : old });\n\t\t\treturn true;\n\t\t},\n\t\t/**\n\t\t * remove a node\n\t\t * @name delete_node(obj)\n\t\t * @param {mixed} obj the node, you can pass an array to delete multiple nodes\n\t\t * @return {Boolean}\n\t\t * @trigger delete_node.jstree, changed.jstree\n\t\t */\n\t\tdelete_node : function (obj) {\n\t\t\tvar t1, t2, par, pos, tmp, i, j, k, l, c, top, lft;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.delete_node(obj[t1]);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) { return false; }\n\t\t\tpar = this.get_node(obj.parent);\n\t\t\tpos = $.inArray(obj.id, par.children);\n\t\t\tc = false;\n\t\t\tif(!this.check(\"delete_node\", obj, par, pos)) {\n\t\t\t\tthis.settings.core.error.call(this, this._data.core.last_error);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(pos !== -1) {\n\t\t\t\tpar.children = $.vakata.array_remove(par.children, pos);\n\t\t\t}\n\t\t\ttmp = obj.children_d.concat([]);\n\t\t\ttmp.push(obj.id);\n\t\t\tfor(i = 0, j = obj.parents.length; i < j; i++) {\n\t\t\t\tthis._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) {\n\t\t\t\t\treturn $.inArray(v, tmp) === -1;\n\t\t\t\t});\n\t\t\t}\n\t\t\tfor(k = 0, l = tmp.length; k < l; k++) {\n\t\t\t\tif(this._model.data[tmp[k]].state.selected) {\n\t\t\t\t\tc = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (c) {\n\t\t\t\tthis._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) {\n\t\t\t\t\treturn $.inArray(v, tmp) === -1;\n\t\t\t\t});\n\t\t\t}\n\t\t\t/**\n\t\t\t * triggered when a node is deleted\n\t\t\t * @event\n\t\t\t * @name delete_node.jstree\n\t\t\t * @param {Object} node\n\t\t\t * @param {String} parent the parent's ID\n\t\t\t */\n\t\t\tthis.trigger('delete_node', { \"node\" : obj, \"parent\" : par.id });\n\t\t\tif(c) {\n\t\t\t\tthis.trigger('changed', { 'action' : 'delete_node', 'node' : obj, 'selected' : this._data.core.selected, 'parent' : par.id });\n\t\t\t}\n\t\t\tfor(k = 0, l = tmp.length; k < l; k++) {\n\t\t\t\tdelete this._model.data[tmp[k]];\n\t\t\t}\n\t\t\tif($.inArray(this._data.core.focused, tmp) !== -1) {\n\t\t\t\tthis._data.core.focused = null;\n\t\t\t\ttop = this.element[0].scrollTop;\n\t\t\t\tlft = this.element[0].scrollLeft;\n\t\t\t\tif(par.id === $.jstree.root) {\n\t\t\t\t\tif (this._model.data[$.jstree.root].children[0]) {\n\t\t\t\t\t\tthis.get_node(this._model.data[$.jstree.root].children[0], true).children('.jstree-anchor').trigger('focus');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.get_node(par, true).children('.jstree-anchor').trigger('focus');\n\t\t\t\t}\n\t\t\t\tthis.element[0].scrollTop = top;\n\t\t\t\tthis.element[0].scrollLeft = lft;\n\t\t\t}\n\t\t\tthis.redraw_node(par, true);\n\t\t\treturn true;\n\t\t},\n\t\t/**\n\t\t * check if an operation is premitted on the tree. Used internally.\n\t\t * @private\n\t\t * @name check(chk, obj, par, pos)\n\t\t * @param {String} chk the operation to check, can be \"create_node\", \"rename_node\", \"delete_node\", \"copy_node\" or \"move_node\"\n\t\t * @param {mixed} obj the node\n\t\t * @param {mixed} par the parent\n\t\t * @param {mixed} pos the position to insert at, or if \"rename_node\" - the new name\n\t\t * @param {mixed} more some various additional information, for example if a \"move_node\" operations is triggered by DND this will be the hovered node\n\t\t * @return {Boolean}\n\t\t */\n\t\tcheck : function (chk, obj, par, pos, more) {\n\t\t\tobj = obj && obj.id ? obj : this.get_node(obj);\n\t\t\tpar = par && par.id ? par : this.get_node(par);\n\t\t\tvar tmp = chk.match(/^(move_node|copy_node|create_node)$/i) ? par : obj,\n\t\t\t\tchc = this.settings.core.check_callback;\n\t\t\tif(chk === \"move_node\" || chk === \"copy_node\") {\n\t\t\t\tif((!more || !more.is_multi) && (chk === \"move_node\" && $.inArray(obj.id, par.children) === pos)) {\n\t\t\t\t\tthis._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_08', 'reason' : 'Moving node to its current position', 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif((!more || !more.is_multi) && (obj.id === par.id || (chk === \"move_node\" && $.inArray(obj.id, par.children) === pos) || $.inArray(par.id, obj.children_d) !== -1)) {\n\t\t\t\t\tthis._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_01', 'reason' : 'Moving parent inside child', 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(tmp && tmp.data) { tmp = tmp.data; }\n\t\t\tif(tmp && tmp.functions && (tmp.functions[chk] === false || tmp.functions[chk] === true)) {\n\t\t\t\tif(tmp.functions[chk] === false) {\n\t\t\t\t\tthis._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_02', 'reason' : 'Node data prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };\n\t\t\t\t}\n\t\t\t\treturn tmp.functions[chk];\n\t\t\t}\n\t\t\tif(chc === false || ($.vakata.is_function(chc) && chc.call(this, chk, obj, par, pos, more) === false) || (chc && chc[chk] === false)) {\n\t\t\t\tthis._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_03', 'reason' : 'User config for core.check_callback prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\t\t/**\n\t\t * get the last error\n\t\t * @name last_error()\n\t\t * @return {Object}\n\t\t */\n\t\tlast_error : function () {\n\t\t\treturn this._data.core.last_error;\n\t\t},\n\t\t/**\n\t\t * move a node to a new parent\n\t\t * @name move_node(obj, par [, pos, callback, is_loaded])\n\t\t * @param {mixed} obj the node to move, pass an array to move multiple nodes\n\t\t * @param {mixed} par the new parent\n\t\t * @param {mixed} pos the position to insert at (besides integer values, \"first\" and \"last\" are supported, as well as \"before\" and \"after\"), defaults to integer `0`\n\t\t * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position\n\t\t * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded\n\t\t * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn\n\t\t * @param {Boolean} instance internal parameter indicating if the node comes from another instance\n\t\t * @trigger move_node.jstree\n\t\t */\n\t\tmove_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) {\n\t\t\tvar t1, t2, old_par, old_pos, new_par, old_ins, is_multi, dpc, tmp, i, j, k, l, p;\n\n\t\t\tpar = this.get_node(par);\n\t\t\tpos = pos === undefined ? 0 : pos;\n\t\t\tif(!par) { return false; }\n\t\t\tif(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {\n\t\t\t\treturn this.load_node(par, function () { this.move_node(obj, par, pos, callback, true, false, origin); });\n\t\t\t}\n\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tif(obj.length === 1) {\n\t\t\t\t\tobj = obj[0];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t//obj = obj.slice();\n\t\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\t\tif((tmp = this.move_node(obj[t1], par, pos, callback, is_loaded, false, origin))) {\n\t\t\t\t\t\t\tpar = tmp;\n\t\t\t\t\t\t\tpos = \"after\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.redraw();\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tobj = obj && obj.id ? obj : this.get_node(obj);\n\n\t\t\tif(!obj || obj.id === $.jstree.root) { return false; }\n\n\t\t\told_par = (obj.parent || $.jstree.root).toString();\n\t\t\tnew_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent);\n\t\t\told_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id));\n\t\t\tis_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id);\n\t\t\told_pos = old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1;\n\t\t\tif(old_ins && old_ins._id) {\n\t\t\t\tobj = old_ins._model.data[obj.id];\n\t\t\t}\n\n\t\t\tif(is_multi) {\n\t\t\t\tif((tmp = this.copy_node(obj, par, pos, callback, is_loaded, false, origin))) {\n\t\t\t\t\tif(old_ins) { old_ins.delete_node(obj); }\n\t\t\t\t\treturn tmp;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t//var m = this._model.data;\n\t\t\tif(par.id === $.jstree.root) {\n\t\t\t\tif(pos === \"before\") { pos = \"first\"; }\n\t\t\t\tif(pos === \"after\") { pos = \"last\"; }\n\t\t\t}\n\t\t\tswitch(pos) {\n\t\t\t\tcase \"before\":\n\t\t\t\t\tpos = $.inArray(par.id, new_par.children);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"after\" :\n\t\t\t\t\tpos = $.inArray(par.id, new_par.children) + 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"inside\":\n\t\t\t\tcase \"first\":\n\t\t\t\t\tpos = 0;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"last\":\n\t\t\t\t\tpos = new_par.children.length;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tif(!pos) { pos = 0; }\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(pos > new_par.children.length) { pos = new_par.children.length; }\n\t\t\tif(!this.check(\"move_node\", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) {\n\t\t\t\tthis.settings.core.error.call(this, this._data.core.last_error);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(obj.parent === new_par.id) {\n\t\t\t\tdpc = new_par.children.concat();\n\t\t\t\ttmp = $.inArray(obj.id, dpc);\n\t\t\t\tif(tmp !== -1) {\n\t\t\t\t\tdpc = $.vakata.array_remove(dpc, tmp);\n\t\t\t\t\tif(pos > tmp) { pos--; }\n\t\t\t\t}\n\t\t\t\ttmp = [];\n\t\t\t\tfor(i = 0, j = dpc.length; i < j; i++) {\n\t\t\t\t\ttmp[i >= pos ? i+1 : i] = dpc[i];\n\t\t\t\t}\n\t\t\t\ttmp[pos] = obj.id;\n\t\t\t\tnew_par.children = tmp;\n\t\t\t\tthis._node_changed(new_par.id);\n\t\t\t\tthis.redraw(new_par.id === $.jstree.root);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// clean old parent and up\n\t\t\t\ttmp = obj.children_d.concat();\n\t\t\t\ttmp.push(obj.id);\n\t\t\t\tfor(i = 0, j = obj.parents.length; i < j; i++) {\n\t\t\t\t\tdpc = [];\n\t\t\t\t\tp = old_ins._model.data[obj.parents[i]].children_d;\n\t\t\t\t\tfor(k = 0, l = p.length; k < l; k++) {\n\t\t\t\t\t\tif($.inArray(p[k], tmp) === -1) {\n\t\t\t\t\t\t\tdpc.push(p[k]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\told_ins._model.data[obj.parents[i]].children_d = dpc;\n\t\t\t\t}\n\t\t\t\told_ins._model.data[old_par].children = $.vakata.array_remove_item(old_ins._model.data[old_par].children, obj.id);\n\n\t\t\t\t// insert into new parent and up\n\t\t\t\tfor(i = 0, j = new_par.parents.length; i < j; i++) {\n\t\t\t\t\tthis._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(tmp);\n\t\t\t\t}\n\t\t\t\tdpc = [];\n\t\t\t\tfor(i = 0, j = new_par.children.length; i < j; i++) {\n\t\t\t\t\tdpc[i >= pos ? i+1 : i] = new_par.children[i];\n\t\t\t\t}\n\t\t\t\tdpc[pos] = obj.id;\n\t\t\t\tnew_par.children = dpc;\n\t\t\t\tnew_par.children_d.push(obj.id);\n\t\t\t\tnew_par.children_d = new_par.children_d.concat(obj.children_d);\n\n\t\t\t\t// update object\n\t\t\t\tobj.parent = new_par.id;\n\t\t\t\ttmp = new_par.parents.concat();\n\t\t\t\ttmp.unshift(new_par.id);\n\t\t\t\tp = obj.parents.length;\n\t\t\t\tobj.parents = tmp;\n\n\t\t\t\t// update object children\n\t\t\t\ttmp = tmp.concat();\n\t\t\t\tfor(i = 0, j = obj.children_d.length; i < j; i++) {\n\t\t\t\t\tthis._model.data[obj.children_d[i]].parents = this._model.data[obj.children_d[i]].parents.slice(0,p*-1);\n\t\t\t\t\tArray.prototype.push.apply(this._model.data[obj.children_d[i]].parents, tmp);\n\t\t\t\t}\n\n\t\t\t\tif(old_par === $.jstree.root || new_par.id === $.jstree.root) {\n\t\t\t\t\tthis._model.force_full_redraw = true;\n\t\t\t\t}\n\t\t\t\tif(!this._model.force_full_redraw) {\n\t\t\t\t\tthis._node_changed(old_par);\n\t\t\t\t\tthis._node_changed(new_par.id);\n\t\t\t\t}\n\t\t\t\tif(!skip_redraw) {\n\t\t\t\t\tthis.redraw();\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(callback) { callback.call(this, obj, new_par, pos); }\n\t\t\t/**\n\t\t\t * triggered when a node is moved\n\t\t\t * @event\n\t\t\t * @name move_node.jstree\n\t\t\t * @param {Object} node\n\t\t\t * @param {String} parent the parent's ID\n\t\t\t * @param {Number} position the position of the node among the parent's children\n\t\t\t * @param {String} old_parent the old parent of the node\n\t\t\t * @param {Number} old_position the old position of the node\n\t\t\t * @param {Boolean} is_multi do the node and new parent belong to different instances\n\t\t\t * @param {jsTree} old_instance the instance the node came from\n\t\t\t * @param {jsTree} new_instance the instance of the new parent\n\t\t\t */\n\t\t\tthis.trigger('move_node', { \"node\" : obj, \"parent\" : new_par.id, \"position\" : pos, \"old_parent\" : old_par, \"old_position\" : old_pos, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this });\n\t\t\treturn obj.id;\n\t\t},\n\t\t/**\n\t\t * copy a node to a new parent\n\t\t * @name copy_node(obj, par [, pos, callback, is_loaded])\n\t\t * @param {mixed} obj the node to copy, pass an array to copy multiple nodes\n\t\t * @param {mixed} par the new parent\n\t\t * @param {mixed} pos the position to insert at (besides integer values, \"first\" and \"last\" are supported, as well as \"before\" and \"after\"), defaults to integer `0`\n\t\t * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position\n\t\t * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded\n\t\t * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn\n\t\t * @param {Boolean} instance internal parameter indicating if the node comes from another instance\n\t\t * @trigger model.jstree copy_node.jstree\n\t\t */\n\t\tcopy_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) {\n\t\t\tvar t1, t2, dpc, tmp, i, j, node, old_par, new_par, old_ins, is_multi;\n\n\t\t\tpar = this.get_node(par);\n\t\t\tpos = pos === undefined ? 0 : pos;\n\t\t\tif(!par) { return false; }\n\t\t\tif(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {\n\t\t\t\treturn this.load_node(par, function () { this.copy_node(obj, par, pos, callback, true, false, origin); });\n\t\t\t}\n\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tif(obj.length === 1) {\n\t\t\t\t\tobj = obj[0];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t//obj = obj.slice();\n\t\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\t\tif((tmp = this.copy_node(obj[t1], par, pos, callback, is_loaded, true, origin))) {\n\t\t\t\t\t\t\tpar = tmp;\n\t\t\t\t\t\t\tpos = \"after\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.redraw();\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tobj = obj && obj.id ? obj : this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) { return false; }\n\n\t\t\told_par = (obj.parent || $.jstree.root).toString();\n\t\t\tnew_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent);\n\t\t\told_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id));\n\t\t\tis_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id);\n\n\t\t\tif(old_ins && old_ins._id) {\n\t\t\t\tobj = old_ins._model.data[obj.id];\n\t\t\t}\n\n\t\t\tif(par.id === $.jstree.root) {\n\t\t\t\tif(pos === \"before\") { pos = \"first\"; }\n\t\t\t\tif(pos === \"after\") { pos = \"last\"; }\n\t\t\t}\n\t\t\tswitch(pos) {\n\t\t\t\tcase \"before\":\n\t\t\t\t\tpos = $.inArray(par.id, new_par.children);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"after\" :\n\t\t\t\t\tpos = $.inArray(par.id, new_par.children) + 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"inside\":\n\t\t\t\tcase \"first\":\n\t\t\t\t\tpos = 0;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"last\":\n\t\t\t\t\tpos = new_par.children.length;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tif(!pos) { pos = 0; }\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(pos > new_par.children.length) { pos = new_par.children.length; }\n\t\t\tif(!this.check(\"copy_node\", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) {\n\t\t\t\tthis.settings.core.error.call(this, this._data.core.last_error);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tnode = old_ins ? old_ins.get_json(obj, { no_id : true, no_data : true, no_state : true }) : obj;\n\t\t\tif(!node) { return false; }\n\t\t\tif(node.id === true) { delete node.id; }\n\t\t\tnode = this._parse_model_from_json(node, new_par.id, new_par.parents.concat());\n\t\t\tif(!node) { return false; }\n\t\t\ttmp = this.get_node(node);\n\t\t\tif(obj && obj.state && obj.state.loaded === false) { tmp.state.loaded = false; }\n\t\t\tdpc = [];\n\t\t\tdpc.push(node);\n\t\t\tdpc = dpc.concat(tmp.children_d);\n\t\t\tthis.trigger('model', { \"nodes\" : dpc, \"parent\" : new_par.id });\n\n\t\t\t// insert into new parent and up\n\t\t\tfor(i = 0, j = new_par.parents.length; i < j; i++) {\n\t\t\t\tthis._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(dpc);\n\t\t\t}\n\t\t\tdpc = [];\n\t\t\tfor(i = 0, j = new_par.children.length; i < j; i++) {\n\t\t\t\tdpc[i >= pos ? i+1 : i] = new_par.children[i];\n\t\t\t}\n\t\t\tdpc[pos] = tmp.id;\n\t\t\tnew_par.children = dpc;\n\t\t\tnew_par.children_d.push(tmp.id);\n\t\t\tnew_par.children_d = new_par.children_d.concat(tmp.children_d);\n\n\t\t\tif(new_par.id === $.jstree.root) {\n\t\t\t\tthis._model.force_full_redraw = true;\n\t\t\t}\n\t\t\tif(!this._model.force_full_redraw) {\n\t\t\t\tthis._node_changed(new_par.id);\n\t\t\t}\n\t\t\tif(!skip_redraw) {\n\t\t\t\tthis.redraw(new_par.id === $.jstree.root);\n\t\t\t}\n\t\t\tif(callback) { callback.call(this, tmp, new_par, pos); }\n\t\t\t/**\n\t\t\t * triggered when a node is copied\n\t\t\t * @event\n\t\t\t * @name copy_node.jstree\n\t\t\t * @param {Object} node the copied node\n\t\t\t * @param {Object} original the original node\n\t\t\t * @param {String} parent the parent's ID\n\t\t\t * @param {Number} position the position of the node among the parent's children\n\t\t\t * @param {String} old_parent the old parent of the node\n\t\t\t * @param {Number} old_position the position of the original node\n\t\t\t * @param {Boolean} is_multi do the node and new parent belong to different instances\n\t\t\t * @param {jsTree} old_instance the instance the node came from\n\t\t\t * @param {jsTree} new_instance the instance of the new parent\n\t\t\t */\n\t\t\tthis.trigger('copy_node', { \"node\" : tmp, \"original\" : obj, \"parent\" : new_par.id, \"position\" : pos, \"old_parent\" : old_par, \"old_position\" : old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1,'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this });\n\t\t\treturn tmp.id;\n\t\t},\n\t\t/**\n\t\t * cut a node (a later call to `paste(obj)` would move the node)\n\t\t * @name cut(obj)\n\t\t * @param {mixed} obj multiple objects can be passed using an array\n\t\t * @trigger cut.jstree\n\t\t */\n\t\tcut : function (obj) {\n\t\t\tif(!obj) { obj = this._data.core.selected.concat(); }\n\t\t\tif(!$.vakata.is_array(obj)) { obj = [obj]; }\n\t\t\tif(!obj.length) { return false; }\n\t\t\tvar tmp = [], o, t1, t2;\n\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\to = this.get_node(obj[t1]);\n\t\t\t\tif(o && o.id && o.id !== $.jstree.root) { tmp.push(o); }\n\t\t\t}\n\t\t\tif(!tmp.length) { return false; }\n\t\t\tccp_node = tmp;\n\t\t\tccp_inst = this;\n\t\t\tccp_mode = 'move_node';\n\t\t\t/**\n\t\t\t * triggered when nodes are added to the buffer for moving\n\t\t\t * @event\n\t\t\t * @name cut.jstree\n\t\t\t * @param {Array} node\n\t\t\t */\n\t\t\tthis.trigger('cut', { \"node\" : obj });\n\t\t},\n\t\t/**\n\t\t * copy a node (a later call to `paste(obj)` would copy the node)\n\t\t * @name copy(obj)\n\t\t * @param {mixed} obj multiple objects can be passed using an array\n\t\t * @trigger copy.jstree\n\t\t */\n\t\tcopy : function (obj) {\n\t\t\tif(!obj) { obj = this._data.core.selected.concat(); }\n\t\t\tif(!$.vakata.is_array(obj)) { obj = [obj]; }\n\t\t\tif(!obj.length) { return false; }\n\t\t\tvar tmp = [], o, t1, t2;\n\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\to = this.get_node(obj[t1]);\n\t\t\t\tif(o && o.id && o.id !== $.jstree.root) { tmp.push(o); }\n\t\t\t}\n\t\t\tif(!tmp.length) { return false; }\n\t\t\tccp_node = tmp;\n\t\t\tccp_inst = this;\n\t\t\tccp_mode = 'copy_node';\n\t\t\t/**\n\t\t\t * triggered when nodes are added to the buffer for copying\n\t\t\t * @event\n\t\t\t * @name copy.jstree\n\t\t\t * @param {Array} node\n\t\t\t */\n\t\t\tthis.trigger('copy', { \"node\" : obj });\n\t\t},\n\t\t/**\n\t\t * get the current buffer (any nodes that are waiting for a paste operation)\n\t\t * @name get_buffer()\n\t\t * @return {Object} an object consisting of `mode` (\"copy_node\" or \"move_node\"), `node` (an array of objects) and `inst` (the instance)\n\t\t */\n\t\tget_buffer : function () {\n\t\t\treturn { 'mode' : ccp_mode, 'node' : ccp_node, 'inst' : ccp_inst };\n\t\t},\n\t\t/**\n\t\t * check if there is something in the buffer to paste\n\t\t * @name can_paste()\n\t\t * @return {Boolean}\n\t\t */\n\t\tcan_paste : function () {\n\t\t\treturn ccp_mode !== false && ccp_node !== false; // && ccp_inst._model.data[ccp_node];\n\t\t},\n\t\t/**\n\t\t * copy or move the previously cut or copied nodes to a new parent\n\t\t * @name paste(obj [, pos])\n\t\t * @param {mixed} obj the new parent\n\t\t * @param {mixed} pos the position to insert at (besides integer, \"first\" and \"last\" are supported), defaults to integer `0`\n\t\t * @trigger paste.jstree\n\t\t */\n\t\tpaste : function (obj, pos) {\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || !ccp_mode || !ccp_mode.match(/^(copy_node|move_node)$/) || !ccp_node) { return false; }\n\t\t\tif(this[ccp_mode](ccp_node, obj, pos, false, false, false, ccp_inst)) {\n\t\t\t\t/**\n\t\t\t\t * triggered when paste is invoked\n\t\t\t\t * @event\n\t\t\t\t * @name paste.jstree\n\t\t\t\t * @param {String} parent the ID of the receiving node\n\t\t\t\t * @param {Array} node the nodes in the buffer\n\t\t\t\t * @param {String} mode the performed operation - \"copy_node\" or \"move_node\"\n\t\t\t\t */\n\t\t\t\tthis.trigger('paste', { \"parent\" : obj.id, \"node\" : ccp_node, \"mode\" : ccp_mode });\n\t\t\t}\n\t\t\tccp_node = false;\n\t\t\tccp_mode = false;\n\t\t\tccp_inst = false;\n\t\t},\n\t\t/**\n\t\t * clear the buffer of previously copied or cut nodes\n\t\t * @name clear_buffer()\n\t\t * @trigger clear_buffer.jstree\n\t\t */\n\t\tclear_buffer : function () {\n\t\t\tccp_node = false;\n\t\t\tccp_mode = false;\n\t\t\tccp_inst = false;\n\t\t\t/**\n\t\t\t * triggered when the copy / cut buffer is cleared\n\t\t\t * @event\n\t\t\t * @name clear_buffer.jstree\n\t\t\t */\n\t\t\tthis.trigger('clear_buffer');\n\t\t},\n\t\t/**\n\t\t * put a node in edit mode (input field to rename the node)\n\t\t * @name edit(obj [, default_text, callback])\n\t\t * @param {mixed} obj\n\t\t * @param {String} default_text the text to populate the input with (if omitted or set to a non-string value the node's text value is used)\n\t\t * @param {Function} callback a function to be called once the text box is blurred, it is called in the instance's scope and receives the node, a status parameter (true if the rename is successful, false otherwise), a boolean indicating if the user cancelled the edit and the original unescaped value provided by the user. You can also access the node's title using .text\n\t\t */\n\t\tedit : function (obj, default_text, callback) {\n\t\t\tvar rtl, w, a, s, t, h1, h2, fn, tmp, cancel = false;\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj) { return false; }\n\t\t\tif(!this.check(\"edit\", obj, this.get_parent(obj))) {\n\t\t\t\tthis.settings.core.error.call(this, this._data.core.last_error);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\ttmp = obj;\n\t\t\tdefault_text = typeof default_text === 'string' ? default_text : obj.text;\n\t\t\tthis.set_text(obj, \"\");\n\t\t\tobj = this._open_to(obj);\n\t\t\ttmp.text = default_text;\n\n\t\t\trtl = this._data.core.rtl;\n\t\t\tw = this.element.width();\n\t\t\tthis._data.core.focused = tmp.id;\n\t\t\ta = obj.children('.jstree-anchor').trigger('focus');\n\t\t\ts = $('');\n\t\t\t/*!\n\t\t\toi = obj.children(\"i:visible\"),\n\t\t\tai = a.children(\"i:visible\"),\n\t\t\tw1 = oi.width() * oi.length,\n\t\t\tw2 = ai.width() * ai.length,\n\t\t\t*/\n\t\t\tt = default_text;\n\t\t\th1 = $(\"<\"+\"div>
        \", { css : { \"position\" : \"absolute\", \"top\" : \"-200px\", \"left\" : (rtl ? \"0px\" : \"-1000px\"), \"visibility\" : \"hidden\" } }).appendTo(document.body);\n\t\t\th2 = $(\"<\"+\"input />\", {\n\t\t\t\t\t\t\"value\" : t,\n\t\t\t\t\t\t\"class\" : \"jstree-rename-input\",\n\t\t\t\t\t\t// \"size\" : t.length,\n\t\t\t\t\t\t\"css\" : {\n\t\t\t\t\t\t\t\"padding\" : \"0\",\n\t\t\t\t\t\t\t\"border\" : \"1px solid silver\",\n\t\t\t\t\t\t\t\"box-sizing\" : \"border-box\",\n\t\t\t\t\t\t\t\"display\" : \"inline-block\",\n\t\t\t\t\t\t\t\"height\" : (this._data.core.li_height) + \"px\",\n\t\t\t\t\t\t\t\"lineHeight\" : (this._data.core.li_height) + \"px\",\n\t\t\t\t\t\t\t\"width\" : \"150px\" // will be set a bit further down\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"blur\" : function (e) {\n\t\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tvar i = s.children(\".jstree-rename-input\"),\n\t\t\t\t\t\t\t\tv = i.val(),\n\t\t\t\t\t\t\t\tf = this.settings.core.force_text,\n\t\t\t\t\t\t\t\tnv;\n\t\t\t\t\t\t\tif(v === \"\") { v = t; }\n\t\t\t\t\t\t\th1.remove();\n\t\t\t\t\t\t\ts.replaceWith(a);\n\t\t\t\t\t\t\ts.remove();\n\t\t\t\t\t\t\tt = f ? t : $('
        ').append($.parseHTML(t)).html();\n\t\t\t\t\t\t\tobj = this.get_node(obj);\n\t\t\t\t\t\t\tthis.set_text(obj, t);\n\t\t\t\t\t\t\tnv = !!this.rename_node(obj, f ? $('
        ').text(v).text() : $('
        ').append($.parseHTML(v)).html());\n\t\t\t\t\t\t\tif(!nv) {\n\t\t\t\t\t\t\t\tthis.set_text(obj, t); // move this up? and fix #483\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis._data.core.focused = tmp.id;\n\t\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\t\tvar node = this.get_node(tmp.id, true);\n\t\t\t\t\t\t\t\tif(node.length) {\n\t\t\t\t\t\t\t\t\tthis._data.core.focused = tmp.id;\n\t\t\t\t\t\t\t\t\tnode.children('.jstree-anchor').trigger('focus');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}.bind(this), 0);\n\t\t\t\t\t\t\tif(callback) {\n\t\t\t\t\t\t\t\tcallback.call(this, tmp, nv, cancel, v);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\th2 = null;\n\t\t\t\t\t\t}.bind(this),\n\t\t\t\t\t\t\"keydown\" : function (e) {\n\t\t\t\t\t\t\tvar key = e.which;\n\t\t\t\t\t\t\tif(key === 27) {\n\t\t\t\t\t\t\t\tcancel = true;\n\t\t\t\t\t\t\t\tthis.value = t;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) {\n\t\t\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(key === 27 || key === 13) {\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tthis.blur();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"click\" : function (e) { e.stopImmediatePropagation(); },\n\t\t\t\t\t\t\"mousedown\" : function (e) { e.stopImmediatePropagation(); },\n\t\t\t\t\t\t\"keyup\" : function (e) {\n\t\t\t\t\t\t\th2.width(Math.min(h1.text(\"pW\" + this.value).width(),w));\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"keypress\" : function(e) {\n\t\t\t\t\t\t\tif(e.which === 13) { return false; }\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\tfn = {\n\t\t\t\t\t\tfontFamily\t\t: a.css('fontFamily')\t\t|| '',\n\t\t\t\t\t\tfontSize\t\t: a.css('fontSize')\t\t\t|| '',\n\t\t\t\t\t\tfontWeight\t\t: a.css('fontWeight')\t\t|| '',\n\t\t\t\t\t\tfontStyle\t\t: a.css('fontStyle')\t\t|| '',\n\t\t\t\t\t\tfontStretch\t\t: a.css('fontStretch')\t\t|| '',\n\t\t\t\t\t\tfontVariant\t\t: a.css('fontVariant')\t\t|| '',\n\t\t\t\t\t\tletterSpacing\t: a.css('letterSpacing')\t|| '',\n\t\t\t\t\t\twordSpacing\t\t: a.css('wordSpacing')\t\t|| ''\n\t\t\t\t};\n\t\t\ts.attr('class', a.attr('class')).append(a.contents().clone()).append(h2);\n\t\t\ta.replaceWith(s);\n\t\t\th1.css(fn);\n\t\t\th2.css(fn).width(Math.min(h1.text(\"pW\" + h2[0].value).width(),w))[0].select();\n\t\t\t$(document).one('mousedown.jstree touchstart.jstree dnd_start.vakata', function (e) {\n\t\t\t\tif (h2 && e.target !== h2) {\n\t\t\t\t\t$(h2).trigger('blur');\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\n\t\t/**\n\t\t * changes the theme\n\t\t * @name set_theme(theme_name [, theme_url])\n\t\t * @param {String} theme_name the name of the new theme to apply\n\t\t * @param {mixed} theme_url the location of the CSS file for this theme. Omit or set to `false` if you manually included the file. Set to `true` to autoload from the `core.themes.dir` directory.\n\t\t * @trigger set_theme.jstree\n\t\t */\n\t\tset_theme : function (theme_name, theme_url) {\n\t\t\tif(!theme_name) { return false; }\n\t\t\tif(theme_url === true) {\n\t\t\t\tvar dir = this.settings.core.themes.dir;\n\t\t\t\tif(!dir) { dir = $.jstree.path + '/themes'; }\n\t\t\t\ttheme_url = dir + '/' + theme_name + '/style.css';\n\t\t\t}\n\t\t\tif(theme_url && $.inArray(theme_url, themes_loaded) === -1) {\n\t\t\t\t$('head').append('<'+'link rel=\"stylesheet\" href=\"' + theme_url + '\" type=\"text/css\" />');\n\t\t\t\tthemes_loaded.push(theme_url);\n\t\t\t}\n\t\t\tif(this._data.core.themes.name) {\n\t\t\t\tthis.element.removeClass('jstree-' + this._data.core.themes.name);\n\t\t\t}\n\t\t\tthis._data.core.themes.name = theme_name;\n\t\t\tthis.element.addClass('jstree-' + theme_name);\n\t\t\tthis.element[this.settings.core.themes.responsive ? 'addClass' : 'removeClass' ]('jstree-' + theme_name + '-responsive');\n\t\t\t/**\n\t\t\t * triggered when a theme is set\n\t\t\t * @event\n\t\t\t * @name set_theme.jstree\n\t\t\t * @param {String} theme the new theme\n\t\t\t */\n\t\t\tthis.trigger('set_theme', { 'theme' : theme_name });\n\t\t},\n\t\t/**\n\t\t * gets the name of the currently applied theme name\n\t\t * @name get_theme()\n\t\t * @return {String}\n\t\t */\n\t\tget_theme : function () { return this._data.core.themes.name; },\n\t\t/**\n\t\t * changes the theme variant (if the theme has variants)\n\t\t * @name set_theme_variant(variant_name)\n\t\t * @param {String|Boolean} variant_name the variant to apply (if `false` is used the current variant is removed)\n\t\t */\n\t\tset_theme_variant : function (variant_name) {\n\t\t\tif(this._data.core.themes.variant) {\n\t\t\t\tthis.element.removeClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant);\n\t\t\t}\n\t\t\tthis._data.core.themes.variant = variant_name;\n\t\t\tif(variant_name) {\n\t\t\t\tthis.element.addClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant);\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * gets the name of the currently applied theme variant\n\t\t * @name get_theme()\n\t\t * @return {String}\n\t\t */\n\t\tget_theme_variant : function () { return this._data.core.themes.variant; },\n\t\t/**\n\t\t * shows a striped background on the container (if the theme supports it)\n\t\t * @name show_stripes()\n\t\t */\n\t\tshow_stripes : function () {\n\t\t\tthis._data.core.themes.stripes = true;\n\t\t\tthis.get_container_ul().addClass(\"jstree-striped\");\n\t\t\t/**\n\t\t\t * triggered when stripes are shown\n\t\t\t * @event\n\t\t\t * @name show_stripes.jstree\n\t\t\t */\n\t\t\tthis.trigger('show_stripes');\n\t\t},\n\t\t/**\n\t\t * hides the striped background on the container\n\t\t * @name hide_stripes()\n\t\t */\n\t\thide_stripes : function () {\n\t\t\tthis._data.core.themes.stripes = false;\n\t\t\tthis.get_container_ul().removeClass(\"jstree-striped\");\n\t\t\t/**\n\t\t\t * triggered when stripes are hidden\n\t\t\t * @event\n\t\t\t * @name hide_stripes.jstree\n\t\t\t */\n\t\t\tthis.trigger('hide_stripes');\n\t\t},\n\t\t/**\n\t\t * toggles the striped background on the container\n\t\t * @name toggle_stripes()\n\t\t */\n\t\ttoggle_stripes : function () { if(this._data.core.themes.stripes) { this.hide_stripes(); } else { this.show_stripes(); } },\n\t\t/**\n\t\t * shows the connecting dots (if the theme supports it)\n\t\t * @name show_dots()\n\t\t */\n\t\tshow_dots : function () {\n\t\t\tthis._data.core.themes.dots = true;\n\t\t\tthis.get_container_ul().removeClass(\"jstree-no-dots\");\n\t\t\t/**\n\t\t\t * triggered when dots are shown\n\t\t\t * @event\n\t\t\t * @name show_dots.jstree\n\t\t\t */\n\t\t\tthis.trigger('show_dots');\n\t\t},\n\t\t/**\n\t\t * hides the connecting dots\n\t\t * @name hide_dots()\n\t\t */\n\t\thide_dots : function () {\n\t\t\tthis._data.core.themes.dots = false;\n\t\t\tthis.get_container_ul().addClass(\"jstree-no-dots\");\n\t\t\t/**\n\t\t\t * triggered when dots are hidden\n\t\t\t * @event\n\t\t\t * @name hide_dots.jstree\n\t\t\t */\n\t\t\tthis.trigger('hide_dots');\n\t\t},\n\t\t/**\n\t\t * toggles the connecting dots\n\t\t * @name toggle_dots()\n\t\t */\n\t\ttoggle_dots : function () { if(this._data.core.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },\n\t\t/**\n\t\t * show the node icons\n\t\t * @name show_icons()\n\t\t */\n\t\tshow_icons : function () {\n\t\t\tthis._data.core.themes.icons = true;\n\t\t\tthis.get_container_ul().removeClass(\"jstree-no-icons\");\n\t\t\t/**\n\t\t\t * triggered when icons are shown\n\t\t\t * @event\n\t\t\t * @name show_icons.jstree\n\t\t\t */\n\t\t\tthis.trigger('show_icons');\n\t\t},\n\t\t/**\n\t\t * hide the node icons\n\t\t * @name hide_icons()\n\t\t */\n\t\thide_icons : function () {\n\t\t\tthis._data.core.themes.icons = false;\n\t\t\tthis.get_container_ul().addClass(\"jstree-no-icons\");\n\t\t\t/**\n\t\t\t * triggered when icons are hidden\n\t\t\t * @event\n\t\t\t * @name hide_icons.jstree\n\t\t\t */\n\t\t\tthis.trigger('hide_icons');\n\t\t},\n\t\t/**\n\t\t * toggle the node icons\n\t\t * @name toggle_icons()\n\t\t */\n\t\ttoggle_icons : function () { if(this._data.core.themes.icons) { this.hide_icons(); } else { this.show_icons(); } },\n\t\t/**\n\t\t * show the node ellipsis\n\t\t * @name show_icons()\n\t\t */\n\t\tshow_ellipsis : function () {\n\t\t\tthis._data.core.themes.ellipsis = true;\n\t\t\tthis.get_container_ul().addClass(\"jstree-ellipsis\");\n\t\t\t/**\n\t\t\t * triggered when ellisis is shown\n\t\t\t * @event\n\t\t\t * @name show_ellipsis.jstree\n\t\t\t */\n\t\t\tthis.trigger('show_ellipsis');\n\t\t},\n\t\t/**\n\t\t * hide the node ellipsis\n\t\t * @name hide_ellipsis()\n\t\t */\n\t\thide_ellipsis : function () {\n\t\t\tthis._data.core.themes.ellipsis = false;\n\t\t\tthis.get_container_ul().removeClass(\"jstree-ellipsis\");\n\t\t\t/**\n\t\t\t * triggered when ellisis is hidden\n\t\t\t * @event\n\t\t\t * @name hide_ellipsis.jstree\n\t\t\t */\n\t\t\tthis.trigger('hide_ellipsis');\n\t\t},\n\t\t/**\n\t\t * toggle the node ellipsis\n\t\t * @name toggle_icons()\n\t\t */\n\t\ttoggle_ellipsis : function () { if(this._data.core.themes.ellipsis) { this.hide_ellipsis(); } else { this.show_ellipsis(); } },\n\t\t/**\n\t\t * set the node icon for a node\n\t\t * @name set_icon(obj, icon)\n\t\t * @param {mixed} obj\n\t\t * @param {String} icon the new icon - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class\n\t\t */\n\t\tset_icon : function (obj, icon) {\n\t\t\tvar t1, t2, dom, old;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.set_icon(obj[t1], icon);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) { return false; }\n\t\t\told = obj.icon;\n\t\t\tobj.icon = icon === true || icon === null || icon === undefined || icon === '' ? true : icon;\n\t\t\tdom = this.get_node(obj, true).children(\".jstree-anchor\").children(\".jstree-themeicon\");\n\t\t\tif(icon === false) {\n\t\t\t\tdom.removeClass('jstree-themeicon-custom ' + old).css(\"background\",\"\").removeAttr(\"rel\");\n\t\t\t\tthis.hide_icon(obj);\n\t\t\t}\n\t\t\telse if(icon === true || icon === null || icon === undefined || icon === '') {\n\t\t\t\tdom.removeClass('jstree-themeicon-custom ' + old).css(\"background\",\"\").removeAttr(\"rel\");\n\t\t\t\tif(old === false) { this.show_icon(obj); }\n\t\t\t}\n\t\t\telse if(icon.indexOf(\"/\") === -1 && icon.indexOf(\".\") === -1) {\n\t\t\t\tdom.removeClass(old).css(\"background\",\"\");\n\t\t\t\tdom.addClass(icon + ' jstree-themeicon-custom').attr(\"rel\",icon);\n\t\t\t\tif(old === false) { this.show_icon(obj); }\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdom.removeClass(old).css(\"background\",\"\");\n\t\t\t\tdom.addClass('jstree-themeicon-custom').css(\"background\", \"url('\" + icon + \"') center center no-repeat\").attr(\"rel\",icon);\n\t\t\t\tif(old === false) { this.show_icon(obj); }\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\t\t/**\n\t\t * get the node icon for a node\n\t\t * @name get_icon(obj)\n\t\t * @param {mixed} obj\n\t\t * @return {String}\n\t\t */\n\t\tget_icon : function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\treturn (!obj || obj.id === $.jstree.root) ? false : obj.icon;\n\t\t},\n\t\t/**\n\t\t * hide the icon on an individual node\n\t\t * @name hide_icon(obj)\n\t\t * @param {mixed} obj\n\t\t */\n\t\thide_icon : function (obj) {\n\t\t\tvar t1, t2;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.hide_icon(obj[t1]);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj === $.jstree.root) { return false; }\n\t\t\tobj.icon = false;\n\t\t\tthis.get_node(obj, true).children(\".jstree-anchor\").children(\".jstree-themeicon\").addClass('jstree-themeicon-hidden');\n\t\t\treturn true;\n\t\t},\n\t\t/**\n\t\t * show the icon on an individual node\n\t\t * @name show_icon(obj)\n\t\t * @param {mixed} obj\n\t\t */\n\t\tshow_icon : function (obj) {\n\t\t\tvar t1, t2, dom;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.show_icon(obj[t1]);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj === $.jstree.root) { return false; }\n\t\t\tdom = this.get_node(obj, true);\n\t\t\tobj.icon = dom.length ? dom.children(\".jstree-anchor\").children(\".jstree-themeicon\").attr('rel') : true;\n\t\t\tif(!obj.icon) { obj.icon = true; }\n\t\t\tdom.children(\".jstree-anchor\").children(\".jstree-themeicon\").removeClass('jstree-themeicon-hidden');\n\t\t\treturn true;\n\t\t}\n\t};\n\n\t// helpers\n\t$.vakata = {};\n\t// collect attributes\n\t$.vakata.attributes = function(node, with_values) {\n\t\tnode = $(node)[0];\n\t\tvar attr = with_values ? {} : [];\n\t\tif(node && node.attributes) {\n\t\t\t$.each(node.attributes, function (i, v) {\n\t\t\t\tif($.inArray(v.name.toLowerCase(),['style','contenteditable','hasfocus','tabindex']) !== -1) { return; }\n\t\t\t\tif(v.value !== null && $.vakata.trim(v.value) !== '') {\n\t\t\t\t\tif(with_values) { attr[v.name] = v.value; }\n\t\t\t\t\telse { attr.push(v.name); }\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn attr;\n\t};\n\t$.vakata.array_unique = function(array) {\n\t\tvar a = [], i, j, l, o = {};\n\t\tfor(i = 0, l = array.length; i < l; i++) {\n\t\t\tif(o[array[i]] === undefined) {\n\t\t\t\ta.push(array[i]);\n\t\t\t\to[array[i]] = true;\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t};\n\t// remove item from array\n\t$.vakata.array_remove = function(array, from) {\n\t\tarray.splice(from, 1);\n\t\treturn array;\n\t\t//var rest = array.slice((to || from) + 1 || array.length);\n\t\t//array.length = from < 0 ? array.length + from : from;\n\t\t//array.push.apply(array, rest);\n\t\t//return array;\n\t};\n\t// remove item from array\n\t$.vakata.array_remove_item = function(array, item) {\n\t\tvar tmp = $.inArray(item, array);\n\t\treturn tmp !== -1 ? $.vakata.array_remove(array, tmp) : array;\n\t};\n\t$.vakata.array_filter = function(c,a,b,d,e) {\n\t\tif (c.filter) {\n\t\t\treturn c.filter(a, b);\n\t\t}\n\t\td=[];\n\t\tfor (e in c) {\n\t\t\tif (~~e+''===e+'' && e>=0 && a.call(b,c[e],+e,c)) {\n\t\t\t\td.push(c[e]);\n\t\t\t}\n\t\t}\n\t\treturn d;\n\t};\n\t$.vakata.trim = function (text) {\n\t\treturn String.prototype.trim ? \n\t\t\tString.prototype.trim.call(text.toString()) :\n\t\t\ttext.toString().replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\t};\n\t$.vakata.is_function = function(obj) {\n\t\treturn typeof obj === \"function\" && typeof obj.nodeType !== \"number\";\n\t};\n\t$.vakata.is_array = Array.isArray || function (obj) {\n\t\treturn Object.prototype.toString.call(obj) === \"[object Array]\";\n\t};\n\n\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Function/bind#polyfill\n\tif (!Function.prototype.bind) {\n\t\tFunction.prototype.bind = function () {\n\t\t\tvar thatFunc = this, thatArg = arguments[0];\n\t\t\tvar args = Array.prototype.slice.call(arguments, 1);\n\t\t\tif (typeof thatFunc !== 'function') {\n\t\t\t\t// closest thing possible to the ECMAScript 5\n\t\t\t\t// internal IsCallable function\n\t\t\t\tthrow new TypeError('Function.prototype.bind - what is trying to be bound is not callable');\n\t\t\t}\n\t\t\treturn function(){\n\t\t\t\tvar funcArgs = args.concat(Array.prototype.slice.call(arguments));\n\t\t\t\treturn thatFunc.apply(thatArg, funcArgs);\n\t\t\t};\n\t\t};\n\t}\n\n\n/**\n * ### Changed plugin\n *\n * This plugin adds more information to the `changed.jstree` event. The new data is contained in the `changed` event data property, and contains a lists of `selected` and `deselected` nodes.\n */\n\n\t$.jstree.plugins.changed = function (options, parent) {\n\t\tvar last = [];\n\t\tthis.trigger = function (ev, data) {\n\t\t\tvar i, j;\n\t\t\tif(!data) {\n\t\t\t\tdata = {};\n\t\t\t}\n\t\t\tif(ev.replace('.jstree','') === 'changed') {\n\t\t\t\tdata.changed = { selected : [], deselected : [] };\n\t\t\t\tvar tmp = {};\n\t\t\t\tfor(i = 0, j = last.length; i < j; i++) {\n\t\t\t\t\ttmp[last[i]] = 1;\n\t\t\t\t}\n\t\t\t\tfor(i = 0, j = data.selected.length; i < j; i++) {\n\t\t\t\t\tif(!tmp[data.selected[i]]) {\n\t\t\t\t\t\tdata.changed.selected.push(data.selected[i]);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\ttmp[data.selected[i]] = 2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(i = 0, j = last.length; i < j; i++) {\n\t\t\t\t\tif(tmp[last[i]] === 1) {\n\t\t\t\t\t\tdata.changed.deselected.push(last[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlast = data.selected.slice();\n\t\t\t}\n\t\t\t/**\n\t\t\t * triggered when selection changes (the \"changed\" plugin enhances the original event with more data)\n\t\t\t * @event\n\t\t\t * @name changed.jstree\n\t\t\t * @param {Object} node\n\t\t\t * @param {Object} action the action that caused the selection to change\n\t\t\t * @param {Array} selected the current selection\n\t\t\t * @param {Object} changed an object containing two properties `selected` and `deselected` - both arrays of node IDs, which were selected or deselected since the last changed event\n\t\t\t * @param {Object} event the event (if any) that triggered this changed event\n\t\t\t * @plugin changed\n\t\t\t */\n\t\t\tparent.trigger.call(this, ev, data);\n\t\t};\n\t\tthis.refresh = function (skip_loading, forget_state) {\n\t\t\tlast = [];\n\t\t\treturn parent.refresh.apply(this, arguments);\n\t\t};\n\t};\n\n/**\n * ### Checkbox plugin\n *\n * This plugin renders checkbox icons in front of each node, making multiple selection much easier.\n * It also supports tri-state behavior, meaning that if a node has a few of its children checked it will be rendered as undetermined, and state will be propagated up.\n */\n\n\tvar _i = document.createElement('I');\n\t_i.className = 'jstree-icon jstree-checkbox';\n\t_i.setAttribute('role', 'presentation');\n\t/**\n\t * stores all defaults for the checkbox plugin\n\t * @name $.jstree.defaults.checkbox\n\t * @plugin checkbox\n\t */\n\t$.jstree.defaults.checkbox = {\n\t\t/**\n\t\t * a boolean indicating if checkboxes should be visible (can be changed at a later time using `show_checkboxes()` and `hide_checkboxes`). Defaults to `true`.\n\t\t * @name $.jstree.defaults.checkbox.visible\n\t\t * @plugin checkbox\n\t\t */\n\t\tvisible\t\t\t\t: true,\n\t\t/**\n\t\t * a boolean indicating if checkboxes should cascade down and have an undetermined state. Defaults to `true`.\n\t\t * @name $.jstree.defaults.checkbox.three_state\n\t\t * @plugin checkbox\n\t\t */\n\t\tthree_state\t\t\t: true,\n\t\t/**\n\t\t * a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`.\n\t\t * @name $.jstree.defaults.checkbox.whole_node\n\t\t * @plugin checkbox\n\t\t */\n\t\twhole_node\t\t\t: true,\n\t\t/**\n\t\t * a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`.\n\t\t * @name $.jstree.defaults.checkbox.keep_selected_style\n\t\t * @plugin checkbox\n\t\t */\n\t\tkeep_selected_style\t: true,\n\t\t/**\n\t\t * This setting controls how cascading and undetermined nodes are applied.\n\t\t * If 'up' is in the string - cascading up is enabled, if 'down' is in the string - cascading down is enabled, if 'undetermined' is in the string - undetermined nodes will be used.\n\t\t * If `three_state` is set to `true` this setting is automatically set to 'up+down+undetermined'. Defaults to ''.\n\t\t * @name $.jstree.defaults.checkbox.cascade\n\t\t * @plugin checkbox\n\t\t */\n\t\tcascade\t\t\t\t: '',\n\t\t/**\n\t\t * This setting controls if checkbox are bound to the general tree selection or to an internal array maintained by the checkbox plugin. Defaults to `true`, only set to `false` if you know exactly what you are doing.\n\t\t * @name $.jstree.defaults.checkbox.tie_selection\n\t\t * @plugin checkbox\n\t\t */\n\t\ttie_selection\t\t: true,\n\n\t\t/**\n\t\t * This setting controls if cascading down affects disabled checkboxes\n\t\t * @name $.jstree.defaults.checkbox.cascade_to_disabled\n\t\t * @plugin checkbox\n\t\t */\n\t\tcascade_to_disabled : true,\n\n\t\t/**\n\t\t * This setting controls if cascading down affects hidden checkboxes\n\t\t * @name $.jstree.defaults.checkbox.cascade_to_hidden\n\t\t * @plugin checkbox\n\t\t */\n\t\tcascade_to_hidden : true\n\t};\n\t$.jstree.plugins.checkbox = function (options, parent) {\n\t\tthis.bind = function () {\n\t\t\tparent.bind.call(this);\n\t\t\tthis._data.checkbox.uto = false;\n\t\t\tthis._data.checkbox.selected = [];\n\t\t\tif(this.settings.checkbox.three_state) {\n\t\t\t\tthis.settings.checkbox.cascade = 'up+down+undetermined';\n\t\t\t}\n\t\t\tthis.element\n\t\t\t\t.on(\"init.jstree\", function () {\n\t\t\t\t\t\tthis._data.checkbox.visible = this.settings.checkbox.visible;\n\t\t\t\t\t\tif(!this.settings.checkbox.keep_selected_style) {\n\t\t\t\t\t\t\tthis.element.addClass('jstree-checkbox-no-clicked');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(this.settings.checkbox.tie_selection) {\n\t\t\t\t\t\t\tthis.element.addClass('jstree-checkbox-selection');\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"loading.jstree\", function () {\n\t\t\t\t\t\tthis[ this._data.checkbox.visible ? 'show_checkboxes' : 'hide_checkboxes' ]();\n\t\t\t\t\t}.bind(this));\n\t\t\tif(this.settings.checkbox.cascade.indexOf('undetermined') !== -1) {\n\t\t\t\tthis.element\n\t\t\t\t\t.on('changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree', function () {\n\t\t\t\t\t\t\t// only if undetermined is in setting\n\t\t\t\t\t\t\tif(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); }\n\t\t\t\t\t\t\tthis._data.checkbox.uto = setTimeout(this._undetermined.bind(this), 50);\n\t\t\t\t\t\t}.bind(this));\n\t\t\t}\n\t\t\tif(!this.settings.checkbox.tie_selection) {\n\t\t\t\tthis.element\n\t\t\t\t\t.on('model.jstree', function (e, data) {\n\t\t\t\t\t\tvar m = this._model.data,\n\t\t\t\t\t\t\tp = m[data.parent],\n\t\t\t\t\t\t\tdpc = data.nodes,\n\t\t\t\t\t\t\ti, j;\n\t\t\t\t\t\tfor(i = 0, j = dpc.length; i < j; i++) {\n\t\t\t\t\t\t\tm[dpc[i]].state.checked = m[dpc[i]].state.checked || (m[dpc[i]].original && m[dpc[i]].original.state && m[dpc[i]].original.state.checked);\n\t\t\t\t\t\t\tif(m[dpc[i]].state.checked) {\n\t\t\t\t\t\t\t\tthis._data.checkbox.selected.push(dpc[i]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this));\n\t\t\t}\n\t\t\tif(this.settings.checkbox.cascade.indexOf('up') !== -1 || this.settings.checkbox.cascade.indexOf('down') !== -1) {\n\t\t\t\tthis.element\n\t\t\t\t\t.on('model.jstree', function (e, data) {\n\t\t\t\t\t\t\tvar m = this._model.data,\n\t\t\t\t\t\t\t\tp = m[data.parent],\n\t\t\t\t\t\t\t\tdpc = data.nodes,\n\t\t\t\t\t\t\t\tchd = [],\n\t\t\t\t\t\t\t\tc, i, j, k, l, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection;\n\n\t\t\t\t\t\t\tif(s.indexOf('down') !== -1) {\n\t\t\t\t\t\t\t\t// apply down\n\t\t\t\t\t\t\t\tif(p.state[ t ? 'selected' : 'checked' ]) {\n\t\t\t\t\t\t\t\t\tfor(i = 0, j = dpc.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\t\tm[dpc[i]].state[ t ? 'selected' : 'checked' ] = true;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tthis._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(dpc);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tfor(i = 0, j = dpc.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\t\tif(m[dpc[i]].state[ t ? 'selected' : 'checked' ]) {\n\t\t\t\t\t\t\t\t\t\t\tfor(k = 0, l = m[dpc[i]].children_d.length; k < l; k++) {\n\t\t\t\t\t\t\t\t\t\t\t\tm[m[dpc[i]].children_d[k]].state[ t ? 'selected' : 'checked' ] = true;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tthis._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(m[dpc[i]].children_d);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif(s.indexOf('up') !== -1) {\n\t\t\t\t\t\t\t\t// apply up\n\t\t\t\t\t\t\t\tfor(i = 0, j = p.children_d.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\tif(!m[p.children_d[i]].children.length) {\n\t\t\t\t\t\t\t\t\t\tchd.push(m[p.children_d[i]].parent);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchd = $.vakata.array_unique(chd);\n\t\t\t\t\t\t\t\tfor(k = 0, l = chd.length; k < l; k++) {\n\t\t\t\t\t\t\t\t\tp = m[chd[k]];\n\t\t\t\t\t\t\t\t\twhile(p && p.id !== $.jstree.root) {\n\t\t\t\t\t\t\t\t\t\tc = 0;\n\t\t\t\t\t\t\t\t\t\tfor(i = 0, j = p.children.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\t\t\tc += m[p.children[i]].state[ t ? 'selected' : 'checked' ];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif(c === j) {\n\t\t\t\t\t\t\t\t\t\t\tp.state[ t ? 'selected' : 'checked' ] = true;\n\t\t\t\t\t\t\t\t\t\t\tthis._data[ t ? 'core' : 'checkbox' ].selected.push(p.id);\n\t\t\t\t\t\t\t\t\t\t\ttmp = this.get_node(p, true);\n\t\t\t\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\n\t\t\t\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').attr('aria-selected', true).addClass( t ? 'jstree-clicked' : 'jstree-checked');\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tp = this.get_node(p.parent);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tthis._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected);\n\t\t\t\t\t\t}.bind(this))\n\t\t\t\t\t.on(this.settings.checkbox.tie_selection ? 'select_node.jstree' : 'check_node.jstree', function (e, data) {\n\t\t\t\t\t\t\tvar self = this,\n\t\t\t\t\t\t\t\tobj = data.node,\n\t\t\t\t\t\t\t\tm = this._model.data,\n\t\t\t\t\t\t\t\tpar = this.get_node(obj.parent),\n\t\t\t\t\t\t\t\ti, j, c, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection,\n\t\t\t\t\t\t\t\tsel = {}, cur = this._data[ t ? 'core' : 'checkbox' ].selected;\n\n\t\t\t\t\t\t\tfor (i = 0, j = cur.length; i < j; i++) {\n\t\t\t\t\t\t\t\tsel[cur[i]] = true;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// apply down\n\t\t\t\t\t\t\tif(s.indexOf('down') !== -1) {\n\t\t\t\t\t\t\t\t//this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected.concat(obj.children_d));\n\t\t\t\t\t\t\t\tvar selectedIds = this._cascade_new_checked_state(obj.id, true);\n\t\t\t\t\t\t\t\tvar temp = obj.children_d.concat(obj.id);\n\t\t\t\t\t\t\t\tfor (i = 0, j = temp.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\tif (selectedIds.indexOf(temp[i]) > -1) {\n\t\t\t\t\t\t\t\t\t\tsel[temp[i]] = true;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tdelete sel[temp[i]];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// apply up\n\t\t\t\t\t\t\tif(s.indexOf('up') !== -1) {\n\t\t\t\t\t\t\t\twhile(par && par.id !== $.jstree.root) {\n\t\t\t\t\t\t\t\t\tc = 0;\n\t\t\t\t\t\t\t\t\tfor(i = 0, j = par.children.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\t\tc += m[par.children[i]].state[ t ? 'selected' : 'checked' ];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif(c === j) {\n\t\t\t\t\t\t\t\t\t\tpar.state[ t ? 'selected' : 'checked' ] = true;\n\t\t\t\t\t\t\t\t\t\tsel[par.id] = true;\n\t\t\t\t\t\t\t\t\t\t//this._data[ t ? 'core' : 'checkbox' ].selected.push(par.id);\n\t\t\t\t\t\t\t\t\t\ttmp = this.get_node(par, true);\n\t\t\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\n\t\t\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').attr('aria-selected', true).addClass(t ? 'jstree-clicked' : 'jstree-checked');\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tpar = this.get_node(par.parent);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcur = [];\n\t\t\t\t\t\t\tfor (i in sel) {\n\t\t\t\t\t\t\t\tif (sel.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\tcur.push(i);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis._data[ t ? 'core' : 'checkbox' ].selected = cur;\n\t\t\t\t\t\t}.bind(this))\n\t\t\t\t\t.on(this.settings.checkbox.tie_selection ? 'deselect_all.jstree' : 'uncheck_all.jstree', function (e, data) {\n\t\t\t\t\t\t\tvar obj = this.get_node($.jstree.root),\n\t\t\t\t\t\t\t\tm = this._model.data,\n\t\t\t\t\t\t\t\ti, j, tmp;\n\t\t\t\t\t\t\tfor(i = 0, j = obj.children_d.length; i < j; i++) {\n\t\t\t\t\t\t\t\ttmp = m[obj.children_d[i]];\n\t\t\t\t\t\t\t\tif(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) {\n\t\t\t\t\t\t\t\t\ttmp.original.state.undetermined = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}.bind(this))\n\t\t\t\t\t.on(this.settings.checkbox.tie_selection ? 'deselect_node.jstree' : 'uncheck_node.jstree', function (e, data) {\n\t\t\t\t\t\t\tvar self = this,\n\t\t\t\t\t\t\t\tobj = data.node,\n\t\t\t\t\t\t\t\tdom = this.get_node(obj, true),\n\t\t\t\t\t\t\t\ti, j, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection,\n\t\t\t\t\t\t\t\tcur = this._data[ t ? 'core' : 'checkbox' ].selected, sel = {},\n\t\t\t\t\t\t\t\tstillSelectedIds = [],\n\t\t\t\t\t\t\t\tallIds = obj.children_d.concat(obj.id);\n\n\t\t\t\t\t\t\t// apply down\n\t\t\t\t\t\t\tif(s.indexOf('down') !== -1) {\n\t\t\t\t\t\t\t\tvar selectedIds = this._cascade_new_checked_state(obj.id, false);\n\n\t\t\t\t\t\t\t\tcur = $.vakata.array_filter(cur, function(id) {\n\t\t\t\t\t\t\t\t\treturn allIds.indexOf(id) === -1 || selectedIds.indexOf(id) > -1;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// only apply up if cascade up is enabled and if this node is not selected\n\t\t\t\t\t\t\t// (if all child nodes are disabled and cascade_to_disabled === false then this node will till be selected).\n\t\t\t\t\t\t\tif(s.indexOf('up') !== -1 && cur.indexOf(obj.id) === -1) {\n\t\t\t\t\t\t\t\tfor(i = 0, j = obj.parents.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\ttmp = this._model.data[obj.parents[i]];\n\t\t\t\t\t\t\t\t\ttmp.state[ t ? 'selected' : 'checked' ] = false;\n\t\t\t\t\t\t\t\t\tif(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) {\n\t\t\t\t\t\t\t\t\t\ttmp.original.state.undetermined = false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\ttmp = this.get_node(obj.parents[i], true);\n\t\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\n\t\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').attr('aria-selected', false).removeClass(t ? 'jstree-clicked' : 'jstree-checked');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tcur = $.vakata.array_filter(cur, function(id) {\n\t\t\t\t\t\t\t\t\treturn obj.parents.indexOf(id) === -1;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tthis._data[ t ? 'core' : 'checkbox' ].selected = cur;\n\t\t\t\t\t\t}.bind(this));\n\t\t\t}\n\t\t\tif(this.settings.checkbox.cascade.indexOf('up') !== -1) {\n\t\t\t\tthis.element\n\t\t\t\t\t.on('delete_node.jstree', function (e, data) {\n\t\t\t\t\t\t\t// apply up (whole handler)\n\t\t\t\t\t\t\tvar p = this.get_node(data.parent),\n\t\t\t\t\t\t\t\tm = this._model.data,\n\t\t\t\t\t\t\t\ti, j, c, tmp, t = this.settings.checkbox.tie_selection;\n\t\t\t\t\t\t\twhile(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) {\n\t\t\t\t\t\t\t\tc = 0;\n\t\t\t\t\t\t\t\tfor(i = 0, j = p.children.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\tc += m[p.children[i]].state[ t ? 'selected' : 'checked' ];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(j > 0 && c === j) {\n\t\t\t\t\t\t\t\t\tp.state[ t ? 'selected' : 'checked' ] = true;\n\t\t\t\t\t\t\t\t\tthis._data[ t ? 'core' : 'checkbox' ].selected.push(p.id);\n\t\t\t\t\t\t\t\t\ttmp = this.get_node(p, true);\n\t\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\n\t\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').attr('aria-selected', true).addClass(t ? 'jstree-clicked' : 'jstree-checked');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tp = this.get_node(p.parent);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}.bind(this))\n\t\t\t\t\t.on('move_node.jstree', function (e, data) {\n\t\t\t\t\t\t\t// apply up (whole handler)\n\t\t\t\t\t\t\tvar is_multi = data.is_multi,\n\t\t\t\t\t\t\t\told_par = data.old_parent,\n\t\t\t\t\t\t\t\tnew_par = this.get_node(data.parent),\n\t\t\t\t\t\t\t\tm = this._model.data,\n\t\t\t\t\t\t\t\tp, c, i, j, tmp, t = this.settings.checkbox.tie_selection;\n\t\t\t\t\t\t\tif(!is_multi) {\n\t\t\t\t\t\t\t\tp = this.get_node(old_par);\n\t\t\t\t\t\t\t\twhile(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) {\n\t\t\t\t\t\t\t\t\tc = 0;\n\t\t\t\t\t\t\t\t\tfor(i = 0, j = p.children.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\t\tc += m[p.children[i]].state[ t ? 'selected' : 'checked' ];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif(j > 0 && c === j) {\n\t\t\t\t\t\t\t\t\t\tp.state[ t ? 'selected' : 'checked' ] = true;\n\t\t\t\t\t\t\t\t\t\tthis._data[ t ? 'core' : 'checkbox' ].selected.push(p.id);\n\t\t\t\t\t\t\t\t\t\ttmp = this.get_node(p, true);\n\t\t\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\n\t\t\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').attr('aria-selected', true).addClass(t ? 'jstree-clicked' : 'jstree-checked');\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tp = this.get_node(p.parent);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tp = new_par;\n\t\t\t\t\t\t\twhile(p && p.id !== $.jstree.root) {\n\t\t\t\t\t\t\t\tc = 0;\n\t\t\t\t\t\t\t\tfor(i = 0, j = p.children.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\tc += m[p.children[i]].state[ t ? 'selected' : 'checked' ];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(c === j) {\n\t\t\t\t\t\t\t\t\tif(!p.state[ t ? 'selected' : 'checked' ]) {\n\t\t\t\t\t\t\t\t\t\tp.state[ t ? 'selected' : 'checked' ] = true;\n\t\t\t\t\t\t\t\t\t\tthis._data[ t ? 'core' : 'checkbox' ].selected.push(p.id);\n\t\t\t\t\t\t\t\t\t\ttmp = this.get_node(p, true);\n\t\t\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\n\t\t\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').attr('aria-selected', true).addClass(t ? 'jstree-clicked' : 'jstree-checked');\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tif(p.state[ t ? 'selected' : 'checked' ]) {\n\t\t\t\t\t\t\t\t\t\tp.state[ t ? 'selected' : 'checked' ] = false;\n\t\t\t\t\t\t\t\t\t\tthis._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_remove_item(this._data[ t ? 'core' : 'checkbox' ].selected, p.id);\n\t\t\t\t\t\t\t\t\t\ttmp = this.get_node(p, true);\n\t\t\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\n\t\t\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').attr('aria-selected', false).removeClass(t ? 'jstree-clicked' : 'jstree-checked');\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tp = this.get_node(p.parent);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}.bind(this));\n\t\t\t}\n\t\t};\n\t\t/**\n\t\t * get an array of all nodes whose state is \"undetermined\"\n\t\t * @name get_undetermined([full])\n\t\t * @param {boolean} full: if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned\n\t\t * @return {Array}\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.get_undetermined = function (full) {\n\t\t\tif (this.settings.checkbox.cascade.indexOf('undetermined') === -1) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tvar i, j, k, l, o = {}, m = this._model.data, t = this.settings.checkbox.tie_selection, s = this._data[ t ? 'core' : 'checkbox' ].selected, p = [], tt = this, r = [];\n\t\t\tfor(i = 0, j = s.length; i < j; i++) {\n\t\t\t\tif(m[s[i]] && m[s[i]].parents) {\n\t\t\t\t\tfor(k = 0, l = m[s[i]].parents.length; k < l; k++) {\n\t\t\t\t\t\tif(o[m[s[i]].parents[k]] !== undefined) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(m[s[i]].parents[k] !== $.jstree.root) {\n\t\t\t\t\t\t\to[m[s[i]].parents[k]] = true;\n\t\t\t\t\t\t\tp.push(m[s[i]].parents[k]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// attempt for server side undetermined state\n\t\t\tthis.element.find('.jstree-closed').not(':has(.jstree-children)')\n\t\t\t\t.each(function () {\n\t\t\t\t\tvar tmp = tt.get_node(this), tmp2;\n\t\t\t\t\t\n\t\t\t\t\tif(!tmp) { return; }\n\t\t\t\t\t\n\t\t\t\t\tif(!tmp.state.loaded) {\n\t\t\t\t\t\tif(tmp.original && tmp.original.state && tmp.original.state.undetermined && tmp.original.state.undetermined === true) {\n\t\t\t\t\t\t\tif(o[tmp.id] === undefined && tmp.id !== $.jstree.root) {\n\t\t\t\t\t\t\t\to[tmp.id] = true;\n\t\t\t\t\t\t\t\tp.push(tmp.id);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfor(k = 0, l = tmp.parents.length; k < l; k++) {\n\t\t\t\t\t\t\t\tif(o[tmp.parents[k]] === undefined && tmp.parents[k] !== $.jstree.root) {\n\t\t\t\t\t\t\t\t\to[tmp.parents[k]] = true;\n\t\t\t\t\t\t\t\t\tp.push(tmp.parents[k]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tfor(i = 0, j = tmp.children_d.length; i < j; i++) {\n\t\t\t\t\t\t\ttmp2 = m[tmp.children_d[i]];\n\t\t\t\t\t\t\tif(!tmp2.state.loaded && tmp2.original && tmp2.original.state && tmp2.original.state.undetermined && tmp2.original.state.undetermined === true) {\n\t\t\t\t\t\t\t\tif(o[tmp2.id] === undefined && tmp2.id !== $.jstree.root) {\n\t\t\t\t\t\t\t\t\to[tmp2.id] = true;\n\t\t\t\t\t\t\t\t\tp.push(tmp2.id);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfor(k = 0, l = tmp2.parents.length; k < l; k++) {\n\t\t\t\t\t\t\t\t\tif(o[tmp2.parents[k]] === undefined && tmp2.parents[k] !== $.jstree.root) {\n\t\t\t\t\t\t\t\t\t\to[tmp2.parents[k]] = true;\n\t\t\t\t\t\t\t\t\t\tp.push(tmp2.parents[k]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\tfor (i = 0, j = p.length; i < j; i++) {\n\t\t\t\tif(!m[p[i]].state[ t ? 'selected' : 'checked' ]) {\n\t\t\t\t\tr.push(full ? m[p[i]] : p[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn r;\n\t\t};\n\t\t/**\n\t\t * set the undetermined state where and if necessary. Used internally.\n\t\t * @private\n\t\t * @name _undetermined()\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis._undetermined = function () {\n\t\t\tif(this.element === null) { return; }\n\t\t\tvar p = this.get_undetermined(false), i, j, s;\n\n\t\t\tthis.element.find('.jstree-undetermined').removeClass('jstree-undetermined');\n\t\t\tfor (i = 0, j = p.length; i < j; i++) {\n\t\t\t\ts = this.get_node(p[i], true);\n\t\t\t\tif(s && s.length) {\n\t\t\t\t\ts.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-undetermined');\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tthis.redraw_node = function(obj, deep, is_callback, force_render) {\n\t\t\tobj = parent.redraw_node.apply(this, arguments);\n\t\t\tif(obj) {\n\t\t\t\tvar i, j, tmp = null, icon = null;\n\t\t\t\tfor(i = 0, j = obj.childNodes.length; i < j; i++) {\n\t\t\t\t\tif(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf(\"jstree-anchor\") !== -1) {\n\t\t\t\t\t\ttmp = obj.childNodes[i];\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(tmp) {\n\t\t\t\t\tif(!this.settings.checkbox.tie_selection && this._model.data[obj.id].state.checked) { tmp.className += ' jstree-checked'; }\n\t\t\t\t\ticon = _i.cloneNode(false);\n\t\t\t\t\tif(this._model.data[obj.id].state.checkbox_disabled) { icon.className += ' jstree-checkbox-disabled'; }\n\t\t\t\t\ttmp.insertBefore(icon, tmp.childNodes[0]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!is_callback && this.settings.checkbox.cascade.indexOf('undetermined') !== -1) {\n\t\t\t\tif(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); }\n\t\t\t\tthis._data.checkbox.uto = setTimeout(this._undetermined.bind(this), 50);\n\t\t\t}\n\t\t\treturn obj;\n\t\t};\n\t\t/**\n\t\t * show the node checkbox icons\n\t\t * @name show_checkboxes()\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.show_checkboxes = function () { this._data.core.themes.checkboxes = true; this.get_container_ul().removeClass(\"jstree-no-checkboxes\"); };\n\t\t/**\n\t\t * hide the node checkbox icons\n\t\t * @name hide_checkboxes()\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.hide_checkboxes = function () { this._data.core.themes.checkboxes = false; this.get_container_ul().addClass(\"jstree-no-checkboxes\"); };\n\t\t/**\n\t\t * toggle the node icons\n\t\t * @name toggle_checkboxes()\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.toggle_checkboxes = function () { if(this._data.core.themes.checkboxes) { this.hide_checkboxes(); } else { this.show_checkboxes(); } };\n\t\t/**\n\t\t * checks if a node is in an undetermined state\n\t\t * @name is_undetermined(obj)\n\t\t * @param {mixed} obj\n\t\t * @return {Boolean}\n\t\t */\n\t\tthis.is_undetermined = function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\tvar s = this.settings.checkbox.cascade, i, j, t = this.settings.checkbox.tie_selection, d = this._data[ t ? 'core' : 'checkbox' ].selected, m = this._model.data;\n\t\t\tif(!obj || obj.state[ t ? 'selected' : 'checked' ] === true || s.indexOf('undetermined') === -1 || (s.indexOf('down') === -1 && s.indexOf('up') === -1)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(!obj.state.loaded && obj.original.state.undetermined === true) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tfor(i = 0, j = obj.children_d.length; i < j; i++) {\n\t\t\t\tif($.inArray(obj.children_d[i], d) !== -1 || (!m[obj.children_d[i]].state.loaded && m[obj.children_d[i]].original.state.undetermined)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\t\t/**\n\t\t * disable a node's checkbox\n\t\t * @name disable_checkbox(obj)\n\t\t * @param {mixed} obj an array can be used too\n\t\t * @trigger disable_checkbox.jstree\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.disable_checkbox = function (obj) {\n\t\t\tvar t1, t2, dom;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.disable_checkbox(obj[t1]);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tdom = this.get_node(obj, true);\n\t\t\tif(!obj.state.checkbox_disabled) {\n\t\t\t\tobj.state.checkbox_disabled = true;\n\t\t\t\tif(dom && dom.length) {\n\t\t\t\t\tdom.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-checkbox-disabled');\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * triggered when an node's checkbox is disabled\n\t\t\t\t * @event\n\t\t\t\t * @name disable_checkbox.jstree\n\t\t\t\t * @param {Object} node\n\t\t\t\t * @plugin checkbox\n\t\t\t\t */\n\t\t\t\tthis.trigger('disable_checkbox', { 'node' : obj });\n\t\t\t}\n\t\t};\n\t\t/**\n\t\t * enable a node's checkbox\n\t\t * @name enable_checkbox(obj)\n\t\t * @param {mixed} obj an array can be used too\n\t\t * @trigger enable_checkbox.jstree\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.enable_checkbox = function (obj) {\n\t\t\tvar t1, t2, dom;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.enable_checkbox(obj[t1]);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tdom = this.get_node(obj, true);\n\t\t\tif(obj.state.checkbox_disabled) {\n\t\t\t\tobj.state.checkbox_disabled = false;\n\t\t\t\tif(dom && dom.length) {\n\t\t\t\t\tdom.children('.jstree-anchor').children('.jstree-checkbox').removeClass('jstree-checkbox-disabled');\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * triggered when an node's checkbox is enabled\n\t\t\t\t * @event\n\t\t\t\t * @name enable_checkbox.jstree\n\t\t\t\t * @param {Object} node\n\t\t\t\t * @plugin checkbox\n\t\t\t\t */\n\t\t\t\tthis.trigger('enable_checkbox', { 'node' : obj });\n\t\t\t}\n\t\t};\n\n\t\tthis.activate_node = function (obj, e) {\n\t\t\tif($(e.target).hasClass('jstree-checkbox-disabled')) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(this.settings.checkbox.tie_selection && (this.settings.checkbox.whole_node || $(e.target).hasClass('jstree-checkbox'))) {\n\t\t\t\te.ctrlKey = true;\n\t\t\t}\n\t\t\tif(this.settings.checkbox.tie_selection || (!this.settings.checkbox.whole_node && !$(e.target).hasClass('jstree-checkbox'))) {\n\t\t\t\treturn parent.activate_node.call(this, obj, e);\n\t\t\t}\n\t\t\tif(this.is_disabled(obj)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(this.is_checked(obj)) {\n\t\t\t\tthis.uncheck_node(obj, e);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.check_node(obj, e);\n\t\t\t}\n\t\t\tthis.trigger('activate_node', { 'node' : this.get_node(obj) });\n\t\t};\n\t\tthis.delete_node = function (obj) {\n\t\t\tif(this.settings.checkbox.tie_selection || $.vakata.is_array(obj)) {\n\t\t\t\treturn parent.delete_node(obj);\n\t\t\t}\n\t\t\tvar tmp, k, l, c = false;\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) { return false; }\n\t\t\ttmp = obj.children_d.concat([]);\n\t\t\ttmp.push(obj.id);\n\t\t\tfor(k = 0, l = tmp.length; k < l; k++) {\n\t\t\t\tif(this._model.data[tmp[k]].state.checked) {\n\t\t\t\t\tc = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (c) {\n\t\t\t\tthis._data.checkbox.selected = $.vakata.array_filter(this._data.checkbox.selected, function (v) {\n\t\t\t\t\treturn $.inArray(v, tmp) === -1;\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn parent.delete_node.call(this, obj);\n\t\t};\n\n\t\t/**\n\t\t * Cascades checked state to a node and all its descendants. This function does NOT affect hidden and disabled nodes (or their descendants).\n\t\t * However if these unaffected nodes are already selected their ids will be included in the returned array.\n\t\t * @private\n\t\t * @name _cascade_new_checked_state(id, checkedState)\n\t\t * @param {string} id the node ID\n\t\t * @param {bool} checkedState should the nodes be checked or not\n\t\t * @returns {Array} Array of all node id's (in this tree branch) that are checked.\n\t\t */\n\t\tthis._cascade_new_checked_state = function (id, checkedState) {\n\t\t\tvar self = this;\n\t\t\tvar t = this.settings.checkbox.tie_selection;\n\t\t\tvar node = this._model.data[id];\n\t\t\tvar selectedNodeIds = [];\n\t\t\tvar selectedChildrenIds = [], i, j, selectedChildIds;\n\n\t\t\tif (\n\t\t\t\t(this.settings.checkbox.cascade_to_disabled || !node.state.disabled) &&\n\t\t\t\t(this.settings.checkbox.cascade_to_hidden || !node.state.hidden)\n\t\t\t) {\n\t\t\t\t//First try and check/uncheck the children\n\t\t\t\tif (node.children) {\n\t\t\t\t\tfor (i = 0, j = node.children.length; i < j; i++) {\n\t\t\t\t\t\tvar childId = node.children[i];\n\t\t\t\t\t\tselectedChildIds = self._cascade_new_checked_state(childId, checkedState);\n\t\t\t\t\t\tselectedNodeIds = selectedNodeIds.concat(selectedChildIds);\n\t\t\t\t\t\tif (selectedChildIds.indexOf(childId) > -1) {\n\t\t\t\t\t\t\tselectedChildrenIds.push(childId);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvar dom = self.get_node(node, true);\n\n\t\t\t\t//A node's state is undetermined if some but not all of it's children are checked/selected .\n\t\t\t\tvar undetermined = selectedChildrenIds.length > 0 && selectedChildrenIds.length < node.children.length;\n\n\t\t\t\tif(node.original && node.original.state && node.original.state.undetermined) {\n\t\t\t\t\tnode.original.state.undetermined = undetermined;\n\t\t\t\t}\n\n\t\t\t\t//If a node is undetermined then remove selected class\n\t\t\t\tif (undetermined) {\n\t\t\t\t\tnode.state[ t ? 'selected' : 'checked' ] = false;\n\t\t\t\t\tdom.children('.jstree-anchor').attr('aria-selected', false).removeClass(t ? 'jstree-clicked' : 'jstree-checked');\n\t\t\t\t}\n\t\t\t\t//Otherwise, if the checkedState === true (i.e. the node is being checked now) and all of the node's children are checked (if it has any children),\n\t\t\t\t//check the node and style it correctly.\n\t\t\t\telse if (checkedState && selectedChildrenIds.length === node.children.length) {\n\t\t\t\t\tnode.state[ t ? 'selected' : 'checked' ] = checkedState;\n\t\t\t\t\tselectedNodeIds.push(node.id);\n\n\t\t\t\t\tdom.children('.jstree-anchor').attr('aria-selected', true).addClass(t ? 'jstree-clicked' : 'jstree-checked');\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnode.state[ t ? 'selected' : 'checked' ] = false;\n\t\t\t\t\tdom.children('.jstree-anchor').attr('aria-selected', false).removeClass(t ? 'jstree-clicked' : 'jstree-checked');\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tselectedChildIds = this.get_checked_descendants(id);\n\n\t\t\t\tif (node.state[ t ? 'selected' : 'checked' ]) {\n\t\t\t\t\tselectedChildIds.push(node.id);\n\t\t\t\t}\n\n\t\t\t\tselectedNodeIds = selectedNodeIds.concat(selectedChildIds);\n\t\t\t}\n\n\t\t\treturn selectedNodeIds;\n\t\t};\n\n\t\t/**\n\t\t * Gets ids of nodes selected in branch (of tree) specified by id (does not include the node specified by id)\n\t\t * @name get_checked_descendants(obj)\n\t\t * @param {string} id the node ID\n\t\t * @return {Array} array of IDs\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.get_checked_descendants = function (id) {\n\t\t\tvar self = this;\n\t\t\tvar t = self.settings.checkbox.tie_selection;\n\t\t\tvar node = self._model.data[id];\n\n\t\t\treturn $.vakata.array_filter(node.children_d, function(_id) {\n\t\t\t\treturn self._model.data[_id].state[ t ? 'selected' : 'checked' ];\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally)\n\t\t * @name check_node(obj)\n\t\t * @param {mixed} obj an array can be used to check multiple nodes\n\t\t * @trigger check_node.jstree\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.check_node = function (obj, e) {\n\t\t\tif(this.settings.checkbox.tie_selection) { return this.select_node(obj, false, true, e); }\n\t\t\tvar dom, t1, t2, th;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.check_node(obj[t1], e);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tdom = this.get_node(obj, true);\n\t\t\tif(!obj.state.checked) {\n\t\t\t\tobj.state.checked = true;\n\t\t\t\tthis._data.checkbox.selected.push(obj.id);\n\t\t\t\tif(dom && dom.length) {\n\t\t\t\t\tdom.children('.jstree-anchor').addClass('jstree-checked');\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * triggered when an node is checked (only if tie_selection in checkbox settings is false)\n\t\t\t\t * @event\n\t\t\t\t * @name check_node.jstree\n\t\t\t\t * @param {Object} node\n\t\t\t\t * @param {Array} selected the current selection\n\t\t\t\t * @param {Object} event the event (if any) that triggered this check_node\n\t\t\t\t * @plugin checkbox\n\t\t\t\t */\n\t\t\t\tthis.trigger('check_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e });\n\t\t\t}\n\t\t};\n\t\t/**\n\t\t * uncheck a node (only if tie_selection in checkbox settings is false, otherwise deselect_node will be called internally)\n\t\t * @name uncheck_node(obj)\n\t\t * @param {mixed} obj an array can be used to uncheck multiple nodes\n\t\t * @trigger uncheck_node.jstree\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.uncheck_node = function (obj, e) {\n\t\t\tif(this.settings.checkbox.tie_selection) { return this.deselect_node(obj, false, e); }\n\t\t\tvar t1, t2, dom;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.uncheck_node(obj[t1], e);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tdom = this.get_node(obj, true);\n\t\t\tif(obj.state.checked) {\n\t\t\t\tobj.state.checked = false;\n\t\t\t\tthis._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, obj.id);\n\t\t\t\tif(dom.length) {\n\t\t\t\t\tdom.children('.jstree-anchor').removeClass('jstree-checked');\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * triggered when an node is unchecked (only if tie_selection in checkbox settings is false)\n\t\t\t\t * @event\n\t\t\t\t * @name uncheck_node.jstree\n\t\t\t\t * @param {Object} node\n\t\t\t\t * @param {Array} selected the current selection\n\t\t\t\t * @param {Object} event the event (if any) that triggered this uncheck_node\n\t\t\t\t * @plugin checkbox\n\t\t\t\t */\n\t\t\t\tthis.trigger('uncheck_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e });\n\t\t\t}\n\t\t};\n\t\t\n\t\t/**\n\t\t * checks all nodes in the tree (only if tie_selection in checkbox settings is false, otherwise select_all will be called internally)\n\t\t * @name check_all()\n\t\t * @trigger check_all.jstree, changed.jstree\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.check_all = function () {\n\t\t\tif(this.settings.checkbox.tie_selection) { return this.select_all(); }\n\t\t\tvar tmp = this._data.checkbox.selected.concat([]), i, j;\n\t\t\tthis._data.checkbox.selected = this._model.data[$.jstree.root].children_d.concat();\n\t\t\tfor(i = 0, j = this._data.checkbox.selected.length; i < j; i++) {\n\t\t\t\tif(this._model.data[this._data.checkbox.selected[i]]) {\n\t\t\t\t\tthis._model.data[this._data.checkbox.selected[i]].state.checked = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.redraw(true);\n\t\t\t/**\n\t\t\t * triggered when all nodes are checked (only if tie_selection in checkbox settings is false)\n\t\t\t * @event\n\t\t\t * @name check_all.jstree\n\t\t\t * @param {Array} selected the current selection\n\t\t\t * @plugin checkbox\n\t\t\t */\n\t\t\tthis.trigger('check_all', { 'selected' : this._data.checkbox.selected });\n\t\t};\n\t\t/**\n\t\t * uncheck all checked nodes (only if tie_selection in checkbox settings is false, otherwise deselect_all will be called internally)\n\t\t * @name uncheck_all()\n\t\t * @trigger uncheck_all.jstree\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.uncheck_all = function () {\n\t\t\tif(this.settings.checkbox.tie_selection) { return this.deselect_all(); }\n\t\t\tvar tmp = this._data.checkbox.selected.concat([]), i, j;\n\t\t\tfor(i = 0, j = this._data.checkbox.selected.length; i < j; i++) {\n\t\t\t\tif(this._model.data[this._data.checkbox.selected[i]]) {\n\t\t\t\t\tthis._model.data[this._data.checkbox.selected[i]].state.checked = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._data.checkbox.selected = [];\n\t\t\tthis.element.find('.jstree-checked').removeClass('jstree-checked');\n\t\t\t/**\n\t\t\t * triggered when all nodes are unchecked (only if tie_selection in checkbox settings is false)\n\t\t\t * @event\n\t\t\t * @name uncheck_all.jstree\n\t\t\t * @param {Object} node the previous selection\n\t\t\t * @param {Array} selected the current selection\n\t\t\t * @plugin checkbox\n\t\t\t */\n\t\t\tthis.trigger('uncheck_all', { 'selected' : this._data.checkbox.selected, 'node' : tmp });\n\t\t};\n\t\t/**\n\t\t * checks if a node is checked (if tie_selection is on in the settings this function will return the same as is_selected)\n\t\t * @name is_checked(obj)\n\t\t * @param {mixed} obj\n\t\t * @return {Boolean}\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.is_checked = function (obj) {\n\t\t\tif(this.settings.checkbox.tie_selection) { return this.is_selected(obj); }\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) { return false; }\n\t\t\treturn obj.state.checked;\n\t\t};\n\t\t/**\n\t\t * get an array of all checked nodes (if tie_selection is on in the settings this function will return the same as get_selected)\n\t\t * @name get_checked([full])\n\t\t * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned\n\t\t * @return {Array}\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.get_checked = function (full) {\n\t\t\tif(this.settings.checkbox.tie_selection) { return this.get_selected(full); }\n\t\t\treturn full ? $.map(this._data.checkbox.selected, function (i) { return this.get_node(i); }.bind(this)) : this._data.checkbox.selected.slice();\n\t\t};\n\t\t/**\n\t\t * get an array of all top level checked nodes (ignoring children of checked nodes) (if tie_selection is on in the settings this function will return the same as get_top_selected)\n\t\t * @name get_top_checked([full])\n\t\t * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned\n\t\t * @return {Array}\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.get_top_checked = function (full) {\n\t\t\tif(this.settings.checkbox.tie_selection) { return this.get_top_selected(full); }\n\t\t\tvar tmp = this.get_checked(true),\n\t\t\t\tobj = {}, i, j, k, l;\n\t\t\tfor(i = 0, j = tmp.length; i < j; i++) {\n\t\t\t\tobj[tmp[i].id] = tmp[i];\n\t\t\t}\n\t\t\tfor(i = 0, j = tmp.length; i < j; i++) {\n\t\t\t\tfor(k = 0, l = tmp[i].children_d.length; k < l; k++) {\n\t\t\t\t\tif(obj[tmp[i].children_d[k]]) {\n\t\t\t\t\t\tdelete obj[tmp[i].children_d[k]];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttmp = [];\n\t\t\tfor(i in obj) {\n\t\t\t\tif(obj.hasOwnProperty(i)) {\n\t\t\t\t\ttmp.push(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn full ? $.map(tmp, function (i) { return this.get_node(i); }.bind(this)) : tmp;\n\t\t};\n\t\t/**\n\t\t * get an array of all bottom level checked nodes (ignoring selected parents) (if tie_selection is on in the settings this function will return the same as get_bottom_selected)\n\t\t * @name get_bottom_checked([full])\n\t\t * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned\n\t\t * @return {Array}\n\t\t * @plugin checkbox\n\t\t */\n\t\tthis.get_bottom_checked = function (full) {\n\t\t\tif(this.settings.checkbox.tie_selection) { return this.get_bottom_selected(full); }\n\t\t\tvar tmp = this.get_checked(true),\n\t\t\t\tobj = [], i, j;\n\t\t\tfor(i = 0, j = tmp.length; i < j; i++) {\n\t\t\t\tif(!tmp[i].children.length) {\n\t\t\t\t\tobj.push(tmp[i].id);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn full ? $.map(obj, function (i) { return this.get_node(i); }.bind(this)) : obj;\n\t\t};\n\t\tthis.load_node = function (obj, callback) {\n\t\t\tvar k, l, i, j, c, tmp;\n\t\t\tif(!$.vakata.is_array(obj) && !this.settings.checkbox.tie_selection) {\n\t\t\t\ttmp = this.get_node(obj);\n\t\t\t\tif(tmp && tmp.state.loaded) {\n\t\t\t\t\tfor(k = 0, l = tmp.children_d.length; k < l; k++) {\n\t\t\t\t\t\tif(this._model.data[tmp.children_d[k]].state.checked) {\n\t\t\t\t\t\t\tc = true;\n\t\t\t\t\t\t\tthis._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, tmp.children_d[k]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn parent.load_node.apply(this, arguments);\n\t\t};\n\t\tthis.get_state = function () {\n\t\t\tvar state = parent.get_state.apply(this, arguments);\n\t\t\tif(this.settings.checkbox.tie_selection) { return state; }\n\t\t\tstate.checkbox = this._data.checkbox.selected.slice();\n\t\t\treturn state;\n\t\t};\n\t\tthis.set_state = function (state, callback) {\n\t\t\tvar res = parent.set_state.apply(this, arguments);\n\t\t\tif(res && state.checkbox) {\n\t\t\t\tif(!this.settings.checkbox.tie_selection) {\n\t\t\t\t\tthis.uncheck_all();\n\t\t\t\t\tvar _this = this;\n\t\t\t\t\t$.each(state.checkbox, function (i, v) {\n\t\t\t\t\t\t_this.check_node(v);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tdelete state.checkbox;\n\t\t\t\tthis.set_state(state, callback);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn res;\n\t\t};\n\t\tthis.refresh = function (skip_loading, forget_state) {\n\t\t\tif(this.settings.checkbox.tie_selection) {\n\t\t\t\tthis._data.checkbox.selected = [];\n\t\t\t}\n\t\t\treturn parent.refresh.apply(this, arguments);\n\t\t};\n\t};\n\n\t// include the checkbox plugin by default\n\t// $.jstree.defaults.plugins.push(\"checkbox\");\n\n\n/**\n * ### Conditionalselect plugin\n *\n * This plugin allows defining a callback to allow or deny node selection by user input (activate node method).\n */\n\n\t/**\n\t * 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`.\n\t * @name $.jstree.defaults.checkbox.visible\n\t * @plugin checkbox\n\t */\n\t$.jstree.defaults.conditionalselect = function () { return true; };\n\t$.jstree.plugins.conditionalselect = function (options, parent) {\n\t\t// own function\n\t\tthis.activate_node = function (obj, e) {\n\t\t\tif(this.settings.conditionalselect.call(this, this.get_node(obj), e)) {\n\t\t\t\treturn parent.activate_node.call(this, obj, e);\n\t\t\t}\n\t\t};\n\t};\n\n\n/**\n * ### Contextmenu plugin\n *\n * Shows a context menu when a node is right-clicked.\n */\n\n\t/**\n\t * stores all defaults for the contextmenu plugin\n\t * @name $.jstree.defaults.contextmenu\n\t * @plugin contextmenu\n\t */\n\t$.jstree.defaults.contextmenu = {\n\t\t/**\n\t\t * a boolean indicating if the node should be selected when the context menu is invoked on it. Defaults to `true`.\n\t\t * @name $.jstree.defaults.contextmenu.select_node\n\t\t * @plugin contextmenu\n\t\t */\n\t\tselect_node : true,\n\t\t/**\n\t\t * a boolean indicating if the menu should be shown aligned with the node. Defaults to `true`, otherwise the mouse coordinates are used.\n\t\t * @name $.jstree.defaults.contextmenu.show_at_node\n\t\t * @plugin contextmenu\n\t\t */\n\t\tshow_at_node : true,\n\t\t/**\n\t\t * an object of actions, or a function that accepts a node and a callback function and calls the callback function with an object of actions available for that node (you can also return the items too).\n\t\t *\n\t\t * Each action consists of a key (a unique name) and a value which is an object with the following properties (only label and action are required). Once a menu item is activated the `action` function will be invoked with an object containing the following keys: item - the contextmenu item definition as seen below, reference - the DOM node that was used (the tree node), element - the contextmenu DOM element, position - an object with x/y properties indicating the position of the menu.\n\t\t *\n\t\t * * `separator_before` - a boolean indicating if there should be a separator before this item\n\t\t * * `separator_after` - a boolean indicating if there should be a separator after this item\n\t\t * * `_disabled` - a boolean indicating if this action should be disabled\n\t\t * * `label` - a string - the name of the action (could be a function returning a string)\n\t\t * * `title` - a string - an optional tooltip for the item\n\t\t * * `action` - a function to be executed if this item is chosen, the function will receive \n\t\t * * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class\n\t\t * * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2)\n\t\t * * `shortcut_label` - shortcut label (like for example `F2` for rename)\n\t\t * * `submenu` - an object with the same structure as $.jstree.defaults.contextmenu.items which can be used to create a submenu - each key will be rendered as a separate option in a submenu that will appear once the current item is hovered\n\t\t *\n\t\t * @name $.jstree.defaults.contextmenu.items\n\t\t * @plugin contextmenu\n\t\t */\n\t\titems : function (o, cb) { // Could be an object directly\n\t\t\treturn {\n\t\t\t\t\"create\" : {\n\t\t\t\t\t\"separator_before\"\t: false,\n\t\t\t\t\t\"separator_after\"\t: true,\n\t\t\t\t\t\"_disabled\"\t\t\t: false, //(this.check(\"create_node\", data.reference, {}, \"last\")),\n\t\t\t\t\t\"label\"\t\t\t\t: \"Create\",\n\t\t\t\t\t\"action\"\t\t\t: function (data) {\n\t\t\t\t\t\tvar inst = $.jstree.reference(data.reference),\n\t\t\t\t\t\t\tobj = inst.get_node(data.reference);\n\t\t\t\t\t\tinst.create_node(obj, {}, \"last\", function (new_node) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tinst.edit(new_node);\n\t\t\t\t\t\t\t} catch (ex) {\n\t\t\t\t\t\t\t\tsetTimeout(function () { inst.edit(new_node); },0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"rename\" : {\n\t\t\t\t\t\"separator_before\"\t: false,\n\t\t\t\t\t\"separator_after\"\t: false,\n\t\t\t\t\t\"_disabled\"\t\t\t: false, //(this.check(\"rename_node\", data.reference, this.get_parent(data.reference), \"\")),\n\t\t\t\t\t\"label\"\t\t\t\t: \"Rename\",\n\t\t\t\t\t/*!\n\t\t\t\t\t\"shortcut\"\t\t\t: 113,\n\t\t\t\t\t\"shortcut_label\"\t: 'F2',\n\t\t\t\t\t\"icon\"\t\t\t\t: \"glyphicon glyphicon-leaf\",\n\t\t\t\t\t*/\n\t\t\t\t\t\"action\"\t\t\t: function (data) {\n\t\t\t\t\t\tvar inst = $.jstree.reference(data.reference),\n\t\t\t\t\t\t\tobj = inst.get_node(data.reference);\n\t\t\t\t\t\tinst.edit(obj);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"remove\" : {\n\t\t\t\t\t\"separator_before\"\t: false,\n\t\t\t\t\t\"icon\"\t\t\t\t: false,\n\t\t\t\t\t\"separator_after\"\t: false,\n\t\t\t\t\t\"_disabled\"\t\t\t: false, //(this.check(\"delete_node\", data.reference, this.get_parent(data.reference), \"\")),\n\t\t\t\t\t\"label\"\t\t\t\t: \"Delete\",\n\t\t\t\t\t\"action\"\t\t\t: function (data) {\n\t\t\t\t\t\tvar inst = $.jstree.reference(data.reference),\n\t\t\t\t\t\t\tobj = inst.get_node(data.reference);\n\t\t\t\t\t\tif(inst.is_selected(obj)) {\n\t\t\t\t\t\t\tinst.delete_node(inst.get_selected());\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tinst.delete_node(obj);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"ccp\" : {\n\t\t\t\t\t\"separator_before\"\t: true,\n\t\t\t\t\t\"icon\"\t\t\t\t: false,\n\t\t\t\t\t\"separator_after\"\t: false,\n\t\t\t\t\t\"label\"\t\t\t\t: \"Edit\",\n\t\t\t\t\t\"action\"\t\t\t: false,\n\t\t\t\t\t\"submenu\" : {\n\t\t\t\t\t\t\"cut\" : {\n\t\t\t\t\t\t\t\"separator_before\"\t: false,\n\t\t\t\t\t\t\t\"separator_after\"\t: false,\n\t\t\t\t\t\t\t\"label\"\t\t\t\t: \"Cut\",\n\t\t\t\t\t\t\t\"action\"\t\t\t: function (data) {\n\t\t\t\t\t\t\t\tvar inst = $.jstree.reference(data.reference),\n\t\t\t\t\t\t\t\t\tobj = inst.get_node(data.reference);\n\t\t\t\t\t\t\t\tif(inst.is_selected(obj)) {\n\t\t\t\t\t\t\t\t\tinst.cut(inst.get_top_selected());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tinst.cut(obj);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"copy\" : {\n\t\t\t\t\t\t\t\"separator_before\"\t: false,\n\t\t\t\t\t\t\t\"icon\"\t\t\t\t: false,\n\t\t\t\t\t\t\t\"separator_after\"\t: false,\n\t\t\t\t\t\t\t\"label\"\t\t\t\t: \"Copy\",\n\t\t\t\t\t\t\t\"action\"\t\t\t: function (data) {\n\t\t\t\t\t\t\t\tvar inst = $.jstree.reference(data.reference),\n\t\t\t\t\t\t\t\t\tobj = inst.get_node(data.reference);\n\t\t\t\t\t\t\t\tif(inst.is_selected(obj)) {\n\t\t\t\t\t\t\t\t\tinst.copy(inst.get_top_selected());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tinst.copy(obj);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"paste\" : {\n\t\t\t\t\t\t\t\"separator_before\"\t: false,\n\t\t\t\t\t\t\t\"icon\"\t\t\t\t: false,\n\t\t\t\t\t\t\t\"_disabled\"\t\t\t: function (data) {\n\t\t\t\t\t\t\t\treturn !$.jstree.reference(data.reference).can_paste();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"separator_after\"\t: false,\n\t\t\t\t\t\t\t\"label\"\t\t\t\t: \"Paste\",\n\t\t\t\t\t\t\t\"action\"\t\t\t: function (data) {\n\t\t\t\t\t\t\t\tvar inst = $.jstree.reference(data.reference),\n\t\t\t\t\t\t\t\t\tobj = inst.get_node(data.reference);\n\t\t\t\t\t\t\t\tinst.paste(obj);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t};\n\n\t$.jstree.plugins.contextmenu = function (options, parent) {\n\t\tthis.bind = function () {\n\t\t\tparent.bind.call(this);\n\n\t\t\tvar last_ts = 0, cto = null, ex, ey;\n\t\t\tthis.element\n\t\t\t\t.on(\"init.jstree loading.jstree ready.jstree\", function () {\n\t\t\t\t\t\tthis.get_container_ul().addClass('jstree-contextmenu');\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"contextmenu.jstree\", \".jstree-anchor\", function (e, data) {\n\t\t\t\t\t\tif (e.target.tagName.toLowerCase() === 'input') {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tlast_ts = e.ctrlKey ? +new Date() : 0;\n\t\t\t\t\t\tif(data || cto) {\n\t\t\t\t\t\t\tlast_ts = (+new Date()) + 10000;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(cto) {\n\t\t\t\t\t\t\tclearTimeout(cto);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(!this.is_loading(e.currentTarget)) {\n\t\t\t\t\t\t\tthis.show_contextmenu(e.currentTarget, e.pageX, e.pageY, e);\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"click.jstree\", \".jstree-anchor\", function (e) {\n\t\t\t\t\t\tif(this._data.contextmenu.visible && (!last_ts || (+new Date()) - last_ts > 250)) { // work around safari & macOS ctrl+click\n\t\t\t\t\t\t\t$.vakata.context.hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlast_ts = 0;\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"touchstart.jstree\", \".jstree-anchor\", function (e) {\n\t\t\t\t\t\tif(!e.originalEvent || !e.originalEvent.changedTouches || !e.originalEvent.changedTouches[0]) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tex = e.originalEvent.changedTouches[0].clientX;\n\t\t\t\t\t\tey = e.originalEvent.changedTouches[0].clientY;\n\t\t\t\t\t\tcto = setTimeout(function () {\n\t\t\t\t\t\t\t$(e.currentTarget).trigger('contextmenu', true);\n\t\t\t\t\t\t}, 750);\n\t\t\t\t\t})\n\t\t\t\t.on('touchmove.vakata.jstree', function (e) {\n\t\t\t\t\t\tif(cto && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0] && (Math.abs(ex - e.originalEvent.changedTouches[0].clientX) > 10 || Math.abs(ey - e.originalEvent.changedTouches[0].clientY) > 10)) {\n\t\t\t\t\t\t\tclearTimeout(cto);\n\t\t\t\t\t\t\t$.vakata.context.hide();\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t.on('touchend.vakata.jstree', function (e) {\n\t\t\t\t\t\tif(cto) {\n\t\t\t\t\t\t\tclearTimeout(cto);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t/*!\n\t\t\tif(!('oncontextmenu' in document.body) && ('ontouchstart' in document.body)) {\n\t\t\t\tvar el = null, tm = null;\n\t\t\t\tthis.element\n\t\t\t\t\t.on(\"touchstart\", \".jstree-anchor\", function (e) {\n\t\t\t\t\t\tel = e.currentTarget;\n\t\t\t\t\t\ttm = +new Date();\n\t\t\t\t\t\t$(document).one(\"touchend\", function (e) {\n\t\t\t\t\t\t\te.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset);\n\t\t\t\t\t\t\te.currentTarget = e.target;\n\t\t\t\t\t\t\ttm = ((+(new Date())) - tm);\n\t\t\t\t\t\t\tif(e.target === el && tm > 600 && tm < 1000) {\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t$(el).trigger('contextmenu', e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tel = null;\n\t\t\t\t\t\t\ttm = null;\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t}\n\t\t\t*/\n\t\t\t$(document).on(\"context_hide.vakata.jstree\", function (e, data) {\n\t\t\t\tthis._data.contextmenu.visible = false;\n\t\t\t\t$(data.reference).removeClass('jstree-context');\n\t\t\t}.bind(this));\n\t\t};\n\t\tthis.teardown = function () {\n\t\t\tif(this._data.contextmenu.visible) {\n\t\t\t\t$.vakata.context.hide();\n\t\t\t}\n\t\t\t$(document).off(\"context_hide.vakata.jstree\");\n\t\t\tparent.teardown.call(this);\n\t\t};\n\n\t\t/**\n\t\t * prepare and show the context menu for a node\n\t\t * @name show_contextmenu(obj [, x, y])\n\t\t * @param {mixed} obj the node\n\t\t * @param {Number} x the x-coordinate relative to the document to show the menu at\n\t\t * @param {Number} y the y-coordinate relative to the document to show the menu at\n\t\t * @param {Object} e the event if available that triggered the contextmenu\n\t\t * @plugin contextmenu\n\t\t * @trigger show_contextmenu.jstree\n\t\t */\n\t\tthis.show_contextmenu = function (obj, x, y, e) {\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj || obj.id === $.jstree.root) { return false; }\n\t\t\tvar s = this.settings.contextmenu,\n\t\t\t\td = this.get_node(obj, true),\n\t\t\t\ta = d.children(\".jstree-anchor\"),\n\t\t\t\to = false,\n\t\t\t\ti = false;\n\t\t\tif(s.show_at_node || x === undefined || y === undefined) {\n\t\t\t\to = a.offset();\n\t\t\t\tx = o.left;\n\t\t\t\ty = o.top + this._data.core.li_height;\n\t\t\t}\n\t\t\tif(this.settings.contextmenu.select_node && !this.is_selected(obj)) {\n\t\t\t\tthis.activate_node(obj, e);\n\t\t\t}\n\n\t\t\ti = s.items;\n\t\t\tif($.vakata.is_function(i)) {\n\t\t\t\ti = i.call(this, obj, function (i) {\n\t\t\t\t\tthis._show_contextmenu(obj, x, y, i);\n\t\t\t\t}.bind(this));\n\t\t\t}\n\t\t\tif($.isPlainObject(i)) {\n\t\t\t\tthis._show_contextmenu(obj, x, y, i);\n\t\t\t}\n\t\t};\n\t\t/**\n\t\t * show the prepared context menu for a node\n\t\t * @name _show_contextmenu(obj, x, y, i)\n\t\t * @param {mixed} obj the node\n\t\t * @param {Number} x the x-coordinate relative to the document to show the menu at\n\t\t * @param {Number} y the y-coordinate relative to the document to show the menu at\n\t\t * @param {Number} i the object of items to show\n\t\t * @plugin contextmenu\n\t\t * @trigger show_contextmenu.jstree\n\t\t * @private\n\t\t */\n\t\tthis._show_contextmenu = function (obj, x, y, i) {\n\t\t\tvar d = this.get_node(obj, true),\n\t\t\t\ta = d.children(\".jstree-anchor\");\n\t\t\t$(document).one(\"context_show.vakata.jstree\", function (e, data) {\n\t\t\t\tvar cls = 'jstree-contextmenu jstree-' + this.get_theme() + '-contextmenu';\n\t\t\t\t$(data.element).addClass(cls);\n\t\t\t\ta.addClass('jstree-context');\n\t\t\t}.bind(this));\n\t\t\tthis._data.contextmenu.visible = true;\n\t\t\t$.vakata.context.show(a, { 'x' : x, 'y' : y }, i);\n\t\t\t/**\n\t\t\t * triggered when the contextmenu is shown for a node\n\t\t\t * @event\n\t\t\t * @name show_contextmenu.jstree\n\t\t\t * @param {Object} node the node\n\t\t\t * @param {Number} x the x-coordinate of the menu relative to the document\n\t\t\t * @param {Number} y the y-coordinate of the menu relative to the document\n\t\t\t * @plugin contextmenu\n\t\t\t */\n\t\t\tthis.trigger('show_contextmenu', { \"node\" : obj, \"x\" : x, \"y\" : y });\n\t\t};\n\t};\n\n\t// contextmenu helper\n\t(function ($) {\n\t\tvar right_to_left = false,\n\t\t\tvakata_context = {\n\t\t\t\telement\t\t: false,\n\t\t\t\treference\t: false,\n\t\t\t\tposition_x\t: 0,\n\t\t\t\tposition_y\t: 0,\n\t\t\t\titems\t\t: [],\n\t\t\t\thtml\t\t: \"\",\n\t\t\t\tis_visible\t: false\n\t\t\t};\n\n\t\t$.vakata.context = {\n\t\t\tsettings : {\n\t\t\t\thide_onmouseleave\t: 0,\n\t\t\t\ticons\t\t\t\t: true\n\t\t\t},\n\t\t\t_trigger : function (event_name) {\n\t\t\t\t$(document).triggerHandler(\"context_\" + event_name + \".vakata\", {\n\t\t\t\t\t\"reference\"\t: vakata_context.reference,\n\t\t\t\t\t\"element\"\t: vakata_context.element,\n\t\t\t\t\t\"position\"\t: {\n\t\t\t\t\t\t\"x\" : vakata_context.position_x,\n\t\t\t\t\t\t\"y\" : vakata_context.position_y\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\t_execute : function (i) {\n\t\t\t\ti = vakata_context.items[i];\n\t\t\t\treturn i && (!i._disabled || ($.vakata.is_function(i._disabled) && !i._disabled({ \"item\" : i, \"reference\" : vakata_context.reference, \"element\" : vakata_context.element }))) && i.action ? i.action.call(null, {\n\t\t\t\t\t\t\t\"item\"\t\t: i,\n\t\t\t\t\t\t\t\"reference\"\t: vakata_context.reference,\n\t\t\t\t\t\t\t\"element\"\t: vakata_context.element,\n\t\t\t\t\t\t\t\"position\"\t: {\n\t\t\t\t\t\t\t\t\"x\" : vakata_context.position_x,\n\t\t\t\t\t\t\t\t\"y\" : vakata_context.position_y\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}) : false;\n\t\t\t},\n\t\t\t_parse : function (o, is_callback) {\n\t\t\t\tif(!o) { return false; }\n\t\t\t\tif(!is_callback) {\n\t\t\t\t\tvakata_context.html\t\t= \"\";\n\t\t\t\t\tvakata_context.items\t= [];\n\t\t\t\t}\n\t\t\t\tvar str = \"\",\n\t\t\t\t\tsep = false,\n\t\t\t\t\ttmp;\n\n\t\t\t\tif(is_callback) { str += \"<\"+\"ul>\"; }\n\t\t\t\t$.each(o, function (i, val) {\n\t\t\t\t\tif(!val) { return true; }\n\t\t\t\t\tvakata_context.items.push(val);\n\t\t\t\t\tif(!sep && val.separator_before) {\n\t\t\t\t\t\tstr += \"<\"+\"li class='vakata-context-separator'><\"+\"a href='#' \" + ($.vakata.context.settings.icons ? '' : 'class=\"vakata-context-no-icons\"') + \"> <\"+\"/a><\"+\"/li>\";\n\t\t\t\t\t}\n\t\t\t\t\tsep = false;\n\t\t\t\t\tstr += \"<\"+\"li class='\" + (val._class || \"\") + (val._disabled === true || ($.vakata.is_function(val._disabled) && val._disabled({ \"item\" : val, \"reference\" : vakata_context.reference, \"element\" : vakata_context.element })) ? \" vakata-contextmenu-disabled \" : \"\") + \"' \"+(val.shortcut?\" data-shortcut='\"+val.shortcut+\"' \":'')+\">\";\n\t\t\t\t\tstr += \"<\"+\"a href='#' rel='\" + (vakata_context.items.length - 1) + \"' \" + (val.title ? \"title='\" + val.title + \"'\" : \"\") + \">\";\n\t\t\t\t\tif($.vakata.context.settings.icons) {\n\t\t\t\t\t\tstr += \"<\"+\"i \";\n\t\t\t\t\t\tif(val.icon) {\n\t\t\t\t\t\t\tif(val.icon.indexOf(\"/\") !== -1 || val.icon.indexOf(\".\") !== -1) { str += \" style='background:url(\\\"\" + val.icon + \"\\\") center center no-repeat' \"; }\n\t\t\t\t\t\t\telse { str += \" class='\" + val.icon + \"' \"; }\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstr += \"><\"+\"/i><\"+\"span class='vakata-contextmenu-sep'> <\"+\"/span>\";\n\t\t\t\t\t}\n\t\t\t\t\tstr += ($.vakata.is_function(val.label) ? val.label({ \"item\" : i, \"reference\" : vakata_context.reference, \"element\" : vakata_context.element }) : val.label) + (val.shortcut?' '+ (val.shortcut_label || '') +'':'') + \"<\"+\"/a>\";\n\t\t\t\t\tif(val.submenu) {\n\t\t\t\t\t\ttmp = $.vakata.context._parse(val.submenu, true);\n\t\t\t\t\t\tif(tmp) { str += tmp; }\n\t\t\t\t\t}\n\t\t\t\t\tstr += \"<\"+\"/li>\";\n\t\t\t\t\tif(val.separator_after) {\n\t\t\t\t\t\tstr += \"<\"+\"li class='vakata-context-separator'><\"+\"a href='#' \" + ($.vakata.context.settings.icons ? '' : 'class=\"vakata-context-no-icons\"') + \"> <\"+\"/a><\"+\"/li>\";\n\t\t\t\t\t\tsep = true;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tstr = str.replace(/
      • <\\/li\\>$/,\"\");\n\t\t\t\tif(is_callback) { str += \"\"; }\n\t\t\t\t/**\n\t\t\t\t * triggered on the document when the contextmenu is parsed (HTML is built)\n\t\t\t\t * @event\n\t\t\t\t * @plugin contextmenu\n\t\t\t\t * @name context_parse.vakata\n\t\t\t\t * @param {jQuery} reference the element that was right clicked\n\t\t\t\t * @param {jQuery} element the DOM element of the menu itself\n\t\t\t\t * @param {Object} position the x & y coordinates of the menu\n\t\t\t\t */\n\t\t\t\tif(!is_callback) { vakata_context.html = str; $.vakata.context._trigger(\"parse\"); }\n\t\t\t\treturn str.length > 10 ? str : false;\n\t\t\t},\n\t\t\t_show_submenu : function (o) {\n\t\t\t\to = $(o);\n\t\t\t\tif(!o.length || !o.children(\"ul\").length) { return; }\n\t\t\t\tvar e = o.children(\"ul\"),\n\t\t\t\t\txl = o.offset().left,\n\t\t\t\t\tx = xl + o.outerWidth(),\n\t\t\t\t\ty = o.offset().top,\n\t\t\t\t\tw = e.width(),\n\t\t\t\t\th = e.height(),\n\t\t\t\t\tdw = $(window).width() + $(window).scrollLeft(),\n\t\t\t\t\tdh = $(window).height() + $(window).scrollTop();\n\t\t\t\t// може да се спести е една проверка - дали няма някой от класовете вече нагоре\n\t\t\t\tif(right_to_left) {\n\t\t\t\t\to[x - (w + 10 + o.outerWidth()) < 0 ? \"addClass\" : \"removeClass\"](\"vakata-context-left\");\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\to[x + w > dw && xl > dw - x ? \"addClass\" : \"removeClass\"](\"vakata-context-right\");\n\t\t\t\t}\n\t\t\t\tif(y + h + 10 > dh) {\n\t\t\t\t\te.css(\"bottom\",\"-1px\");\n\t\t\t\t}\n\n\t\t\t\t//if does not fit - stick it to the side\n\t\t\t\tif (o.hasClass('vakata-context-right')) {\n\t\t\t\t\tif (xl < w) {\n\t\t\t\t\t\te.css(\"margin-right\", xl - w);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (dw - x < w) {\n\t\t\t\t\t\te.css(\"margin-left\", dw - x - w);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\te.show();\n\t\t\t},\n\t\t\tshow : function (reference, position, data) {\n\t\t\t\tvar o, e, x, y, w, h, dw, dh, cond = true;\n\t\t\t\tif(vakata_context.element && vakata_context.element.length) {\n\t\t\t\t\tvakata_context.element.width('');\n\t\t\t\t}\n\t\t\t\tswitch(cond) {\n\t\t\t\t\tcase (!position && !reference):\n\t\t\t\t\t\treturn false;\n\t\t\t\t\tcase (!!position && !!reference):\n\t\t\t\t\t\tvakata_context.reference\t= reference;\n\t\t\t\t\t\tvakata_context.position_x\t= position.x;\n\t\t\t\t\t\tvakata_context.position_y\t= position.y;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase (!position && !!reference):\n\t\t\t\t\t\tvakata_context.reference\t= reference;\n\t\t\t\t\t\to = reference.offset();\n\t\t\t\t\t\tvakata_context.position_x\t= o.left + reference.outerHeight();\n\t\t\t\t\t\tvakata_context.position_y\t= o.top;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase (!!position && !reference):\n\t\t\t\t\t\tvakata_context.position_x\t= position.x;\n\t\t\t\t\t\tvakata_context.position_y\t= position.y;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(!!reference && !data && $(reference).data('vakata_contextmenu')) {\n\t\t\t\t\tdata = $(reference).data('vakata_contextmenu');\n\t\t\t\t}\n\t\t\t\tif($.vakata.context._parse(data)) {\n\t\t\t\t\tvakata_context.element.html(vakata_context.html);\n\t\t\t\t}\n\t\t\t\tif(vakata_context.items.length) {\n\t\t\t\t\tvakata_context.element.appendTo(document.body);\n\t\t\t\t\te = vakata_context.element;\n\t\t\t\t\tx = vakata_context.position_x;\n\t\t\t\t\ty = vakata_context.position_y;\n\t\t\t\t\tw = e.width();\n\t\t\t\t\th = e.height();\n\t\t\t\t\tdw = $(window).width() + $(window).scrollLeft();\n\t\t\t\t\tdh = $(window).height() + $(window).scrollTop();\n\t\t\t\t\tif(right_to_left) {\n\t\t\t\t\t\tx -= (e.outerWidth() - $(reference).outerWidth());\n\t\t\t\t\t\tif(x < $(window).scrollLeft() + 20) {\n\t\t\t\t\t\t\tx = $(window).scrollLeft() + 20;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(x + w + 20 > dw) {\n\t\t\t\t\t\tx = dw - (w + 20);\n\t\t\t\t\t}\n\t\t\t\t\tif(y + h + 20 > dh) {\n\t\t\t\t\t\ty = dh - (h + 20);\n\t\t\t\t\t}\n\n\t\t\t\t\tvakata_context.element\n\t\t\t\t\t\t.css({ \"left\" : x, \"top\" : y })\n\t\t\t\t\t\t.show()\n\t\t\t\t\t\t.find('a').first().trigger('focus').parent().addClass(\"vakata-context-hover\");\n\t\t\t\t\tvakata_context.is_visible = true;\n\t\t\t\t\t/**\n\t\t\t\t\t * triggered on the document when the contextmenu is shown\n\t\t\t\t\t * @event\n\t\t\t\t\t * @plugin contextmenu\n\t\t\t\t\t * @name context_show.vakata\n\t\t\t\t\t * @param {jQuery} reference the element that was right clicked\n\t\t\t\t\t * @param {jQuery} element the DOM element of the menu itself\n\t\t\t\t\t * @param {Object} position the x & y coordinates of the menu\n\t\t\t\t\t */\n\t\t\t\t\t$.vakata.context._trigger(\"show\");\n\t\t\t\t}\n\t\t\t},\n\t\t\thide : function () {\n\t\t\t\tif(vakata_context.is_visible) {\n\t\t\t\t\tvakata_context.element.hide().find(\"ul\").hide().end().find(':focus').trigger('blur').end().detach();\n\t\t\t\t\tvakata_context.is_visible = false;\n\t\t\t\t\t/**\n\t\t\t\t\t * triggered on the document when the contextmenu is hidden\n\t\t\t\t\t * @event\n\t\t\t\t\t * @plugin contextmenu\n\t\t\t\t\t * @name context_hide.vakata\n\t\t\t\t\t * @param {jQuery} reference the element that was right clicked\n\t\t\t\t\t * @param {jQuery} element the DOM element of the menu itself\n\t\t\t\t\t * @param {Object} position the x & y coordinates of the menu\n\t\t\t\t\t */\n\t\t\t\t\t$.vakata.context._trigger(\"hide\");\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t$(function () {\n\t\t\tright_to_left = $(document.body).css(\"direction\") === \"rtl\";\n\t\t\tvar to = false;\n\n\t\t\tvakata_context.element = $(\"
          \");\n\t\t\tvakata_context.element\n\t\t\t\t.on(\"mouseenter\", \"li\", function (e) {\n\t\t\t\t\te.stopImmediatePropagation();\n\n\t\t\t\t\tif($.contains(this, e.relatedTarget)) {\n\t\t\t\t\t\t// премахнато заради delegate mouseleave по-долу\n\t\t\t\t\t\t// $(this).find(\".vakata-context-hover\").removeClass(\"vakata-context-hover\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(to) { clearTimeout(to); }\n\t\t\t\t\tvakata_context.element.find(\".vakata-context-hover\").removeClass(\"vakata-context-hover\").end();\n\n\t\t\t\t\t$(this)\n\t\t\t\t\t\t.siblings().find(\"ul\").hide().end().end()\n\t\t\t\t\t\t.parentsUntil(\".vakata-context\", \"li\").addBack().addClass(\"vakata-context-hover\");\n\t\t\t\t\t$.vakata.context._show_submenu(this);\n\t\t\t\t})\n\t\t\t\t// тестово - дали не натоварва?\n\t\t\t\t.on(\"mouseleave\", \"li\", function (e) {\n\t\t\t\t\tif($.contains(this, e.relatedTarget)) { return; }\n\t\t\t\t\t$(this).find(\".vakata-context-hover\").addBack().removeClass(\"vakata-context-hover\");\n\t\t\t\t})\n\t\t\t\t.on(\"mouseleave\", function (e) {\n\t\t\t\t\t$(this).find(\".vakata-context-hover\").removeClass(\"vakata-context-hover\");\n\t\t\t\t\tif($.vakata.context.settings.hide_onmouseleave) {\n\t\t\t\t\t\tto = setTimeout(\n\t\t\t\t\t\t\t(function (t) {\n\t\t\t\t\t\t\t\treturn function () { $.vakata.context.hide(); };\n\t\t\t\t\t\t\t}(this)), $.vakata.context.settings.hide_onmouseleave);\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.on(\"click\", \"a\", function (e) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t//})\n\t\t\t\t//.on(\"mouseup\", \"a\", function (e) {\n\t\t\t\t\tif(!$(this).trigger('blur').parent().hasClass(\"vakata-context-disabled\") && $.vakata.context._execute($(this).attr(\"rel\")) !== false) {\n\t\t\t\t\t\t$.vakata.context.hide();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.on('keydown', 'a', function (e) {\n\t\t\t\t\t\tvar o = null;\n\t\t\t\t\t\tswitch(e.which) {\n\t\t\t\t\t\t\tcase 13:\n\t\t\t\t\t\t\tcase 32:\n\t\t\t\t\t\t\t\te.type = \"click\";\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t$(e.currentTarget).trigger(e);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 37:\n\t\t\t\t\t\t\t\tif(vakata_context.is_visible) {\n\t\t\t\t\t\t\t\t\tvakata_context.element.find(\".vakata-context-hover\").last().closest(\"li\").first().find(\"ul\").hide().find(\".vakata-context-hover\").removeClass(\"vakata-context-hover\").end().end().children('a').trigger('focus');\n\t\t\t\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 38:\n\t\t\t\t\t\t\t\tif(vakata_context.is_visible) {\n\t\t\t\t\t\t\t\t\to = vakata_context.element.find(\"ul:visible\").addBack().last().children(\".vakata-context-hover\").removeClass(\"vakata-context-hover\").prevAll(\"li:not(.vakata-context-separator)\").first();\n\t\t\t\t\t\t\t\t\tif(!o.length) { o = vakata_context.element.find(\"ul:visible\").addBack().last().children(\"li:not(.vakata-context-separator)\").last(); }\n\t\t\t\t\t\t\t\t\to.addClass(\"vakata-context-hover\").children('a').trigger('focus');\n\t\t\t\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 39:\n\t\t\t\t\t\t\t\tif(vakata_context.is_visible) {\n\t\t\t\t\t\t\t\t\tvakata_context.element.find(\".vakata-context-hover\").last().children(\"ul\").show().children(\"li:not(.vakata-context-separator)\").removeClass(\"vakata-context-hover\").first().addClass(\"vakata-context-hover\").children('a').trigger('focus');\n\t\t\t\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 40:\n\t\t\t\t\t\t\t\tif(vakata_context.is_visible) {\n\t\t\t\t\t\t\t\t\to = vakata_context.element.find(\"ul:visible\").addBack().last().children(\".vakata-context-hover\").removeClass(\"vakata-context-hover\").nextAll(\"li:not(.vakata-context-separator)\").first();\n\t\t\t\t\t\t\t\t\tif(!o.length) { o = vakata_context.element.find(\"ul:visible\").addBack().last().children(\"li:not(.vakata-context-separator)\").first(); }\n\t\t\t\t\t\t\t\t\to.addClass(\"vakata-context-hover\").children('a').trigger('focus');\n\t\t\t\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 27:\n\t\t\t\t\t\t\t\t$.vakata.context.hide();\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t//console.log(e.which);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t.on('keydown', function (e) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tvar a = vakata_context.element.find('.vakata-contextmenu-shortcut-' + e.which).parent();\n\t\t\t\t\tif(a.parent().not('.vakata-context-disabled')) {\n\t\t\t\t\t\ta.trigger('click');\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t$(document)\n\t\t\t\t.on(\"mousedown.vakata.jstree\", function (e) {\n\t\t\t\t\tif(vakata_context.is_visible && vakata_context.element[0] !== e.target && !$.contains(vakata_context.element[0], e.target)) {\n\t\t\t\t\t\t$.vakata.context.hide();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.on(\"context_show.vakata.jstree\", function (e, data) {\n\t\t\t\t\tvakata_context.element.find(\"li:has(ul)\").children(\"a\").addClass(\"vakata-context-parent\");\n\t\t\t\t\tif(right_to_left) {\n\t\t\t\t\t\tvakata_context.element.addClass(\"vakata-context-rtl\").css(\"direction\", \"rtl\");\n\t\t\t\t\t}\n\t\t\t\t\t// also apply a RTL class?\n\t\t\t\t\tvakata_context.element.find(\"ul\").hide().end();\n\t\t\t\t});\n\t\t});\n\t}($));\n\t// $.jstree.defaults.plugins.push(\"contextmenu\");\n\n\n/**\n * ### Drag'n'drop plugin\n *\n * Enables dragging and dropping of nodes in the tree, resulting in a move or copy operations.\n */\n\n\t/**\n\t * stores all defaults for the drag'n'drop plugin\n\t * @name $.jstree.defaults.dnd\n\t * @plugin dnd\n\t */\n\t$.jstree.defaults.dnd = {\n\t\t/**\n\t\t * a boolean indicating if a copy should be possible while dragging (by pressint the meta key or Ctrl). Defaults to `true`.\n\t\t * @name $.jstree.defaults.dnd.copy\n\t\t * @plugin dnd\n\t\t */\n\t\tcopy : true,\n\t\t/**\n\t\t * a number indicating how long a node should remain hovered while dragging to be opened. Defaults to `500`.\n\t\t * @name $.jstree.defaults.dnd.open_timeout\n\t\t * @plugin dnd\n\t\t */\n\t\topen_timeout : 500,\n\t\t/**\n\t\t * a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the nodes about to be dragged as an argument (array) and the event that started the drag - return `false` to prevent dragging\n\t\t * @name $.jstree.defaults.dnd.is_draggable\n\t\t * @plugin dnd\n\t\t */\n\t\tis_draggable : true,\n\t\t/**\n\t\t * a boolean indicating if checks should constantly be made while the user is dragging the node (as opposed to checking only on drop), default is `true`\n\t\t * @name $.jstree.defaults.dnd.check_while_dragging\n\t\t * @plugin dnd\n\t\t */\n\t\tcheck_while_dragging : true,\n\t\t/**\n\t\t * a boolean indicating if nodes from this tree should only be copied with dnd (as opposed to moved), default is `false`\n\t\t * @name $.jstree.defaults.dnd.always_copy\n\t\t * @plugin dnd\n\t\t */\n\t\talways_copy : false,\n\t\t/**\n\t\t * when dropping a node \"inside\", this setting indicates the position the node should go to - it can be an integer or a string: \"first\" (same as 0) or \"last\", default is `0`\n\t\t * @name $.jstree.defaults.dnd.inside_pos\n\t\t * @plugin dnd\n\t\t */\n\t\tinside_pos : 0,\n\t\t/**\n\t\t * when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node\n\t\t * @name $.jstree.defaults.dnd.drag_selection\n\t\t * @plugin dnd\n\t\t */\n\t\tdrag_selection : true,\n\t\t/**\n\t\t * controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string \"selected\" which means only selected nodes can be dragged on touch devices.\n\t\t * @name $.jstree.defaults.dnd.touch\n\t\t * @plugin dnd\n\t\t */\n\t\ttouch : true,\n\t\t/**\n\t\t * controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target.\n\t\t * @name $.jstree.defaults.dnd.large_drop_target\n\t\t * @plugin dnd\n\t\t */\n\t\tlarge_drop_target : false,\n\t\t/**\n\t\t * controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to \"selected\".\n\t\t * @name $.jstree.defaults.dnd.large_drag_target\n\t\t * @plugin dnd\n\t\t */\n\t\tlarge_drag_target : false,\n\t\t/**\n\t\t * controls whether use HTML5 dnd api instead of classical. That will allow better integration of dnd events with other HTML5 controls.\n\t\t * @reference http://caniuse.com/#feat=dragndrop\n\t\t * @name $.jstree.defaults.dnd.use_html5\n\t\t * @plugin dnd\n\t\t */\n\t\tuse_html5: false,\n\t\t/**\n\t\t * controls whether items can be dropped anywhere on the tree.\n\t\t * @name $.jstree.defaults.dnd.blank_space_drop\n\t\t * @plugin dnd\n\t\t */\n\t\tblank_space_drop: false\n\t};\n\tvar drg, elm;\n\t// TODO: now check works by checking for each node individually, how about max_children, unique, etc?\n\t$.jstree.plugins.dnd = function (options, parent) {\n\t\tthis.init = function (el, options) {\n\t\t\tparent.init.call(this, el, options);\n\t\t\tthis.settings.dnd.use_html5 = this.settings.dnd.use_html5 && ('draggable' in document.createElement('span'));\n\t\t};\n\t\tthis.bind = function () {\n\t\t\tparent.bind.call(this);\n\n\t\t\tthis.element\n\t\t\t\t.on(this.settings.dnd.use_html5 ? 'dragstart.jstree' : 'mousedown.jstree touchstart.jstree', this.settings.dnd.large_drag_target ? '.jstree-node' : '.jstree-anchor', function (e) {\n\t\t\t\t\t\tif(this.settings.dnd.large_drag_target && $(e.target).closest('.jstree-node')[0] !== e.currentTarget) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(e.type === \"touchstart\" && (!this.settings.dnd.touch || (this.settings.dnd.touch === 'selected' && !$(e.currentTarget).closest('.jstree-node').children('.jstree-anchor').hasClass('jstree-clicked')))) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar obj = this.get_node(e.target),\n\t\t\t\t\t\t\tmlt = this.is_selected(obj) && this.settings.dnd.drag_selection ? this.get_top_selected().length : 1,\n\t\t\t\t\t\t\ttxt = (mlt > 1 ? mlt + ' ' + this.get_string('nodes') : this.get_text(e.currentTarget));\n\t\t\t\t\t\tif(this.settings.core.force_text) {\n\t\t\t\t\t\t\ttxt = $.vakata.html.escape(txt);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(obj && obj.id && obj.id !== $.jstree.root && (e.which === 1 || e.type === \"touchstart\" || e.type === \"dragstart\") &&\n\t\t\t\t\t\t\t(this.settings.dnd.is_draggable === true || ($.vakata.is_function(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_top_selected(true) : [obj]), e)))\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tdrg = { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_top_selected() : [obj.id] };\n\t\t\t\t\t\t\telm = e.currentTarget;\n\t\t\t\t\t\t\tif (this.settings.dnd.use_html5) {\n\t\t\t\t\t\t\t\t$.vakata.dnd._trigger('start', e, { 'helper': $(), 'element': elm, 'data': drg });\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.element.trigger('mousedown.jstree');\n\t\t\t\t\t\t\t\treturn $.vakata.dnd.start(e, drg, '
          ' + txt + '+
          ');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this));\n\t\t\tif (this.settings.dnd.use_html5) {\n\t\t\t\tthis.element\n\t\t\t\t\t.on('dragover.jstree', function (e) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg });\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t})\n\t\t\t\t\t//.on('dragenter.jstree', this.settings.dnd.large_drop_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) {\n\t\t\t\t\t//\t\te.preventDefault();\n\t\t\t\t\t//\t\t$.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg });\n\t\t\t\t\t//\t\treturn false;\n\t\t\t\t\t//\t}, this))\n\t\t\t\t\t.on('drop.jstree', function (e) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg });\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}.bind(this));\n\t\t\t}\n\t\t};\n\t\tthis.redraw_node = function(obj, deep, callback, force_render) {\n\t\t\tobj = parent.redraw_node.apply(this, arguments);\n\t\t\tif (obj && this.settings.dnd.use_html5) {\n\t\t\t\tif (this.settings.dnd.large_drag_target) {\n\t\t\t\t\tobj.setAttribute('draggable', true);\n\t\t\t\t} else {\n\t\t\t\t\tvar i, j, tmp = null;\n\t\t\t\t\tfor(i = 0, j = obj.childNodes.length; i < j; i++) {\n\t\t\t\t\t\tif(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf(\"jstree-anchor\") !== -1) {\n\t\t\t\t\t\t\ttmp = obj.childNodes[i];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(tmp) {\n\t\t\t\t\t\ttmp.setAttribute('draggable', true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn obj;\n\t\t};\n\t};\n\n\t$(function() {\n\t\t// bind only once for all instances\n\t\tvar lastmv = false,\n\t\t\tlaster = false,\n\t\t\tlastev = false,\n\t\t\topento = false,\n\t\t\tmarker = $('
           
          ').hide(); //.appendTo('body');\n\n\t\t$(document)\n\t\t\t.on('dragover.vakata.jstree', function (e) {\n\t\t\t\tif (elm) {\n\t\t\t\t\t$.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg });\n\t\t\t\t}\n\t\t\t})\n\t\t\t.on('drop.vakata.jstree', function (e) {\n\t\t\t\tif (elm) {\n\t\t\t\t\t$.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg });\n\t\t\t\t\telm = null;\n\t\t\t\t\tdrg = null;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.on('dnd_start.vakata.jstree', function (e, data) {\n\t\t\t\tlastmv = false;\n\t\t\t\tlastev = false;\n\t\t\t\tif(!data || !data.data || !data.data.jstree) { return; }\n\t\t\t\tmarker.appendTo(document.body); //.show();\n\t\t\t})\n\t\t\t.on('dnd_move.vakata.jstree', function (e, data) {\n\t\t\t\tvar isDifferentNode = data.event.target !== lastev.target;\n\t\t\t\tif(opento) {\n\t\t\t\t\tif (!data.event || data.event.type !== 'dragover' || isDifferentNode) {\n\t\t\t\t\t\tclearTimeout(opento);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!data || !data.data || !data.data.jstree) { return; }\n\n\t\t\t\t// if we are hovering the marker image do nothing (can happen on \"inside\" drags)\n\t\t\t\tif(data.event.target.id && data.event.target.id === 'jstree-marker') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlastev = data.event;\n\n\t\t\t\tvar ins = $.jstree.reference(data.event.target),\n\t\t\t\t\tref = false,\n\t\t\t\t\toff = false,\n\t\t\t\t\trel = false,\n\t\t\t\t\ttmp, l, t, h, p, i, o, ok, t1, t2, op, ps, pr, ip, tm, is_copy, pn, c;\n\t\t\t\t// if we are over an instance\n\t\t\t\tif(ins && ins._data && ins._data.dnd) {\n\t\t\t\t\tmarker.attr('class', 'jstree-' + ins.get_theme() + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' ));\n\t\t\t\t\tis_copy = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey)));\n\t\t\t\t\tdata.helper\n\t\t\t\t\t\t.children().attr('class', 'jstree-' + ins.get_theme() + ' jstree-' + ins.get_theme() + '-' + ins.get_theme_variant() + ' ' + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' ))\n\t\t\t\t\t\t.find('.jstree-copy').first()[ is_copy ? 'show' : 'hide' ]();\n\n\t\t\t\t\t// if are hovering the container itself add a new root node\n\t\t\t\t\t//console.log(data.event);\n\t\t\t\t\tif( (data.event.target === ins.element[0] || data.event.target === ins.get_container_ul()[0]) && (ins.get_container_ul().children().length === 0 || ins.settings.dnd.blank_space_drop)) {\n\t\t\t\t\t\tok = true;\n\t\t\t\t\t\tfor(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) {\n\t\t\t\t\t\t\tok = ok && ins.check( (data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey)) ) ? \"copy_node\" : \"move_node\"), (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), $.jstree.root, 'last', { 'dnd' : true, 'ref' : ins.get_node($.jstree.root), 'pos' : 'i', 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) });\n\t\t\t\t\t\t\tif(!ok) { break; }\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(ok) {\n\t\t\t\t\t\t\tlastmv = { 'ins' : ins, 'par' : $.jstree.root, 'pos' : 'last' };\n\t\t\t\t\t\t\tmarker.hide();\n\t\t\t\t\t\t\tdata.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok');\n\t\t\t\t\t\t\tif (data.event.originalEvent && data.event.originalEvent.dataTransfer) {\n\t\t\t\t\t\t\t\tdata.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// if we are hovering a tree node\n\t\t\t\t\t\tref = ins.settings.dnd.large_drop_target ? $(data.event.target).closest('.jstree-node').children('.jstree-anchor') : $(data.event.target).closest('.jstree-anchor');\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(ref && ref.length && ref.parent().is('.jstree-closed, .jstree-open, .jstree-leaf')) {\n\t\t\t\t\t\t\toff = ref.offset();\n\t\t\t\t\t\t\trel = (data.event.pageY !== undefined ? data.event.pageY : data.event.originalEvent.pageY) - off.top;\n\t\t\t\t\t\t\th = ref.outerHeight();\n\t\t\t\t\t\t\tif(rel < h / 3) {\n\t\t\t\t\t\t\t\to = ['b', 'i', 'a'];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if(rel > h - h / 3) {\n\t\t\t\t\t\t\t\to = ['a', 'i', 'b'];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\to = rel > h / 2 ? ['i', 'a', 'b'] : ['i', 'b', 'a'];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$.each(o, function (j, v) {\n\t\t\t\t\t\t\t\tswitch(v) {\n\t\t\t\t\t\t\t\t\tcase 'b':\n\t\t\t\t\t\t\t\t\t\tl = off.left - 6;\n\t\t\t\t\t\t\t\t\t\tt = off.top;\n\t\t\t\t\t\t\t\t\t\tp = ins.get_parent(ref);\n\t\t\t\t\t\t\t\t\t\ti = ref.parent().index();\n\t\t\t\t\t\t\t\t\t\tc = 'jstree-below';\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase 'i':\n\t\t\t\t\t\t\t\t\t\tip = ins.settings.dnd.inside_pos;\n\t\t\t\t\t\t\t\t\t\ttm = ins.get_node(ref.parent());\n\t\t\t\t\t\t\t\t\t\tl = off.left - 2;\n\t\t\t\t\t\t\t\t\t\tt = off.top + h / 2 + 1;\n\t\t\t\t\t\t\t\t\t\tp = tm.id;\n\t\t\t\t\t\t\t\t\t\ti = ip === 'first' ? 0 : (ip === 'last' ? tm.children.length : Math.min(ip, tm.children.length));\n\t\t\t\t\t\t\t\t\t\tc = 'jstree-inside';\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase 'a':\n\t\t\t\t\t\t\t\t\t\tl = off.left - 6;\n\t\t\t\t\t\t\t\t\t\tt = off.top + h;\n\t\t\t\t\t\t\t\t\t\tp = ins.get_parent(ref);\n\t\t\t\t\t\t\t\t\t\ti = ref.parent().index() + 1;\n\t\t\t\t\t\t\t\t\t\tc = 'jstree-above';\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tok = true;\n\t\t\t\t\t\t\t\tfor(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) {\n\t\t\t\t\t\t\t\t\top = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? \"copy_node\" : \"move_node\";\n\t\t\t\t\t\t\t\t\tps = i;\n\t\t\t\t\t\t\t\t\tif(op === \"move_node\" && v === 'a' && (data.data.origin && data.data.origin === ins) && p === ins.get_parent(data.data.nodes[t1])) {\n\t\t\t\t\t\t\t\t\t\tpr = ins.get_node(p);\n\t\t\t\t\t\t\t\t\t\tif(ps > $.inArray(data.data.nodes[t1], pr.children)) {\n\t\t\t\t\t\t\t\t\t\t\tps -= 1;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tok = ok && ( (ins && ins.settings && ins.settings.dnd && ins.settings.dnd.check_while_dragging === false) || ins.check(op, (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), p, ps, { 'dnd' : true, 'ref' : ins.get_node(ref.parent()), 'pos' : v, 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }) );\n\t\t\t\t\t\t\t\t\tif(!ok) {\n\t\t\t\t\t\t\t\t\t\tif(ins && ins.last_error) { laster = ins.last_error(); }\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(v === 'i' && ref.parent().is('.jstree-closed') && ins.settings.dnd.open_timeout) {\n\t\t\t\t\t\t\t\t\tif (!data.event || data.event.type !== 'dragover' || isDifferentNode) {\n\t\t\t\t\t\t\t\t\t\tif (opento) { clearTimeout(opento); }\n\t\t\t\t\t\t\t\t\t\topento = setTimeout((function (x, z) { return function () { x.open_node(z); }; }(ins, ref)), ins.settings.dnd.open_timeout);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(ok) {\n\t\t\t\t\t\t\t\t\tpn = ins.get_node(p, true);\n\t\t\t\t\t\t\t\t\tif (!pn.hasClass('.jstree-dnd-parent')) {\n\t\t\t\t\t\t\t\t\t\t$('.jstree-dnd-parent').removeClass('jstree-dnd-parent');\n\t\t\t\t\t\t\t\t\t\tpn.addClass('jstree-dnd-parent');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tlastmv = { 'ins' : ins, 'par' : p, 'pos' : v === 'i' && ip === 'last' && i === 0 && !ins.is_loaded(tm) ? 'last' : i };\n\t\t\t\t\t\t\t\t\tmarker.css({ 'left' : l + 'px', 'top' : t + 'px' }).show();\n\t\t\t\t\t\t\t\t\tmarker.removeClass('jstree-above jstree-inside jstree-below').addClass(c);\n\t\t\t\t\t\t\t\t\tdata.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok');\n\t\t\t\t\t\t\t\t\tif (data.event.originalEvent && data.event.originalEvent.dataTransfer) {\n\t\t\t\t\t\t\t\t\t\tdata.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move';\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tlaster = {};\n\t\t\t\t\t\t\t\t\to = true;\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif(o === true) { return; }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$('.jstree-dnd-parent').removeClass('jstree-dnd-parent');\n\t\t\t\tlastmv = false;\n\t\t\t\tdata.helper.find('.jstree-icon').removeClass('jstree-ok').addClass('jstree-er');\n\t\t\t\tif (data.event.originalEvent && data.event.originalEvent.dataTransfer) {\n\t\t\t\t\t//data.event.originalEvent.dataTransfer.dropEffect = 'none';\n\t\t\t\t}\n\t\t\t\tmarker.hide();\n\t\t\t})\n\t\t\t.on('dnd_scroll.vakata.jstree', function (e, data) {\n\t\t\t\tif(!data || !data.data || !data.data.jstree) { return; }\n\t\t\t\tmarker.hide();\n\t\t\t\tlastmv = false;\n\t\t\t\tlastev = false;\n\t\t\t\tdata.helper.find('.jstree-icon').first().removeClass('jstree-ok').addClass('jstree-er');\n\t\t\t})\n\t\t\t.on('dnd_stop.vakata.jstree', function (e, data) {\n\t\t\t\t$('.jstree-dnd-parent').removeClass('jstree-dnd-parent');\n\t\t\t\tif(opento) { clearTimeout(opento); }\n\t\t\t\tif(!data || !data.data || !data.data.jstree) { return; }\n\t\t\t\tmarker.hide().detach();\n\t\t\t\tvar i, j, nodes = [];\n\t\t\t\tif(lastmv) {\n\t\t\t\t\tfor(i = 0, j = data.data.nodes.length; i < j; i++) {\n\t\t\t\t\t\tnodes[i] = data.data.origin ? data.data.origin.get_node(data.data.nodes[i]) : data.data.nodes[i];\n\t\t\t\t\t}\n\t\t\t\t\tlastmv.ins[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? 'copy_node' : 'move_node' ](nodes, lastmv.par, lastmv.pos, false, false, false, data.data.origin);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ti = $(data.event.target).closest('.jstree');\n\t\t\t\t\tif(i.length && laster && laster.error && laster.error === 'check') {\n\t\t\t\t\t\ti = i.jstree(true);\n\t\t\t\t\t\tif(i) {\n\t\t\t\t\t\t\ti.settings.core.error.call(this, laster);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlastev = false;\n\t\t\t\tlastmv = false;\n\t\t\t})\n\t\t\t.on('keyup.jstree keydown.jstree', function (e, data) {\n\t\t\t\tdata = $.vakata.dnd._get();\n\t\t\t\tif(data && data.data && data.data.jstree) {\n\t\t\t\t\tif (e.type === \"keyup\" && e.which === 27) {\n\t\t\t\t\t\tif (opento) { clearTimeout(opento); }\n\t\t\t\t\t\tlastmv = false;\n\t\t\t\t\t\tlaster = false;\n\t\t\t\t\t\tlastev = false;\n\t\t\t\t\t\topento = false;\n\t\t\t\t\t\tmarker.hide().detach();\n\t\t\t\t\t\t$.vakata.dnd._clean();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdata.helper.find('.jstree-copy').first()[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (e.metaKey || e.ctrlKey))) ? 'show' : 'hide' ]();\n\t\t\t\t\t\tif(lastev) {\n\t\t\t\t\t\t\tlastev.metaKey = e.metaKey;\n\t\t\t\t\t\t\tlastev.ctrlKey = e.ctrlKey;\n\t\t\t\t\t\t\t$.vakata.dnd._trigger('move', lastev);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t});\n\n\t// helpers\n\t(function ($) {\n\t\t$.vakata.html = {\n\t\t\tdiv : $('
          '),\n\t\t\tescape : function (str) {\n\t\t\t\treturn $.vakata.html.div.text(str).html();\n\t\t\t},\n\t\t\tstrip : function (str) {\n\t\t\t\treturn $.vakata.html.div.empty().append($.parseHTML(str)).text();\n\t\t\t}\n\t\t};\n\t\t// private variable\n\t\tvar vakata_dnd = {\n\t\t\telement\t: false,\n\t\t\ttarget\t: false,\n\t\t\tis_down\t: false,\n\t\t\tis_drag\t: false,\n\t\t\thelper\t: false,\n\t\t\thelper_w: 0,\n\t\t\tdata\t: false,\n\t\t\tinit_x\t: 0,\n\t\t\tinit_y\t: 0,\n\t\t\tscroll_l: 0,\n\t\t\tscroll_t: 0,\n\t\t\tscroll_e: false,\n\t\t\tscroll_i: false,\n\t\t\tis_touch: false\n\t\t};\n\t\t$.vakata.dnd = {\n\t\t\tsettings : {\n\t\t\t\tscroll_speed\t\t: 10,\n\t\t\t\tscroll_proximity\t: 20,\n\t\t\t\thelper_left\t\t\t: 5,\n\t\t\t\thelper_top\t\t\t: 10,\n\t\t\t\tthreshold\t\t\t: 5,\n\t\t\t\tthreshold_touch\t\t: 10\n\t\t\t},\n\t\t\t_trigger : function (event_name, e, data) {\n\t\t\t\tif (data === undefined) {\n\t\t\t\t\tdata = $.vakata.dnd._get();\n\t\t\t\t}\n\t\t\t\tdata.event = e;\n\t\t\t\t$(document).triggerHandler(\"dnd_\" + event_name + \".vakata\", data);\n\t\t\t},\n\t\t\t_get : function () {\n\t\t\t\treturn {\n\t\t\t\t\t\"data\"\t\t: vakata_dnd.data,\n\t\t\t\t\t\"element\"\t: vakata_dnd.element,\n\t\t\t\t\t\"helper\"\t: vakata_dnd.helper\n\t\t\t\t};\n\t\t\t},\n\t\t\t_clean : function () {\n\t\t\t\tif(vakata_dnd.helper) { vakata_dnd.helper.remove(); }\n\t\t\t\tif(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; }\n\t\t\t\tvakata_dnd = {\n\t\t\t\t\telement\t: false,\n\t\t\t\t\ttarget\t: false,\n\t\t\t\t\tis_down\t: false,\n\t\t\t\t\tis_drag\t: false,\n\t\t\t\t\thelper\t: false,\n\t\t\t\t\thelper_w: 0,\n\t\t\t\t\tdata\t: false,\n\t\t\t\t\tinit_x\t: 0,\n\t\t\t\t\tinit_y\t: 0,\n\t\t\t\t\tscroll_l: 0,\n\t\t\t\t\tscroll_t: 0,\n\t\t\t\t\tscroll_e: false,\n\t\t\t\t\tscroll_i: false,\n\t\t\t\t\tis_touch: false\n\t\t\t\t};\n\t\t\t\telm = null;\n\t\t\t\t$(document).off(\"mousemove.vakata.jstree touchmove.vakata.jstree\", $.vakata.dnd.drag);\n\t\t\t\t$(document).off(\"mouseup.vakata.jstree touchend.vakata.jstree\", $.vakata.dnd.stop);\n\t\t\t},\n\t\t\t_scroll : function (init_only) {\n\t\t\t\tif(!vakata_dnd.scroll_e || (!vakata_dnd.scroll_l && !vakata_dnd.scroll_t)) {\n\t\t\t\t\tif(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; }\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif(!vakata_dnd.scroll_i) {\n\t\t\t\t\tvakata_dnd.scroll_i = setInterval($.vakata.dnd._scroll, 100);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif(init_only === true) { return false; }\n\n\t\t\t\tvar i = vakata_dnd.scroll_e.scrollTop(),\n\t\t\t\t\tj = vakata_dnd.scroll_e.scrollLeft();\n\t\t\t\tvakata_dnd.scroll_e.scrollTop(i + vakata_dnd.scroll_t * $.vakata.dnd.settings.scroll_speed);\n\t\t\t\tvakata_dnd.scroll_e.scrollLeft(j + vakata_dnd.scroll_l * $.vakata.dnd.settings.scroll_speed);\n\t\t\t\tif(i !== vakata_dnd.scroll_e.scrollTop() || j !== vakata_dnd.scroll_e.scrollLeft()) {\n\t\t\t\t\t/**\n\t\t\t\t\t * triggered on the document when a drag causes an element to scroll\n\t\t\t\t\t * @event\n\t\t\t\t\t * @plugin dnd\n\t\t\t\t\t * @name dnd_scroll.vakata\n\t\t\t\t\t * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start\n\t\t\t\t\t * @param {DOM} element the DOM element being dragged\n\t\t\t\t\t * @param {jQuery} helper the helper shown next to the mouse\n\t\t\t\t\t * @param {jQuery} event the element that is scrolling\n\t\t\t\t\t */\n\t\t\t\t\t$.vakata.dnd._trigger(\"scroll\", vakata_dnd.scroll_e);\n\t\t\t\t}\n\t\t\t},\n\t\t\tstart : function (e, data, html) {\n\t\t\t\tif(e.type === \"touchstart\" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) {\n\t\t\t\t\te.pageX = e.originalEvent.changedTouches[0].pageX;\n\t\t\t\t\te.pageY = e.originalEvent.changedTouches[0].pageY;\n\t\t\t\t\te.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset);\n\t\t\t\t}\n\t\t\t\tif(vakata_dnd.is_drag) { $.vakata.dnd.stop({}); }\n\t\t\t\ttry {\n\t\t\t\t\te.currentTarget.unselectable = \"on\";\n\t\t\t\t\te.currentTarget.onselectstart = function() { return false; };\n\t\t\t\t\tif(e.currentTarget.style) {\n\t\t\t\t\t\te.currentTarget.style.touchAction = \"none\";\n\t\t\t\t\t\te.currentTarget.style.msTouchAction = \"none\";\n\t\t\t\t\t\te.currentTarget.style.MozUserSelect = \"none\";\n\t\t\t\t\t}\n\t\t\t\t} catch(ignore) { }\n\t\t\t\tvakata_dnd.init_x\t= e.pageX;\n\t\t\t\tvakata_dnd.init_y\t= e.pageY;\n\t\t\t\tvakata_dnd.data\t\t= data;\n\t\t\t\tvakata_dnd.is_down\t= true;\n\t\t\t\tvakata_dnd.element\t= e.currentTarget;\n\t\t\t\tvakata_dnd.target\t= e.target;\n\t\t\t\tvakata_dnd.is_touch\t= e.type === \"touchstart\";\n\t\t\t\tif(html !== false) {\n\t\t\t\t\tvakata_dnd.helper = $(\"
          \").html(html).css({\n\t\t\t\t\t\t\"display\"\t\t: \"block\",\n\t\t\t\t\t\t\"margin\"\t\t: \"0\",\n\t\t\t\t\t\t\"padding\"\t\t: \"0\",\n\t\t\t\t\t\t\"position\"\t\t: \"absolute\",\n\t\t\t\t\t\t\"top\"\t\t\t: \"-2000px\",\n\t\t\t\t\t\t\"lineHeight\"\t: \"16px\",\n\t\t\t\t\t\t\"zIndex\"\t\t: \"10000\"\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t$(document).on(\"mousemove.vakata.jstree touchmove.vakata.jstree\", $.vakata.dnd.drag);\n\t\t\t\t$(document).on(\"mouseup.vakata.jstree touchend.vakata.jstree\", $.vakata.dnd.stop);\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\tdrag : function (e) {\n\t\t\t\tif(e.type === \"touchmove\" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) {\n\t\t\t\t\te.pageX = e.originalEvent.changedTouches[0].pageX;\n\t\t\t\t\te.pageY = e.originalEvent.changedTouches[0].pageY;\n\t\t\t\t\te.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset);\n\t\t\t\t}\n\t\t\t\tif(!vakata_dnd.is_down) { return; }\n\t\t\t\tif(!vakata_dnd.is_drag) {\n\t\t\t\t\tif(\n\t\t\t\t\t\tMath.abs(e.pageX - vakata_dnd.init_x) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) ||\n\t\t\t\t\t\tMath.abs(e.pageY - vakata_dnd.init_y) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif(vakata_dnd.helper) {\n\t\t\t\t\t\t\tvakata_dnd.helper.appendTo(document.body);\n\t\t\t\t\t\t\tvakata_dnd.helper_w = vakata_dnd.helper.outerWidth();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvakata_dnd.is_drag = true;\n\t\t\t\t\t\t$(vakata_dnd.target).one('click.vakata', false);\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * triggered on the document when a drag starts\n\t\t\t\t\t\t * @event\n\t\t\t\t\t\t * @plugin dnd\n\t\t\t\t\t\t * @name dnd_start.vakata\n\t\t\t\t\t\t * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start\n\t\t\t\t\t\t * @param {DOM} element the DOM element being dragged\n\t\t\t\t\t\t * @param {jQuery} helper the helper shown next to the mouse\n\t\t\t\t\t\t * @param {Object} event the event that caused the start (probably mousemove)\n\t\t\t\t\t\t */\n\t\t\t\t\t\t$.vakata.dnd._trigger(\"start\", e);\n\t\t\t\t\t}\n\t\t\t\t\telse { return; }\n\t\t\t\t}\n\n\t\t\t\tvar d = false, w = false,\n\t\t\t\t\tdh = false, wh = false,\n\t\t\t\t\tdw = false, ww = false,\n\t\t\t\t\tdt = false, dl = false,\n\t\t\t\t\tht = false, hl = false;\n\n\t\t\t\tvakata_dnd.scroll_t = 0;\n\t\t\t\tvakata_dnd.scroll_l = 0;\n\t\t\t\tvakata_dnd.scroll_e = false;\n\t\t\t\t$($(e.target).parentsUntil(\"body\").addBack().get().reverse())\n\t\t\t\t\t.filter(function () {\n\t\t\t\t\t\treturn\tthis.ownerDocument && (/^auto|scroll$/).test($(this).css(\"overflow\")) &&\n\t\t\t\t\t\t\t\t(this.scrollHeight > this.offsetHeight || this.scrollWidth > this.offsetWidth);\n\t\t\t\t\t})\n\t\t\t\t\t.each(function () {\n\t\t\t\t\t\tvar t = $(this), o = t.offset();\n\t\t\t\t\t\tif(this.scrollHeight > this.offsetHeight) {\n\t\t\t\t\t\t\tif(o.top + t.height() - e.pageY < $.vakata.dnd.settings.scroll_proximity)\t{ vakata_dnd.scroll_t = 1; }\n\t\t\t\t\t\t\tif(e.pageY - o.top < $.vakata.dnd.settings.scroll_proximity)\t\t\t\t{ vakata_dnd.scroll_t = -1; }\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(this.scrollWidth > this.offsetWidth) {\n\t\t\t\t\t\t\tif(o.left + t.width() - e.pageX < $.vakata.dnd.settings.scroll_proximity)\t{ vakata_dnd.scroll_l = 1; }\n\t\t\t\t\t\t\tif(e.pageX - o.left < $.vakata.dnd.settings.scroll_proximity)\t\t\t\t{ vakata_dnd.scroll_l = -1; }\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(vakata_dnd.scroll_t || vakata_dnd.scroll_l) {\n\t\t\t\t\t\t\tvakata_dnd.scroll_e = $(this);\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\tif(!vakata_dnd.scroll_e) {\n\t\t\t\t\td = $(document); w = $(window);\n\t\t\t\t\tdh = d.height(); wh = w.height();\n\t\t\t\t\tdw = d.width(); ww = w.width();\n\t\t\t\t\tdt = d.scrollTop(); dl = d.scrollLeft();\n\t\t\t\t\tif(dh > wh && e.pageY - dt < $.vakata.dnd.settings.scroll_proximity)\t\t{ vakata_dnd.scroll_t = -1; }\n\t\t\t\t\tif(dh > wh && wh - (e.pageY - dt) < $.vakata.dnd.settings.scroll_proximity)\t{ vakata_dnd.scroll_t = 1; }\n\t\t\t\t\tif(dw > ww && e.pageX - dl < $.vakata.dnd.settings.scroll_proximity)\t\t{ vakata_dnd.scroll_l = -1; }\n\t\t\t\t\tif(dw > ww && ww - (e.pageX - dl) < $.vakata.dnd.settings.scroll_proximity)\t{ vakata_dnd.scroll_l = 1; }\n\t\t\t\t\tif(vakata_dnd.scroll_t || vakata_dnd.scroll_l) {\n\t\t\t\t\t\tvakata_dnd.scroll_e = d;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(vakata_dnd.scroll_e) { $.vakata.dnd._scroll(true); }\n\n\t\t\t\tif(vakata_dnd.helper) {\n\t\t\t\t\tht = parseInt(e.pageY + $.vakata.dnd.settings.helper_top, 10);\n\t\t\t\t\thl = parseInt(e.pageX + $.vakata.dnd.settings.helper_left, 10);\n\t\t\t\t\tif(dh && ht + 25 > dh) { ht = dh - 50; }\n\t\t\t\t\tif(dw && hl + vakata_dnd.helper_w > dw) { hl = dw - (vakata_dnd.helper_w + 2); }\n\t\t\t\t\tvakata_dnd.helper.css({\n\t\t\t\t\t\tleft\t: hl + \"px\",\n\t\t\t\t\t\ttop\t\t: ht + \"px\"\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * triggered on the document when a drag is in progress\n\t\t\t\t * @event\n\t\t\t\t * @plugin dnd\n\t\t\t\t * @name dnd_move.vakata\n\t\t\t\t * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start\n\t\t\t\t * @param {DOM} element the DOM element being dragged\n\t\t\t\t * @param {jQuery} helper the helper shown next to the mouse\n\t\t\t\t * @param {Object} event the event that caused this to trigger (most likely mousemove)\n\t\t\t\t */\n\t\t\t\t$.vakata.dnd._trigger(\"move\", e);\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\tstop : function (e) {\n\t\t\t\tif(e.type === \"touchend\" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) {\n\t\t\t\t\te.pageX = e.originalEvent.changedTouches[0].pageX;\n\t\t\t\t\te.pageY = e.originalEvent.changedTouches[0].pageY;\n\t\t\t\t\te.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset);\n\t\t\t\t}\n\t\t\t\tif(vakata_dnd.is_drag) {\n\t\t\t\t\t/**\n\t\t\t\t\t * triggered on the document when a drag stops (the dragged element is dropped)\n\t\t\t\t\t * @event\n\t\t\t\t\t * @plugin dnd\n\t\t\t\t\t * @name dnd_stop.vakata\n\t\t\t\t\t * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start\n\t\t\t\t\t * @param {DOM} element the DOM element being dragged\n\t\t\t\t\t * @param {jQuery} helper the helper shown next to the mouse\n\t\t\t\t\t * @param {Object} event the event that caused the stop\n\t\t\t\t\t */\n\t\t\t\t\tif (e.target !== vakata_dnd.target) {\n\t\t\t\t\t\t$(vakata_dnd.target).off('click.vakata');\n\t\t\t\t\t}\n\t\t\t\t\t$.vakata.dnd._trigger(\"stop\", e);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(e.type === \"touchend\" && e.target === vakata_dnd.target) {\n\t\t\t\t\t\tvar to = setTimeout(function () { $(e.target).trigger('click'); }, 100);\n\t\t\t\t\t\t$(e.target).one('click', function() { if(to) { clearTimeout(to); } });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$.vakata.dnd._clean();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t};\n\t}($));\n\n\t// include the dnd plugin by default\n\t// $.jstree.defaults.plugins.push(\"dnd\");\n\n\n/**\n * ### Massload plugin\n *\n * Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading).\n */\n\n\t/**\n\t * massload configuration\n\t *\n\t * It is possible to set this to a standard jQuery-like AJAX config.\n\t * In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used.\n\t *\n\t * You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result.\n\t *\n\t * Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array.\n\t *\n\t *\t{\n\t *\t\t\"id1\" : [{ \"text\" : \"Child of ID1\", \"id\" : \"c1\" }, { \"text\" : \"Another child of ID1\", \"id\" : \"c2\" }],\n\t *\t\t\"id2\" : [{ \"text\" : \"Child of ID2\", \"id\" : \"c3\" }]\n\t *\t}\n\t * \n\t * @name $.jstree.defaults.massload\n\t * @plugin massload\n\t */\n\t$.jstree.defaults.massload = null;\n\t$.jstree.plugins.massload = function (options, parent) {\n\t\tthis.init = function (el, options) {\n\t\t\tthis._data.massload = {};\n\t\t\tparent.init.call(this, el, options);\n\t\t};\n\t\tthis._load_nodes = function (nodes, callback, is_callback, force_reload) {\n\t\t\tvar s = this.settings.massload,\t\t\t\t\n\t\t\t\ttoLoad = [],\n\t\t\t\tm = this._model.data,\n\t\t\t\ti, j, dom;\n\t\t\tif (!is_callback) {\n\t\t\t\tfor(i = 0, j = nodes.length; i < j; i++) {\n\t\t\t\t\tif(!m[nodes[i]] || ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || force_reload) ) {\n\t\t\t\t\t\ttoLoad.push(nodes[i]);\n\t\t\t\t\t\tdom = this.get_node(nodes[i], true);\n\t\t\t\t\t\tif (dom && dom.length) {\n\t\t\t\t\t\t\tdom.addClass(\"jstree-loading\").attr('aria-busy',true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis._data.massload = {};\n\t\t\t\tif (toLoad.length) {\n\t\t\t\t\tif($.vakata.is_function(s)) {\n\t\t\t\t\t\treturn s.call(this, toLoad, function (data) {\n\t\t\t\t\t\t\tvar i, j;\n\t\t\t\t\t\t\tif(data) {\n\t\t\t\t\t\t\t\tfor(i in data) {\n\t\t\t\t\t\t\t\t\tif(data.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\t\tthis._data.massload[i] = data[i];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfor(i = 0, j = nodes.length; i < j; i++) {\n\t\t\t\t\t\t\t\tdom = this.get_node(nodes[i], true);\n\t\t\t\t\t\t\t\tif (dom && dom.length) {\n\t\t\t\t\t\t\t\t\tdom.removeClass(\"jstree-loading\").attr('aria-busy',false);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tparent._load_nodes.call(this, nodes, callback, is_callback, force_reload);\n\t\t\t\t\t\t}.bind(this));\n\t\t\t\t\t}\n\t\t\t\t\tif(typeof s === 'object' && s && s.url) {\n\t\t\t\t\t\ts = $.extend(true, {}, s);\n\t\t\t\t\t\tif($.vakata.is_function(s.url)) {\n\t\t\t\t\t\t\ts.url = s.url.call(this, toLoad);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($.vakata.is_function(s.data)) {\n\t\t\t\t\t\t\ts.data = s.data.call(this, toLoad);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn $.ajax(s)\n\t\t\t\t\t\t\t.done(function (data,t,x) {\n\t\t\t\t\t\t\t\t\tvar i, j;\n\t\t\t\t\t\t\t\t\tif(data) {\n\t\t\t\t\t\t\t\t\t\tfor(i in data) {\n\t\t\t\t\t\t\t\t\t\t\tif(data.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\t\t\t\tthis._data.massload[i] = data[i];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tfor(i = 0, j = nodes.length; i < j; i++) {\n\t\t\t\t\t\t\t\t\t\tdom = this.get_node(nodes[i], true);\n\t\t\t\t\t\t\t\t\t\tif (dom && dom.length) {\n\t\t\t\t\t\t\t\t\t\t\tdom.removeClass(\"jstree-loading\").attr('aria-busy',false);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tparent._load_nodes.call(this, nodes, callback, is_callback, force_reload);\n\t\t\t\t\t\t\t\t}.bind(this))\n\t\t\t\t\t\t\t.fail(function (f) {\n\t\t\t\t\t\t\t\t\tparent._load_nodes.call(this, nodes, callback, is_callback, force_reload);\n\t\t\t\t\t\t\t\t}.bind(this));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn parent._load_nodes.call(this, nodes, callback, is_callback, force_reload);\n\t\t};\n\t\tthis._load_node = function (obj, callback) {\n\t\t\tvar data = this._data.massload[obj.id],\n\t\t\t\trslt = null, dom;\n\t\t\tif(data) {\n\t\t\t\trslt = this[typeof data === 'string' ? '_append_html_data' : '_append_json_data'](\n\t\t\t\t\tobj,\n\t\t\t\t\ttypeof data === 'string' ? $($.parseHTML(data)).filter(function () { return this.nodeType !== 3; }) : data,\n\t\t\t\t\tfunction (status) { callback.call(this, status); }\n\t\t\t\t);\n\t\t\t\tdom = this.get_node(obj.id, true);\n\t\t\t\tif (dom && dom.length) {\n\t\t\t\t\tdom.removeClass(\"jstree-loading\").attr('aria-busy',false);\n\t\t\t\t}\n\t\t\t\tdelete this._data.massload[obj.id];\n\t\t\t\treturn rslt;\n\t\t\t}\n\t\t\treturn parent._load_node.call(this, obj, callback);\n\t\t};\n\t};\n\n\n/**\n * ### Search plugin\n *\n * Adds search functionality to jsTree.\n */\n\n\t/**\n\t * stores all defaults for the search plugin\n\t * @name $.jstree.defaults.search\n\t * @plugin search\n\t */\n\t$.jstree.defaults.search = {\n\t\t/**\n\t\t * a jQuery-like AJAX config, which jstree uses if a server should be queried for results.\n\t\t *\n\t\t * A `str` (which is the search string) parameter will be added with the request, an optional `inside` parameter will be added if the search is limited to a node id. The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed.\n\t\t * Leave this setting as `false` to not query the server. You can also set this to a function, which will be invoked in the instance's scope and receive 3 parameters - the search string, the callback to call with the array of nodes to load, and the optional node ID to limit the search to\n\t\t * @name $.jstree.defaults.search.ajax\n\t\t * @plugin search\n\t\t */\n\t\tajax : false,\n\t\t/**\n\t\t * Indicates if the search should be fuzzy or not (should `chnd3` match `child node 3`). Default is `false`.\n\t\t * @name $.jstree.defaults.search.fuzzy\n\t\t * @plugin search\n\t\t */\n\t\tfuzzy : false,\n\t\t/**\n\t\t * Indicates if the search should be case sensitive. Default is `false`.\n\t\t * @name $.jstree.defaults.search.case_sensitive\n\t\t * @plugin search\n\t\t */\n\t\tcase_sensitive : false,\n\t\t/**\n\t\t * Indicates if the tree should be filtered (by default) to show only matching nodes (keep in mind this can be a heavy on large trees in old browsers).\n\t\t * This setting can be changed at runtime when calling the search method. Default is `false`.\n\t\t * @name $.jstree.defaults.search.show_only_matches\n\t\t * @plugin search\n\t\t */\n\t\tshow_only_matches : false,\n\t\t/**\n\t\t * Indicates if the children of matched element are shown (when show_only_matches is true)\n\t\t * This setting can be changed at runtime when calling the search method. Default is `false`.\n\t\t * @name $.jstree.defaults.search.show_only_matches_children\n\t\t * @plugin search\n\t\t */\n\t\tshow_only_matches_children : false,\n\t\t/**\n\t\t * Indicates if all nodes opened to reveal the search result, should be closed when the search is cleared or a new search is performed. Default is `true`.\n\t\t * @name $.jstree.defaults.search.close_opened_onclear\n\t\t * @plugin search\n\t\t */\n\t\tclose_opened_onclear : true,\n\t\t/**\n\t\t * Indicates if only leaf nodes should be included in search results. Default is `false`.\n\t\t * @name $.jstree.defaults.search.search_leaves_only\n\t\t * @plugin search\n\t\t */\n\t\tsearch_leaves_only : false,\n\t\t/**\n\t\t * If set to a function it wil be called in the instance's scope with two arguments - search string and node (where node will be every node in the structure, so use with caution).\n\t\t * If the function returns a truthy value the node will be considered a match (it might not be displayed if search_only_leaves is set to true and the node is not a leaf). Default is `false`.\n\t\t * @name $.jstree.defaults.search.search_callback\n\t\t * @plugin search\n\t\t */\n\t\tsearch_callback : false\n\t};\n\n\t$.jstree.plugins.search = function (options, parent) {\n\t\tthis.bind = function () {\n\t\t\tparent.bind.call(this);\n\n\t\t\tthis._data.search.str = \"\";\n\t\t\tthis._data.search.dom = $();\n\t\t\tthis._data.search.res = [];\n\t\t\tthis._data.search.opn = [];\n\t\t\tthis._data.search.som = false;\n\t\t\tthis._data.search.smc = false;\n\t\t\tthis._data.search.hdn = [];\n\n\t\t\tthis.element\n\t\t\t\t.on(\"search.jstree\", function (e, data) {\n\t\t\t\t\t\tif(this._data.search.som && data.res.length) {\n\t\t\t\t\t\t\tvar m = this._model.data, i, j, p = [], k, l;\n\t\t\t\t\t\t\tfor(i = 0, j = data.res.length; i < j; i++) {\n\t\t\t\t\t\t\t\tif(m[data.res[i]] && !m[data.res[i]].state.hidden) {\n\t\t\t\t\t\t\t\t\tp.push(data.res[i]);\n\t\t\t\t\t\t\t\t\tp = p.concat(m[data.res[i]].parents);\n\t\t\t\t\t\t\t\t\tif(this._data.search.smc) {\n\t\t\t\t\t\t\t\t\t\tfor (k = 0, l = m[data.res[i]].children_d.length; k < l; k++) {\n\t\t\t\t\t\t\t\t\t\t\tif (m[m[data.res[i]].children_d[k]] && !m[m[data.res[i]].children_d[k]].state.hidden) {\n\t\t\t\t\t\t\t\t\t\t\t\tp.push(m[data.res[i]].children_d[k]);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tp = $.vakata.array_remove_item($.vakata.array_unique(p), $.jstree.root);\n\t\t\t\t\t\t\tthis._data.search.hdn = this.hide_all(true);\n\t\t\t\t\t\t\tthis.show_node(p, true);\n\t\t\t\t\t\t\tthis.redraw(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"clear_search.jstree\", function (e, data) {\n\t\t\t\t\t\tif(this._data.search.som && data.res.length) {\n\t\t\t\t\t\t\tthis.show_node(this._data.search.hdn, true);\n\t\t\t\t\t\t\tthis.redraw(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this));\n\t\t};\n\t\t/**\n\t\t * used to search the tree nodes for a given string\n\t\t * @name search(str [, skip_async])\n\t\t * @param {String} str the search string\n\t\t * @param {Boolean} skip_async if set to true server will not be queried even if configured\n\t\t * @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers)\n\t\t * @param {mixed} inside an optional node to whose children to limit the search\n\t\t * @param {Boolean} append if set to true the results of this search are appended to the previous search\n\t\t * @plugin search\n\t\t * @trigger search.jstree\n\t\t */\n\t\tthis.search = function (str, skip_async, show_only_matches, inside, append, show_only_matches_children) {\n\t\t\tif(str === false || $.vakata.trim(str.toString()) === \"\") {\n\t\t\t\treturn this.clear_search();\n\t\t\t}\n\t\t\tinside = this.get_node(inside);\n\t\t\tinside = inside && inside.id ? inside.id : null;\n\t\t\tstr = str.toString();\n\t\t\tvar s = this.settings.search,\n\t\t\t\ta = s.ajax ? s.ajax : false,\n\t\t\t\tm = this._model.data,\n\t\t\t\tf = null,\n\t\t\t\tr = [],\n\t\t\t\tp = [], i, j;\n\t\t\tif(this._data.search.res.length && !append) {\n\t\t\t\tthis.clear_search();\n\t\t\t}\n\t\t\tif(show_only_matches === undefined) {\n\t\t\t\tshow_only_matches = s.show_only_matches;\n\t\t\t}\n\t\t\tif(show_only_matches_children === undefined) {\n\t\t\t\tshow_only_matches_children = s.show_only_matches_children;\n\t\t\t}\n\t\t\tif(!skip_async && a !== false) {\n\t\t\t\tif($.vakata.is_function(a)) {\n\t\t\t\t\treturn a.call(this, str, function (d) {\n\t\t\t\t\t\t\tif(d && d.d) { d = d.d; }\n\t\t\t\t\t\t\tthis._load_nodes(!$.vakata.is_array(d) ? [] : $.vakata.array_unique(d), function () {\n\t\t\t\t\t\t\t\tthis.search(str, true, show_only_matches, inside, append, show_only_matches_children);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}.bind(this), inside);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ta = $.extend({}, a);\n\t\t\t\t\tif(!a.data) { a.data = {}; }\n\t\t\t\t\ta.data.str = str;\n\t\t\t\t\tif(inside) {\n\t\t\t\t\t\ta.data.inside = inside;\n\t\t\t\t\t}\n\t\t\t\t\tif (this._data.search.lastRequest) {\n\t\t\t\t\t\tthis._data.search.lastRequest.abort();\n\t\t\t\t\t}\n\t\t\t\t\tthis._data.search.lastRequest = $.ajax(a)\n\t\t\t\t\t\t.fail(function () {\n\t\t\t\t\t\t\tthis._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'search', 'id' : 'search_01', 'reason' : 'Could not load search parents', 'data' : JSON.stringify(a) };\n\t\t\t\t\t\t\tthis.settings.core.error.call(this, this._data.core.last_error);\n\t\t\t\t\t\t}.bind(this))\n\t\t\t\t\t\t.done(function (d) {\n\t\t\t\t\t\t\tif(d && d.d) { d = d.d; }\n\t\t\t\t\t\t\tthis._load_nodes(!$.vakata.is_array(d) ? [] : $.vakata.array_unique(d), function () {\n\t\t\t\t\t\t\t\tthis.search(str, true, show_only_matches, inside, append, show_only_matches_children);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}.bind(this));\n\t\t\t\t\treturn this._data.search.lastRequest;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!append) {\n\t\t\t\tthis._data.search.str = str;\n\t\t\t\tthis._data.search.dom = $();\n\t\t\t\tthis._data.search.res = [];\n\t\t\t\tthis._data.search.opn = [];\n\t\t\t\tthis._data.search.som = show_only_matches;\n\t\t\t\tthis._data.search.smc = show_only_matches_children;\n\t\t\t}\n\n\t\t\tf = new $.vakata.search(str, true, { caseSensitive : s.case_sensitive, fuzzy : s.fuzzy });\n\t\t\t$.each(m[inside ? inside : $.jstree.root].children_d, function (ii, i) {\n\t\t\t\tvar v = m[i];\n\t\t\t\tif(v.text && !v.state.hidden && (!s.search_leaves_only || (v.state.loaded && v.children.length === 0)) && ( (s.search_callback && s.search_callback.call(this, str, v)) || (!s.search_callback && f.search(v.text).isMatch) ) ) {\n\t\t\t\t\tr.push(i);\n\t\t\t\t\tp = p.concat(v.parents);\n\t\t\t\t}\n\t\t\t});\n\t\t\tif(r.length) {\n\t\t\t\tp = $.vakata.array_unique(p);\n\t\t\t\tfor(i = 0, j = p.length; i < j; i++) {\n\t\t\t\t\tif(p[i] !== $.jstree.root && m[p[i]] && this.open_node(p[i], null, 0) === true) {\n\t\t\t\t\t\tthis._data.search.opn.push(p[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(!append) {\n\t\t\t\t\tthis._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return \"0123456789\".indexOf(v[0]) !== -1 ? '\\\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\\\$&') : v.replace($.jstree.idregex,'\\\\$&'); }).join(', #')));\n\t\t\t\t\tthis._data.search.res = r;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis._data.search.dom = this._data.search.dom.add($(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return \"0123456789\".indexOf(v[0]) !== -1 ? '\\\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\\\$&') : v.replace($.jstree.idregex,'\\\\$&'); }).join(', #'))));\n\t\t\t\t\tthis._data.search.res = $.vakata.array_unique(this._data.search.res.concat(r));\n\t\t\t\t}\n\t\t\t\tthis._data.search.dom.children(\".jstree-anchor\").addClass('jstree-search');\n\t\t\t}\n\t\t\t/**\n\t\t\t * triggered after search is complete\n\t\t\t * @event\n\t\t\t * @name search.jstree\n\t\t\t * @param {jQuery} nodes a jQuery collection of matching nodes\n\t\t\t * @param {String} str the search string\n\t\t\t * @param {Array} res a collection of objects represeing the matching nodes\n\t\t\t * @plugin search\n\t\t\t */\n\t\t\tthis.trigger('search', { nodes : this._data.search.dom, str : str, res : this._data.search.res, show_only_matches : show_only_matches });\n\t\t};\n\t\t/**\n\t\t * used to clear the last search (removes classes and shows all nodes if filtering is on)\n\t\t * @name clear_search()\n\t\t * @plugin search\n\t\t * @trigger clear_search.jstree\n\t\t */\n\t\tthis.clear_search = function () {\n\t\t\tif(this.settings.search.close_opened_onclear) {\n\t\t\t\tthis.close_node(this._data.search.opn, 0);\n\t\t\t}\n\t\t\t/**\n\t\t\t * triggered after search is complete\n\t\t\t * @event\n\t\t\t * @name clear_search.jstree\n\t\t\t * @param {jQuery} nodes a jQuery collection of matching nodes (the result from the last search)\n\t\t\t * @param {String} str the search string (the last search string)\n\t\t\t * @param {Array} res a collection of objects represeing the matching nodes (the result from the last search)\n\t\t\t * @plugin search\n\t\t\t */\n\t\t\tthis.trigger('clear_search', { 'nodes' : this._data.search.dom, str : this._data.search.str, res : this._data.search.res });\n\t\t\tif(this._data.search.res.length) {\n\t\t\t\tthis._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(this._data.search.res, function (v) {\n\t\t\t\t\treturn \"0123456789\".indexOf(v[0]) !== -1 ? '\\\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\\\$&') : v.replace($.jstree.idregex,'\\\\$&');\n\t\t\t\t}).join(', #')));\n\t\t\t\tthis._data.search.dom.children(\".jstree-anchor\").removeClass(\"jstree-search\");\n\t\t\t}\n\t\t\tthis._data.search.str = \"\";\n\t\t\tthis._data.search.res = [];\n\t\t\tthis._data.search.opn = [];\n\t\t\tthis._data.search.dom = $();\n\t\t};\n\n\t\tthis.redraw_node = function(obj, deep, callback, force_render) {\n\t\t\tobj = parent.redraw_node.apply(this, arguments);\n\t\t\tif(obj) {\n\t\t\t\tif($.inArray(obj.id, this._data.search.res) !== -1) {\n\t\t\t\t\tvar i, j, tmp = null;\n\t\t\t\t\tfor(i = 0, j = obj.childNodes.length; i < j; i++) {\n\t\t\t\t\t\tif(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf(\"jstree-anchor\") !== -1) {\n\t\t\t\t\t\t\ttmp = obj.childNodes[i];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(tmp) {\n\t\t\t\t\t\ttmp.className += ' jstree-search';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn obj;\n\t\t};\n\t};\n\n\t// helpers\n\t(function ($) {\n\t\t// from http://kiro.me/projects/fuse.html\n\t\t$.vakata.search = function(pattern, txt, options) {\n\t\t\toptions = options || {};\n\t\t\toptions = $.extend({}, $.vakata.search.defaults, options);\n\t\t\tif(options.fuzzy !== false) {\n\t\t\t\toptions.fuzzy = true;\n\t\t\t}\n\t\t\tpattern = options.caseSensitive ? pattern : pattern.toLowerCase();\n\t\t\tvar MATCH_LOCATION\t= options.location,\n\t\t\t\tMATCH_DISTANCE\t= options.distance,\n\t\t\t\tMATCH_THRESHOLD\t= options.threshold,\n\t\t\t\tpatternLen = pattern.length,\n\t\t\t\tmatchmask, pattern_alphabet, match_bitapScore, search;\n\t\t\tif(patternLen > 32) {\n\t\t\t\toptions.fuzzy = false;\n\t\t\t}\n\t\t\tif(options.fuzzy) {\n\t\t\t\tmatchmask = 1 << (patternLen - 1);\n\t\t\t\tpattern_alphabet = (function () {\n\t\t\t\t\tvar mask = {},\n\t\t\t\t\t\ti = 0;\n\t\t\t\t\tfor (i = 0; i < patternLen; i++) {\n\t\t\t\t\t\tmask[pattern.charAt(i)] = 0;\n\t\t\t\t\t}\n\t\t\t\t\tfor (i = 0; i < patternLen; i++) {\n\t\t\t\t\t\tmask[pattern.charAt(i)] |= 1 << (patternLen - i - 1);\n\t\t\t\t\t}\n\t\t\t\t\treturn mask;\n\t\t\t\t}());\n\t\t\t\tmatch_bitapScore = function (e, x) {\n\t\t\t\t\tvar accuracy = e / patternLen,\n\t\t\t\t\t\tproximity = Math.abs(MATCH_LOCATION - x);\n\t\t\t\t\tif(!MATCH_DISTANCE) {\n\t\t\t\t\t\treturn proximity ? 1.0 : accuracy;\n\t\t\t\t\t}\n\t\t\t\t\treturn accuracy + (proximity / MATCH_DISTANCE);\n\t\t\t\t};\n\t\t\t}\n\t\t\tsearch = function (text) {\n\t\t\t\ttext = options.caseSensitive ? text.toString() : text.toString().toLowerCase();\n\t\t\t\tif(pattern === text || text.indexOf(pattern) !== -1) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisMatch: true,\n\t\t\t\t\t\tscore: 0\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif(!options.fuzzy) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisMatch: false,\n\t\t\t\t\t\tscore: 1\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tvar i, j,\n\t\t\t\t\ttextLen = text.length,\n\t\t\t\t\tscoreThreshold = MATCH_THRESHOLD,\n\t\t\t\t\tbestLoc = text.indexOf(pattern, MATCH_LOCATION),\n\t\t\t\t\tbinMin, binMid,\n\t\t\t\t\tbinMax = patternLen + textLen,\n\t\t\t\t\tlastRd, start, finish, rd, charMatch,\n\t\t\t\t\tscore = 1,\n\t\t\t\t\tlocations = [];\n\t\t\t\tif (bestLoc !== -1) {\n\t\t\t\t\tscoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold);\n\t\t\t\t\tbestLoc = text.lastIndexOf(pattern, MATCH_LOCATION + patternLen);\n\t\t\t\t\tif (bestLoc !== -1) {\n\t\t\t\t\t\tscoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbestLoc = -1;\n\t\t\t\tfor (i = 0; i < patternLen; i++) {\n\t\t\t\t\tbinMin = 0;\n\t\t\t\t\tbinMid = binMax;\n\t\t\t\t\twhile (binMin < binMid) {\n\t\t\t\t\t\tif (match_bitapScore(i, MATCH_LOCATION + binMid) <= scoreThreshold) {\n\t\t\t\t\t\t\tbinMin = binMid;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbinMax = binMid;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbinMid = Math.floor((binMax - binMin) / 2 + binMin);\n\t\t\t\t\t}\n\t\t\t\t\tbinMax = binMid;\n\t\t\t\t\tstart = Math.max(1, MATCH_LOCATION - binMid + 1);\n\t\t\t\t\tfinish = Math.min(MATCH_LOCATION + binMid, textLen) + patternLen;\n\t\t\t\t\trd = new Array(finish + 2);\n\t\t\t\t\trd[finish + 1] = (1 << i) - 1;\n\t\t\t\t\tfor (j = finish; j >= start; j--) {\n\t\t\t\t\t\tcharMatch = pattern_alphabet[text.charAt(j - 1)];\n\t\t\t\t\t\tif (i === 0) {\n\t\t\t\t\t\t\trd[j] = ((rd[j + 1] << 1) | 1) & charMatch;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trd[j] = ((rd[j + 1] << 1) | 1) & charMatch | (((lastRd[j + 1] | lastRd[j]) << 1) | 1) | lastRd[j + 1];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (rd[j] & matchmask) {\n\t\t\t\t\t\t\tscore = match_bitapScore(i, j - 1);\n\t\t\t\t\t\t\tif (score <= scoreThreshold) {\n\t\t\t\t\t\t\t\tscoreThreshold = score;\n\t\t\t\t\t\t\t\tbestLoc = j - 1;\n\t\t\t\t\t\t\t\tlocations.push(bestLoc);\n\t\t\t\t\t\t\t\tif (bestLoc > MATCH_LOCATION) {\n\t\t\t\t\t\t\t\t\tstart = Math.max(1, 2 * MATCH_LOCATION - bestLoc);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (match_bitapScore(i + 1, MATCH_LOCATION) > scoreThreshold) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tlastRd = rd;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tisMatch: bestLoc >= 0,\n\t\t\t\t\tscore: score\n\t\t\t\t};\n\t\t\t};\n\t\t\treturn txt === true ? { 'search' : search } : search(txt);\n\t\t};\n\t\t$.vakata.search.defaults = {\n\t\t\tlocation : 0,\n\t\t\tdistance : 100,\n\t\t\tthreshold : 0.6,\n\t\t\tfuzzy : false,\n\t\t\tcaseSensitive : false\n\t\t};\n\t}($));\n\n\t// include the search plugin by default\n\t// $.jstree.defaults.plugins.push(\"search\");\n\n\n/**\n * ### Sort plugin\n *\n * Automatically sorts all siblings in the tree according to a sorting function.\n */\n\n\t/**\n\t * the settings function used to sort the nodes.\n\t * It is executed in the tree's context, accepts two nodes as arguments and should return `1` or `-1`.\n\t * @name $.jstree.defaults.sort\n\t * @plugin sort\n\t */\n\t$.jstree.defaults.sort = function (a, b) {\n\t\t//return this.get_type(a) === this.get_type(b) ? (this.get_text(a) > this.get_text(b) ? 1 : -1) : this.get_type(a) >= this.get_type(b);\n\t\treturn this.get_text(a) > this.get_text(b) ? 1 : -1;\n\t};\n\t$.jstree.plugins.sort = function (options, parent) {\n\t\tthis.bind = function () {\n\t\t\tparent.bind.call(this);\n\t\t\tthis.element\n\t\t\t\t.on(\"model.jstree\", function (e, data) {\n\t\t\t\t\t\tthis.sort(data.parent, true);\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"rename_node.jstree create_node.jstree\", function (e, data) {\n\t\t\t\t\t\tthis.sort(data.parent || data.node.parent, false);\n\t\t\t\t\t\tthis.redraw_node(data.parent || data.node.parent, true);\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"move_node.jstree copy_node.jstree\", function (e, data) {\n\t\t\t\t\t\tthis.sort(data.parent, false);\n\t\t\t\t\t\tthis.redraw_node(data.parent, true);\n\t\t\t\t\t}.bind(this));\n\t\t};\n\t\t/**\n\t\t * used to sort a node's children\n\t\t * @private\n\t\t * @name sort(obj [, deep])\n\t\t * @param {mixed} obj the node\n\t\t * @param {Boolean} deep if set to `true` nodes are sorted recursively.\n\t\t * @plugin sort\n\t\t * @trigger search.jstree\n\t\t */\n\t\tthis.sort = function (obj, deep) {\n\t\t\tvar i, j;\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(obj && obj.children && obj.children.length) {\n\t\t\t\tobj.children.sort(this.settings.sort.bind(this));\n\t\t\t\tif(deep) {\n\t\t\t\t\tfor(i = 0, j = obj.children_d.length; i < j; i++) {\n\t\t\t\t\t\tthis.sort(obj.children_d[i], false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t};\n\n\t// include the sort plugin by default\n\t// $.jstree.defaults.plugins.push(\"sort\");\n\n/**\n * ### State plugin\n *\n * Saves the state of the tree (selected nodes, opened nodes) on the user's computer using available options (localStorage, cookies, etc)\n */\n\n\tvar to = false;\n\t/**\n\t * stores all defaults for the state plugin\n\t * @name $.jstree.defaults.state\n\t * @plugin state\n\t */\n\t$.jstree.defaults.state = {\n\t\t/**\n\t\t * A string for the key to use when saving the current tree (change if using multiple trees in your project). Defaults to `jstree`.\n\t\t * @name $.jstree.defaults.state.key\n\t\t * @plugin state\n\t\t */\n\t\tkey\t\t: 'jstree',\n\t\t/**\n\t\t * A space separated list of events that trigger a state save. Defaults to `changed.jstree open_node.jstree close_node.jstree`.\n\t\t * @name $.jstree.defaults.state.events\n\t\t * @plugin state\n\t\t */\n\t\tevents\t: 'changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree',\n\t\t/**\n\t\t * Time in milliseconds after which the state will expire. Defaults to 'false' meaning - no expire.\n\t\t * @name $.jstree.defaults.state.ttl\n\t\t * @plugin state\n\t\t */\n\t\tttl\t\t: false,\n\t\t/**\n\t\t * A function that will be executed prior to restoring state with one argument - the state object. Can be used to clear unwanted parts of the state.\n\t\t * @name $.jstree.defaults.state.filter\n\t\t * @plugin state\n\t\t */\n\t\tfilter\t: false,\n\t\t/**\n\t\t * Should loaded nodes be restored (setting this to true means that it is possible that the whole tree will be loaded for some users - use with caution). Defaults to `false`\n\t\t * @name $.jstree.defaults.state.preserve_loaded\n\t\t * @plugin state\n\t\t */\n\t\tpreserve_loaded : false\n\t};\n\t$.jstree.plugins.state = function (options, parent) {\n\t\tthis.bind = function () {\n\t\t\tparent.bind.call(this);\n\t\t\tvar bind = function () {\n\t\t\t\tthis.element.on(this.settings.state.events, function () {\n\t\t\t\t\tif(to) { clearTimeout(to); }\n\t\t\t\t\tto = setTimeout(function () { this.save_state(); }.bind(this), 100);\n\t\t\t\t}.bind(this));\n\t\t\t\t/**\n\t\t\t\t * triggered when the state plugin is finished restoring the state (and immediately after ready if there is no state to restore).\n\t\t\t\t * @event\n\t\t\t\t * @name state_ready.jstree\n\t\t\t\t * @plugin state\n\t\t\t\t */\n\t\t\t\tthis.trigger('state_ready');\n\t\t\t}.bind(this);\n\t\t\tthis.element\n\t\t\t\t.on(\"ready.jstree\", function (e, data) {\n\t\t\t\t\t\tthis.element.one(\"restore_state.jstree\", bind);\n\t\t\t\t\t\tif(!this.restore_state()) { bind(); }\n\t\t\t\t\t}.bind(this));\n\t\t};\n\t\t/**\n\t\t * save the state\n\t\t * @name save_state()\n\t\t * @plugin state\n\t\t */\n\t\tthis.save_state = function () {\n\t\t\tvar tm = this.get_state();\n\t\t\tif (!this.settings.state.preserve_loaded) {\n\t\t\t\tdelete tm.core.loaded;\n\t\t\t}\n\t\t\tvar st = { 'state' : tm, 'ttl' : this.settings.state.ttl, 'sec' : +(new Date()) };\n\t\t\t$.vakata.storage.set(this.settings.state.key, JSON.stringify(st));\n\t\t};\n\t\t/**\n\t\t * restore the state from the user's computer\n\t\t * @name restore_state()\n\t\t * @plugin state\n\t\t */\n\t\tthis.restore_state = function () {\n\t\t\tvar k = $.vakata.storage.get(this.settings.state.key);\n\t\t\tif(!!k) { try { k = JSON.parse(k); } catch(ex) { return false; } }\n\t\t\tif(!!k && k.ttl && k.sec && +(new Date()) - k.sec > k.ttl) { return false; }\n\t\t\tif(!!k && k.state) { k = k.state; }\n\t\t\tif(!!k && $.vakata.is_function(this.settings.state.filter)) { k = this.settings.state.filter.call(this, k); }\n\t\t\tif(!!k) {\n\t\t\t\tif (!this.settings.state.preserve_loaded) {\n\t\t\t\t\tdelete k.core.loaded;\n\t\t\t\t}\n\t\t\t\tthis.element.one(\"set_state.jstree\", function (e, data) { data.instance.trigger('restore_state', { 'state' : $.extend(true, {}, k) }); });\n\t\t\t\tthis.set_state(k);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\t\t/**\n\t\t * clear the state on the user's computer\n\t\t * @name clear_state()\n\t\t * @plugin state\n\t\t */\n\t\tthis.clear_state = function () {\n\t\t\treturn $.vakata.storage.del(this.settings.state.key);\n\t\t};\n\t};\n\n\t(function ($, undefined) {\n\t\t$.vakata.storage = {\n\t\t\t// simply specifying the functions in FF throws an error\n\t\t\tset : function (key, val) { return window.localStorage.setItem(key, val); },\n\t\t\tget : function (key) { return window.localStorage.getItem(key); },\n\t\t\tdel : function (key) { return window.localStorage.removeItem(key); }\n\t\t};\n\t}($));\n\n\t// include the state plugin by default\n\t// $.jstree.defaults.plugins.push(\"state\");\n\n/**\n * ### Types plugin\n *\n * Makes it possible to add predefined types for groups of nodes, which make it possible to easily control nesting rules and icon for each group.\n */\n\n\t/**\n\t * An object storing all types as key value pairs, where the key is the type name and the value is an object that could contain following keys (all optional).\n\t *\n\t * * `max_children` the maximum number of immediate children this node type can have. Do not specify or set to `-1` for unlimited.\n\t * * `max_depth` the maximum number of nesting this node type can have. A value of `1` would mean that the node can have children, but no grandchildren. Do not specify or set to `-1` for unlimited.\n\t * * `valid_children` an array of node type strings, that nodes of this type can have as children. Do not specify or set to `-1` for no limits.\n\t * * `icon` a string - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class. Omit to use the default icon from your theme.\n\t * * `li_attr` an object of values which will be used to add HTML attributes on the resulting LI DOM node (merged with the node's own data)\n\t * * `a_attr` an object of values which will be used to add HTML attributes on the resulting A DOM node (merged with the node's own data)\n\t *\n\t * There are two predefined types:\n\t *\n\t * * `#` represents the root of the tree, for example `max_children` would control the maximum number of root nodes.\n\t * * `default` represents the default node - any settings here will be applied to all nodes that do not have a type specified.\n\t *\n\t * @name $.jstree.defaults.types\n\t * @plugin types\n\t */\n\t$.jstree.defaults.types = {\n\t\t'default' : {}\n\t};\n\t$.jstree.defaults.types[$.jstree.root] = {};\n\n\t$.jstree.plugins.types = function (options, parent) {\n\t\tthis.init = function (el, options) {\n\t\t\tvar i, j;\n\t\t\tif(options && options.types && options.types['default']) {\n\t\t\t\tfor(i in options.types) {\n\t\t\t\t\tif(i !== \"default\" && i !== $.jstree.root && options.types.hasOwnProperty(i)) {\n\t\t\t\t\t\tfor(j in options.types['default']) {\n\t\t\t\t\t\t\tif(options.types['default'].hasOwnProperty(j) && options.types[i][j] === undefined) {\n\t\t\t\t\t\t\t\toptions.types[i][j] = options.types['default'][j];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tparent.init.call(this, el, options);\n\t\t\tthis._model.data[$.jstree.root].type = $.jstree.root;\n\t\t};\n\t\tthis.refresh = function (skip_loading, forget_state) {\n\t\t\tparent.refresh.call(this, skip_loading, forget_state);\n\t\t\tthis._model.data[$.jstree.root].type = $.jstree.root;\n\t\t};\n\t\tthis.bind = function () {\n\t\t\tthis.element\n\t\t\t\t.on('model.jstree', function (e, data) {\n\t\t\t\t\t\tvar m = this._model.data,\n\t\t\t\t\t\t\tdpc = data.nodes,\n\t\t\t\t\t\t\tt = this.settings.types,\n\t\t\t\t\t\t\ti, j, c = 'default', k;\n\t\t\t\t\t\tfor(i = 0, j = dpc.length; i < j; i++) {\n\t\t\t\t\t\t\tc = 'default';\n\t\t\t\t\t\t\tif(m[dpc[i]].original && m[dpc[i]].original.type && t[m[dpc[i]].original.type]) {\n\t\t\t\t\t\t\t\tc = m[dpc[i]].original.type;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(m[dpc[i]].data && m[dpc[i]].data.jstree && m[dpc[i]].data.jstree.type && t[m[dpc[i]].data.jstree.type]) {\n\t\t\t\t\t\t\t\tc = m[dpc[i]].data.jstree.type;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tm[dpc[i]].type = c;\n\t\t\t\t\t\t\tif(m[dpc[i]].icon === true && t[c].icon !== undefined) {\n\t\t\t\t\t\t\t\tm[dpc[i]].icon = t[c].icon;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(t[c].li_attr !== undefined && typeof t[c].li_attr === 'object') {\n\t\t\t\t\t\t\t\tfor (k in t[c].li_attr) {\n\t\t\t\t\t\t\t\t\tif (t[c].li_attr.hasOwnProperty(k)) {\n\t\t\t\t\t\t\t\t\t\tif (k === 'id') {\n\t\t\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse if (m[dpc[i]].li_attr[k] === undefined) {\n\t\t\t\t\t\t\t\t\t\t\tm[dpc[i]].li_attr[k] = t[c].li_attr[k];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse if (k === 'class') {\n\t\t\t\t\t\t\t\t\t\t\tm[dpc[i]].li_attr['class'] = t[c].li_attr['class'] + ' ' + m[dpc[i]].li_attr['class'];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(t[c].a_attr !== undefined && typeof t[c].a_attr === 'object') {\n\t\t\t\t\t\t\t\tfor (k in t[c].a_attr) {\n\t\t\t\t\t\t\t\t\tif (t[c].a_attr.hasOwnProperty(k)) {\n\t\t\t\t\t\t\t\t\t\tif (k === 'id') {\n\t\t\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse if (m[dpc[i]].a_attr[k] === undefined) {\n\t\t\t\t\t\t\t\t\t\t\tm[dpc[i]].a_attr[k] = t[c].a_attr[k];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse if (k === 'href' && m[dpc[i]].a_attr[k] === '#') {\n\t\t\t\t\t\t\t\t\t\t\tm[dpc[i]].a_attr['href'] = t[c].a_attr['href'];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\telse if (k === 'class') {\n\t\t\t\t\t\t\t\t\t\t\tm[dpc[i]].a_attr['class'] = t[c].a_attr['class'] + ' ' + m[dpc[i]].a_attr['class'];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tm[$.jstree.root].type = $.jstree.root;\n\t\t\t\t\t}.bind(this));\n\t\t\tparent.bind.call(this);\n\t\t};\n\t\tthis.get_json = function (obj, options, flat) {\n\t\t\tvar i, j,\n\t\t\t\tm = this._model.data,\n\t\t\t\topt = options ? $.extend(true, {}, options, {no_id:false}) : {},\n\t\t\t\ttmp = parent.get_json.call(this, obj, opt, flat);\n\t\t\tif(tmp === false) { return false; }\n\t\t\tif($.vakata.is_array(tmp)) {\n\t\t\t\tfor(i = 0, j = tmp.length; i < j; i++) {\n\t\t\t\t\ttmp[i].type = tmp[i].id && m[tmp[i].id] && m[tmp[i].id].type ? m[tmp[i].id].type : \"default\";\n\t\t\t\t\tif(options && options.no_id) {\n\t\t\t\t\t\tdelete tmp[i].id;\n\t\t\t\t\t\tif(tmp[i].li_attr && tmp[i].li_attr.id) {\n\t\t\t\t\t\t\tdelete tmp[i].li_attr.id;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(tmp[i].a_attr && tmp[i].a_attr.id) {\n\t\t\t\t\t\t\tdelete tmp[i].a_attr.id;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttmp.type = tmp.id && m[tmp.id] && m[tmp.id].type ? m[tmp.id].type : \"default\";\n\t\t\t\tif(options && options.no_id) {\n\t\t\t\t\ttmp = this._delete_ids(tmp);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tmp;\n\t\t};\n\t\tthis._delete_ids = function (tmp) {\n\t\t\tif($.vakata.is_array(tmp)) {\n\t\t\t\tfor(var i = 0, j = tmp.length; i < j; i++) {\n\t\t\t\t\ttmp[i] = this._delete_ids(tmp[i]);\n\t\t\t\t}\n\t\t\t\treturn tmp;\n\t\t\t}\n\t\t\tdelete tmp.id;\n\t\t\tif(tmp.li_attr && tmp.li_attr.id) {\n\t\t\t\tdelete tmp.li_attr.id;\n\t\t\t}\n\t\t\tif(tmp.a_attr && tmp.a_attr.id) {\n\t\t\t\tdelete tmp.a_attr.id;\n\t\t\t}\n\t\t\tif(tmp.children && $.vakata.is_array(tmp.children)) {\n\t\t\t\ttmp.children = this._delete_ids(tmp.children);\n\t\t\t}\n\t\t\treturn tmp;\n\t\t};\n\t\tthis.check = function (chk, obj, par, pos, more) {\n\t\t\tif(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; }\n\t\t\tobj = obj && obj.id ? obj : this.get_node(obj);\n\t\t\tpar = par && par.id ? par : this.get_node(par);\n\t\t\tvar m = obj && obj.id ? (more && more.origin ? more.origin : $.jstree.reference(obj.id)) : null, tmp, d, i, j;\n\t\t\tm = m && m._model && m._model.data ? m._model.data : null;\n\t\t\tswitch(chk) {\n\t\t\t\tcase \"create_node\":\n\t\t\t\tcase \"move_node\":\n\t\t\t\tcase \"copy_node\":\n\t\t\t\t\tif(chk !== 'move_node' || $.inArray(obj.id, par.children) === -1) {\n\t\t\t\t\t\ttmp = this.get_rules(par);\n\t\t\t\t\t\tif(tmp.max_children !== undefined && tmp.max_children !== -1 && tmp.max_children === par.children.length) {\n\t\t\t\t\t\t\tthis._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_01', 'reason' : 'max_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(tmp.valid_children !== undefined && tmp.valid_children !== -1 && $.inArray((obj.type || 'default'), tmp.valid_children) === -1) {\n\t\t\t\t\t\t\tthis._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_02', 'reason' : 'valid_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(m && obj.children_d && obj.parents) {\n\t\t\t\t\t\t\td = 0;\n\t\t\t\t\t\t\tfor(i = 0, j = obj.children_d.length; i < j; i++) {\n\t\t\t\t\t\t\t\td = Math.max(d, m[obj.children_d[i]].parents.length);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\td = d - obj.parents.length + 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(d <= 0 || d === undefined) { d = 1; }\n\t\t\t\t\t\tdo {\n\t\t\t\t\t\t\tif(tmp.max_depth !== undefined && tmp.max_depth !== -1 && tmp.max_depth < d) {\n\t\t\t\t\t\t\t\tthis._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_03', 'reason' : 'max_depth prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpar = this.get_node(par.parent);\n\t\t\t\t\t\t\ttmp = this.get_rules(par);\n\t\t\t\t\t\t\td++;\n\t\t\t\t\t\t} while(par);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\t/**\n\t\t * used to retrieve the type settings object for a node\n\t\t * @name get_rules(obj)\n\t\t * @param {mixed} obj the node to find the rules for\n\t\t * @return {Object}\n\t\t * @plugin types\n\t\t */\n\t\tthis.get_rules = function (obj) {\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!obj) { return false; }\n\t\t\tvar tmp = this.get_type(obj, true);\n\t\t\tif(tmp.max_depth === undefined) { tmp.max_depth = -1; }\n\t\t\tif(tmp.max_children === undefined) { tmp.max_children = -1; }\n\t\t\tif(tmp.valid_children === undefined) { tmp.valid_children = -1; }\n\t\t\treturn tmp;\n\t\t};\n\t\t/**\n\t\t * used to retrieve the type string or settings object for a node\n\t\t * @name get_type(obj [, rules])\n\t\t * @param {mixed} obj the node to find the rules for\n\t\t * @param {Boolean} rules if set to `true` instead of a string the settings object will be returned\n\t\t * @return {String|Object}\n\t\t * @plugin types\n\t\t */\n\t\tthis.get_type = function (obj, rules) {\n\t\t\tobj = this.get_node(obj);\n\t\t\treturn (!obj) ? false : ( rules ? $.extend({ 'type' : obj.type }, this.settings.types[obj.type]) : obj.type);\n\t\t};\n\t\t/**\n\t\t * used to change a node's type\n\t\t * @name set_type(obj, type)\n\t\t * @param {mixed} obj the node to change\n\t\t * @param {String} type the new type\n\t\t * @plugin types\n\t\t */\n\t\tthis.set_type = function (obj, type) {\n\t\t\tvar m = this._model.data, t, t1, t2, old_type, old_icon, k, d, a;\n\t\t\tif($.vakata.is_array(obj)) {\n\t\t\t\tobj = obj.slice();\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\n\t\t\t\t\tthis.set_type(obj[t1], type);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tt = this.settings.types;\n\t\t\tobj = this.get_node(obj);\n\t\t\tif(!t[type] || !obj) { return false; }\n\t\t\td = this.get_node(obj, true);\n\t\t\tif (d && d.length) {\n\t\t\t\ta = d.children('.jstree-anchor');\n\t\t\t}\n\t\t\told_type = obj.type;\n\t\t\told_icon = this.get_icon(obj);\n\t\t\tobj.type = type;\n\t\t\tif(old_icon === true || !t[old_type] || (t[old_type].icon !== undefined && old_icon === t[old_type].icon)) {\n\t\t\t\tthis.set_icon(obj, t[type].icon !== undefined ? t[type].icon : true);\n\t\t\t}\n\n\t\t\t// remove old type props\n\t\t\tif(t[old_type] && t[old_type].li_attr !== undefined && typeof t[old_type].li_attr === 'object') {\n\t\t\t\tfor (k in t[old_type].li_attr) {\n\t\t\t\t\tif (t[old_type].li_attr.hasOwnProperty(k)) {\n\t\t\t\t\t\tif (k === 'id') {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (k === 'class') {\n\t\t\t\t\t\t\tm[obj.id].li_attr['class'] = (m[obj.id].li_attr['class'] || '').replace(t[old_type].li_attr[k], '');\n\t\t\t\t\t\t\tif (d) { d.removeClass(t[old_type].li_attr[k]); }\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (m[obj.id].li_attr[k] === t[old_type].li_attr[k]) {\n\t\t\t\t\t\t\tm[obj.id].li_attr[k] = null;\n\t\t\t\t\t\t\tif (d) { d.removeAttr(k); }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t[old_type] && t[old_type].a_attr !== undefined && typeof t[old_type].a_attr === 'object') {\n\t\t\t\tfor (k in t[old_type].a_attr) {\n\t\t\t\t\tif (t[old_type].a_attr.hasOwnProperty(k)) {\n\t\t\t\t\t\tif (k === 'id') {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (k === 'class') {\n\t\t\t\t\t\t\tm[obj.id].a_attr['class'] = (m[obj.id].a_attr['class'] || '').replace(t[old_type].a_attr[k], '');\n\t\t\t\t\t\t\tif (a) { a.removeClass(t[old_type].a_attr[k]); }\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (m[obj.id].a_attr[k] === t[old_type].a_attr[k]) {\n\t\t\t\t\t\t\tif (k === 'href') {\n\t\t\t\t\t\t\t\tm[obj.id].a_attr[k] = '#';\n\t\t\t\t\t\t\t\tif (a) { a.attr('href', '#'); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tdelete m[obj.id].a_attr[k];\n\t\t\t\t\t\t\t\tif (a) { a.removeAttr(k); }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// add new props\n\t\t\tif(t[type].li_attr !== undefined && typeof t[type].li_attr === 'object') {\n\t\t\t\tfor (k in t[type].li_attr) {\n\t\t\t\t\tif (t[type].li_attr.hasOwnProperty(k)) {\n\t\t\t\t\t\tif (k === 'id') {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (m[obj.id].li_attr[k] === undefined) {\n\t\t\t\t\t\t\tm[obj.id].li_attr[k] = t[type].li_attr[k];\n\t\t\t\t\t\t\tif (d) {\n\t\t\t\t\t\t\t\tif (k === 'class') {\n\t\t\t\t\t\t\t\t\td.addClass(t[type].li_attr[k]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\td.attr(k, t[type].li_attr[k]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (k === 'class') {\n\t\t\t\t\t\t\tm[obj.id].li_attr['class'] = t[type].li_attr[k] + ' ' + m[obj.id].li_attr['class'];\n\t\t\t\t\t\t\tif (d) { d.addClass(t[type].li_attr[k]); }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t[type].a_attr !== undefined && typeof t[type].a_attr === 'object') {\n\t\t\t\tfor (k in t[type].a_attr) {\n\t\t\t\t\tif (t[type].a_attr.hasOwnProperty(k)) {\n\t\t\t\t\t\tif (k === 'id') {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (m[obj.id].a_attr[k] === undefined) {\n\t\t\t\t\t\t\tm[obj.id].a_attr[k] = t[type].a_attr[k];\n\t\t\t\t\t\t\tif (a) {\n\t\t\t\t\t\t\t\tif (k === 'class') {\n\t\t\t\t\t\t\t\t\ta.addClass(t[type].a_attr[k]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\ta.attr(k, t[type].a_attr[k]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (k === 'href' && m[obj.id].a_attr[k] === '#') {\n\t\t\t\t\t\t\tm[obj.id].a_attr['href'] = t[type].a_attr['href'];\n\t\t\t\t\t\t\tif (a) { a.attr('href', t[type].a_attr['href']); }\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (k === 'class') {\n\t\t\t\t\t\t\tm[obj.id].a_attr['class'] = t[type].a_attr['class'] + ' ' + m[obj.id].a_attr['class'];\n\t\t\t\t\t\t\tif (a) { a.addClass(t[type].a_attr[k]); }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true;\n\t\t};\n\t};\n\t// include the types plugin by default\n\t// $.jstree.defaults.plugins.push(\"types\");\n\n\n/**\n * ### Unique plugin\n *\n * Enforces that no nodes with the same name can coexist as siblings.\n */\n\n\t/**\n\t * stores all defaults for the unique plugin\n\t * @name $.jstree.defaults.unique\n\t * @plugin unique\n\t */\n\t$.jstree.defaults.unique = {\n\t\t/**\n\t\t * Indicates if the comparison should be case sensitive. Default is `false`.\n\t\t * @name $.jstree.defaults.unique.case_sensitive\n\t\t * @plugin unique\n\t\t */\n\t\tcase_sensitive : false,\n\t\t/**\n\t\t * Indicates if white space should be trimmed before the comparison. Default is `false`.\n\t\t * @name $.jstree.defaults.unique.trim_whitespace\n\t\t * @plugin unique\n\t\t */\n\t\ttrim_whitespace : false,\n\t\t/**\n\t\t * A callback executed in the instance's scope when a new node is created with no name and a node with the default name already exists, the two arguments are the conflicting name and the counter. The default will produce results like `New node (2)`.\n\t\t * @name $.jstree.defaults.unique.duplicate\n\t\t * @plugin unique\n\t\t */\n\t\tduplicate : function (name, counter) {\n\t\t\treturn name + ' (' + counter + ')';\n\t\t}\n\t};\n\n\t$.jstree.plugins.unique = function (options, parent) {\n\t\tthis.check = function (chk, obj, par, pos, more) {\n\t\t\tif(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; }\n\t\t\tobj = obj && obj.id ? obj : this.get_node(obj);\n\t\t\tpar = par && par.id ? par : this.get_node(par);\n\t\t\tif(!par || !par.children) { return true; }\n\t\t\tvar n = chk === \"rename_node\" ? pos : obj.text,\n\t\t\t\tc = [],\n\t\t\t\ts = this.settings.unique.case_sensitive,\n\t\t\t\tw = this.settings.unique.trim_whitespace,\n\t\t\t\tm = this._model.data, i, j, t;\n\t\t\tfor(i = 0, j = par.children.length; i < j; i++) {\n\t\t\t\tt = m[par.children[i]].text;\n\t\t\t\tif (!s) {\n\t\t\t\t\tt = t.toLowerCase();\n\t\t\t\t}\n\t\t\t\tif (w) {\n\t\t\t\t\tt = t.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\t\t\t\t}\n\t\t\t\tc.push(t);\n\t\t\t}\n\t\t\tif(!s) { n = n.toLowerCase(); }\n\t\t\tif (w) { n = n.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, ''); }\n\t\t\tswitch(chk) {\n\t\t\t\tcase \"delete_node\":\n\t\t\t\t\treturn true;\n\t\t\t\tcase \"rename_node\":\n\t\t\t\t\tt = obj.text || '';\n\t\t\t\t\tif (!s) {\n\t\t\t\t\t\tt = t.toLowerCase();\n\t\t\t\t\t}\n\t\t\t\t\tif (w) {\n\t\t\t\t\t\tt = t.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\t\t\t\t\t}\n\t\t\t\t\ti = ($.inArray(n, c) === -1 || (obj.text && t === n));\n\t\t\t\t\tif(!i) {\n\t\t\t\t\t\tthis._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_01', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };\n\t\t\t\t\t}\n\t\t\t\t\treturn i;\n\t\t\t\tcase \"create_node\":\n\t\t\t\t\ti = ($.inArray(n, c) === -1);\n\t\t\t\t\tif(!i) {\n\t\t\t\t\t\tthis._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_04', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };\n\t\t\t\t\t}\n\t\t\t\t\treturn i;\n\t\t\t\tcase \"copy_node\":\n\t\t\t\t\ti = ($.inArray(n, c) === -1);\n\t\t\t\t\tif(!i) {\n\t\t\t\t\t\tthis._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_02', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };\n\t\t\t\t\t}\n\t\t\t\t\treturn i;\n\t\t\t\tcase \"move_node\":\n\t\t\t\t\ti = ( (obj.parent === par.id && (!more || !more.is_multi)) || $.inArray(n, c) === -1);\n\t\t\t\t\tif(!i) {\n\t\t\t\t\t\tthis._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_03', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };\n\t\t\t\t\t}\n\t\t\t\t\treturn i;\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\tthis.create_node = function (par, node, pos, callback, is_loaded) {\n\t\t\tif(!node || (typeof node === 'object' && node.text === undefined)) {\n\t\t\t\tif(par === null) {\n\t\t\t\t\tpar = $.jstree.root;\n\t\t\t\t}\n\t\t\t\tpar = this.get_node(par);\n\t\t\t\tif(!par) {\n\t\t\t\t\treturn parent.create_node.call(this, par, node, pos, callback, is_loaded);\n\t\t\t\t}\n\t\t\t\tpos = pos === undefined ? \"last\" : pos;\n\t\t\t\tif(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {\n\t\t\t\t\treturn parent.create_node.call(this, par, node, pos, callback, is_loaded);\n\t\t\t\t}\n\t\t\t\tif(!node) { node = {}; }\n\t\t\t\tvar tmp, n, dpc, i, j, m = this._model.data, s = this.settings.unique.case_sensitive, w = this.settings.unique.trim_whitespace, cb = this.settings.unique.duplicate, t;\n\t\t\t\tn = tmp = this.get_string('New node');\n\t\t\t\tdpc = [];\n\t\t\t\tfor(i = 0, j = par.children.length; i < j; i++) {\n\t\t\t\t\tt = m[par.children[i]].text;\n\t\t\t\t\tif (!s) {\n\t\t\t\t\t\tt = t.toLowerCase();\n\t\t\t\t\t}\n\t\t\t\t\tif (w) {\n\t\t\t\t\t\tt = t.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\t\t\t\t\t}\n\t\t\t\t\tdpc.push(t);\n\t\t\t\t}\n\t\t\t\ti = 1;\n\t\t\t\tt = n;\n\t\t\t\tif (!s) {\n\t\t\t\t\tt = t.toLowerCase();\n\t\t\t\t}\n\t\t\t\tif (w) {\n\t\t\t\t\tt = t.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\t\t\t\t}\n\t\t\t\twhile($.inArray(t, dpc) !== -1) {\n\t\t\t\t\tn = cb.call(this, tmp, (++i)).toString();\n\t\t\t\t\tt = n;\n\t\t\t\t\tif (!s) {\n\t\t\t\t\t\tt = t.toLowerCase();\n\t\t\t\t\t}\n\t\t\t\t\tif (w) {\n\t\t\t\t\t\tt = t.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnode.text = n;\n\t\t\t}\n\t\t\treturn parent.create_node.call(this, par, node, pos, callback, is_loaded);\n\t\t};\n\t};\n\n\t// include the unique plugin by default\n\t// $.jstree.defaults.plugins.push(\"unique\");\n\n\n/**\n * ### Wholerow plugin\n *\n * Makes each node appear block level. Making selection easier. May cause slow down for large trees in old browsers.\n */\n\n\tvar div = document.createElement('DIV');\n\tdiv.setAttribute('unselectable','on');\n\tdiv.setAttribute('role','presentation');\n\tdiv.className = 'jstree-wholerow';\n\tdiv.innerHTML = ' ';\n\t$.jstree.plugins.wholerow = function (options, parent) {\n\t\tthis.bind = function () {\n\t\t\tparent.bind.call(this);\n\n\t\t\tthis.element\n\t\t\t\t.on('ready.jstree set_state.jstree', function () {\n\t\t\t\t\t\tthis.hide_dots();\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"init.jstree loading.jstree ready.jstree\", function () {\n\t\t\t\t\t\t//div.style.height = this._data.core.li_height + 'px';\n\t\t\t\t\t\tthis.get_container_ul().addClass('jstree-wholerow-ul');\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"deselect_all.jstree\", function (e, data) {\n\t\t\t\t\t\tthis.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked');\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"changed.jstree\", function (e, data) {\n\t\t\t\t\t\tthis.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked');\n\t\t\t\t\t\tvar tmp = false, i, j;\n\t\t\t\t\t\tfor(i = 0, j = data.selected.length; i < j; i++) {\n\t\t\t\t\t\t\ttmp = this.get_node(data.selected[i], true);\n\t\t\t\t\t\t\tif(tmp && tmp.length) {\n\t\t\t\t\t\t\t\ttmp.children('.jstree-wholerow').addClass('jstree-wholerow-clicked');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"open_node.jstree\", function (e, data) {\n\t\t\t\t\t\tthis.get_node(data.node, true).find('.jstree-clicked').parent().children('.jstree-wholerow').addClass('jstree-wholerow-clicked');\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"hover_node.jstree dehover_node.jstree\", function (e, data) {\n\t\t\t\t\t\tif(e.type === \"hover_node\" && this.is_disabled(data.node)) { return; }\n\t\t\t\t\t\tthis.get_node(data.node, true).children('.jstree-wholerow')[e.type === \"hover_node\"?\"addClass\":\"removeClass\"]('jstree-wholerow-hovered');\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"contextmenu.jstree\", \".jstree-wholerow\", function (e) {\n\t\t\t\t\t\tif (this._data.contextmenu) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tvar tmp = $.Event('contextmenu', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey, pageX : e.pageX, pageY : e.pageY });\n\t\t\t\t\t\t\t$(e.currentTarget).closest(\".jstree-node\").children(\".jstree-anchor\").first().trigger(tmp);\n\t\t\t\t\t\t}\n\t\t\t\t\t}.bind(this))\n\t\t\t\t/*!\n\t\t\t\t.on(\"mousedown.jstree touchstart.jstree\", \".jstree-wholerow\", function (e) {\n\t\t\t\t\t\tif(e.target === e.currentTarget) {\n\t\t\t\t\t\t\tvar a = $(e.currentTarget).closest(\".jstree-node\").children(\".jstree-anchor\");\n\t\t\t\t\t\t\te.target = a[0];\n\t\t\t\t\t\t\ta.trigger(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t*/\n\t\t\t\t.on(\"click.jstree\", \".jstree-wholerow\", function (e) {\n\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\tvar tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });\n\t\t\t\t\t\t$(e.currentTarget).closest(\".jstree-node\").children(\".jstree-anchor\").first().trigger(tmp).trigger('focus');\n\t\t\t\t\t})\n\t\t\t\t.on(\"dblclick.jstree\", \".jstree-wholerow\", function (e) {\n\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\tvar tmp = $.Event('dblclick', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });\n\t\t\t\t\t\t$(e.currentTarget).closest(\".jstree-node\").children(\".jstree-anchor\").first().trigger(tmp).trigger('focus');\n\t\t\t\t\t})\n\t\t\t\t.on(\"click.jstree\", \".jstree-leaf > .jstree-ocl\", function (e) {\n\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\tvar tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });\n\t\t\t\t\t\t$(e.currentTarget).closest(\".jstree-node\").children(\".jstree-anchor\").first().trigger(tmp).trigger('focus');\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"mouseover.jstree\", \".jstree-wholerow, .jstree-icon\", function (e) {\n\t\t\t\t\t\te.stopImmediatePropagation();\n\t\t\t\t\t\tif(!this.is_disabled(e.currentTarget)) {\n\t\t\t\t\t\t\tthis.hover_node(e.currentTarget);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}.bind(this))\n\t\t\t\t.on(\"mouseleave.jstree\", \".jstree-node\", function (e) {\n\t\t\t\t\t\tthis.dehover_node(e.currentTarget);\n\t\t\t\t\t}.bind(this));\n\t\t};\n\t\tthis.teardown = function () {\n\t\t\tif(this.settings.wholerow) {\n\t\t\t\tthis.element.find(\".jstree-wholerow\").remove();\n\t\t\t}\n\t\t\tparent.teardown.call(this);\n\t\t};\n\t\tthis.redraw_node = function(obj, deep, callback, force_render) {\n\t\t\tobj = parent.redraw_node.apply(this, arguments);\n\t\t\tif(obj) {\n\t\t\t\tvar tmp = div.cloneNode(true);\n\t\t\t\t//tmp.style.height = this._data.core.li_height + 'px';\n\t\t\t\tif($.inArray(obj.id, this._data.core.selected) !== -1) { tmp.className += ' jstree-wholerow-clicked'; }\n\t\t\t\tif(this._data.core.focused && this._data.core.focused === obj.id) { tmp.className += ' jstree-wholerow-hovered'; }\n\t\t\t\tobj.insertBefore(tmp, obj.childNodes[0]);\n\t\t\t}\n\t\t\treturn obj;\n\t\t};\n\t};\n\t// include the wholerow plugin by default\n\t// $.jstree.defaults.plugins.push(\"wholerow\");\n\tif(window.customElements && Object && Object.create) {\n\t\tvar proto = Object.create(HTMLElement.prototype);\n\t\tproto.createdCallback = function () {\n\t\t\tvar c = { core : {}, plugins : [] }, i;\n\t\t\tfor(i in $.jstree.plugins) {\n\t\t\t\tif($.jstree.plugins.hasOwnProperty(i) && this.attributes[i]) {\n\t\t\t\t\tc.plugins.push(i);\n\t\t\t\t\tif(this.getAttribute(i) && JSON.parse(this.getAttribute(i))) {\n\t\t\t\t\t\tc[i] = JSON.parse(this.getAttribute(i));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(i in $.jstree.defaults.core) {\n\t\t\t\tif($.jstree.defaults.core.hasOwnProperty(i) && this.attributes[i]) {\n\t\t\t\t\tc.core[i] = JSON.parse(this.getAttribute(i)) || this.getAttribute(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$(this).jstree(c);\n\t\t};\n\t\t// proto.attributeChangedCallback = function (name, previous, value) { };\n\t\ttry {\n\t\t\twindow.customElements.define(\"vakata-jstree\", function() {}, { prototype: proto });\n\t\t} catch (ignore) { }\n\t}\n\n}));//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvanN0cmVlL2Rpc3QvanN0cmVlLmpzLmpzIiwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBLEtBQUssSUFBMEM7QUFDL0MsRUFBRSxpQ0FBTyxDQUFDLDJDQUFRLENBQUMsb0NBQUUsT0FBTztBQUFBO0FBQUE7QUFBQSxrR0FBQztBQUM3QjtBQUNBLE1BQU0sRUFLSjtBQUNGLENBQU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ZXJ0eShpKSAmJiB0aGlzLmF0dHJpYnV0ZXNbaV0pIHtcblx0XHRcdFx0XHRjLnBsdWdpbnMucHVzaChpKTtcblx0XHRcdFx0XHRpZih0aGlzLmdldEF0dHJpYnV0ZShpKSAmJiBKU09OLnBhcnNlKHRoaXMuZ2V0QXR0cmlidXRlKGkpKSkge1xuXHRcdFx0XHRcdFx0Y1tpXSA9IEpTT04ucGFyc2UodGhpcy5nZXRBdHRyaWJ1dGUoaSkpO1xuXHRcdFx0XHRcdH1cblx0XHRcdFx0fVxuXHRcdFx0fVxuXHRcdFx0Zm9yKGkgaW4gJC5qc3RyZWUuZGVmYXVsdHMuY29yZSkge1xuXHRcdFx0XHRpZigkLmpzdHJlZS5kZWZhdWx0cy5jb3JlLmhhc093blByb3BlcnR5KGkpICYmIHRoaXMuYXR0cmlidXRlc1tpXSkge1xuXHRcdFx0XHRcdGMuY29yZVtpXSA9IEpTT04ucGFyc2UodGhpcy5nZXRBdHRyaWJ1dGUoaSkpIHx8IHRoaXMuZ2V0QXR0cmlidXRlKGkpO1xuXHRcdFx0XHR9XG5cdFx0XHR9XG5cdFx0XHQkKHRoaXMpLmpzdHJlZShjKTtcblx0XHR9O1xuXHRcdC8vIHByb3RvLmF0dHJpYnV0ZUNoYW5nZWRDYWxsYmFjayA9IGZ1bmN0aW9uIChuYW1lLCBwcmV2aW91cywgdmFsdWUpIHsgfTtcblx0XHR0cnkge1xuXHRcdFx0d2luZG93LmN1c3RvbUVsZW1lbnRzLmRlZmluZShcInZha2F0YS1qc3RyZWVcIiwgZnVuY3Rpb24oKSB7fSwgeyBwcm90b3R5cGU6IHByb3RvIH0pO1xuXHRcdH0gY2F0Y2ggKGlnbm9yZSkgeyB9XG5cdH1cblxufSkpOyJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./node_modules/jstree/dist/jstree.js\n"); - -/***/ }), - -/***/ "jquery": -/*!*************************!*\ - !*** external "jQuery" ***! - \*************************/ -/***/ (function(module) { - -"use strict"; -module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__; - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module can't be inlined because the eval-source-map devtool is used. -/******/ var __webpack_exports__ = __webpack_require__("./libs/jstree/jstree.js"); -/******/ -/******/ return __webpack_exports__; -/******/ })() -; -}); \ No newline at end of file + + /** + * ### jsTree core functionality + */ + + // internal variables + var instance_counter = 0, + ccp_node = false, + ccp_mode = false, + ccp_inst = false, + themes_loaded = [], + src = $('script:last').attr('src'), + document = window.document; // local variable is always faster to access then a global + + /** + * holds all jstree related functions and variables, including the actual class and methods to create, access and manipulate instances. + * @name $.jstree + */ + $.jstree = { + /** + * specifies the jstree version in use + * @name $.jstree.version + */ + version : '3.3.7', + /** + * holds all the default options used when creating new instances + * @name $.jstree.defaults + */ + defaults : { + /** + * configure which plugins will be active on an instance. Should be an array of strings, where each element is a plugin name. The default is `[]` + * @name $.jstree.defaults.plugins + */ + plugins : [] + }, + /** + * stores all loaded jstree plugins (used internally) + * @name $.jstree.plugins + */ + plugins : {}, + path : src && src.indexOf('/') !== -1 ? src.replace(/\/[^\/]+$/,'') : '', + idregex : /[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g, + root : '#' + }; + + /** + * creates a jstree instance + * @name $.jstree.create(el [, options]) + * @param {DOMElement|jQuery|String} el the element to create the instance on, can be jQuery extended or a selector + * @param {Object} options options for this instance (extends `$.jstree.defaults`) + * @return {jsTree} the new instance + */ + $.jstree.create = function (el, options) { + var tmp = new $.jstree.core(++instance_counter), + opt = options; + options = $.extend(true, {}, $.jstree.defaults, options); + if(opt && opt.plugins) { + options.plugins = opt.plugins; + } + $.each(options.plugins, function (i, k) { + if(i !== 'core') { + tmp = tmp.plugin(k, options[k]); + } + }); + $(el).data('jstree', tmp); + tmp.init(el, options); + return tmp; + }; + /** + * remove all traces of jstree from the DOM and destroy all instances + * @name $.jstree.destroy() + */ + $.jstree.destroy = function () { + $('.jstree:jstree').jstree('destroy'); + $(document).off('.jstree'); + }; + /** + * the jstree class constructor, used only internally + * @private + * @name $.jstree.core(id) + * @param {Number} id this instance's index + */ + $.jstree.core = function (id) { + this._id = id; + this._cnt = 0; + this._wrk = null; + this._data = { + core : { + themes : { + name : false, + dots : false, + icons : false, + ellipsis : false + }, + selected : [], + last_error : {}, + working : false, + worker_queue : [], + focused : null + } + }; + }; + /** + * get a reference to an existing instance + * + * __Examples__ + * + * // provided a container with an ID of "tree", and a nested node with an ID of "branch" + * // all of there will return the same instance + * $.jstree.reference('tree'); + * $.jstree.reference('#tree'); + * $.jstree.reference($('#tree')); + * $.jstree.reference(document.getElementByID('tree')); + * $.jstree.reference('branch'); + * $.jstree.reference('#branch'); + * $.jstree.reference($('#branch')); + * $.jstree.reference(document.getElementByID('branch')); + * + * @name $.jstree.reference(needle) + * @param {DOMElement|jQuery|String} needle + * @return {jsTree|null} the instance or `null` if not found + */ + $.jstree.reference = function (needle) { + var tmp = null, + obj = null; + if(needle && needle.id && (!needle.tagName || !needle.nodeType)) { needle = needle.id; } + + if(!obj || !obj.length) { + try { obj = $(needle); } catch (ignore) { } + } + if(!obj || !obj.length) { + try { obj = $('#' + needle.replace($.jstree.idregex,'\\$&')); } catch (ignore) { } + } + if(obj && obj.length && (obj = obj.closest('.jstree')).length && (obj = obj.data('jstree'))) { + tmp = obj; + } + else { + $('.jstree').each(function () { + var inst = $(this).data('jstree'); + if(inst && inst._model.data[needle]) { + tmp = inst; + return false; + } + }); + } + return tmp; + }; + /** + * Create an instance, get an instance or invoke a command on a instance. + * + * If there is no instance associated with the current node a new one is created and `arg` is used to extend `$.jstree.defaults` for this new instance. There would be no return value (chaining is not broken). + * + * If there is an existing instance and `arg` is a string the command specified by `arg` is executed on the instance, with any additional arguments passed to the function. If the function returns a value it will be returned (chaining could break depending on function). + * + * If there is an existing instance and `arg` is not a string the instance itself is returned (similar to `$.jstree.reference`). + * + * In any other case - nothing is returned and chaining is not broken. + * + * __Examples__ + * + * $('#tree1').jstree(); // creates an instance + * $('#tree2').jstree({ plugins : [] }); // create an instance with some options + * $('#tree1').jstree('open_node', '#branch_1'); // call a method on an existing instance, passing additional arguments + * $('#tree2').jstree(); // get an existing instance (or create an instance) + * $('#tree2').jstree(true); // get an existing instance (will not create new instance) + * $('#branch_1').jstree().select_node('#branch_1'); // get an instance (using a nested element and call a method) + * + * @name $().jstree([arg]) + * @param {String|Object} arg + * @return {Mixed} + */ + $.fn.jstree = function (arg) { + // check for string argument + var is_method = (typeof arg === 'string'), + args = Array.prototype.slice.call(arguments, 1), + result = null; + if(arg === true && !this.length) { return false; } + this.each(function () { + // get the instance (if there is one) and method (if it exists) + var instance = $.jstree.reference(this), + method = is_method && instance ? instance[arg] : null; + // if calling a method, and method is available - execute on the instance + result = is_method && method ? + method.apply(instance, args) : + null; + // if there is no instance and no method is being called - create one + if(!instance && !is_method && (arg === undefined || $.isPlainObject(arg))) { + $.jstree.create(this, arg); + } + // if there is an instance and no method is called - return the instance + if( (instance && !is_method) || arg === true ) { + result = instance || false; + } + // if there was a method call which returned a result - break and return the value + if(result !== null && result !== undefined) { + return false; + } + }); + // if there was a method call with a valid return value - return that, otherwise continue the chain + return result !== null && result !== undefined ? + result : this; + }; + /** + * used to find elements containing an instance + * + * __Examples__ + * + * $('div:jstree').each(function () { + * $(this).jstree('destroy'); + * }); + * + * @name $(':jstree') + * @return {jQuery} + */ + $.expr.pseudos.jstree = $.expr.createPseudo(function(search) { + return function(a) { + return $(a).hasClass('jstree') && + $(a).data('jstree') !== undefined; + }; + }); + + /** + * stores all defaults for the core + * @name $.jstree.defaults.core + */ + $.jstree.defaults.core = { + /** + * data configuration + * + * If left as `false` the HTML inside the jstree container element is used to populate the tree (that should be an unordered list with list items). + * + * You can also pass in a HTML string or a JSON array here. + * + * It is possible to pass in a standard jQuery-like AJAX config and jstree will automatically determine if the response is JSON or HTML and use that to populate the tree. + * In addition to the standard jQuery ajax options here you can suppy functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node is being loaded, the return value of those functions will be used. + * + * The last option is to specify a function, that function will receive the node being loaded as argument and a second param which is a function which should be called with the result. + * + * __Examples__ + * + * // AJAX + * $('#tree').jstree({ + * 'core' : { + * 'data' : { + * 'url' : '/get/children/', + * 'data' : function (node) { + * return { 'id' : node.id }; + * } + * } + * }); + * + * // direct data + * $('#tree').jstree({ + * 'core' : { + * 'data' : [ + * 'Simple root node', + * { + * 'id' : 'node_2', + * 'text' : 'Root node with options', + * 'state' : { 'opened' : true, 'selected' : true }, + * 'children' : [ { 'text' : 'Child 1' }, 'Child 2'] + * } + * ] + * } + * }); + * + * // function + * $('#tree').jstree({ + * 'core' : { + * 'data' : function (obj, callback) { + * callback.call(this, ['Root 1', 'Root 2']); + * } + * }); + * + * @name $.jstree.defaults.core.data + */ + data : false, + /** + * configure the various strings used throughout the tree + * + * You can use an object where the key is the string you need to replace and the value is your replacement. + * Another option is to specify a function which will be called with an argument of the needed string and should return the replacement. + * If left as `false` no replacement is made. + * + * __Examples__ + * + * $('#tree').jstree({ + * 'core' : { + * 'strings' : { + * 'Loading ...' : 'Please wait ...' + * } + * } + * }); + * + * @name $.jstree.defaults.core.strings + */ + strings : false, + /** + * determines what happens when a user tries to modify the structure of the tree + * If left as `false` all operations like create, rename, delete, move or copy are prevented. + * You can set this to `true` to allow all interactions or use a function to have better control. + * + * __Examples__ + * + * $('#tree').jstree({ + * 'core' : { + * 'check_callback' : function (operation, node, node_parent, node_position, more) { + * // operation can be 'create_node', 'rename_node', 'delete_node', 'move_node', 'copy_node' or 'edit' + * // in case of 'rename_node' node_position is filled with the new node name + * return operation === 'rename_node' ? true : false; + * } + * } + * }); + * + * @name $.jstree.defaults.core.check_callback + */ + check_callback : false, + /** + * a callback called with a single object parameter in the instance's scope when something goes wrong (operation prevented, ajax failed, etc) + * @name $.jstree.defaults.core.error + */ + error : $.noop, + /** + * the open / close animation duration in milliseconds - set this to `false` to disable the animation (default is `200`) + * @name $.jstree.defaults.core.animation + */ + animation : 200, + /** + * a boolean indicating if multiple nodes can be selected + * @name $.jstree.defaults.core.multiple + */ + multiple : true, + /** + * theme configuration object + * @name $.jstree.defaults.core.themes + */ + themes : { + /** + * the name of the theme to use (if left as `false` the default theme is used) + * @name $.jstree.defaults.core.themes.name + */ + name : false, + /** + * the URL of the theme's CSS file, leave this as `false` if you have manually included the theme CSS (recommended). You can set this to `true` too which will try to autoload the theme. + * @name $.jstree.defaults.core.themes.url + */ + url : false, + /** + * the location of all jstree themes - only used if `url` is set to `true` + * @name $.jstree.defaults.core.themes.dir + */ + dir : false, + /** + * a boolean indicating if connecting dots are shown + * @name $.jstree.defaults.core.themes.dots + */ + dots : true, + /** + * a boolean indicating if node icons are shown + * @name $.jstree.defaults.core.themes.icons + */ + icons : true, + /** + * a boolean indicating if node ellipsis should be shown - this only works with a fixed with on the container + * @name $.jstree.defaults.core.themes.ellipsis + */ + ellipsis : false, + /** + * a boolean indicating if the tree background is striped + * @name $.jstree.defaults.core.themes.stripes + */ + stripes : false, + /** + * a string (or boolean `false`) specifying the theme variant to use (if the theme supports variants) + * @name $.jstree.defaults.core.themes.variant + */ + variant : false, + /** + * a boolean specifying if a reponsive version of the theme should kick in on smaller screens (if the theme supports it). Defaults to `false`. + * @name $.jstree.defaults.core.themes.responsive + */ + responsive : false + }, + /** + * if left as `true` all parents of all selected nodes will be opened once the tree loads (so that all selected nodes are visible to the user) + * @name $.jstree.defaults.core.expand_selected_onload + */ + expand_selected_onload : true, + /** + * if left as `true` web workers will be used to parse incoming JSON data where possible, so that the UI will not be blocked by large requests. Workers are however about 30% slower. Defaults to `true` + * @name $.jstree.defaults.core.worker + */ + worker : true, + /** + * Force node text to plain text (and escape HTML). Defaults to `false` + * @name $.jstree.defaults.core.force_text + */ + force_text : false, + /** + * Should the node be toggled if the text is double clicked. Defaults to `true` + * @name $.jstree.defaults.core.dblclick_toggle + */ + dblclick_toggle : true, + /** + * Should the loaded nodes be part of the state. Defaults to `false` + * @name $.jstree.defaults.core.loaded_state + */ + loaded_state : false, + /** + * Should the last active node be focused when the tree container is blurred and the focused again. This helps working with screen readers. Defaults to `true` + * @name $.jstree.defaults.core.restore_focus + */ + restore_focus : true, + /** + * Default keyboard shortcuts (an object where each key is the button name or combo - like 'enter', 'ctrl-space', 'p', etc and the value is the function to execute in the instance's scope) + * @name $.jstree.defaults.core.keyboard + */ + keyboard : { + 'ctrl-space': function (e) { + // aria defines space only with Ctrl + e.type = "click"; + $(e.currentTarget).trigger(e); + }, + 'enter': function (e) { + // enter + e.type = "click"; + $(e.currentTarget).trigger(e); + }, + 'left': function (e) { + // left + e.preventDefault(); + if(this.is_open(e.currentTarget)) { + this.close_node(e.currentTarget); + } + else { + var o = this.get_parent(e.currentTarget); + if(o && o.id !== $.jstree.root) { this.get_node(o, true).children('.jstree-anchor').focus(); } + } + }, + 'up': function (e) { + // up + e.preventDefault(); + var o = this.get_prev_dom(e.currentTarget); + if(o && o.length) { o.children('.jstree-anchor').focus(); } + }, + 'right': function (e) { + // right + e.preventDefault(); + if(this.is_closed(e.currentTarget)) { + this.open_node(e.currentTarget, function (o) { this.get_node(o, true).children('.jstree-anchor').focus(); }); + } + else if (this.is_open(e.currentTarget)) { + var o = this.get_node(e.currentTarget, true).children('.jstree-children')[0]; + if(o) { $(this._firstChild(o)).children('.jstree-anchor').focus(); } + } + }, + 'down': function (e) { + // down + e.preventDefault(); + var o = this.get_next_dom(e.currentTarget); + if(o && o.length) { o.children('.jstree-anchor').focus(); } + }, + '*': function (e) { + // aria defines * on numpad as open_all - not very common + this.open_all(); + }, + 'home': function (e) { + // home + e.preventDefault(); + var o = this._firstChild(this.get_container_ul()[0]); + if(o) { $(o).children('.jstree-anchor').filter(':visible').focus(); } + }, + 'end': function (e) { + // end + e.preventDefault(); + this.element.find('.jstree-anchor').filter(':visible').last().focus(); + }, + 'f2': function (e) { + // f2 - safe to include - if check_callback is false it will fail + e.preventDefault(); + this.edit(e.currentTarget); + } + } + }; + $.jstree.core.prototype = { + /** + * used to decorate an instance with a plugin. Used internally. + * @private + * @name plugin(deco [, opts]) + * @param {String} deco the plugin to decorate with + * @param {Object} opts options for the plugin + * @return {jsTree} + */ + plugin : function (deco, opts) { + var Child = $.jstree.plugins[deco]; + if(Child) { + this._data[deco] = {}; + Child.prototype = this; + return new Child(opts, this); + } + return this; + }, + /** + * initialize the instance. Used internally. + * @private + * @name init(el, optons) + * @param {DOMElement|jQuery|String} el the element we are transforming + * @param {Object} options options for this instance + * @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree + */ + init : function (el, options) { + this._model = { + data : {}, + changed : [], + force_full_redraw : false, + redraw_timeout : false, + default_state : { + loaded : true, + opened : false, + selected : false, + disabled : false + } + }; + this._model.data[$.jstree.root] = { + id : $.jstree.root, + parent : null, + parents : [], + children : [], + children_d : [], + state : { loaded : false } + }; + + this.element = $(el).addClass('jstree jstree-' + this._id); + this.settings = options; + + this._data.core.ready = false; + this._data.core.loaded = false; + this._data.core.rtl = (this.element.css("direction") === "rtl"); + this.element[this._data.core.rtl ? 'addClass' : 'removeClass']("jstree-rtl"); + this.element.attr('role','tree'); + if(this.settings.core.multiple) { + this.element.attr('aria-multiselectable', true); + } + if(!this.element.attr('tabindex')) { + this.element.attr('tabindex','0'); + } + + this.bind(); + /** + * triggered after all events are bound + * @event + * @name init.jstree + */ + this.trigger("init"); + + this._data.core.original_container_html = this.element.find(" > ul > li").clone(true); + this._data.core.original_container_html + .find("li").addBack() + .contents().filter(function() { + return this.nodeType === 3 && (!this.nodeValue || /^\s+$/.test(this.nodeValue)); + }) + .remove(); + this.element.html("<"+"ul class='jstree-container-ul jstree-children' role='group'><"+"li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><"+"a class='jstree-anchor' href='#'>" + this.get_string("Loading ...") + "
        • "); + this.element.attr('aria-activedescendant','j' + this._id + '_loading'); + this._data.core.li_height = this.get_container_ul().children("li").first().outerHeight() || 24; + this._data.core.node = this._create_prototype_node(); + /** + * triggered after the loading text is shown and before loading starts + * @event + * @name loading.jstree + */ + this.trigger("loading"); + this.load_node($.jstree.root); + }, + /** + * destroy an instance + * @name destroy() + * @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact + */ + destroy : function (keep_html) { + /** + * triggered before the tree is destroyed + * @event + * @name destroy.jstree + */ + this.trigger("destroy"); + if(this._wrk) { + try { + window.URL.revokeObjectURL(this._wrk); + this._wrk = null; + } + catch (ignore) { } + } + if(!keep_html) { this.element.empty(); } + this.teardown(); + }, + /** + * Create a prototype node + * @name _create_prototype_node() + * @return {DOMElement} + */ + _create_prototype_node : function () { + var _node = document.createElement('LI'), _temp1, _temp2; + _node.setAttribute('role', 'treeitem'); + _temp1 = document.createElement('I'); + _temp1.className = 'jstree-icon jstree-ocl'; + _temp1.setAttribute('role', 'presentation'); + _node.appendChild(_temp1); + _temp1 = document.createElement('A'); + _temp1.className = 'jstree-anchor'; + _temp1.setAttribute('href','#'); + _temp1.setAttribute('tabindex','-1'); + _temp2 = document.createElement('I'); + _temp2.className = 'jstree-icon jstree-themeicon'; + _temp2.setAttribute('role', 'presentation'); + _temp1.appendChild(_temp2); + _node.appendChild(_temp1); + _temp1 = _temp2 = null; + + return _node; + }, + _kbevent_to_func : function (e) { + var keys = { + 8: "Backspace", 9: "Tab", 13: "Return", 19: "Pause", 27: "Esc", + 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home", + 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "Print", 45: "Insert", + 46: "Delete", 96: "Numpad0", 97: "Numpad1", 98: "Numpad2", 99 : "Numpad3", + 100: "Numpad4", 101: "Numpad5", 102: "Numpad6", 103: "Numpad7", + 104: "Numpad8", 105: "Numpad9", '-13': "NumpadEnter", 112: "F1", + 113: "F2", 114: "F3", 115: "F4", 116: "F5", 117: "F6", 118: "F7", + 119: "F8", 120: "F9", 121: "F10", 122: "F11", 123: "F12", 144: "Numlock", + 145: "Scrolllock", 16: 'Shift', 17: 'Ctrl', 18: 'Alt', + 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', + 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a', + 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h', + 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o', + 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v', + 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.', + 186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`', + 219: '[', 220: '\\',221: ']', 222: "'", 111: '/', 106: '*', 173: '-' + }; + var parts = []; + if (e.ctrlKey) { parts.push('ctrl'); } + if (e.altKey) { parts.push('alt'); } + if (e.shiftKey) { parts.push('shift'); } + parts.push(keys[e.which] || e.which); + parts = parts.sort().join('-').toLowerCase(); + + var kb = this.settings.core.keyboard, i, tmp; + for (i in kb) { + if (kb.hasOwnProperty(i)) { + tmp = i; + if (tmp !== '-' && tmp !== '+') { + tmp = tmp.replace('--', '-MINUS').replace('+-', '-MINUS').replace('++', '-PLUS').replace('-+', '-PLUS'); + tmp = tmp.split(/-|\+/).sort().join('-').replace('MINUS', '-').replace('PLUS', '+').toLowerCase(); + } + if (tmp === parts) { + return kb[i]; + } + } + } + return null; + }, + /** + * part of the destroying of an instance. Used internally. + * @private + * @name teardown() + */ + teardown : function () { + this.unbind(); + this.element + .removeClass('jstree') + .removeData('jstree') + .find("[class^='jstree']") + .addBack() + .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); }); + this.element = null; + }, + /** + * bind all events. Used internally. + * @private + * @name bind() + */ + bind : function () { + var word = '', + tout = null, + was_click = 0; + this.element + .on("dblclick.jstree", function (e) { + if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } + if(document.selection && document.selection.empty) { + document.selection.empty(); + } + else { + if(window.getSelection) { + var sel = window.getSelection(); + try { + sel.removeAllRanges(); + sel.collapse(); + } catch (ignore) { } + } + } + }) + .on("mousedown.jstree", $.proxy(function (e) { + if(e.target === this.element[0]) { + e.preventDefault(); // prevent losing focus when clicking scroll arrows (FF, Chrome) + was_click = +(new Date()); // ie does not allow to prevent losing focus + } + }, this)) + .on("mousedown.jstree", ".jstree-ocl", function (e) { + e.preventDefault(); // prevent any node inside from losing focus when clicking the open/close icon + }) + .on("click.jstree", ".jstree-ocl", $.proxy(function (e) { + this.toggle_node(e.target); + }, this)) + .on("dblclick.jstree", ".jstree-anchor", $.proxy(function (e) { + if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } + if(this.settings.core.dblclick_toggle) { + this.toggle_node(e.target); + } + }, this)) + .on("click.jstree", ".jstree-anchor", $.proxy(function (e) { + e.preventDefault(); + if(e.currentTarget !== document.activeElement) { $(e.currentTarget).focus(); } + this.activate_node(e.currentTarget, e); + }, this)) + .on('keydown.jstree', '.jstree-anchor', $.proxy(function (e) { + if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } + if(this._data.core.rtl) { + if(e.which === 37) { e.which = 39; } + else if(e.which === 39) { e.which = 37; } + } + var f = this._kbevent_to_func(e); + if (f) { + var r = f.call(this, e); + if (r === false || r === true) { + return r; + } + } + }, this)) + .on("load_node.jstree", $.proxy(function (e, data) { + if(data.status) { + if(data.node.id === $.jstree.root && !this._data.core.loaded) { + this._data.core.loaded = true; + if(this._firstChild(this.get_container_ul()[0])) { + this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id); + } + /** + * triggered after the root node is loaded for the first time + * @event + * @name loaded.jstree + */ + this.trigger("loaded"); + } + if(!this._data.core.ready) { + setTimeout($.proxy(function() { + if(this.element && !this.get_container_ul().find('.jstree-loading').length) { + this._data.core.ready = true; + if(this._data.core.selected.length) { + if(this.settings.core.expand_selected_onload) { + var tmp = [], i, j; + for(i = 0, j = this._data.core.selected.length; i < j; i++) { + tmp = tmp.concat(this._model.data[this._data.core.selected[i]].parents); + } + tmp = $.vakata.array_unique(tmp); + for(i = 0, j = tmp.length; i < j; i++) { + this.open_node(tmp[i], false, 0); + } + } + this.trigger('changed', { 'action' : 'ready', 'selected' : this._data.core.selected }); + } + /** + * triggered after all nodes are finished loading + * @event + * @name ready.jstree + */ + this.trigger("ready"); + } + }, this), 0); + } + } + }, this)) + // quick searching when the tree is focused + .on('keypress.jstree', $.proxy(function (e) { + if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } + if(tout) { clearTimeout(tout); } + tout = setTimeout(function () { + word = ''; + }, 500); + + var chr = String.fromCharCode(e.which).toLowerCase(), + col = this.element.find('.jstree-anchor').filter(':visible'), + ind = col.index(document.activeElement) || 0, + end = false; + word += chr; + + // match for whole word from current node down (including the current node) + if(word.length > 1) { + col.slice(ind).each($.proxy(function (i, v) { + if($(v).text().toLowerCase().indexOf(word) === 0) { + $(v).focus(); + end = true; + return false; + } + }, this)); + if(end) { return; } + + // match for whole word from the beginning of the tree + col.slice(0, ind).each($.proxy(function (i, v) { + if($(v).text().toLowerCase().indexOf(word) === 0) { + $(v).focus(); + end = true; + return false; + } + }, this)); + if(end) { return; } + } + // list nodes that start with that letter (only if word consists of a single char) + if(new RegExp('^' + chr.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '+$').test(word)) { + // search for the next node starting with that letter + col.slice(ind + 1).each($.proxy(function (i, v) { + if($(v).text().toLowerCase().charAt(0) === chr) { + $(v).focus(); + end = true; + return false; + } + }, this)); + if(end) { return; } + + // search from the beginning + col.slice(0, ind + 1).each($.proxy(function (i, v) { + if($(v).text().toLowerCase().charAt(0) === chr) { + $(v).focus(); + end = true; + return false; + } + }, this)); + if(end) { return; } + } + }, this)) + // THEME RELATED + .on("init.jstree", $.proxy(function () { + var s = this.settings.core.themes; + this._data.core.themes.dots = s.dots; + this._data.core.themes.stripes = s.stripes; + this._data.core.themes.icons = s.icons; + this._data.core.themes.ellipsis = s.ellipsis; + this.set_theme(s.name || "default", s.url); + this.set_theme_variant(s.variant); + }, this)) + .on("loading.jstree", $.proxy(function () { + this[ this._data.core.themes.dots ? "show_dots" : "hide_dots" ](); + this[ this._data.core.themes.icons ? "show_icons" : "hide_icons" ](); + this[ this._data.core.themes.stripes ? "show_stripes" : "hide_stripes" ](); + this[ this._data.core.themes.ellipsis ? "show_ellipsis" : "hide_ellipsis" ](); + }, this)) + .on('blur.jstree', '.jstree-anchor', $.proxy(function (e) { + this._data.core.focused = null; + $(e.currentTarget).filter('.jstree-hovered').mouseleave(); + this.element.attr('tabindex', '0'); + }, this)) + .on('focus.jstree', '.jstree-anchor', $.proxy(function (e) { + var tmp = this.get_node(e.currentTarget); + if(tmp && tmp.id) { + this._data.core.focused = tmp.id; + } + this.element.find('.jstree-hovered').not(e.currentTarget).mouseleave(); + $(e.currentTarget).mouseenter(); + this.element.attr('tabindex', '-1'); + }, this)) + .on('focus.jstree', $.proxy(function () { + if(+(new Date()) - was_click > 500 && !this._data.core.focused && this.settings.core.restore_focus) { + was_click = 0; + var act = this.get_node(this.element.attr('aria-activedescendant'), true); + if(act) { + act.find('> .jstree-anchor').focus(); + } + } + }, this)) + .on('mouseenter.jstree', '.jstree-anchor', $.proxy(function (e) { + this.hover_node(e.currentTarget); + }, this)) + .on('mouseleave.jstree', '.jstree-anchor', $.proxy(function (e) { + this.dehover_node(e.currentTarget); + }, this)); + }, + /** + * part of the destroying of an instance. Used internally. + * @private + * @name unbind() + */ + unbind : function () { + this.element.off('.jstree'); + $(document).off('.jstree-' + this._id); + }, + /** + * trigger an event. Used internally. + * @private + * @name trigger(ev [, data]) + * @param {String} ev the name of the event to trigger + * @param {Object} data additional data to pass with the event + */ + trigger : function (ev, data) { + if(!data) { + data = {}; + } + data.instance = this; + this.element.triggerHandler(ev.replace('.jstree','') + '.jstree', data); + }, + /** + * returns the jQuery extended instance container + * @name get_container() + * @return {jQuery} + */ + get_container : function () { + return this.element; + }, + /** + * returns the jQuery extended main UL node inside the instance container. Used internally. + * @private + * @name get_container_ul() + * @return {jQuery} + */ + get_container_ul : function () { + return this.element.children(".jstree-children").first(); + }, + /** + * gets string replacements (localization). Used internally. + * @private + * @name get_string(key) + * @param {String} key + * @return {String} + */ + get_string : function (key) { + var a = this.settings.core.strings; + if($.isFunction(a)) { return a.call(this, key); } + if(a && a[key]) { return a[key]; } + return key; + }, + /** + * gets the first child of a DOM node. Used internally. + * @private + * @name _firstChild(dom) + * @param {DOMElement} dom + * @return {DOMElement} + */ + _firstChild : function (dom) { + dom = dom ? dom.firstChild : null; + while(dom !== null && dom.nodeType !== 1) { + dom = dom.nextSibling; + } + return dom; + }, + /** + * gets the next sibling of a DOM node. Used internally. + * @private + * @name _nextSibling(dom) + * @param {DOMElement} dom + * @return {DOMElement} + */ + _nextSibling : function (dom) { + dom = dom ? dom.nextSibling : null; + while(dom !== null && dom.nodeType !== 1) { + dom = dom.nextSibling; + } + return dom; + }, + /** + * gets the previous sibling of a DOM node. Used internally. + * @private + * @name _previousSibling(dom) + * @param {DOMElement} dom + * @return {DOMElement} + */ + _previousSibling : function (dom) { + dom = dom ? dom.previousSibling : null; + while(dom !== null && dom.nodeType !== 1) { + dom = dom.previousSibling; + } + return dom; + }, + /** + * get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc) + * @name get_node(obj [, as_dom]) + * @param {mixed} obj + * @param {Boolean} as_dom + * @return {Object|jQuery} + */ + get_node : function (obj, as_dom) { + if(obj && obj.id) { + obj = obj.id; + } + if (obj instanceof jQuery && obj.length && obj[0].id) { + obj = obj[0].id; + } + var dom; + try { + if(this._model.data[obj]) { + obj = this._model.data[obj]; + } + else if(typeof obj === "string" && this._model.data[obj.replace(/^#/, '')]) { + obj = this._model.data[obj.replace(/^#/, '')]; + } + else if(typeof obj === "string" && (dom = $('#' + obj.replace($.jstree.idregex,'\\$&'), this.element)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) { + obj = this._model.data[dom.closest('.jstree-node').attr('id')]; + } + else if((dom = this.element.find(obj)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) { + obj = this._model.data[dom.closest('.jstree-node').attr('id')]; + } + else if((dom = this.element.find(obj)).length && dom.hasClass('jstree')) { + obj = this._model.data[$.jstree.root]; + } + else { + return false; + } + + if(as_dom) { + obj = obj.id === $.jstree.root ? this.element : $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element); + } + return obj; + } catch (ex) { return false; } + }, + /** + * get the path to a node, either consisting of node texts, or of node IDs, optionally glued together (otherwise an array) + * @name get_path(obj [, glue, ids]) + * @param {mixed} obj the node + * @param {String} glue if you want the path as a string - pass the glue here (for example '/'), if a falsy value is supplied here, an array is returned + * @param {Boolean} ids if set to true build the path using ID, otherwise node text is used + * @return {mixed} + */ + get_path : function (obj, glue, ids) { + obj = obj.parents ? obj : this.get_node(obj); + if(!obj || obj.id === $.jstree.root || !obj.parents) { + return false; + } + var i, j, p = []; + p.push(ids ? obj.id : obj.text); + for(i = 0, j = obj.parents.length; i < j; i++) { + p.push(ids ? obj.parents[i] : this.get_text(obj.parents[i])); + } + p = p.reverse().slice(1); + return glue ? p.join(glue) : p; + }, + /** + * get the next visible node that is below the `obj` node. If `strict` is set to `true` only sibling nodes are returned. + * @name get_next_dom(obj [, strict]) + * @param {mixed} obj + * @param {Boolean} strict + * @return {jQuery} + */ + get_next_dom : function (obj, strict) { + var tmp; + obj = this.get_node(obj, true); + if(obj[0] === this.element[0]) { + tmp = this._firstChild(this.get_container_ul()[0]); + while (tmp && tmp.offsetHeight === 0) { + tmp = this._nextSibling(tmp); + } + return tmp ? $(tmp) : false; + } + if(!obj || !obj.length) { + return false; + } + if(strict) { + tmp = obj[0]; + do { + tmp = this._nextSibling(tmp); + } while (tmp && tmp.offsetHeight === 0); + return tmp ? $(tmp) : false; + } + if(obj.hasClass("jstree-open")) { + tmp = this._firstChild(obj.children('.jstree-children')[0]); + while (tmp && tmp.offsetHeight === 0) { + tmp = this._nextSibling(tmp); + } + if(tmp !== null) { + return $(tmp); + } + } + tmp = obj[0]; + do { + tmp = this._nextSibling(tmp); + } while (tmp && tmp.offsetHeight === 0); + if(tmp !== null) { + return $(tmp); + } + return obj.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first(); + }, + /** + * get the previous visible node that is above the `obj` node. If `strict` is set to `true` only sibling nodes are returned. + * @name get_prev_dom(obj [, strict]) + * @param {mixed} obj + * @param {Boolean} strict + * @return {jQuery} + */ + get_prev_dom : function (obj, strict) { + var tmp; + obj = this.get_node(obj, true); + if(obj[0] === this.element[0]) { + tmp = this.get_container_ul()[0].lastChild; + while (tmp && tmp.offsetHeight === 0) { + tmp = this._previousSibling(tmp); + } + return tmp ? $(tmp) : false; + } + if(!obj || !obj.length) { + return false; + } + if(strict) { + tmp = obj[0]; + do { + tmp = this._previousSibling(tmp); + } while (tmp && tmp.offsetHeight === 0); + return tmp ? $(tmp) : false; + } + tmp = obj[0]; + do { + tmp = this._previousSibling(tmp); + } while (tmp && tmp.offsetHeight === 0); + if(tmp !== null) { + obj = $(tmp); + while(obj.hasClass("jstree-open")) { + obj = obj.children(".jstree-children").first().children(".jstree-node:visible:last"); + } + return obj; + } + tmp = obj[0].parentNode.parentNode; + return tmp && tmp.className && tmp.className.indexOf('jstree-node') !== -1 ? $(tmp) : false; + }, + /** + * get the parent ID of a node + * @name get_parent(obj) + * @param {mixed} obj + * @return {String} + */ + get_parent : function (obj) { + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + return obj.parent; + }, + /** + * get a jQuery collection of all the children of a node (node must be rendered), returns false on error + * @name get_children_dom(obj) + * @param {mixed} obj + * @return {jQuery} + */ + get_children_dom : function (obj) { + obj = this.get_node(obj, true); + if(obj[0] === this.element[0]) { + return this.get_container_ul().children(".jstree-node"); + } + if(!obj || !obj.length) { + return false; + } + return obj.children(".jstree-children").children(".jstree-node"); + }, + /** + * checks if a node has children + * @name is_parent(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_parent : function (obj) { + obj = this.get_node(obj); + return obj && (obj.state.loaded === false || obj.children.length > 0); + }, + /** + * checks if a node is loaded (its children are available) + * @name is_loaded(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_loaded : function (obj) { + obj = this.get_node(obj); + return obj && obj.state.loaded; + }, + /** + * check if a node is currently loading (fetching children) + * @name is_loading(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_loading : function (obj) { + obj = this.get_node(obj); + return obj && obj.state && obj.state.loading; + }, + /** + * check if a node is opened + * @name is_open(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_open : function (obj) { + obj = this.get_node(obj); + return obj && obj.state.opened; + }, + /** + * check if a node is in a closed state + * @name is_closed(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_closed : function (obj) { + obj = this.get_node(obj); + return obj && this.is_parent(obj) && !obj.state.opened; + }, + /** + * check if a node has no children + * @name is_leaf(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_leaf : function (obj) { + return !this.is_parent(obj); + }, + /** + * loads a node (fetches its children using the `core.data` setting). Multiple nodes can be passed to by using an array. + * @name load_node(obj [, callback]) + * @param {mixed} obj + * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives two arguments - the node and a boolean status + * @return {Boolean} + * @trigger load_node.jstree + */ + load_node : function (obj, callback) { + var k, l, i, j, c; + if($.isArray(obj)) { + this._load_nodes(obj.slice(), callback); + return true; + } + obj = this.get_node(obj); + if(!obj) { + if(callback) { callback.call(this, obj, false); } + return false; + } + // if(obj.state.loading) { } // the node is already loading - just wait for it to load and invoke callback? but if called implicitly it should be loaded again? + if(obj.state.loaded) { + obj.state.loaded = false; + for(i = 0, j = obj.parents.length; i < j; i++) { + this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) { + return $.inArray(v, obj.children_d) === -1; + }); + } + for(k = 0, l = obj.children_d.length; k < l; k++) { + if(this._model.data[obj.children_d[k]].state.selected) { + c = true; + } + delete this._model.data[obj.children_d[k]]; + } + if (c) { + this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) { + return $.inArray(v, obj.children_d) === -1; + }); + } + obj.children = []; + obj.children_d = []; + if(c) { + this.trigger('changed', { 'action' : 'load_node', 'node' : obj, 'selected' : this._data.core.selected }); + } + } + obj.state.failed = false; + obj.state.loading = true; + this.get_node(obj, true).addClass("jstree-loading").attr('aria-busy',true); + this._load_node(obj, $.proxy(function (status) { + obj = this._model.data[obj.id]; + obj.state.loading = false; + obj.state.loaded = status; + obj.state.failed = !obj.state.loaded; + var dom = this.get_node(obj, true), i = 0, j = 0, m = this._model.data, has_children = false; + for(i = 0, j = obj.children.length; i < j; i++) { + if(m[obj.children[i]] && !m[obj.children[i]].state.hidden) { + has_children = true; + break; + } + } + if(obj.state.loaded && dom && dom.length) { + dom.removeClass('jstree-closed jstree-open jstree-leaf'); + if (!has_children) { + dom.addClass('jstree-leaf'); + } + else { + if (obj.id !== '#') { + dom.addClass(obj.state.opened ? 'jstree-open' : 'jstree-closed'); + } + } + } + dom.removeClass("jstree-loading").attr('aria-busy',false); + /** + * triggered after a node is loaded + * @event + * @name load_node.jstree + * @param {Object} node the node that was loading + * @param {Boolean} status was the node loaded successfully + */ + this.trigger('load_node', { "node" : obj, "status" : status }); + if(callback) { + callback.call(this, obj, status); + } + }, this)); + return true; + }, + /** + * load an array of nodes (will also load unavailable nodes as soon as they appear in the structure). Used internally. + * @private + * @name _load_nodes(nodes [, callback]) + * @param {array} nodes + * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes + */ + _load_nodes : function (nodes, callback, is_callback, force_reload) { + var r = true, + c = function () { this._load_nodes(nodes, callback, true); }, + m = this._model.data, i, j, tmp = []; + for(i = 0, j = nodes.length; i < j; i++) { + if(m[nodes[i]] && ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || (!is_callback && force_reload) )) { + if(!this.is_loading(nodes[i])) { + this.load_node(nodes[i], c); + } + r = false; + } + } + if(r) { + for(i = 0, j = nodes.length; i < j; i++) { + if(m[nodes[i]] && m[nodes[i]].state.loaded) { + tmp.push(nodes[i]); + } + } + if(callback && !callback.done) { + callback.call(this, tmp); + callback.done = true; + } + } + }, + /** + * loads all unloaded nodes + * @name load_all([obj, callback]) + * @param {mixed} obj the node to load recursively, omit to load all nodes in the tree + * @param {function} callback a function to be executed once loading all the nodes is complete, + * @trigger load_all.jstree + */ + load_all : function (obj, callback) { + if(!obj) { obj = $.jstree.root; } + obj = this.get_node(obj); + if(!obj) { return false; } + var to_load = [], + m = this._model.data, + c = m[obj.id].children_d, + i, j; + if(obj.state && !obj.state.loaded) { + to_load.push(obj.id); + } + for(i = 0, j = c.length; i < j; i++) { + if(m[c[i]] && m[c[i]].state && !m[c[i]].state.loaded) { + to_load.push(c[i]); + } + } + if(to_load.length) { + this._load_nodes(to_load, function () { + this.load_all(obj, callback); + }); + } + else { + /** + * triggered after a load_all call completes + * @event + * @name load_all.jstree + * @param {Object} node the recursively loaded node + */ + if(callback) { callback.call(this, obj); } + this.trigger('load_all', { "node" : obj }); + } + }, + /** + * handles the actual loading of a node. Used only internally. + * @private + * @name _load_node(obj [, callback]) + * @param {mixed} obj + * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status + * @return {Boolean} + */ + _load_node : function (obj, callback) { + var s = this.settings.core.data, t; + var notTextOrCommentNode = function notTextOrCommentNode () { + return this.nodeType !== 3 && this.nodeType !== 8; + }; + // use original HTML + if(!s) { + if(obj.id === $.jstree.root) { + return this._append_html_data(obj, this._data.core.original_container_html.clone(true), function (status) { + callback.call(this, status); + }); + } + else { + return callback.call(this, false); + } + // return callback.call(this, obj.id === $.jstree.root ? this._append_html_data(obj, this._data.core.original_container_html.clone(true)) : false); + } + if($.isFunction(s)) { + return s.call(this, obj, $.proxy(function (d) { + if(d === false) { + callback.call(this, false); + } + else { + this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $($.parseHTML(d)).filter(notTextOrCommentNode) : d, function (status) { + callback.call(this, status); + }); + } + // return d === false ? callback.call(this, false) : callback.call(this, this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $(d) : d)); + }, this)); + } + if(typeof s === 'object') { + if(s.url) { + s = $.extend(true, {}, s); + if($.isFunction(s.url)) { + s.url = s.url.call(this, obj); + } + if($.isFunction(s.data)) { + s.data = s.data.call(this, obj); + } + return $.ajax(s) + .done($.proxy(function (d,t,x) { + var type = x.getResponseHeader('Content-Type'); + if((type && type.indexOf('json') !== -1) || typeof d === "object") { + return this._append_json_data(obj, d, function (status) { callback.call(this, status); }); + //return callback.call(this, this._append_json_data(obj, d)); + } + if((type && type.indexOf('html') !== -1) || typeof d === "string") { + return this._append_html_data(obj, $($.parseHTML(d)).filter(notTextOrCommentNode), function (status) { callback.call(this, status); }); + // return callback.call(this, this._append_html_data(obj, $(d))); + } + this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : x }) }; + this.settings.core.error.call(this, this._data.core.last_error); + return callback.call(this, false); + }, this)) + .fail($.proxy(function (f) { + this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : f }) }; + callback.call(this, false); + this.settings.core.error.call(this, this._data.core.last_error); + }, this)); + } + if ($.isArray(s)) { + t = $.extend(true, [], s); + } else if ($.isPlainObject(s)) { + t = $.extend(true, {}, s); + } else { + t = s; + } + if(obj.id === $.jstree.root) { + return this._append_json_data(obj, t, function (status) { + callback.call(this, status); + }); + } + else { + this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_05', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) }; + this.settings.core.error.call(this, this._data.core.last_error); + return callback.call(this, false); + } + //return callback.call(this, (obj.id === $.jstree.root ? this._append_json_data(obj, t) : false) ); + } + if(typeof s === 'string') { + if(obj.id === $.jstree.root) { + return this._append_html_data(obj, $($.parseHTML(s)).filter(notTextOrCommentNode), function (status) { + callback.call(this, status); + }); + } + else { + this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_06', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) }; + this.settings.core.error.call(this, this._data.core.last_error); + return callback.call(this, false); + } + //return callback.call(this, (obj.id === $.jstree.root ? this._append_html_data(obj, $(s)) : false) ); + } + return callback.call(this, false); + }, + /** + * adds a node to the list of nodes to redraw. Used only internally. + * @private + * @name _node_changed(obj [, callback]) + * @param {mixed} obj + */ + _node_changed : function (obj) { + obj = this.get_node(obj); + if (obj && $.inArray(obj.id, this._model.changed) === -1) { + this._model.changed.push(obj.id); + } + }, + /** + * appends HTML content to the tree. Used internally. + * @private + * @name _append_html_data(obj, data) + * @param {mixed} obj the node to append to + * @param {String} data the HTML string to parse and append + * @trigger model.jstree, changed.jstree + */ + _append_html_data : function (dom, data, cb) { + dom = this.get_node(dom); + dom.children = []; + dom.children_d = []; + var dat = data.is('ul') ? data.children() : data, + par = dom.id, + chd = [], + dpc = [], + m = this._model.data, + p = m[par], + s = this._data.core.selected.length, + tmp, i, j; + dat.each($.proxy(function (i, v) { + tmp = this._parse_model_from_html($(v), par, p.parents.concat()); + if(tmp) { + chd.push(tmp); + dpc.push(tmp); + if(m[tmp].children_d.length) { + dpc = dpc.concat(m[tmp].children_d); + } + } + }, this)); + p.children = chd; + p.children_d = dpc; + for(i = 0, j = p.parents.length; i < j; i++) { + m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); + } + /** + * triggered when new data is inserted to the tree model + * @event + * @name model.jstree + * @param {Array} nodes an array of node IDs + * @param {String} parent the parent ID of the nodes + */ + this.trigger('model', { "nodes" : dpc, 'parent' : par }); + if(par !== $.jstree.root) { + this._node_changed(par); + this.redraw(); + } + else { + this.get_container_ul().children('.jstree-initial-node').remove(); + this.redraw(true); + } + if(this._data.core.selected.length !== s) { + this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected }); + } + cb.call(this, true); + }, + /** + * appends JSON content to the tree. Used internally. + * @private + * @name _append_json_data(obj, data) + * @param {mixed} obj the node to append to + * @param {String} data the JSON object to parse and append + * @param {Boolean} force_processing internal param - do not set + * @trigger model.jstree, changed.jstree + */ + _append_json_data : function (dom, data, cb, force_processing) { + if(this.element === null) { return; } + dom = this.get_node(dom); + dom.children = []; + dom.children_d = []; + // *%$@!!! + if(data.d) { + data = data.d; + if(typeof data === "string") { + data = JSON.parse(data); + } + } + if(!$.isArray(data)) { data = [data]; } + var w = null, + args = { + 'df' : this._model.default_state, + 'dat' : data, + 'par' : dom.id, + 'm' : this._model.data, + 't_id' : this._id, + 't_cnt' : this._cnt, + 'sel' : this._data.core.selected + }, + func = function (data, undefined) { + if(data.data) { data = data.data; } + var dat = data.dat, + par = data.par, + chd = [], + dpc = [], + add = [], + df = data.df, + t_id = data.t_id, + t_cnt = data.t_cnt, + m = data.m, + p = m[par], + sel = data.sel, + tmp, i, j, rslt, + parse_flat = function (d, p, ps) { + if(!ps) { ps = []; } + else { ps = ps.concat(); } + if(p) { ps.unshift(p); } + var tid = d.id.toString(), + i, j, c, e, + tmp = { + id : tid, + text : d.text || '', + icon : d.icon !== undefined ? d.icon : true, + parent : p, + parents : ps, + children : d.children || [], + children_d : d.children_d || [], + data : d.data, + state : { }, + li_attr : { id : false }, + a_attr : { href : '#' }, + original : false + }; + for(i in df) { + if(df.hasOwnProperty(i)) { + tmp.state[i] = df[i]; + } + } + if(d && d.data && d.data.jstree && d.data.jstree.icon) { + tmp.icon = d.data.jstree.icon; + } + if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { + tmp.icon = true; + } + if(d && d.data) { + tmp.data = d.data; + if(d.data.jstree) { + for(i in d.data.jstree) { + if(d.data.jstree.hasOwnProperty(i)) { + tmp.state[i] = d.data.jstree[i]; + } + } + } + } + if(d && typeof d.state === 'object') { + for (i in d.state) { + if(d.state.hasOwnProperty(i)) { + tmp.state[i] = d.state[i]; + } + } + } + if(d && typeof d.li_attr === 'object') { + for (i in d.li_attr) { + if(d.li_attr.hasOwnProperty(i)) { + tmp.li_attr[i] = d.li_attr[i]; + } + } + } + if(!tmp.li_attr.id) { + tmp.li_attr.id = tid; + } + if(d && typeof d.a_attr === 'object') { + for (i in d.a_attr) { + if(d.a_attr.hasOwnProperty(i)) { + tmp.a_attr[i] = d.a_attr[i]; + } + } + } + if(d && d.children && d.children === true) { + tmp.state.loaded = false; + tmp.children = []; + tmp.children_d = []; + } + m[tmp.id] = tmp; + for(i = 0, j = tmp.children.length; i < j; i++) { + c = parse_flat(m[tmp.children[i]], tmp.id, ps); + e = m[c]; + tmp.children_d.push(c); + if(e.children_d.length) { + tmp.children_d = tmp.children_d.concat(e.children_d); + } + } + delete d.data; + delete d.children; + m[tmp.id].original = d; + if(tmp.state.selected) { + add.push(tmp.id); + } + return tmp.id; + }, + parse_nest = function (d, p, ps) { + if(!ps) { ps = []; } + else { ps = ps.concat(); } + if(p) { ps.unshift(p); } + var tid = false, i, j, c, e, tmp; + do { + tid = 'j' + t_id + '_' + (++t_cnt); + } while(m[tid]); + + tmp = { + id : false, + text : typeof d === 'string' ? d : '', + icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true, + parent : p, + parents : ps, + children : [], + children_d : [], + data : null, + state : { }, + li_attr : { id : false }, + a_attr : { href : '#' }, + original : false + }; + for(i in df) { + if(df.hasOwnProperty(i)) { + tmp.state[i] = df[i]; + } + } + if(d && d.id) { tmp.id = d.id.toString(); } + if(d && d.text) { tmp.text = d.text; } + if(d && d.data && d.data.jstree && d.data.jstree.icon) { + tmp.icon = d.data.jstree.icon; + } + if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { + tmp.icon = true; + } + if(d && d.data) { + tmp.data = d.data; + if(d.data.jstree) { + for(i in d.data.jstree) { + if(d.data.jstree.hasOwnProperty(i)) { + tmp.state[i] = d.data.jstree[i]; + } + } + } + } + if(d && typeof d.state === 'object') { + for (i in d.state) { + if(d.state.hasOwnProperty(i)) { + tmp.state[i] = d.state[i]; + } + } + } + if(d && typeof d.li_attr === 'object') { + for (i in d.li_attr) { + if(d.li_attr.hasOwnProperty(i)) { + tmp.li_attr[i] = d.li_attr[i]; + } + } + } + if(tmp.li_attr.id && !tmp.id) { + tmp.id = tmp.li_attr.id.toString(); + } + if(!tmp.id) { + tmp.id = tid; + } + if(!tmp.li_attr.id) { + tmp.li_attr.id = tmp.id; + } + if(d && typeof d.a_attr === 'object') { + for (i in d.a_attr) { + if(d.a_attr.hasOwnProperty(i)) { + tmp.a_attr[i] = d.a_attr[i]; + } + } + } + if(d && d.children && d.children.length) { + for(i = 0, j = d.children.length; i < j; i++) { + c = parse_nest(d.children[i], tmp.id, ps); + e = m[c]; + tmp.children.push(c); + if(e.children_d.length) { + tmp.children_d = tmp.children_d.concat(e.children_d); + } + } + tmp.children_d = tmp.children_d.concat(tmp.children); + } + if(d && d.children && d.children === true) { + tmp.state.loaded = false; + tmp.children = []; + tmp.children_d = []; + } + delete d.data; + delete d.children; + tmp.original = d; + m[tmp.id] = tmp; + if(tmp.state.selected) { + add.push(tmp.id); + } + return tmp.id; + }; + + if(dat.length && dat[0].id !== undefined && dat[0].parent !== undefined) { + // Flat JSON support (for easy import from DB): + // 1) convert to object (foreach) + for(i = 0, j = dat.length; i < j; i++) { + if(!dat[i].children) { + dat[i].children = []; + } + if(!dat[i].state) { + dat[i].state = {}; + } + m[dat[i].id.toString()] = dat[i]; + } + // 2) populate children (foreach) + for(i = 0, j = dat.length; i < j; i++) { + if (!m[dat[i].parent.toString()]) { + this._data.core.last_error = { 'error' : 'parse', 'plugin' : 'core', 'id' : 'core_07', 'reason' : 'Node with invalid parent', 'data' : JSON.stringify({ 'id' : dat[i].id.toString(), 'parent' : dat[i].parent.toString() }) }; + this.settings.core.error.call(this, this._data.core.last_error); + continue; + } + + m[dat[i].parent.toString()].children.push(dat[i].id.toString()); + // populate parent.children_d + p.children_d.push(dat[i].id.toString()); + } + // 3) normalize && populate parents and children_d with recursion + for(i = 0, j = p.children.length; i < j; i++) { + tmp = parse_flat(m[p.children[i]], par, p.parents.concat()); + dpc.push(tmp); + if(m[tmp].children_d.length) { + dpc = dpc.concat(m[tmp].children_d); + } + } + for(i = 0, j = p.parents.length; i < j; i++) { + m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); + } + // ?) three_state selection - p.state.selected && t - (if three_state foreach(dat => ch) -> foreach(parents) if(parent.selected) child.selected = true; + rslt = { + 'cnt' : t_cnt, + 'mod' : m, + 'sel' : sel, + 'par' : par, + 'dpc' : dpc, + 'add' : add + }; + } + else { + for(i = 0, j = dat.length; i < j; i++) { + tmp = parse_nest(dat[i], par, p.parents.concat()); + if(tmp) { + chd.push(tmp); + dpc.push(tmp); + if(m[tmp].children_d.length) { + dpc = dpc.concat(m[tmp].children_d); + } + } + } + p.children = chd; + p.children_d = dpc; + for(i = 0, j = p.parents.length; i < j; i++) { + m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); + } + rslt = { + 'cnt' : t_cnt, + 'mod' : m, + 'sel' : sel, + 'par' : par, + 'dpc' : dpc, + 'add' : add + }; + } + if(typeof window === 'undefined' || typeof window.document === 'undefined') { + postMessage(rslt); + } + else { + return rslt; + } + }, + rslt = function (rslt, worker) { + if(this.element === null) { return; } + this._cnt = rslt.cnt; + var i, m = this._model.data; + for (i in m) { + if (m.hasOwnProperty(i) && m[i].state && m[i].state.loading && rslt.mod[i]) { + rslt.mod[i].state.loading = true; + } + } + this._model.data = rslt.mod; // breaks the reference in load_node - careful + + if(worker) { + var j, a = rslt.add, r = rslt.sel, s = this._data.core.selected.slice(); + m = this._model.data; + // if selection was changed while calculating in worker + if(r.length !== s.length || $.vakata.array_unique(r.concat(s)).length !== r.length) { + // deselect nodes that are no longer selected + for(i = 0, j = r.length; i < j; i++) { + if($.inArray(r[i], a) === -1 && $.inArray(r[i], s) === -1) { + m[r[i]].state.selected = false; + } + } + // select nodes that were selected in the mean time + for(i = 0, j = s.length; i < j; i++) { + if($.inArray(s[i], r) === -1) { + m[s[i]].state.selected = true; + } + } + } + } + if(rslt.add.length) { + this._data.core.selected = this._data.core.selected.concat(rslt.add); + } + + this.trigger('model', { "nodes" : rslt.dpc, 'parent' : rslt.par }); + + if(rslt.par !== $.jstree.root) { + this._node_changed(rslt.par); + this.redraw(); + } + else { + // this.get_container_ul().children('.jstree-initial-node').remove(); + this.redraw(true); + } + if(rslt.add.length) { + this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected }); + } + cb.call(this, true); + }; + if(this.settings.core.worker && window.Blob && window.URL && window.Worker) { + try { + if(this._wrk === null) { + this._wrk = window.URL.createObjectURL( + new window.Blob( + ['self.onmessage = ' + func.toString()], + {type:"text/javascript"} + ) + ); + } + if(!this._data.core.working || force_processing) { + this._data.core.working = true; + w = new window.Worker(this._wrk); + w.onmessage = $.proxy(function (e) { + rslt.call(this, e.data, true); + try { w.terminate(); w = null; } catch(ignore) { } + if(this._data.core.worker_queue.length) { + this._append_json_data.apply(this, this._data.core.worker_queue.shift()); + } + else { + this._data.core.working = false; + } + }, this); + if(!args.par) { + if(this._data.core.worker_queue.length) { + this._append_json_data.apply(this, this._data.core.worker_queue.shift()); + } + else { + this._data.core.working = false; + } + } + else { + w.postMessage(args); + } + } + else { + this._data.core.worker_queue.push([dom, data, cb, true]); + } + } + catch(e) { + rslt.call(this, func(args), false); + if(this._data.core.worker_queue.length) { + this._append_json_data.apply(this, this._data.core.worker_queue.shift()); + } + else { + this._data.core.working = false; + } + } + } + else { + rslt.call(this, func(args), false); + } + }, + /** + * parses a node from a jQuery object and appends them to the in memory tree model. Used internally. + * @private + * @name _parse_model_from_html(d [, p, ps]) + * @param {jQuery} d the jQuery object to parse + * @param {String} p the parent ID + * @param {Array} ps list of all parents + * @return {String} the ID of the object added to the model + */ + _parse_model_from_html : function (d, p, ps) { + if(!ps) { ps = []; } + else { ps = [].concat(ps); } + if(p) { ps.unshift(p); } + var c, e, m = this._model.data, + data = { + id : false, + text : false, + icon : true, + parent : p, + parents : ps, + children : [], + children_d : [], + data : null, + state : { }, + li_attr : { id : false }, + a_attr : { href : '#' }, + original : false + }, i, tmp, tid; + for(i in this._model.default_state) { + if(this._model.default_state.hasOwnProperty(i)) { + data.state[i] = this._model.default_state[i]; + } + } + tmp = $.vakata.attributes(d, true); + $.each(tmp, function (i, v) { + v = $.trim(v); + if(!v.length) { return true; } + data.li_attr[i] = v; + if(i === 'id') { + data.id = v.toString(); + } + }); + tmp = d.children('a').first(); + if(tmp.length) { + tmp = $.vakata.attributes(tmp, true); + $.each(tmp, function (i, v) { + v = $.trim(v); + if(v.length) { + data.a_attr[i] = v; + } + }); + } + tmp = d.children("a").first().length ? d.children("a").first().clone() : d.clone(); + tmp.children("ins, i, ul").remove(); + tmp = tmp.html(); + tmp = $('
          ').html(tmp); + data.text = this.settings.core.force_text ? tmp.text() : tmp.html(); + tmp = d.data(); + data.data = tmp ? $.extend(true, {}, tmp) : null; + data.state.opened = d.hasClass('jstree-open'); + data.state.selected = d.children('a').hasClass('jstree-clicked'); + data.state.disabled = d.children('a').hasClass('jstree-disabled'); + if(data.data && data.data.jstree) { + for(i in data.data.jstree) { + if(data.data.jstree.hasOwnProperty(i)) { + data.state[i] = data.data.jstree[i]; + } + } + } + tmp = d.children("a").children(".jstree-themeicon"); + if(tmp.length) { + data.icon = tmp.hasClass('jstree-themeicon-hidden') ? false : tmp.attr('rel'); + } + if(data.state.icon !== undefined) { + data.icon = data.state.icon; + } + if(data.icon === undefined || data.icon === null || data.icon === "") { + data.icon = true; + } + tmp = d.children("ul").children("li"); + do { + tid = 'j' + this._id + '_' + (++this._cnt); + } while(m[tid]); + data.id = data.li_attr.id ? data.li_attr.id.toString() : tid; + if(tmp.length) { + tmp.each($.proxy(function (i, v) { + c = this._parse_model_from_html($(v), data.id, ps); + e = this._model.data[c]; + data.children.push(c); + if(e.children_d.length) { + data.children_d = data.children_d.concat(e.children_d); + } + }, this)); + data.children_d = data.children_d.concat(data.children); + } + else { + if(d.hasClass('jstree-closed')) { + data.state.loaded = false; + } + } + if(data.li_attr['class']) { + data.li_attr['class'] = data.li_attr['class'].replace('jstree-closed','').replace('jstree-open',''); + } + if(data.a_attr['class']) { + data.a_attr['class'] = data.a_attr['class'].replace('jstree-clicked','').replace('jstree-disabled',''); + } + m[data.id] = data; + if(data.state.selected) { + this._data.core.selected.push(data.id); + } + return data.id; + }, + /** + * parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally. + * @private + * @name _parse_model_from_flat_json(d [, p, ps]) + * @param {Object} d the JSON object to parse + * @param {String} p the parent ID + * @param {Array} ps list of all parents + * @return {String} the ID of the object added to the model + */ + _parse_model_from_flat_json : function (d, p, ps) { + if(!ps) { ps = []; } + else { ps = ps.concat(); } + if(p) { ps.unshift(p); } + var tid = d.id.toString(), + m = this._model.data, + df = this._model.default_state, + i, j, c, e, + tmp = { + id : tid, + text : d.text || '', + icon : d.icon !== undefined ? d.icon : true, + parent : p, + parents : ps, + children : d.children || [], + children_d : d.children_d || [], + data : d.data, + state : { }, + li_attr : { id : false }, + a_attr : { href : '#' }, + original : false + }; + for(i in df) { + if(df.hasOwnProperty(i)) { + tmp.state[i] = df[i]; + } + } + if(d && d.data && d.data.jstree && d.data.jstree.icon) { + tmp.icon = d.data.jstree.icon; + } + if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { + tmp.icon = true; + } + if(d && d.data) { + tmp.data = d.data; + if(d.data.jstree) { + for(i in d.data.jstree) { + if(d.data.jstree.hasOwnProperty(i)) { + tmp.state[i] = d.data.jstree[i]; + } + } + } + } + if(d && typeof d.state === 'object') { + for (i in d.state) { + if(d.state.hasOwnProperty(i)) { + tmp.state[i] = d.state[i]; + } + } + } + if(d && typeof d.li_attr === 'object') { + for (i in d.li_attr) { + if(d.li_attr.hasOwnProperty(i)) { + tmp.li_attr[i] = d.li_attr[i]; + } + } + } + if(!tmp.li_attr.id) { + tmp.li_attr.id = tid; + } + if(d && typeof d.a_attr === 'object') { + for (i in d.a_attr) { + if(d.a_attr.hasOwnProperty(i)) { + tmp.a_attr[i] = d.a_attr[i]; + } + } + } + if(d && d.children && d.children === true) { + tmp.state.loaded = false; + tmp.children = []; + tmp.children_d = []; + } + m[tmp.id] = tmp; + for(i = 0, j = tmp.children.length; i < j; i++) { + c = this._parse_model_from_flat_json(m[tmp.children[i]], tmp.id, ps); + e = m[c]; + tmp.children_d.push(c); + if(e.children_d.length) { + tmp.children_d = tmp.children_d.concat(e.children_d); + } + } + delete d.data; + delete d.children; + m[tmp.id].original = d; + if(tmp.state.selected) { + this._data.core.selected.push(tmp.id); + } + return tmp.id; + }, + /** + * parses a node from a JSON object and appends it to the in memory tree model. Used internally. + * @private + * @name _parse_model_from_json(d [, p, ps]) + * @param {Object} d the JSON object to parse + * @param {String} p the parent ID + * @param {Array} ps list of all parents + * @return {String} the ID of the object added to the model + */ + _parse_model_from_json : function (d, p, ps) { + if(!ps) { ps = []; } + else { ps = ps.concat(); } + if(p) { ps.unshift(p); } + var tid = false, i, j, c, e, m = this._model.data, df = this._model.default_state, tmp; + do { + tid = 'j' + this._id + '_' + (++this._cnt); + } while(m[tid]); + + tmp = { + id : false, + text : typeof d === 'string' ? d : '', + icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true, + parent : p, + parents : ps, + children : [], + children_d : [], + data : null, + state : { }, + li_attr : { id : false }, + a_attr : { href : '#' }, + original : false + }; + for(i in df) { + if(df.hasOwnProperty(i)) { + tmp.state[i] = df[i]; + } + } + if(d && d.id) { tmp.id = d.id.toString(); } + if(d && d.text) { tmp.text = d.text; } + if(d && d.data && d.data.jstree && d.data.jstree.icon) { + tmp.icon = d.data.jstree.icon; + } + if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { + tmp.icon = true; + } + if(d && d.data) { + tmp.data = d.data; + if(d.data.jstree) { + for(i in d.data.jstree) { + if(d.data.jstree.hasOwnProperty(i)) { + tmp.state[i] = d.data.jstree[i]; + } + } + } + } + if(d && typeof d.state === 'object') { + for (i in d.state) { + if(d.state.hasOwnProperty(i)) { + tmp.state[i] = d.state[i]; + } + } + } + if(d && typeof d.li_attr === 'object') { + for (i in d.li_attr) { + if(d.li_attr.hasOwnProperty(i)) { + tmp.li_attr[i] = d.li_attr[i]; + } + } + } + if(tmp.li_attr.id && !tmp.id) { + tmp.id = tmp.li_attr.id.toString(); + } + if(!tmp.id) { + tmp.id = tid; + } + if(!tmp.li_attr.id) { + tmp.li_attr.id = tmp.id; + } + if(d && typeof d.a_attr === 'object') { + for (i in d.a_attr) { + if(d.a_attr.hasOwnProperty(i)) { + tmp.a_attr[i] = d.a_attr[i]; + } + } + } + if(d && d.children && d.children.length) { + for(i = 0, j = d.children.length; i < j; i++) { + c = this._parse_model_from_json(d.children[i], tmp.id, ps); + e = m[c]; + tmp.children.push(c); + if(e.children_d.length) { + tmp.children_d = tmp.children_d.concat(e.children_d); + } + } + tmp.children_d = tmp.children_d.concat(tmp.children); + } + if(d && d.children && d.children === true) { + tmp.state.loaded = false; + tmp.children = []; + tmp.children_d = []; + } + delete d.data; + delete d.children; + tmp.original = d; + m[tmp.id] = tmp; + if(tmp.state.selected) { + this._data.core.selected.push(tmp.id); + } + return tmp.id; + }, + /** + * redraws all nodes that need to be redrawn. Used internally. + * @private + * @name _redraw() + * @trigger redraw.jstree + */ + _redraw : function () { + var nodes = this._model.force_full_redraw ? this._model.data[$.jstree.root].children.concat([]) : this._model.changed.concat([]), + f = document.createElement('UL'), tmp, i, j, fe = this._data.core.focused; + for(i = 0, j = nodes.length; i < j; i++) { + tmp = this.redraw_node(nodes[i], true, this._model.force_full_redraw); + if(tmp && this._model.force_full_redraw) { + f.appendChild(tmp); + } + } + if(this._model.force_full_redraw) { + f.className = this.get_container_ul()[0].className; + f.setAttribute('role','group'); + this.element.empty().append(f); + //this.get_container_ul()[0].appendChild(f); + } + if(fe !== null && this.settings.core.restore_focus) { + tmp = this.get_node(fe, true); + if(tmp && tmp.length && tmp.children('.jstree-anchor')[0] !== document.activeElement) { + tmp.children('.jstree-anchor').focus(); + } + else { + this._data.core.focused = null; + } + } + this._model.force_full_redraw = false; + this._model.changed = []; + /** + * triggered after nodes are redrawn + * @event + * @name redraw.jstree + * @param {array} nodes the redrawn nodes + */ + this.trigger('redraw', { "nodes" : nodes }); + }, + /** + * redraws all nodes that need to be redrawn or optionally - the whole tree + * @name redraw([full]) + * @param {Boolean} full if set to `true` all nodes are redrawn. + */ + redraw : function (full) { + if(full) { + this._model.force_full_redraw = true; + } + //if(this._model.redraw_timeout) { + // clearTimeout(this._model.redraw_timeout); + //} + //this._model.redraw_timeout = setTimeout($.proxy(this._redraw, this),0); + this._redraw(); + }, + /** + * redraws a single node's children. Used internally. + * @private + * @name draw_children(node) + * @param {mixed} node the node whose children will be redrawn + */ + draw_children : function (node) { + var obj = this.get_node(node), + i = false, + j = false, + k = false, + d = document; + if(!obj) { return false; } + if(obj.id === $.jstree.root) { return this.redraw(true); } + node = this.get_node(node, true); + if(!node || !node.length) { return false; } // TODO: quick toggle + + node.children('.jstree-children').remove(); + node = node[0]; + if(obj.children.length && obj.state.loaded) { + k = d.createElement('UL'); + k.setAttribute('role', 'group'); + k.className = 'jstree-children'; + for(i = 0, j = obj.children.length; i < j; i++) { + k.appendChild(this.redraw_node(obj.children[i], true, true)); + } + node.appendChild(k); + } + }, + /** + * redraws a single node. Used internally. + * @private + * @name redraw_node(node, deep, is_callback, force_render) + * @param {mixed} node the node to redraw + * @param {Boolean} deep should child nodes be redrawn too + * @param {Boolean} is_callback is this a recursion call + * @param {Boolean} force_render should children of closed parents be drawn anyway + */ + redraw_node : function (node, deep, is_callback, force_render) { + var obj = this.get_node(node), + par = false, + ind = false, + old = false, + i = false, + j = false, + k = false, + c = '', + d = document, + m = this._model.data, + f = false, + s = false, + tmp = null, + t = 0, + l = 0, + has_children = false, + last_sibling = false; + if(!obj) { return false; } + if(obj.id === $.jstree.root) { return this.redraw(true); } + deep = deep || obj.children.length === 0; + node = !document.querySelector ? document.getElementById(obj.id) : this.element[0].querySelector('#' + ("0123456789".indexOf(obj.id[0]) !== -1 ? '\\3' + obj.id[0] + ' ' + obj.id.substr(1).replace($.jstree.idregex,'\\$&') : obj.id.replace($.jstree.idregex,'\\$&')) ); //, this.element); + if(!node) { + deep = true; + //node = d.createElement('LI'); + if(!is_callback) { + par = obj.parent !== $.jstree.root ? $('#' + obj.parent.replace($.jstree.idregex,'\\$&'), this.element)[0] : null; + if(par !== null && (!par || !m[obj.parent].state.opened)) { + return false; + } + ind = $.inArray(obj.id, par === null ? m[$.jstree.root].children : m[obj.parent].children); + } + } + else { + node = $(node); + if(!is_callback) { + par = node.parent().parent()[0]; + if(par === this.element[0]) { + par = null; + } + ind = node.index(); + } + // m[obj.id].data = node.data(); // use only node's data, no need to touch jquery storage + if(!deep && obj.children.length && !node.children('.jstree-children').length) { + deep = true; + } + if(!deep) { + old = node.children('.jstree-children')[0]; + } + f = node.children('.jstree-anchor')[0] === document.activeElement; + node.remove(); + //node = d.createElement('LI'); + //node = node[0]; + } + node = this._data.core.node.cloneNode(true); + // node is DOM, deep is boolean + + c = 'jstree-node '; + for(i in obj.li_attr) { + if(obj.li_attr.hasOwnProperty(i)) { + if(i === 'id') { continue; } + if(i !== 'class') { + node.setAttribute(i, obj.li_attr[i]); + } + else { + c += obj.li_attr[i]; + } + } + } + if(!obj.a_attr.id) { + obj.a_attr.id = obj.id + '_anchor'; + } + node.setAttribute('aria-selected', !!obj.state.selected); + node.setAttribute('aria-level', obj.parents.length); + node.setAttribute('aria-labelledby', obj.a_attr.id); + if(obj.state.disabled) { + node.setAttribute('aria-disabled', true); + } + + for(i = 0, j = obj.children.length; i < j; i++) { + if(!m[obj.children[i]].state.hidden) { + has_children = true; + break; + } + } + if(obj.parent !== null && m[obj.parent] && !obj.state.hidden) { + i = $.inArray(obj.id, m[obj.parent].children); + last_sibling = obj.id; + if(i !== -1) { + i++; + for(j = m[obj.parent].children.length; i < j; i++) { + if(!m[m[obj.parent].children[i]].state.hidden) { + last_sibling = m[obj.parent].children[i]; + } + if(last_sibling !== obj.id) { + break; + } + } + } + } + + if(obj.state.hidden) { + c += ' jstree-hidden'; + } + if (obj.state.loading) { + c += ' jstree-loading'; + } + if(obj.state.loaded && !has_children) { + c += ' jstree-leaf'; + } + else { + c += obj.state.opened && obj.state.loaded ? ' jstree-open' : ' jstree-closed'; + node.setAttribute('aria-expanded', (obj.state.opened && obj.state.loaded) ); + } + if(last_sibling === obj.id) { + c += ' jstree-last'; + } + node.id = obj.id; + node.className = c; + c = ( obj.state.selected ? ' jstree-clicked' : '') + ( obj.state.disabled ? ' jstree-disabled' : ''); + for(j in obj.a_attr) { + if(obj.a_attr.hasOwnProperty(j)) { + if(j === 'href' && obj.a_attr[j] === '#') { continue; } + if(j !== 'class') { + node.childNodes[1].setAttribute(j, obj.a_attr[j]); + } + else { + c += ' ' + obj.a_attr[j]; + } + } + } + if(c.length) { + node.childNodes[1].className = 'jstree-anchor ' + c; + } + if((obj.icon && obj.icon !== true) || obj.icon === false) { + if(obj.icon === false) { + node.childNodes[1].childNodes[0].className += ' jstree-themeicon-hidden'; + } + else if(obj.icon.indexOf('/') === -1 && obj.icon.indexOf('.') === -1) { + node.childNodes[1].childNodes[0].className += ' ' + obj.icon + ' jstree-themeicon-custom'; + } + else { + node.childNodes[1].childNodes[0].style.backgroundImage = 'url("'+obj.icon+'")'; + node.childNodes[1].childNodes[0].style.backgroundPosition = 'center center'; + node.childNodes[1].childNodes[0].style.backgroundSize = 'auto'; + node.childNodes[1].childNodes[0].className += ' jstree-themeicon-custom'; + } + } + + if(this.settings.core.force_text) { + node.childNodes[1].appendChild(d.createTextNode(obj.text)); + } + else { + node.childNodes[1].innerHTML += obj.text; + } + + + if(deep && obj.children.length && (obj.state.opened || force_render) && obj.state.loaded) { + k = d.createElement('UL'); + k.setAttribute('role', 'group'); + k.className = 'jstree-children'; + for(i = 0, j = obj.children.length; i < j; i++) { + k.appendChild(this.redraw_node(obj.children[i], deep, true)); + } + node.appendChild(k); + } + if(old) { + node.appendChild(old); + } + if(!is_callback) { + // append back using par / ind + if(!par) { + par = this.element[0]; + } + for(i = 0, j = par.childNodes.length; i < j; i++) { + if(par.childNodes[i] && par.childNodes[i].className && par.childNodes[i].className.indexOf('jstree-children') !== -1) { + tmp = par.childNodes[i]; + break; + } + } + if(!tmp) { + tmp = d.createElement('UL'); + tmp.setAttribute('role', 'group'); + tmp.className = 'jstree-children'; + par.appendChild(tmp); + } + par = tmp; + + if(ind < par.childNodes.length) { + par.insertBefore(node, par.childNodes[ind]); + } + else { + par.appendChild(node); + } + if(f) { + t = this.element[0].scrollTop; + l = this.element[0].scrollLeft; + node.childNodes[1].focus(); + this.element[0].scrollTop = t; + this.element[0].scrollLeft = l; + } + } + if(obj.state.opened && !obj.state.loaded) { + obj.state.opened = false; + setTimeout($.proxy(function () { + this.open_node(obj.id, false, 0); + }, this), 0); + } + return node; + }, + /** + * opens a node, revealing its children. If the node is not loaded it will be loaded and opened once ready. + * @name open_node(obj [, callback, animation]) + * @param {mixed} obj the node to open + * @param {Function} callback a function to execute once the node is opened + * @param {Number} animation the animation duration in milliseconds when opening the node (overrides the `core.animation` setting). Use `false` for no animation. + * @trigger open_node.jstree, after_open.jstree, before_open.jstree + */ + open_node : function (obj, callback, animation) { + var t1, t2, d, t; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.open_node(obj[t1], callback, animation); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + animation = animation === undefined ? this.settings.core.animation : animation; + if(!this.is_closed(obj)) { + if(callback) { + callback.call(this, obj, false); + } + return false; + } + if(!this.is_loaded(obj)) { + if(this.is_loading(obj)) { + return setTimeout($.proxy(function () { + this.open_node(obj, callback, animation); + }, this), 500); + } + this.load_node(obj, function (o, ok) { + return ok ? this.open_node(o, callback, animation) : (callback ? callback.call(this, o, false) : false); + }); + } + else { + d = this.get_node(obj, true); + t = this; + if(d.length) { + if(animation && d.children(".jstree-children").length) { + d.children(".jstree-children").stop(true, true); + } + if(obj.children.length && !this._firstChild(d.children('.jstree-children')[0])) { + this.draw_children(obj); + //d = this.get_node(obj, true); + } + if(!animation) { + this.trigger('before_open', { "node" : obj }); + d[0].className = d[0].className.replace('jstree-closed', 'jstree-open'); + d[0].setAttribute("aria-expanded", true); + } + else { + this.trigger('before_open', { "node" : obj }); + d + .children(".jstree-children").css("display","none").end() + .removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded", true) + .children(".jstree-children").stop(true, true) + .slideDown(animation, function () { + this.style.display = ""; + if (t.element) { + t.trigger("after_open", { "node" : obj }); + } + }); + } + } + obj.state.opened = true; + if(callback) { + callback.call(this, obj, true); + } + if(!d.length) { + /** + * triggered when a node is about to be opened (if the node is supposed to be in the DOM, it will be, but it won't be visible yet) + * @event + * @name before_open.jstree + * @param {Object} node the opened node + */ + this.trigger('before_open', { "node" : obj }); + } + /** + * triggered when a node is opened (if there is an animation it will not be completed yet) + * @event + * @name open_node.jstree + * @param {Object} node the opened node + */ + this.trigger('open_node', { "node" : obj }); + if(!animation || !d.length) { + /** + * triggered when a node is opened and the animation is complete + * @event + * @name after_open.jstree + * @param {Object} node the opened node + */ + this.trigger("after_open", { "node" : obj }); + } + return true; + } + }, + /** + * opens every parent of a node (node should be loaded) + * @name _open_to(obj) + * @param {mixed} obj the node to reveal + * @private + */ + _open_to : function (obj) { + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + var i, j, p = obj.parents; + for(i = 0, j = p.length; i < j; i+=1) { + if(i !== $.jstree.root) { + this.open_node(p[i], false, 0); + } + } + return $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element); + }, + /** + * closes a node, hiding its children + * @name close_node(obj [, animation]) + * @param {mixed} obj the node to close + * @param {Number} animation the animation duration in milliseconds when closing the node (overrides the `core.animation` setting). Use `false` for no animation. + * @trigger close_node.jstree, after_close.jstree + */ + close_node : function (obj, animation) { + var t1, t2, t, d; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.close_node(obj[t1], animation); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + if(this.is_closed(obj)) { + return false; + } + animation = animation === undefined ? this.settings.core.animation : animation; + t = this; + d = this.get_node(obj, true); + + obj.state.opened = false; + /** + * triggered when a node is closed (if there is an animation it will not be complete yet) + * @event + * @name close_node.jstree + * @param {Object} node the closed node + */ + this.trigger('close_node',{ "node" : obj }); + if(!d.length) { + /** + * triggered when a node is closed and the animation is complete + * @event + * @name after_close.jstree + * @param {Object} node the closed node + */ + this.trigger("after_close", { "node" : obj }); + } + else { + if(!animation) { + d[0].className = d[0].className.replace('jstree-open', 'jstree-closed'); + d.attr("aria-expanded", false).children('.jstree-children').remove(); + this.trigger("after_close", { "node" : obj }); + } + else { + d + .children(".jstree-children").attr("style","display:block !important").end() + .removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded", false) + .children(".jstree-children").stop(true, true).slideUp(animation, function () { + this.style.display = ""; + d.children('.jstree-children').remove(); + if (t.element) { + t.trigger("after_close", { "node" : obj }); + } + }); + } + } + }, + /** + * toggles a node - closing it if it is open, opening it if it is closed + * @name toggle_node(obj) + * @param {mixed} obj the node to toggle + */ + toggle_node : function (obj) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.toggle_node(obj[t1]); + } + return true; + } + if(this.is_closed(obj)) { + return this.open_node(obj); + } + if(this.is_open(obj)) { + return this.close_node(obj); + } + }, + /** + * opens all nodes within a node (or the tree), revealing their children. If the node is not loaded it will be loaded and opened once ready. + * @name open_all([obj, animation, original_obj]) + * @param {mixed} obj the node to open recursively, omit to open all nodes in the tree + * @param {Number} animation the animation duration in milliseconds when opening the nodes, the default is no animation + * @param {jQuery} reference to the node that started the process (internal use) + * @trigger open_all.jstree + */ + open_all : function (obj, animation, original_obj) { + if(!obj) { obj = $.jstree.root; } + obj = this.get_node(obj); + if(!obj) { return false; } + var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), i, j, _this; + if(!dom.length) { + for(i = 0, j = obj.children_d.length; i < j; i++) { + if(this.is_closed(this._model.data[obj.children_d[i]])) { + this._model.data[obj.children_d[i]].state.opened = true; + } + } + return this.trigger('open_all', { "node" : obj }); + } + original_obj = original_obj || dom; + _this = this; + dom = this.is_closed(obj) ? dom.find('.jstree-closed').addBack() : dom.find('.jstree-closed'); + dom.each(function () { + _this.open_node( + this, + function(node, status) { if(status && this.is_parent(node)) { this.open_all(node, animation, original_obj); } }, + animation || 0 + ); + }); + if(original_obj.find('.jstree-closed').length === 0) { + /** + * triggered when an `open_all` call completes + * @event + * @name open_all.jstree + * @param {Object} node the opened node + */ + this.trigger('open_all', { "node" : this.get_node(original_obj) }); + } + }, + /** + * closes all nodes within a node (or the tree), revealing their children + * @name close_all([obj, animation]) + * @param {mixed} obj the node to close recursively, omit to close all nodes in the tree + * @param {Number} animation the animation duration in milliseconds when closing the nodes, the default is no animation + * @trigger close_all.jstree + */ + close_all : function (obj, animation) { + if(!obj) { obj = $.jstree.root; } + obj = this.get_node(obj); + if(!obj) { return false; } + var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), + _this = this, i, j; + if(dom.length) { + dom = this.is_open(obj) ? dom.find('.jstree-open').addBack() : dom.find('.jstree-open'); + $(dom.get().reverse()).each(function () { _this.close_node(this, animation || 0); }); + } + for(i = 0, j = obj.children_d.length; i < j; i++) { + this._model.data[obj.children_d[i]].state.opened = false; + } + /** + * triggered when an `close_all` call completes + * @event + * @name close_all.jstree + * @param {Object} node the closed node + */ + this.trigger('close_all', { "node" : obj }); + }, + /** + * checks if a node is disabled (not selectable) + * @name is_disabled(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_disabled : function (obj) { + obj = this.get_node(obj); + return obj && obj.state && obj.state.disabled; + }, + /** + * enables a node - so that it can be selected + * @name enable_node(obj) + * @param {mixed} obj the node to enable + * @trigger enable_node.jstree + */ + enable_node : function (obj) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.enable_node(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + obj.state.disabled = false; + this.get_node(obj,true).children('.jstree-anchor').removeClass('jstree-disabled').attr('aria-disabled', false); + /** + * triggered when an node is enabled + * @event + * @name enable_node.jstree + * @param {Object} node the enabled node + */ + this.trigger('enable_node', { 'node' : obj }); + }, + /** + * disables a node - so that it can not be selected + * @name disable_node(obj) + * @param {mixed} obj the node to disable + * @trigger disable_node.jstree + */ + disable_node : function (obj) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.disable_node(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + obj.state.disabled = true; + this.get_node(obj,true).children('.jstree-anchor').addClass('jstree-disabled').attr('aria-disabled', true); + /** + * triggered when an node is disabled + * @event + * @name disable_node.jstree + * @param {Object} node the disabled node + */ + this.trigger('disable_node', { 'node' : obj }); + }, + /** + * determines if a node is hidden + * @name is_hidden(obj) + * @param {mixed} obj the node + */ + is_hidden : function (obj) { + obj = this.get_node(obj); + return obj.state.hidden === true; + }, + /** + * hides a node - it is still in the structure but will not be visible + * @name hide_node(obj) + * @param {mixed} obj the node to hide + * @param {Boolean} skip_redraw internal parameter controlling if redraw is called + * @trigger hide_node.jstree + */ + hide_node : function (obj, skip_redraw) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.hide_node(obj[t1], true); + } + if (!skip_redraw) { + this.redraw(); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + if(!obj.state.hidden) { + obj.state.hidden = true; + this._node_changed(obj.parent); + if(!skip_redraw) { + this.redraw(); + } + /** + * triggered when an node is hidden + * @event + * @name hide_node.jstree + * @param {Object} node the hidden node + */ + this.trigger('hide_node', { 'node' : obj }); + } + }, + /** + * shows a node + * @name show_node(obj) + * @param {mixed} obj the node to show + * @param {Boolean} skip_redraw internal parameter controlling if redraw is called + * @trigger show_node.jstree + */ + show_node : function (obj, skip_redraw) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.show_node(obj[t1], true); + } + if (!skip_redraw) { + this.redraw(); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + if(obj.state.hidden) { + obj.state.hidden = false; + this._node_changed(obj.parent); + if(!skip_redraw) { + this.redraw(); + } + /** + * triggered when an node is shown + * @event + * @name show_node.jstree + * @param {Object} node the shown node + */ + this.trigger('show_node', { 'node' : obj }); + } + }, + /** + * hides all nodes + * @name hide_all() + * @trigger hide_all.jstree + */ + hide_all : function (skip_redraw) { + var i, m = this._model.data, ids = []; + for(i in m) { + if(m.hasOwnProperty(i) && i !== $.jstree.root && !m[i].state.hidden) { + m[i].state.hidden = true; + ids.push(i); + } + } + this._model.force_full_redraw = true; + if(!skip_redraw) { + this.redraw(); + } + /** + * triggered when all nodes are hidden + * @event + * @name hide_all.jstree + * @param {Array} nodes the IDs of all hidden nodes + */ + this.trigger('hide_all', { 'nodes' : ids }); + return ids; + }, + /** + * shows all nodes + * @name show_all() + * @trigger show_all.jstree + */ + show_all : function (skip_redraw) { + var i, m = this._model.data, ids = []; + for(i in m) { + if(m.hasOwnProperty(i) && i !== $.jstree.root && m[i].state.hidden) { + m[i].state.hidden = false; + ids.push(i); + } + } + this._model.force_full_redraw = true; + if(!skip_redraw) { + this.redraw(); + } + /** + * triggered when all nodes are shown + * @event + * @name show_all.jstree + * @param {Array} nodes the IDs of all shown nodes + */ + this.trigger('show_all', { 'nodes' : ids }); + return ids; + }, + /** + * called when a node is selected by the user. Used internally. + * @private + * @name activate_node(obj, e) + * @param {mixed} obj the node + * @param {Object} e the related event + * @trigger activate_node.jstree, changed.jstree + */ + activate_node : function (obj, e) { + if(this.is_disabled(obj)) { + return false; + } + if(!e || typeof e !== 'object') { + e = {}; + } + + // ensure last_clicked is still in the DOM, make it fresh (maybe it was moved?) and make sure it is still selected, if not - make last_clicked the last selected node + this._data.core.last_clicked = this._data.core.last_clicked && this._data.core.last_clicked.id !== undefined ? this.get_node(this._data.core.last_clicked.id) : null; + if(this._data.core.last_clicked && !this._data.core.last_clicked.state.selected) { this._data.core.last_clicked = null; } + if(!this._data.core.last_clicked && this._data.core.selected.length) { this._data.core.last_clicked = this.get_node(this._data.core.selected[this._data.core.selected.length - 1]); } + + if(!this.settings.core.multiple || (!e.metaKey && !e.ctrlKey && !e.shiftKey) || (e.shiftKey && (!this._data.core.last_clicked || !this.get_parent(obj) || this.get_parent(obj) !== this._data.core.last_clicked.parent ) )) { + if(!this.settings.core.multiple && (e.metaKey || e.ctrlKey || e.shiftKey) && this.is_selected(obj)) { + this.deselect_node(obj, false, e); + } + else { + this.deselect_all(true); + this.select_node(obj, false, false, e); + this._data.core.last_clicked = this.get_node(obj); + } + } + else { + if(e.shiftKey) { + var o = this.get_node(obj).id, + l = this._data.core.last_clicked.id, + p = this.get_node(this._data.core.last_clicked.parent).children, + c = false, + i, j; + for(i = 0, j = p.length; i < j; i += 1) { + // separate IFs work whem o and l are the same + if(p[i] === o) { + c = !c; + } + if(p[i] === l) { + c = !c; + } + if(!this.is_disabled(p[i]) && (c || p[i] === o || p[i] === l)) { + if (!this.is_hidden(p[i])) { + this.select_node(p[i], true, false, e); + } + } + else { + this.deselect_node(p[i], true, e); + } + } + this.trigger('changed', { 'action' : 'select_node', 'node' : this.get_node(obj), 'selected' : this._data.core.selected, 'event' : e }); + } + else { + if(!this.is_selected(obj)) { + this.select_node(obj, false, false, e); + } + else { + this.deselect_node(obj, false, e); + } + } + } + /** + * triggered when an node is clicked or intercated with by the user + * @event + * @name activate_node.jstree + * @param {Object} node + * @param {Object} event the ooriginal event (if any) which triggered the call (may be an empty object) + */ + this.trigger('activate_node', { 'node' : this.get_node(obj), 'event' : e }); + }, + /** + * applies the hover state on a node, called when a node is hovered by the user. Used internally. + * @private + * @name hover_node(obj) + * @param {mixed} obj + * @trigger hover_node.jstree + */ + hover_node : function (obj) { + obj = this.get_node(obj, true); + if(!obj || !obj.length || obj.children('.jstree-hovered').length) { + return false; + } + var o = this.element.find('.jstree-hovered'), t = this.element; + if(o && o.length) { this.dehover_node(o); } + + obj.children('.jstree-anchor').addClass('jstree-hovered'); + /** + * triggered when an node is hovered + * @event + * @name hover_node.jstree + * @param {Object} node + */ + this.trigger('hover_node', { 'node' : this.get_node(obj) }); + setTimeout(function () { t.attr('aria-activedescendant', obj[0].id); }, 0); + }, + /** + * removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally. + * @private + * @name dehover_node(obj) + * @param {mixed} obj + * @trigger dehover_node.jstree + */ + dehover_node : function (obj) { + obj = this.get_node(obj, true); + if(!obj || !obj.length || !obj.children('.jstree-hovered').length) { + return false; + } + obj.children('.jstree-anchor').removeClass('jstree-hovered'); + /** + * triggered when an node is no longer hovered + * @event + * @name dehover_node.jstree + * @param {Object} node + */ + this.trigger('dehover_node', { 'node' : this.get_node(obj) }); + }, + /** + * select a node + * @name select_node(obj [, supress_event, prevent_open]) + * @param {mixed} obj an array can be used to select multiple nodes + * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered + * @param {Boolean} prevent_open if set to `true` parents of the selected node won't be opened + * @trigger select_node.jstree, changed.jstree + */ + select_node : function (obj, supress_event, prevent_open, e) { + var dom, t1, t2, th; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.select_node(obj[t1], supress_event, prevent_open, e); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + dom = this.get_node(obj, true); + if(!obj.state.selected) { + obj.state.selected = true; + this._data.core.selected.push(obj.id); + if(!prevent_open) { + dom = this._open_to(obj); + } + if(dom && dom.length) { + dom.attr('aria-selected', true).children('.jstree-anchor').addClass('jstree-clicked'); + } + /** + * triggered when an node is selected + * @event + * @name select_node.jstree + * @param {Object} node + * @param {Array} selected the current selection + * @param {Object} event the event (if any) that triggered this select_node + */ + this.trigger('select_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); + if(!supress_event) { + /** + * triggered when selection changes + * @event + * @name changed.jstree + * @param {Object} node + * @param {Object} action the action that caused the selection to change + * @param {Array} selected the current selection + * @param {Object} event the event (if any) that triggered this changed event + */ + this.trigger('changed', { 'action' : 'select_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); + } + } + }, + /** + * deselect a node + * @name deselect_node(obj [, supress_event]) + * @param {mixed} obj an array can be used to deselect multiple nodes + * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered + * @trigger deselect_node.jstree, changed.jstree + */ + deselect_node : function (obj, supress_event, e) { + var t1, t2, dom; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.deselect_node(obj[t1], supress_event, e); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + dom = this.get_node(obj, true); + if(obj.state.selected) { + obj.state.selected = false; + this._data.core.selected = $.vakata.array_remove_item(this._data.core.selected, obj.id); + if(dom.length) { + dom.attr('aria-selected', false).children('.jstree-anchor').removeClass('jstree-clicked'); + } + /** + * triggered when an node is deselected + * @event + * @name deselect_node.jstree + * @param {Object} node + * @param {Array} selected the current selection + * @param {Object} event the event (if any) that triggered this deselect_node + */ + this.trigger('deselect_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); + if(!supress_event) { + this.trigger('changed', { 'action' : 'deselect_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); + } + } + }, + /** + * select all nodes in the tree + * @name select_all([supress_event]) + * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered + * @trigger select_all.jstree, changed.jstree + */ + select_all : function (supress_event) { + var tmp = this._data.core.selected.concat([]), i, j; + this._data.core.selected = this._model.data[$.jstree.root].children_d.concat(); + for(i = 0, j = this._data.core.selected.length; i < j; i++) { + if(this._model.data[this._data.core.selected[i]]) { + this._model.data[this._data.core.selected[i]].state.selected = true; + } + } + this.redraw(true); + /** + * triggered when all nodes are selected + * @event + * @name select_all.jstree + * @param {Array} selected the current selection + */ + this.trigger('select_all', { 'selected' : this._data.core.selected }); + if(!supress_event) { + this.trigger('changed', { 'action' : 'select_all', 'selected' : this._data.core.selected, 'old_selection' : tmp }); + } + }, + /** + * deselect all selected nodes + * @name deselect_all([supress_event]) + * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered + * @trigger deselect_all.jstree, changed.jstree + */ + deselect_all : function (supress_event) { + var tmp = this._data.core.selected.concat([]), i, j; + for(i = 0, j = this._data.core.selected.length; i < j; i++) { + if(this._model.data[this._data.core.selected[i]]) { + this._model.data[this._data.core.selected[i]].state.selected = false; + } + } + this._data.core.selected = []; + this.element.find('.jstree-clicked').removeClass('jstree-clicked').parent().attr('aria-selected', false); + /** + * triggered when all nodes are deselected + * @event + * @name deselect_all.jstree + * @param {Object} node the previous selection + * @param {Array} selected the current selection + */ + this.trigger('deselect_all', { 'selected' : this._data.core.selected, 'node' : tmp }); + if(!supress_event) { + this.trigger('changed', { 'action' : 'deselect_all', 'selected' : this._data.core.selected, 'old_selection' : tmp }); + } + }, + /** + * checks if a node is selected + * @name is_selected(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_selected : function (obj) { + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + return obj.state.selected; + }, + /** + * get an array of all selected nodes + * @name get_selected([full]) + * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + */ + get_selected : function (full) { + return full ? $.map(this._data.core.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.core.selected.slice(); + }, + /** + * get an array of all top level selected nodes (ignoring children of selected nodes) + * @name get_top_selected([full]) + * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + */ + get_top_selected : function (full) { + var tmp = this.get_selected(true), + obj = {}, i, j, k, l; + for(i = 0, j = tmp.length; i < j; i++) { + obj[tmp[i].id] = tmp[i]; + } + for(i = 0, j = tmp.length; i < j; i++) { + for(k = 0, l = tmp[i].children_d.length; k < l; k++) { + if(obj[tmp[i].children_d[k]]) { + delete obj[tmp[i].children_d[k]]; + } + } + } + tmp = []; + for(i in obj) { + if(obj.hasOwnProperty(i)) { + tmp.push(i); + } + } + return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp; + }, + /** + * get an array of all bottom level selected nodes (ignoring selected parents) + * @name get_bottom_selected([full]) + * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + */ + get_bottom_selected : function (full) { + var tmp = this.get_selected(true), + obj = [], i, j; + for(i = 0, j = tmp.length; i < j; i++) { + if(!tmp[i].children.length) { + obj.push(tmp[i].id); + } + } + return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj; + }, + /** + * gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally. + * @name get_state() + * @private + * @return {Object} + */ + get_state : function () { + var state = { + 'core' : { + 'open' : [], + 'loaded' : [], + 'scroll' : { + 'left' : this.element.scrollLeft(), + 'top' : this.element.scrollTop() + }, + /*! + 'themes' : { + 'name' : this.get_theme(), + 'icons' : this._data.core.themes.icons, + 'dots' : this._data.core.themes.dots + }, + */ + 'selected' : [] + } + }, i; + for(i in this._model.data) { + if(this._model.data.hasOwnProperty(i)) { + if(i !== $.jstree.root) { + if(this._model.data[i].state.loaded && this.settings.core.loaded_state) { + state.core.loaded.push(i); + } + if(this._model.data[i].state.opened) { + state.core.open.push(i); + } + if(this._model.data[i].state.selected) { + state.core.selected.push(i); + } + } + } + } + return state; + }, + /** + * sets the state of the tree. Used internally. + * @name set_state(state [, callback]) + * @private + * @param {Object} state the state to restore. Keep in mind this object is passed by reference and jstree will modify it. + * @param {Function} callback an optional function to execute once the state is restored. + * @trigger set_state.jstree + */ + set_state : function (state, callback) { + if(state) { + if(state.core && state.core.selected && state.core.initial_selection === undefined) { + state.core.initial_selection = this._data.core.selected.concat([]).sort().join(','); + } + if(state.core) { + var res, n, t, _this, i; + if(state.core.loaded) { + if(!this.settings.core.loaded_state || !$.isArray(state.core.loaded) || !state.core.loaded.length) { + delete state.core.loaded; + this.set_state(state, callback); + } + else { + this._load_nodes(state.core.loaded, function (nodes) { + delete state.core.loaded; + this.set_state(state, callback); + }); + } + return false; + } + if(state.core.open) { + if(!$.isArray(state.core.open) || !state.core.open.length) { + delete state.core.open; + this.set_state(state, callback); + } + else { + this._load_nodes(state.core.open, function (nodes) { + this.open_node(nodes, false, 0); + delete state.core.open; + this.set_state(state, callback); + }); + } + return false; + } + if(state.core.scroll) { + if(state.core.scroll && state.core.scroll.left !== undefined) { + this.element.scrollLeft(state.core.scroll.left); + } + if(state.core.scroll && state.core.scroll.top !== undefined) { + this.element.scrollTop(state.core.scroll.top); + } + delete state.core.scroll; + this.set_state(state, callback); + return false; + } + if(state.core.selected) { + _this = this; + if (state.core.initial_selection === undefined || + state.core.initial_selection === this._data.core.selected.concat([]).sort().join(',') + ) { + this.deselect_all(); + $.each(state.core.selected, function (i, v) { + _this.select_node(v, false, true); + }); + } + delete state.core.initial_selection; + delete state.core.selected; + this.set_state(state, callback); + return false; + } + for(i in state) { + if(state.hasOwnProperty(i) && i !== "core" && $.inArray(i, this.settings.plugins) === -1) { + delete state[i]; + } + } + if($.isEmptyObject(state.core)) { + delete state.core; + this.set_state(state, callback); + return false; + } + } + if($.isEmptyObject(state)) { + state = null; + if(callback) { callback.call(this); } + /** + * triggered when a `set_state` call completes + * @event + * @name set_state.jstree + */ + this.trigger('set_state'); + return false; + } + return true; + } + return false; + }, + /** + * refreshes the tree - all nodes are reloaded with calls to `load_node`. + * @name refresh() + * @param {Boolean} skip_loading an option to skip showing the loading indicator + * @param {Mixed} forget_state if set to `true` state will not be reapplied, if set to a function (receiving the current state as argument) the result of that function will be used as state + * @trigger refresh.jstree + */ + refresh : function (skip_loading, forget_state) { + this._data.core.state = forget_state === true ? {} : this.get_state(); + if(forget_state && $.isFunction(forget_state)) { this._data.core.state = forget_state.call(this, this._data.core.state); } + this._cnt = 0; + this._model.data = {}; + this._model.data[$.jstree.root] = { + id : $.jstree.root, + parent : null, + parents : [], + children : [], + children_d : [], + state : { loaded : false } + }; + this._data.core.selected = []; + this._data.core.last_clicked = null; + this._data.core.focused = null; + + var c = this.get_container_ul()[0].className; + if(!skip_loading) { + this.element.html("<"+"ul class='"+c+"' role='group'><"+"li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j"+this._id+"_loading'><"+"a class='jstree-anchor' href='#'>" + this.get_string("Loading ...") + ""); + this.element.attr('aria-activedescendant','j'+this._id+'_loading'); + } + this.load_node($.jstree.root, function (o, s) { + if(s) { + this.get_container_ul()[0].className = c; + if(this._firstChild(this.get_container_ul()[0])) { + this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id); + } + this.set_state($.extend(true, {}, this._data.core.state), function () { + /** + * triggered when a `refresh` call completes + * @event + * @name refresh.jstree + */ + this.trigger('refresh'); + }); + } + this._data.core.state = null; + }); + }, + /** + * refreshes a node in the tree (reload its children) all opened nodes inside that node are reloaded with calls to `load_node`. + * @name refresh_node(obj) + * @param {mixed} obj the node + * @trigger refresh_node.jstree + */ + refresh_node : function (obj) { + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + var opened = [], to_load = [], s = this._data.core.selected.concat([]); + to_load.push(obj.id); + if(obj.state.opened === true) { opened.push(obj.id); } + this.get_node(obj, true).find('.jstree-open').each(function() { to_load.push(this.id); opened.push(this.id); }); + this._load_nodes(to_load, $.proxy(function (nodes) { + this.open_node(opened, false, 0); + this.select_node(s); + /** + * triggered when a node is refreshed + * @event + * @name refresh_node.jstree + * @param {Object} node - the refreshed node + * @param {Array} nodes - an array of the IDs of the nodes that were reloaded + */ + this.trigger('refresh_node', { 'node' : obj, 'nodes' : nodes }); + }, this), false, true); + }, + /** + * set (change) the ID of a node + * @name set_id(obj, id) + * @param {mixed} obj the node + * @param {String} id the new ID + * @return {Boolean} + * @trigger set_id.jstree + */ + set_id : function (obj, id) { + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + var i, j, m = this._model.data, old = obj.id; + id = id.toString(); + // update parents (replace current ID with new one in children and children_d) + m[obj.parent].children[$.inArray(obj.id, m[obj.parent].children)] = id; + for(i = 0, j = obj.parents.length; i < j; i++) { + m[obj.parents[i]].children_d[$.inArray(obj.id, m[obj.parents[i]].children_d)] = id; + } + // update children (replace current ID with new one in parent and parents) + for(i = 0, j = obj.children.length; i < j; i++) { + m[obj.children[i]].parent = id; + } + for(i = 0, j = obj.children_d.length; i < j; i++) { + m[obj.children_d[i]].parents[$.inArray(obj.id, m[obj.children_d[i]].parents)] = id; + } + i = $.inArray(obj.id, this._data.core.selected); + if(i !== -1) { this._data.core.selected[i] = id; } + // update model and obj itself (obj.id, this._model.data[KEY]) + i = this.get_node(obj.id, true); + if(i) { + i.attr('id', id); //.children('.jstree-anchor').attr('id', id + '_anchor').end().attr('aria-labelledby', id + '_anchor'); + if(this.element.attr('aria-activedescendant') === obj.id) { + this.element.attr('aria-activedescendant', id); + } + } + delete m[obj.id]; + obj.id = id; + obj.li_attr.id = id; + m[id] = obj; + /** + * triggered when a node id value is changed + * @event + * @name set_id.jstree + * @param {Object} node + * @param {String} old the old id + */ + this.trigger('set_id',{ "node" : obj, "new" : obj.id, "old" : old }); + return true; + }, + /** + * get the text value of a node + * @name get_text(obj) + * @param {mixed} obj the node + * @return {String} + */ + get_text : function (obj) { + obj = this.get_node(obj); + return (!obj || obj.id === $.jstree.root) ? false : obj.text; + }, + /** + * set the text value of a node. Used internally, please use `rename_node(obj, val)`. + * @private + * @name set_text(obj, val) + * @param {mixed} obj the node, you can pass an array to set the text on multiple nodes + * @param {String} val the new text value + * @return {Boolean} + * @trigger set_text.jstree + */ + set_text : function (obj, val) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.set_text(obj[t1], val); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + obj.text = val; + if(this.get_node(obj, true).length) { + this.redraw_node(obj.id); + } + /** + * triggered when a node text value is changed + * @event + * @name set_text.jstree + * @param {Object} obj + * @param {String} text the new value + */ + this.trigger('set_text',{ "obj" : obj, "text" : val }); + return true; + }, + /** + * gets a JSON representation of a node (or the whole tree) + * @name get_json([obj, options]) + * @param {mixed} obj + * @param {Object} options + * @param {Boolean} options.no_state do not return state information + * @param {Boolean} options.no_id do not return ID + * @param {Boolean} options.no_children do not include children + * @param {Boolean} options.no_data do not include node data + * @param {Boolean} options.no_li_attr do not include LI attributes + * @param {Boolean} options.no_a_attr do not include A attributes + * @param {Boolean} options.flat return flat JSON instead of nested + * @return {Object} + */ + get_json : function (obj, options, flat) { + obj = this.get_node(obj || $.jstree.root); + if(!obj) { return false; } + if(options && options.flat && !flat) { flat = []; } + var tmp = { + 'id' : obj.id, + 'text' : obj.text, + 'icon' : this.get_icon(obj), + 'li_attr' : $.extend(true, {}, obj.li_attr), + 'a_attr' : $.extend(true, {}, obj.a_attr), + 'state' : {}, + 'data' : options && options.no_data ? false : $.extend(true, $.isArray(obj.data)?[]:{}, obj.data) + //( this.get_node(obj, true).length ? this.get_node(obj, true).data() : obj.data ), + }, i, j; + if(options && options.flat) { + tmp.parent = obj.parent; + } + else { + tmp.children = []; + } + if(!options || !options.no_state) { + for(i in obj.state) { + if(obj.state.hasOwnProperty(i)) { + tmp.state[i] = obj.state[i]; + } + } + } else { + delete tmp.state; + } + if(options && options.no_li_attr) { + delete tmp.li_attr; + } + if(options && options.no_a_attr) { + delete tmp.a_attr; + } + if(options && options.no_id) { + delete tmp.id; + if(tmp.li_attr && tmp.li_attr.id) { + delete tmp.li_attr.id; + } + if(tmp.a_attr && tmp.a_attr.id) { + delete tmp.a_attr.id; + } + } + if(options && options.flat && obj.id !== $.jstree.root) { + flat.push(tmp); + } + if(!options || !options.no_children) { + for(i = 0, j = obj.children.length; i < j; i++) { + if(options && options.flat) { + this.get_json(obj.children[i], options, flat); + } + else { + tmp.children.push(this.get_json(obj.children[i], options)); + } + } + } + return options && options.flat ? flat : (obj.id === $.jstree.root ? tmp.children : tmp); + }, + /** + * create a new node (do not confuse with load_node) + * @name create_node([par, node, pos, callback, is_loaded]) + * @param {mixed} par the parent node (to create a root node use either "#" (string) or `null`) + * @param {mixed} node the data for the new node (a valid JSON object, or a simple string with the name) + * @param {mixed} pos the index at which to insert the node, "first" and "last" are also supported, default is "last" + * @param {Function} callback a function to be called once the node is created + * @param {Boolean} is_loaded internal argument indicating if the parent node was succesfully loaded + * @return {String} the ID of the newly create node + * @trigger model.jstree, create_node.jstree + */ + create_node : function (par, node, pos, callback, is_loaded) { + if(par === null) { par = $.jstree.root; } + par = this.get_node(par); + if(!par) { return false; } + pos = pos === undefined ? "last" : pos; + if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { + return this.load_node(par, function () { this.create_node(par, node, pos, callback, true); }); + } + if(!node) { node = { "text" : this.get_string('New node') }; } + if(typeof node === "string") { + node = { "text" : node }; + } else { + node = $.extend(true, {}, node); + } + if(node.text === undefined) { node.text = this.get_string('New node'); } + var tmp, dpc, i, j; + + if(par.id === $.jstree.root) { + if(pos === "before") { pos = "first"; } + if(pos === "after") { pos = "last"; } + } + switch(pos) { + case "before": + tmp = this.get_node(par.parent); + pos = $.inArray(par.id, tmp.children); + par = tmp; + break; + case "after" : + tmp = this.get_node(par.parent); + pos = $.inArray(par.id, tmp.children) + 1; + par = tmp; + break; + case "inside": + case "first": + pos = 0; + break; + case "last": + pos = par.children.length; + break; + default: + if(!pos) { pos = 0; } + break; + } + if(pos > par.children.length) { pos = par.children.length; } + if(!node.id) { node.id = true; } + if(!this.check("create_node", node, par, pos)) { + this.settings.core.error.call(this, this._data.core.last_error); + return false; + } + if(node.id === true) { delete node.id; } + node = this._parse_model_from_json(node, par.id, par.parents.concat()); + if(!node) { return false; } + tmp = this.get_node(node); + dpc = []; + dpc.push(node); + dpc = dpc.concat(tmp.children_d); + this.trigger('model', { "nodes" : dpc, "parent" : par.id }); + + par.children_d = par.children_d.concat(dpc); + for(i = 0, j = par.parents.length; i < j; i++) { + this._model.data[par.parents[i]].children_d = this._model.data[par.parents[i]].children_d.concat(dpc); + } + node = tmp; + tmp = []; + for(i = 0, j = par.children.length; i < j; i++) { + tmp[i >= pos ? i+1 : i] = par.children[i]; + } + tmp[pos] = node.id; + par.children = tmp; + + this.redraw_node(par, true); + /** + * triggered when a node is created + * @event + * @name create_node.jstree + * @param {Object} node + * @param {String} parent the parent's ID + * @param {Number} position the position of the new node among the parent's children + */ + this.trigger('create_node', { "node" : this.get_node(node), "parent" : par.id, "position" : pos }); + if(callback) { callback.call(this, this.get_node(node)); } + return node.id; + }, + /** + * set the text value of a node + * @name rename_node(obj, val) + * @param {mixed} obj the node, you can pass an array to rename multiple nodes to the same name + * @param {String} val the new text value + * @return {Boolean} + * @trigger rename_node.jstree + */ + rename_node : function (obj, val) { + var t1, t2, old; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.rename_node(obj[t1], val); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + old = obj.text; + if(!this.check("rename_node", obj, this.get_parent(obj), val)) { + this.settings.core.error.call(this, this._data.core.last_error); + return false; + } + this.set_text(obj, val); // .apply(this, Array.prototype.slice.call(arguments)) + /** + * triggered when a node is renamed + * @event + * @name rename_node.jstree + * @param {Object} node + * @param {String} text the new value + * @param {String} old the old value + */ + this.trigger('rename_node', { "node" : obj, "text" : val, "old" : old }); + return true; + }, + /** + * remove a node + * @name delete_node(obj) + * @param {mixed} obj the node, you can pass an array to delete multiple nodes + * @return {Boolean} + * @trigger delete_node.jstree, changed.jstree + */ + delete_node : function (obj) { + var t1, t2, par, pos, tmp, i, j, k, l, c, top, lft; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.delete_node(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + par = this.get_node(obj.parent); + pos = $.inArray(obj.id, par.children); + c = false; + if(!this.check("delete_node", obj, par, pos)) { + this.settings.core.error.call(this, this._data.core.last_error); + return false; + } + if(pos !== -1) { + par.children = $.vakata.array_remove(par.children, pos); + } + tmp = obj.children_d.concat([]); + tmp.push(obj.id); + for(i = 0, j = obj.parents.length; i < j; i++) { + this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) { + return $.inArray(v, tmp) === -1; + }); + } + for(k = 0, l = tmp.length; k < l; k++) { + if(this._model.data[tmp[k]].state.selected) { + c = true; + break; + } + } + if (c) { + this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) { + return $.inArray(v, tmp) === -1; + }); + } + /** + * triggered when a node is deleted + * @event + * @name delete_node.jstree + * @param {Object} node + * @param {String} parent the parent's ID + */ + this.trigger('delete_node', { "node" : obj, "parent" : par.id }); + if(c) { + this.trigger('changed', { 'action' : 'delete_node', 'node' : obj, 'selected' : this._data.core.selected, 'parent' : par.id }); + } + for(k = 0, l = tmp.length; k < l; k++) { + delete this._model.data[tmp[k]]; + } + if($.inArray(this._data.core.focused, tmp) !== -1) { + this._data.core.focused = null; + top = this.element[0].scrollTop; + lft = this.element[0].scrollLeft; + if(par.id === $.jstree.root) { + if (this._model.data[$.jstree.root].children[0]) { + this.get_node(this._model.data[$.jstree.root].children[0], true).children('.jstree-anchor').focus(); + } + } + else { + this.get_node(par, true).children('.jstree-anchor').focus(); + } + this.element[0].scrollTop = top; + this.element[0].scrollLeft = lft; + } + this.redraw_node(par, true); + return true; + }, + /** + * check if an operation is premitted on the tree. Used internally. + * @private + * @name check(chk, obj, par, pos) + * @param {String} chk the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node" + * @param {mixed} obj the node + * @param {mixed} par the parent + * @param {mixed} pos the position to insert at, or if "rename_node" - the new name + * @param {mixed} more some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node + * @return {Boolean} + */ + check : function (chk, obj, par, pos, more) { + obj = obj && obj.id ? obj : this.get_node(obj); + par = par && par.id ? par : this.get_node(par); + var tmp = chk.match(/^move_node|copy_node|create_node$/i) ? par : obj, + chc = this.settings.core.check_callback; + if(chk === "move_node" || chk === "copy_node") { + if((!more || !more.is_multi) && (obj.id === par.id || (chk === "move_node" && $.inArray(obj.id, par.children) === pos) || $.inArray(par.id, obj.children_d) !== -1)) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_01', 'reason' : 'Moving parent inside child', 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + return false; + } + } + if(tmp && tmp.data) { tmp = tmp.data; } + if(tmp && tmp.functions && (tmp.functions[chk] === false || tmp.functions[chk] === true)) { + if(tmp.functions[chk] === false) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_02', 'reason' : 'Node data prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + } + return tmp.functions[chk]; + } + if(chc === false || ($.isFunction(chc) && chc.call(this, chk, obj, par, pos, more) === false) || (chc && chc[chk] === false)) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_03', 'reason' : 'User config for core.check_callback prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + return false; + } + return true; + }, + /** + * get the last error + * @name last_error() + * @return {Object} + */ + last_error : function () { + return this._data.core.last_error; + }, + /** + * move a node to a new parent + * @name move_node(obj, par [, pos, callback, is_loaded]) + * @param {mixed} obj the node to move, pass an array to move multiple nodes + * @param {mixed} par the new parent + * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` + * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position + * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded + * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn + * @param {Boolean} instance internal parameter indicating if the node comes from another instance + * @trigger move_node.jstree + */ + move_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { + var t1, t2, old_par, old_pos, new_par, old_ins, is_multi, dpc, tmp, i, j, k, l, p; + + par = this.get_node(par); + pos = pos === undefined ? 0 : pos; + if(!par) { return false; } + if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { + return this.load_node(par, function () { this.move_node(obj, par, pos, callback, true, false, origin); }); + } + + if($.isArray(obj)) { + if(obj.length === 1) { + obj = obj[0]; + } + else { + //obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + if((tmp = this.move_node(obj[t1], par, pos, callback, is_loaded, false, origin))) { + par = tmp; + pos = "after"; + } + } + this.redraw(); + return true; + } + } + obj = obj && obj.id ? obj : this.get_node(obj); + + if(!obj || obj.id === $.jstree.root) { return false; } + + old_par = (obj.parent || $.jstree.root).toString(); + new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent); + old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id)); + is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id); + old_pos = old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1; + if(old_ins && old_ins._id) { + obj = old_ins._model.data[obj.id]; + } + + if(is_multi) { + if((tmp = this.copy_node(obj, par, pos, callback, is_loaded, false, origin))) { + if(old_ins) { old_ins.delete_node(obj); } + return tmp; + } + return false; + } + //var m = this._model.data; + if(par.id === $.jstree.root) { + if(pos === "before") { pos = "first"; } + if(pos === "after") { pos = "last"; } + } + switch(pos) { + case "before": + pos = $.inArray(par.id, new_par.children); + break; + case "after" : + pos = $.inArray(par.id, new_par.children) + 1; + break; + case "inside": + case "first": + pos = 0; + break; + case "last": + pos = new_par.children.length; + break; + default: + if(!pos) { pos = 0; } + break; + } + if(pos > new_par.children.length) { pos = new_par.children.length; } + if(!this.check("move_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) { + this.settings.core.error.call(this, this._data.core.last_error); + return false; + } + if(obj.parent === new_par.id) { + dpc = new_par.children.concat(); + tmp = $.inArray(obj.id, dpc); + if(tmp !== -1) { + dpc = $.vakata.array_remove(dpc, tmp); + if(pos > tmp) { pos--; } + } + tmp = []; + for(i = 0, j = dpc.length; i < j; i++) { + tmp[i >= pos ? i+1 : i] = dpc[i]; + } + tmp[pos] = obj.id; + new_par.children = tmp; + this._node_changed(new_par.id); + this.redraw(new_par.id === $.jstree.root); + } + else { + // clean old parent and up + tmp = obj.children_d.concat(); + tmp.push(obj.id); + for(i = 0, j = obj.parents.length; i < j; i++) { + dpc = []; + p = old_ins._model.data[obj.parents[i]].children_d; + for(k = 0, l = p.length; k < l; k++) { + if($.inArray(p[k], tmp) === -1) { + dpc.push(p[k]); + } + } + old_ins._model.data[obj.parents[i]].children_d = dpc; + } + old_ins._model.data[old_par].children = $.vakata.array_remove_item(old_ins._model.data[old_par].children, obj.id); + + // insert into new parent and up + for(i = 0, j = new_par.parents.length; i < j; i++) { + this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(tmp); + } + dpc = []; + for(i = 0, j = new_par.children.length; i < j; i++) { + dpc[i >= pos ? i+1 : i] = new_par.children[i]; + } + dpc[pos] = obj.id; + new_par.children = dpc; + new_par.children_d.push(obj.id); + new_par.children_d = new_par.children_d.concat(obj.children_d); + + // update object + obj.parent = new_par.id; + tmp = new_par.parents.concat(); + tmp.unshift(new_par.id); + p = obj.parents.length; + obj.parents = tmp; + + // update object children + tmp = tmp.concat(); + for(i = 0, j = obj.children_d.length; i < j; i++) { + this._model.data[obj.children_d[i]].parents = this._model.data[obj.children_d[i]].parents.slice(0,p*-1); + Array.prototype.push.apply(this._model.data[obj.children_d[i]].parents, tmp); + } + + if(old_par === $.jstree.root || new_par.id === $.jstree.root) { + this._model.force_full_redraw = true; + } + if(!this._model.force_full_redraw) { + this._node_changed(old_par); + this._node_changed(new_par.id); + } + if(!skip_redraw) { + this.redraw(); + } + } + if(callback) { callback.call(this, obj, new_par, pos); } + /** + * triggered when a node is moved + * @event + * @name move_node.jstree + * @param {Object} node + * @param {String} parent the parent's ID + * @param {Number} position the position of the node among the parent's children + * @param {String} old_parent the old parent of the node + * @param {Number} old_position the old position of the node + * @param {Boolean} is_multi do the node and new parent belong to different instances + * @param {jsTree} old_instance the instance the node came from + * @param {jsTree} new_instance the instance of the new parent + */ + this.trigger('move_node', { "node" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_pos, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this }); + return obj.id; + }, + /** + * copy a node to a new parent + * @name copy_node(obj, par [, pos, callback, is_loaded]) + * @param {mixed} obj the node to copy, pass an array to copy multiple nodes + * @param {mixed} par the new parent + * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` + * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position + * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded + * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn + * @param {Boolean} instance internal parameter indicating if the node comes from another instance + * @trigger model.jstree copy_node.jstree + */ + copy_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { + var t1, t2, dpc, tmp, i, j, node, old_par, new_par, old_ins, is_multi; + + par = this.get_node(par); + pos = pos === undefined ? 0 : pos; + if(!par) { return false; } + if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { + return this.load_node(par, function () { this.copy_node(obj, par, pos, callback, true, false, origin); }); + } + + if($.isArray(obj)) { + if(obj.length === 1) { + obj = obj[0]; + } + else { + //obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + if((tmp = this.copy_node(obj[t1], par, pos, callback, is_loaded, true, origin))) { + par = tmp; + pos = "after"; + } + } + this.redraw(); + return true; + } + } + obj = obj && obj.id ? obj : this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + + old_par = (obj.parent || $.jstree.root).toString(); + new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent); + old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id)); + is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id); + + if(old_ins && old_ins._id) { + obj = old_ins._model.data[obj.id]; + } + + if(par.id === $.jstree.root) { + if(pos === "before") { pos = "first"; } + if(pos === "after") { pos = "last"; } + } + switch(pos) { + case "before": + pos = $.inArray(par.id, new_par.children); + break; + case "after" : + pos = $.inArray(par.id, new_par.children) + 1; + break; + case "inside": + case "first": + pos = 0; + break; + case "last": + pos = new_par.children.length; + break; + default: + if(!pos) { pos = 0; } + break; + } + if(pos > new_par.children.length) { pos = new_par.children.length; } + if(!this.check("copy_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) { + this.settings.core.error.call(this, this._data.core.last_error); + return false; + } + node = old_ins ? old_ins.get_json(obj, { no_id : true, no_data : true, no_state : true }) : obj; + if(!node) { return false; } + if(node.id === true) { delete node.id; } + node = this._parse_model_from_json(node, new_par.id, new_par.parents.concat()); + if(!node) { return false; } + tmp = this.get_node(node); + if(obj && obj.state && obj.state.loaded === false) { tmp.state.loaded = false; } + dpc = []; + dpc.push(node); + dpc = dpc.concat(tmp.children_d); + this.trigger('model', { "nodes" : dpc, "parent" : new_par.id }); + + // insert into new parent and up + for(i = 0, j = new_par.parents.length; i < j; i++) { + this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(dpc); + } + dpc = []; + for(i = 0, j = new_par.children.length; i < j; i++) { + dpc[i >= pos ? i+1 : i] = new_par.children[i]; + } + dpc[pos] = tmp.id; + new_par.children = dpc; + new_par.children_d.push(tmp.id); + new_par.children_d = new_par.children_d.concat(tmp.children_d); + + if(new_par.id === $.jstree.root) { + this._model.force_full_redraw = true; + } + if(!this._model.force_full_redraw) { + this._node_changed(new_par.id); + } + if(!skip_redraw) { + this.redraw(new_par.id === $.jstree.root); + } + if(callback) { callback.call(this, tmp, new_par, pos); } + /** + * triggered when a node is copied + * @event + * @name copy_node.jstree + * @param {Object} node the copied node + * @param {Object} original the original node + * @param {String} parent the parent's ID + * @param {Number} position the position of the node among the parent's children + * @param {String} old_parent the old parent of the node + * @param {Number} old_position the position of the original node + * @param {Boolean} is_multi do the node and new parent belong to different instances + * @param {jsTree} old_instance the instance the node came from + * @param {jsTree} new_instance the instance of the new parent + */ + this.trigger('copy_node', { "node" : tmp, "original" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1,'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this }); + return tmp.id; + }, + /** + * cut a node (a later call to `paste(obj)` would move the node) + * @name cut(obj) + * @param {mixed} obj multiple objects can be passed using an array + * @trigger cut.jstree + */ + cut : function (obj) { + if(!obj) { obj = this._data.core.selected.concat(); } + if(!$.isArray(obj)) { obj = [obj]; } + if(!obj.length) { return false; } + var tmp = [], o, t1, t2; + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + o = this.get_node(obj[t1]); + if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); } + } + if(!tmp.length) { return false; } + ccp_node = tmp; + ccp_inst = this; + ccp_mode = 'move_node'; + /** + * triggered when nodes are added to the buffer for moving + * @event + * @name cut.jstree + * @param {Array} node + */ + this.trigger('cut', { "node" : obj }); + }, + /** + * copy a node (a later call to `paste(obj)` would copy the node) + * @name copy(obj) + * @param {mixed} obj multiple objects can be passed using an array + * @trigger copy.jstree + */ + copy : function (obj) { + if(!obj) { obj = this._data.core.selected.concat(); } + if(!$.isArray(obj)) { obj = [obj]; } + if(!obj.length) { return false; } + var tmp = [], o, t1, t2; + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + o = this.get_node(obj[t1]); + if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); } + } + if(!tmp.length) { return false; } + ccp_node = tmp; + ccp_inst = this; + ccp_mode = 'copy_node'; + /** + * triggered when nodes are added to the buffer for copying + * @event + * @name copy.jstree + * @param {Array} node + */ + this.trigger('copy', { "node" : obj }); + }, + /** + * get the current buffer (any nodes that are waiting for a paste operation) + * @name get_buffer() + * @return {Object} an object consisting of `mode` ("copy_node" or "move_node"), `node` (an array of objects) and `inst` (the instance) + */ + get_buffer : function () { + return { 'mode' : ccp_mode, 'node' : ccp_node, 'inst' : ccp_inst }; + }, + /** + * check if there is something in the buffer to paste + * @name can_paste() + * @return {Boolean} + */ + can_paste : function () { + return ccp_mode !== false && ccp_node !== false; // && ccp_inst._model.data[ccp_node]; + }, + /** + * copy or move the previously cut or copied nodes to a new parent + * @name paste(obj [, pos]) + * @param {mixed} obj the new parent + * @param {mixed} pos the position to insert at (besides integer, "first" and "last" are supported), defaults to integer `0` + * @trigger paste.jstree + */ + paste : function (obj, pos) { + obj = this.get_node(obj); + if(!obj || !ccp_mode || !ccp_mode.match(/^(copy_node|move_node)$/) || !ccp_node) { return false; } + if(this[ccp_mode](ccp_node, obj, pos, false, false, false, ccp_inst)) { + /** + * triggered when paste is invoked + * @event + * @name paste.jstree + * @param {String} parent the ID of the receiving node + * @param {Array} node the nodes in the buffer + * @param {String} mode the performed operation - "copy_node" or "move_node" + */ + this.trigger('paste', { "parent" : obj.id, "node" : ccp_node, "mode" : ccp_mode }); + } + ccp_node = false; + ccp_mode = false; + ccp_inst = false; + }, + /** + * clear the buffer of previously copied or cut nodes + * @name clear_buffer() + * @trigger clear_buffer.jstree + */ + clear_buffer : function () { + ccp_node = false; + ccp_mode = false; + ccp_inst = false; + /** + * triggered when the copy / cut buffer is cleared + * @event + * @name clear_buffer.jstree + */ + this.trigger('clear_buffer'); + }, + /** + * put a node in edit mode (input field to rename the node) + * @name edit(obj [, default_text, callback]) + * @param {mixed} obj + * @param {String} default_text the text to populate the input with (if omitted or set to a non-string value the node's text value is used) + * @param {Function} callback a function to be called once the text box is blurred, it is called in the instance's scope and receives the node, a status parameter (true if the rename is successful, false otherwise) and a boolean indicating if the user cancelled the edit. You can access the node's title using .text + */ + edit : function (obj, default_text, callback) { + var rtl, w, a, s, t, h1, h2, fn, tmp, cancel = false; + obj = this.get_node(obj); + if(!obj) { return false; } + if(!this.check("edit", obj, this.get_parent(obj))) { + this.settings.core.error.call(this, this._data.core.last_error); + return false; + } + tmp = obj; + default_text = typeof default_text === 'string' ? default_text : obj.text; + this.set_text(obj, ""); + obj = this._open_to(obj); + tmp.text = default_text; + + rtl = this._data.core.rtl; + w = this.element.width(); + this._data.core.focused = tmp.id; + a = obj.children('.jstree-anchor').focus(); + s = $(''); + /*! + oi = obj.children("i:visible"), + ai = a.children("i:visible"), + w1 = oi.width() * oi.length, + w2 = ai.width() * ai.length, + */ + t = default_text; + h1 = $("<"+"div />", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo(document.body); + h2 = $("<"+"input />", { + "value" : t, + "class" : "jstree-rename-input", + // "size" : t.length, + "css" : { + "padding" : "0", + "border" : "1px solid silver", + "box-sizing" : "border-box", + "display" : "inline-block", + "height" : (this._data.core.li_height) + "px", + "lineHeight" : (this._data.core.li_height) + "px", + "width" : "150px" // will be set a bit further down + }, + "blur" : $.proxy(function (e) { + e.stopImmediatePropagation(); + e.preventDefault(); + var i = s.children(".jstree-rename-input"), + v = i.val(), + f = this.settings.core.force_text, + nv; + if(v === "") { v = t; } + h1.remove(); + s.replaceWith(a); + s.remove(); + t = f ? t : $('
          ').append($.parseHTML(t)).html(); + obj = this.get_node(obj); + this.set_text(obj, t); + nv = !!this.rename_node(obj, f ? $('
          ').text(v).text() : $('
          ').append($.parseHTML(v)).html()); + if(!nv) { + this.set_text(obj, t); // move this up? and fix #483 + } + this._data.core.focused = tmp.id; + setTimeout($.proxy(function () { + var node = this.get_node(tmp.id, true); + if(node.length) { + this._data.core.focused = tmp.id; + node.children('.jstree-anchor').focus(); + } + }, this), 0); + if(callback) { + callback.call(this, tmp, nv, cancel); + } + h2 = null; + }, this), + "keydown" : function (e) { + var key = e.which; + if(key === 27) { + cancel = true; + this.value = t; + } + if(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) { + e.stopImmediatePropagation(); + } + if(key === 27 || key === 13) { + e.preventDefault(); + this.blur(); + } + }, + "click" : function (e) { e.stopImmediatePropagation(); }, + "mousedown" : function (e) { e.stopImmediatePropagation(); }, + "keyup" : function (e) { + h2.width(Math.min(h1.text("pW" + this.value).width(),w)); + }, + "keypress" : function(e) { + if(e.which === 13) { return false; } + } + }); + fn = { + fontFamily : a.css('fontFamily') || '', + fontSize : a.css('fontSize') || '', + fontWeight : a.css('fontWeight') || '', + fontStyle : a.css('fontStyle') || '', + fontStretch : a.css('fontStretch') || '', + fontVariant : a.css('fontVariant') || '', + letterSpacing : a.css('letterSpacing') || '', + wordSpacing : a.css('wordSpacing') || '' + }; + s.attr('class', a.attr('class')).append(a.contents().clone()).append(h2); + a.replaceWith(s); + h1.css(fn); + h2.css(fn).width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select(); + $(document).one('mousedown.jstree touchstart.jstree dnd_start.vakata', function (e) { + if (h2 && e.target !== h2) { + $(h2).blur(); + } + }); + }, + + + /** + * changes the theme + * @name set_theme(theme_name [, theme_url]) + * @param {String} theme_name the name of the new theme to apply + * @param {mixed} theme_url the location of the CSS file for this theme. Omit or set to `false` if you manually included the file. Set to `true` to autoload from the `core.themes.dir` directory. + * @trigger set_theme.jstree + */ + set_theme : function (theme_name, theme_url) { + if(!theme_name) { return false; } + if(theme_url === true) { + var dir = this.settings.core.themes.dir; + if(!dir) { dir = $.jstree.path + '/themes'; } + theme_url = dir + '/' + theme_name + '/style.css'; + } + if(theme_url && $.inArray(theme_url, themes_loaded) === -1) { + $('head').append('<'+'link rel="stylesheet" href="' + theme_url + '" type="text/css" />'); + themes_loaded.push(theme_url); + } + if(this._data.core.themes.name) { + this.element.removeClass('jstree-' + this._data.core.themes.name); + } + this._data.core.themes.name = theme_name; + this.element.addClass('jstree-' + theme_name); + this.element[this.settings.core.themes.responsive ? 'addClass' : 'removeClass' ]('jstree-' + theme_name + '-responsive'); + /** + * triggered when a theme is set + * @event + * @name set_theme.jstree + * @param {String} theme the new theme + */ + this.trigger('set_theme', { 'theme' : theme_name }); + }, + /** + * gets the name of the currently applied theme name + * @name get_theme() + * @return {String} + */ + get_theme : function () { return this._data.core.themes.name; }, + /** + * changes the theme variant (if the theme has variants) + * @name set_theme_variant(variant_name) + * @param {String|Boolean} variant_name the variant to apply (if `false` is used the current variant is removed) + */ + set_theme_variant : function (variant_name) { + if(this._data.core.themes.variant) { + this.element.removeClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant); + } + this._data.core.themes.variant = variant_name; + if(variant_name) { + this.element.addClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant); + } + }, + /** + * gets the name of the currently applied theme variant + * @name get_theme() + * @return {String} + */ + get_theme_variant : function () { return this._data.core.themes.variant; }, + /** + * shows a striped background on the container (if the theme supports it) + * @name show_stripes() + */ + show_stripes : function () { + this._data.core.themes.stripes = true; + this.get_container_ul().addClass("jstree-striped"); + /** + * triggered when stripes are shown + * @event + * @name show_stripes.jstree + */ + this.trigger('show_stripes'); + }, + /** + * hides the striped background on the container + * @name hide_stripes() + */ + hide_stripes : function () { + this._data.core.themes.stripes = false; + this.get_container_ul().removeClass("jstree-striped"); + /** + * triggered when stripes are hidden + * @event + * @name hide_stripes.jstree + */ + this.trigger('hide_stripes'); + }, + /** + * toggles the striped background on the container + * @name toggle_stripes() + */ + toggle_stripes : function () { if(this._data.core.themes.stripes) { this.hide_stripes(); } else { this.show_stripes(); } }, + /** + * shows the connecting dots (if the theme supports it) + * @name show_dots() + */ + show_dots : function () { + this._data.core.themes.dots = true; + this.get_container_ul().removeClass("jstree-no-dots"); + /** + * triggered when dots are shown + * @event + * @name show_dots.jstree + */ + this.trigger('show_dots'); + }, + /** + * hides the connecting dots + * @name hide_dots() + */ + hide_dots : function () { + this._data.core.themes.dots = false; + this.get_container_ul().addClass("jstree-no-dots"); + /** + * triggered when dots are hidden + * @event + * @name hide_dots.jstree + */ + this.trigger('hide_dots'); + }, + /** + * toggles the connecting dots + * @name toggle_dots() + */ + toggle_dots : function () { if(this._data.core.themes.dots) { this.hide_dots(); } else { this.show_dots(); } }, + /** + * show the node icons + * @name show_icons() + */ + show_icons : function () { + this._data.core.themes.icons = true; + this.get_container_ul().removeClass("jstree-no-icons"); + /** + * triggered when icons are shown + * @event + * @name show_icons.jstree + */ + this.trigger('show_icons'); + }, + /** + * hide the node icons + * @name hide_icons() + */ + hide_icons : function () { + this._data.core.themes.icons = false; + this.get_container_ul().addClass("jstree-no-icons"); + /** + * triggered when icons are hidden + * @event + * @name hide_icons.jstree + */ + this.trigger('hide_icons'); + }, + /** + * toggle the node icons + * @name toggle_icons() + */ + toggle_icons : function () { if(this._data.core.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }, + /** + * show the node ellipsis + * @name show_icons() + */ + show_ellipsis : function () { + this._data.core.themes.ellipsis = true; + this.get_container_ul().addClass("jstree-ellipsis"); + /** + * triggered when ellisis is shown + * @event + * @name show_ellipsis.jstree + */ + this.trigger('show_ellipsis'); + }, + /** + * hide the node ellipsis + * @name hide_ellipsis() + */ + hide_ellipsis : function () { + this._data.core.themes.ellipsis = false; + this.get_container_ul().removeClass("jstree-ellipsis"); + /** + * triggered when ellisis is hidden + * @event + * @name hide_ellipsis.jstree + */ + this.trigger('hide_ellipsis'); + }, + /** + * toggle the node ellipsis + * @name toggle_icons() + */ + toggle_ellipsis : function () { if(this._data.core.themes.ellipsis) { this.hide_ellipsis(); } else { this.show_ellipsis(); } }, + /** + * set the node icon for a node + * @name set_icon(obj, icon) + * @param {mixed} obj + * @param {String} icon the new icon - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class + */ + set_icon : function (obj, icon) { + var t1, t2, dom, old; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.set_icon(obj[t1], icon); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + old = obj.icon; + obj.icon = icon === true || icon === null || icon === undefined || icon === '' ? true : icon; + dom = this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon"); + if(icon === false) { + dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel"); + this.hide_icon(obj); + } + else if(icon === true || icon === null || icon === undefined || icon === '') { + dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel"); + if(old === false) { this.show_icon(obj); } + } + else if(icon.indexOf("/") === -1 && icon.indexOf(".") === -1) { + dom.removeClass(old).css("background",""); + dom.addClass(icon + ' jstree-themeicon-custom').attr("rel",icon); + if(old === false) { this.show_icon(obj); } + } + else { + dom.removeClass(old).css("background",""); + dom.addClass('jstree-themeicon-custom').css("background", "url('" + icon + "') center center no-repeat").attr("rel",icon); + if(old === false) { this.show_icon(obj); } + } + return true; + }, + /** + * get the node icon for a node + * @name get_icon(obj) + * @param {mixed} obj + * @return {String} + */ + get_icon : function (obj) { + obj = this.get_node(obj); + return (!obj || obj.id === $.jstree.root) ? false : obj.icon; + }, + /** + * hide the icon on an individual node + * @name hide_icon(obj) + * @param {mixed} obj + */ + hide_icon : function (obj) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.hide_icon(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj === $.jstree.root) { return false; } + obj.icon = false; + this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon").addClass('jstree-themeicon-hidden'); + return true; + }, + /** + * show the icon on an individual node + * @name show_icon(obj) + * @param {mixed} obj + */ + show_icon : function (obj) { + var t1, t2, dom; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.show_icon(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj === $.jstree.root) { return false; } + dom = this.get_node(obj, true); + obj.icon = dom.length ? dom.children(".jstree-anchor").children(".jstree-themeicon").attr('rel') : true; + if(!obj.icon) { obj.icon = true; } + dom.children(".jstree-anchor").children(".jstree-themeicon").removeClass('jstree-themeicon-hidden'); + return true; + } + }; + + // helpers + $.vakata = {}; + // collect attributes + $.vakata.attributes = function(node, with_values) { + node = $(node)[0]; + var attr = with_values ? {} : []; + if(node && node.attributes) { + $.each(node.attributes, function (i, v) { + if($.inArray(v.name.toLowerCase(),['style','contenteditable','hasfocus','tabindex']) !== -1) { return; } + if(v.value !== null && $.trim(v.value) !== '') { + if(with_values) { attr[v.name] = v.value; } + else { attr.push(v.name); } + } + }); + } + return attr; + }; + $.vakata.array_unique = function(array) { + var a = [], i, j, l, o = {}; + for(i = 0, l = array.length; i < l; i++) { + if(o[array[i]] === undefined) { + a.push(array[i]); + o[array[i]] = true; + } + } + return a; + }; + // remove item from array + $.vakata.array_remove = function(array, from) { + array.splice(from, 1); + return array; + //var rest = array.slice((to || from) + 1 || array.length); + //array.length = from < 0 ? array.length + from : from; + //array.push.apply(array, rest); + //return array; + }; + // remove item from array + $.vakata.array_remove_item = function(array, item) { + var tmp = $.inArray(item, array); + return tmp !== -1 ? $.vakata.array_remove(array, tmp) : array; + }; + $.vakata.array_filter = function(c,a,b,d,e) { + if (c.filter) { + return c.filter(a, b); + } + d=[]; + for (e in c) { + if (~~e+''===e+'' && e>=0 && a.call(b,c[e],+e,c)) { + d.push(c[e]); + } + } + return d; + }; + + +/** + * ### Changed plugin + * + * This plugin adds more information to the `changed.jstree` event. The new data is contained in the `changed` event data property, and contains a lists of `selected` and `deselected` nodes. + */ + + $.jstree.plugins.changed = function (options, parent) { + var last = []; + this.trigger = function (ev, data) { + var i, j; + if(!data) { + data = {}; + } + if(ev.replace('.jstree','') === 'changed') { + data.changed = { selected : [], deselected : [] }; + var tmp = {}; + for(i = 0, j = last.length; i < j; i++) { + tmp[last[i]] = 1; + } + for(i = 0, j = data.selected.length; i < j; i++) { + if(!tmp[data.selected[i]]) { + data.changed.selected.push(data.selected[i]); + } + else { + tmp[data.selected[i]] = 2; + } + } + for(i = 0, j = last.length; i < j; i++) { + if(tmp[last[i]] === 1) { + data.changed.deselected.push(last[i]); + } + } + last = data.selected.slice(); + } + /** + * triggered when selection changes (the "changed" plugin enhances the original event with more data) + * @event + * @name changed.jstree + * @param {Object} node + * @param {Object} action the action that caused the selection to change + * @param {Array} selected the current selection + * @param {Object} changed an object containing two properties `selected` and `deselected` - both arrays of node IDs, which were selected or deselected since the last changed event + * @param {Object} event the event (if any) that triggered this changed event + * @plugin changed + */ + parent.trigger.call(this, ev, data); + }; + this.refresh = function (skip_loading, forget_state) { + last = []; + return parent.refresh.apply(this, arguments); + }; + }; + +/** + * ### Checkbox plugin + * + * This plugin renders checkbox icons in front of each node, making multiple selection much easier. + * It also supports tri-state behavior, meaning that if a node has a few of its children checked it will be rendered as undetermined, and state will be propagated up. + */ + + var _i = document.createElement('I'); + _i.className = 'jstree-icon jstree-checkbox'; + _i.setAttribute('role', 'presentation'); + /** + * stores all defaults for the checkbox plugin + * @name $.jstree.defaults.checkbox + * @plugin checkbox + */ + $.jstree.defaults.checkbox = { + /** + * a boolean indicating if checkboxes should be visible (can be changed at a later time using `show_checkboxes()` and `hide_checkboxes`). Defaults to `true`. + * @name $.jstree.defaults.checkbox.visible + * @plugin checkbox + */ + visible : true, + /** + * a boolean indicating if checkboxes should cascade down and have an undetermined state. Defaults to `true`. + * @name $.jstree.defaults.checkbox.three_state + * @plugin checkbox + */ + three_state : true, + /** + * a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`. + * @name $.jstree.defaults.checkbox.whole_node + * @plugin checkbox + */ + whole_node : true, + /** + * a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`. + * @name $.jstree.defaults.checkbox.keep_selected_style + * @plugin checkbox + */ + keep_selected_style : true, + /** + * This setting controls how cascading and undetermined nodes are applied. + * If 'up' is in the string - cascading up is enabled, if 'down' is in the string - cascading down is enabled, if 'undetermined' is in the string - undetermined nodes will be used. + * If `three_state` is set to `true` this setting is automatically set to 'up+down+undetermined'. Defaults to ''. + * @name $.jstree.defaults.checkbox.cascade + * @plugin checkbox + */ + cascade : '', + /** + * This setting controls if checkbox are bound to the general tree selection or to an internal array maintained by the checkbox plugin. Defaults to `true`, only set to `false` if you know exactly what you are doing. + * @name $.jstree.defaults.checkbox.tie_selection + * @plugin checkbox + */ + tie_selection : true, + + /** + * This setting controls if cascading down affects disabled checkboxes + * @name $.jstree.defaults.checkbox.cascade_to_disabled + * @plugin checkbox + */ + cascade_to_disabled : true, + + /** + * This setting controls if cascading down affects hidden checkboxes + * @name $.jstree.defaults.checkbox.cascade_to_hidden + * @plugin checkbox + */ + cascade_to_hidden : true + }; + $.jstree.plugins.checkbox = function (options, parent) { + this.bind = function () { + parent.bind.call(this); + this._data.checkbox.uto = false; + this._data.checkbox.selected = []; + if(this.settings.checkbox.three_state) { + this.settings.checkbox.cascade = 'up+down+undetermined'; + } + this.element + .on("init.jstree", $.proxy(function () { + this._data.checkbox.visible = this.settings.checkbox.visible; + if(!this.settings.checkbox.keep_selected_style) { + this.element.addClass('jstree-checkbox-no-clicked'); + } + if(this.settings.checkbox.tie_selection) { + this.element.addClass('jstree-checkbox-selection'); + } + }, this)) + .on("loading.jstree", $.proxy(function () { + this[ this._data.checkbox.visible ? 'show_checkboxes' : 'hide_checkboxes' ](); + }, this)); + if(this.settings.checkbox.cascade.indexOf('undetermined') !== -1) { + this.element + .on('changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree', $.proxy(function () { + // only if undetermined is in setting + if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); } + this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50); + }, this)); + } + if(!this.settings.checkbox.tie_selection) { + this.element + .on('model.jstree', $.proxy(function (e, data) { + var m = this._model.data, + p = m[data.parent], + dpc = data.nodes, + i, j; + for(i = 0, j = dpc.length; i < j; i++) { + m[dpc[i]].state.checked = m[dpc[i]].state.checked || (m[dpc[i]].original && m[dpc[i]].original.state && m[dpc[i]].original.state.checked); + if(m[dpc[i]].state.checked) { + this._data.checkbox.selected.push(dpc[i]); + } + } + }, this)); + } + if(this.settings.checkbox.cascade.indexOf('up') !== -1 || this.settings.checkbox.cascade.indexOf('down') !== -1) { + this.element + .on('model.jstree', $.proxy(function (e, data) { + var m = this._model.data, + p = m[data.parent], + dpc = data.nodes, + chd = [], + c, i, j, k, l, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection; + + if(s.indexOf('down') !== -1) { + // apply down + if(p.state[ t ? 'selected' : 'checked' ]) { + for(i = 0, j = dpc.length; i < j; i++) { + m[dpc[i]].state[ t ? 'selected' : 'checked' ] = true; + } + + this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(dpc); + } + else { + for(i = 0, j = dpc.length; i < j; i++) { + if(m[dpc[i]].state[ t ? 'selected' : 'checked' ]) { + for(k = 0, l = m[dpc[i]].children_d.length; k < l; k++) { + m[m[dpc[i]].children_d[k]].state[ t ? 'selected' : 'checked' ] = true; + } + this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(m[dpc[i]].children_d); + } + } + } + } + + if(s.indexOf('up') !== -1) { + // apply up + for(i = 0, j = p.children_d.length; i < j; i++) { + if(!m[p.children_d[i]].children.length) { + chd.push(m[p.children_d[i]].parent); + } + } + chd = $.vakata.array_unique(chd); + for(k = 0, l = chd.length; k < l; k++) { + p = m[chd[k]]; + while(p && p.id !== $.jstree.root) { + c = 0; + for(i = 0, j = p.children.length; i < j; i++) { + c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; + } + if(c === j) { + p.state[ t ? 'selected' : 'checked' ] = true; + this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); + tmp = this.get_node(p, true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', true).children('.jstree-anchor').addClass( t ? 'jstree-clicked' : 'jstree-checked'); + } + } + else { + break; + } + p = this.get_node(p.parent); + } + } + } + + this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected); + }, this)) + .on(this.settings.checkbox.tie_selection ? 'select_node.jstree' : 'check_node.jstree', $.proxy(function (e, data) { + var self = this, + obj = data.node, + m = this._model.data, + par = this.get_node(obj.parent), + i, j, c, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection, + sel = {}, cur = this._data[ t ? 'core' : 'checkbox' ].selected; + + for (i = 0, j = cur.length; i < j; i++) { + sel[cur[i]] = true; + } + + // apply down + if(s.indexOf('down') !== -1) { + //this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected.concat(obj.children_d)); + var selectedIds = this._cascade_new_checked_state(obj.id, true); + var temp = obj.children_d.concat(obj.id); + for (i = 0, j = temp.length; i < j; i++) { + if (selectedIds.indexOf(temp[i]) > -1) { + sel[temp[i]] = true; + } + else { + delete sel[temp[i]]; + } + } + } + + // apply up + if(s.indexOf('up') !== -1) { + while(par && par.id !== $.jstree.root) { + c = 0; + for(i = 0, j = par.children.length; i < j; i++) { + c += m[par.children[i]].state[ t ? 'selected' : 'checked' ]; + } + if(c === j) { + par.state[ t ? 'selected' : 'checked' ] = true; + sel[par.id] = true; + //this._data[ t ? 'core' : 'checkbox' ].selected.push(par.id); + tmp = this.get_node(par, true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + else { + break; + } + par = this.get_node(par.parent); + } + } + + cur = []; + for (i in sel) { + if (sel.hasOwnProperty(i)) { + cur.push(i); + } + } + this._data[ t ? 'core' : 'checkbox' ].selected = cur; + }, this)) + .on(this.settings.checkbox.tie_selection ? 'deselect_all.jstree' : 'uncheck_all.jstree', $.proxy(function (e, data) { + var obj = this.get_node($.jstree.root), + m = this._model.data, + i, j, tmp; + for(i = 0, j = obj.children_d.length; i < j; i++) { + tmp = m[obj.children_d[i]]; + if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { + tmp.original.state.undetermined = false; + } + } + }, this)) + .on(this.settings.checkbox.tie_selection ? 'deselect_node.jstree' : 'uncheck_node.jstree', $.proxy(function (e, data) { + var self = this, + obj = data.node, + dom = this.get_node(obj, true), + i, j, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection, + cur = this._data[ t ? 'core' : 'checkbox' ].selected, sel = {}, + stillSelectedIds = [], + allIds = obj.children_d.concat(obj.id); + + // apply down + if(s.indexOf('down') !== -1) { + var selectedIds = this._cascade_new_checked_state(obj.id, false); + + cur = cur.filter(function(id) { + return allIds.indexOf(id) === -1 || selectedIds.indexOf(id) > -1; + }); + } + + // only apply up if cascade up is enabled and if this node is not selected + // (if all child nodes are disabled and cascade_to_disabled === false then this node will till be selected). + if(s.indexOf('up') !== -1 && cur.indexOf(obj.id) === -1) { + for(i = 0, j = obj.parents.length; i < j; i++) { + tmp = this._model.data[obj.parents[i]]; + tmp.state[ t ? 'selected' : 'checked' ] = false; + if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { + tmp.original.state.undetermined = false; + } + tmp = this.get_node(obj.parents[i], true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + + cur = cur.filter(function(id) { + return obj.parents.indexOf(id) === -1; + }); + } + + this._data[ t ? 'core' : 'checkbox' ].selected = cur; + }, this)); + } + if(this.settings.checkbox.cascade.indexOf('up') !== -1) { + this.element + .on('delete_node.jstree', $.proxy(function (e, data) { + // apply up (whole handler) + var p = this.get_node(data.parent), + m = this._model.data, + i, j, c, tmp, t = this.settings.checkbox.tie_selection; + while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) { + c = 0; + for(i = 0, j = p.children.length; i < j; i++) { + c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; + } + if(j > 0 && c === j) { + p.state[ t ? 'selected' : 'checked' ] = true; + this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); + tmp = this.get_node(p, true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + else { + break; + } + p = this.get_node(p.parent); + } + }, this)) + .on('move_node.jstree', $.proxy(function (e, data) { + // apply up (whole handler) + var is_multi = data.is_multi, + old_par = data.old_parent, + new_par = this.get_node(data.parent), + m = this._model.data, + p, c, i, j, tmp, t = this.settings.checkbox.tie_selection; + if(!is_multi) { + p = this.get_node(old_par); + while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) { + c = 0; + for(i = 0, j = p.children.length; i < j; i++) { + c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; + } + if(j > 0 && c === j) { + p.state[ t ? 'selected' : 'checked' ] = true; + this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); + tmp = this.get_node(p, true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + else { + break; + } + p = this.get_node(p.parent); + } + } + p = new_par; + while(p && p.id !== $.jstree.root) { + c = 0; + for(i = 0, j = p.children.length; i < j; i++) { + c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; + } + if(c === j) { + if(!p.state[ t ? 'selected' : 'checked' ]) { + p.state[ t ? 'selected' : 'checked' ] = true; + this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); + tmp = this.get_node(p, true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + } + else { + if(p.state[ t ? 'selected' : 'checked' ]) { + p.state[ t ? 'selected' : 'checked' ] = false; + this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_remove_item(this._data[ t ? 'core' : 'checkbox' ].selected, p.id); + tmp = this.get_node(p, true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + else { + break; + } + } + p = this.get_node(p.parent); + } + }, this)); + } + }; + /** + * get an array of all nodes whose state is "undetermined" + * @name get_undetermined([full]) + * @param {boolean} full: if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + * @plugin checkbox + */ + this.get_undetermined = function (full) { + if (this.settings.checkbox.cascade.indexOf('undetermined') === -1) { + return []; + } + var i, j, k, l, o = {}, m = this._model.data, t = this.settings.checkbox.tie_selection, s = this._data[ t ? 'core' : 'checkbox' ].selected, p = [], tt = this, r = []; + for(i = 0, j = s.length; i < j; i++) { + if(m[s[i]] && m[s[i]].parents) { + for(k = 0, l = m[s[i]].parents.length; k < l; k++) { + if(o[m[s[i]].parents[k]] !== undefined) { + break; + } + if(m[s[i]].parents[k] !== $.jstree.root) { + o[m[s[i]].parents[k]] = true; + p.push(m[s[i]].parents[k]); + } + } + } + } + // attempt for server side undetermined state + this.element.find('.jstree-closed').not(':has(.jstree-children)') + .each(function () { + var tmp = tt.get_node(this), tmp2; + + if(!tmp) { return; } + + if(!tmp.state.loaded) { + if(tmp.original && tmp.original.state && tmp.original.state.undetermined && tmp.original.state.undetermined === true) { + if(o[tmp.id] === undefined && tmp.id !== $.jstree.root) { + o[tmp.id] = true; + p.push(tmp.id); + } + for(k = 0, l = tmp.parents.length; k < l; k++) { + if(o[tmp.parents[k]] === undefined && tmp.parents[k] !== $.jstree.root) { + o[tmp.parents[k]] = true; + p.push(tmp.parents[k]); + } + } + } + } + else { + for(i = 0, j = tmp.children_d.length; i < j; i++) { + tmp2 = m[tmp.children_d[i]]; + if(!tmp2.state.loaded && tmp2.original && tmp2.original.state && tmp2.original.state.undetermined && tmp2.original.state.undetermined === true) { + if(o[tmp2.id] === undefined && tmp2.id !== $.jstree.root) { + o[tmp2.id] = true; + p.push(tmp2.id); + } + for(k = 0, l = tmp2.parents.length; k < l; k++) { + if(o[tmp2.parents[k]] === undefined && tmp2.parents[k] !== $.jstree.root) { + o[tmp2.parents[k]] = true; + p.push(tmp2.parents[k]); + } + } + } + } + } + }); + for (i = 0, j = p.length; i < j; i++) { + if(!m[p[i]].state[ t ? 'selected' : 'checked' ]) { + r.push(full ? m[p[i]] : p[i]); + } + } + return r; + }; + /** + * set the undetermined state where and if necessary. Used internally. + * @private + * @name _undetermined() + * @plugin checkbox + */ + this._undetermined = function () { + if(this.element === null) { return; } + var p = this.get_undetermined(false), i, j, s; + + this.element.find('.jstree-undetermined').removeClass('jstree-undetermined'); + for (i = 0, j = p.length; i < j; i++) { + s = this.get_node(p[i], true); + if(s && s.length) { + s.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-undetermined'); + } + } + }; + this.redraw_node = function(obj, deep, is_callback, force_render) { + obj = parent.redraw_node.apply(this, arguments); + if(obj) { + var i, j, tmp = null, icon = null; + for(i = 0, j = obj.childNodes.length; i < j; i++) { + if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { + tmp = obj.childNodes[i]; + break; + } + } + if(tmp) { + if(!this.settings.checkbox.tie_selection && this._model.data[obj.id].state.checked) { tmp.className += ' jstree-checked'; } + icon = _i.cloneNode(false); + if(this._model.data[obj.id].state.checkbox_disabled) { icon.className += ' jstree-checkbox-disabled'; } + tmp.insertBefore(icon, tmp.childNodes[0]); + } + } + if(!is_callback && this.settings.checkbox.cascade.indexOf('undetermined') !== -1) { + if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); } + this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50); + } + return obj; + }; + /** + * show the node checkbox icons + * @name show_checkboxes() + * @plugin checkbox + */ + this.show_checkboxes = function () { this._data.core.themes.checkboxes = true; this.get_container_ul().removeClass("jstree-no-checkboxes"); }; + /** + * hide the node checkbox icons + * @name hide_checkboxes() + * @plugin checkbox + */ + this.hide_checkboxes = function () { this._data.core.themes.checkboxes = false; this.get_container_ul().addClass("jstree-no-checkboxes"); }; + /** + * toggle the node icons + * @name toggle_checkboxes() + * @plugin checkbox + */ + this.toggle_checkboxes = function () { if(this._data.core.themes.checkboxes) { this.hide_checkboxes(); } else { this.show_checkboxes(); } }; + /** + * checks if a node is in an undetermined state + * @name is_undetermined(obj) + * @param {mixed} obj + * @return {Boolean} + */ + this.is_undetermined = function (obj) { + obj = this.get_node(obj); + var s = this.settings.checkbox.cascade, i, j, t = this.settings.checkbox.tie_selection, d = this._data[ t ? 'core' : 'checkbox' ].selected, m = this._model.data; + if(!obj || obj.state[ t ? 'selected' : 'checked' ] === true || s.indexOf('undetermined') === -1 || (s.indexOf('down') === -1 && s.indexOf('up') === -1)) { + return false; + } + if(!obj.state.loaded && obj.original.state.undetermined === true) { + return true; + } + for(i = 0, j = obj.children_d.length; i < j; i++) { + if($.inArray(obj.children_d[i], d) !== -1 || (!m[obj.children_d[i]].state.loaded && m[obj.children_d[i]].original.state.undetermined)) { + return true; + } + } + return false; + }; + /** + * disable a node's checkbox + * @name disable_checkbox(obj) + * @param {mixed} obj an array can be used too + * @trigger disable_checkbox.jstree + * @plugin checkbox + */ + this.disable_checkbox = function (obj) { + var t1, t2, dom; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.disable_checkbox(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + dom = this.get_node(obj, true); + if(!obj.state.checkbox_disabled) { + obj.state.checkbox_disabled = true; + if(dom && dom.length) { + dom.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-checkbox-disabled'); + } + /** + * triggered when an node's checkbox is disabled + * @event + * @name disable_checkbox.jstree + * @param {Object} node + * @plugin checkbox + */ + this.trigger('disable_checkbox', { 'node' : obj }); + } + }; + /** + * enable a node's checkbox + * @name disable_checkbox(obj) + * @param {mixed} obj an array can be used too + * @trigger enable_checkbox.jstree + * @plugin checkbox + */ + this.enable_checkbox = function (obj) { + var t1, t2, dom; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.enable_checkbox(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + dom = this.get_node(obj, true); + if(obj.state.checkbox_disabled) { + obj.state.checkbox_disabled = false; + if(dom && dom.length) { + dom.children('.jstree-anchor').children('.jstree-checkbox').removeClass('jstree-checkbox-disabled'); + } + /** + * triggered when an node's checkbox is enabled + * @event + * @name enable_checkbox.jstree + * @param {Object} node + * @plugin checkbox + */ + this.trigger('enable_checkbox', { 'node' : obj }); + } + }; + + this.activate_node = function (obj, e) { + if($(e.target).hasClass('jstree-checkbox-disabled')) { + return false; + } + if(this.settings.checkbox.tie_selection && (this.settings.checkbox.whole_node || $(e.target).hasClass('jstree-checkbox'))) { + e.ctrlKey = true; + } + if(this.settings.checkbox.tie_selection || (!this.settings.checkbox.whole_node && !$(e.target).hasClass('jstree-checkbox'))) { + return parent.activate_node.call(this, obj, e); + } + if(this.is_disabled(obj)) { + return false; + } + if(this.is_checked(obj)) { + this.uncheck_node(obj, e); + } + else { + this.check_node(obj, e); + } + this.trigger('activate_node', { 'node' : this.get_node(obj) }); + }; + + /** + * Cascades checked state to a node and all its descendants. This function does NOT affect hidden and disabled nodes (or their descendants). + * However if these unaffected nodes are already selected their ids will be included in the returned array. + * @private + * @param {string} id the node ID + * @param {bool} checkedState should the nodes be checked or not + * @returns {Array} Array of all node id's (in this tree branch) that are checked. + */ + this._cascade_new_checked_state = function (id, checkedState) { + var self = this; + var t = this.settings.checkbox.tie_selection; + var node = this._model.data[id]; + var selectedNodeIds = []; + var selectedChildrenIds = [], i, j, selectedChildIds; + + if ( + (this.settings.checkbox.cascade_to_disabled || !node.state.disabled) && + (this.settings.checkbox.cascade_to_hidden || !node.state.hidden) + ) { + //First try and check/uncheck the children + if (node.children) { + for (i = 0, j = node.children.length; i < j; i++) { + var childId = node.children[i]; + selectedChildIds = self._cascade_new_checked_state(childId, checkedState); + selectedNodeIds = selectedNodeIds.concat(selectedChildIds); + if (selectedChildIds.indexOf(childId) > -1) { + selectedChildrenIds.push(childId); + } + } + } + + var dom = self.get_node(node, true); + + //A node's state is undetermined if some but not all of it's children are checked/selected . + var undetermined = selectedChildrenIds.length > 0 && selectedChildrenIds.length < node.children.length; + + if(node.original && node.original.state && node.original.state.undetermined) { + node.original.state.undetermined = undetermined; + } + + //If a node is undetermined then remove selected class + if (undetermined) { + node.state[ t ? 'selected' : 'checked' ] = false; + dom.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + //Otherwise, if the checkedState === true (i.e. the node is being checked now) and all of the node's children are checked (if it has any children), + //check the node and style it correctly. + else if (checkedState && selectedChildrenIds.length === node.children.length) { + node.state[ t ? 'selected' : 'checked' ] = checkedState; + selectedNodeIds.push(node.id); + + dom.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + else { + node.state[ t ? 'selected' : 'checked' ] = false; + dom.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + else { + selectedChildIds = this.get_checked_descendants(id); + + if (node.state[ t ? 'selected' : 'checked' ]) { + selectedChildIds.push(node.id); + } + + selectedNodeIds = selectedNodeIds.concat(selectedChildIds); + } + + return selectedNodeIds; + }; + + /** + * Gets ids of nodes selected in branch (of tree) specified by id (does not include the node specified by id) + * @name get_checked_descendants(obj) + * @param {string} id the node ID + * @return {Array} array of IDs + * @plugin checkbox + */ + this.get_checked_descendants = function (id) { + var self = this; + var t = self.settings.checkbox.tie_selection; + var node = self._model.data[id]; + + return node.children_d.filter(function(_id) { + return self._model.data[_id].state[ t ? 'selected' : 'checked' ]; + }); + }; + + /** + * check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally) + * @name check_node(obj) + * @param {mixed} obj an array can be used to check multiple nodes + * @trigger check_node.jstree + * @plugin checkbox + */ + this.check_node = function (obj, e) { + if(this.settings.checkbox.tie_selection) { return this.select_node(obj, false, true, e); } + var dom, t1, t2, th; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.check_node(obj[t1], e); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + dom = this.get_node(obj, true); + if(!obj.state.checked) { + obj.state.checked = true; + this._data.checkbox.selected.push(obj.id); + if(dom && dom.length) { + dom.children('.jstree-anchor').addClass('jstree-checked'); + } + /** + * triggered when an node is checked (only if tie_selection in checkbox settings is false) + * @event + * @name check_node.jstree + * @param {Object} node + * @param {Array} selected the current selection + * @param {Object} event the event (if any) that triggered this check_node + * @plugin checkbox + */ + this.trigger('check_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e }); + } + }; + /** + * uncheck a node (only if tie_selection in checkbox settings is false, otherwise deselect_node will be called internally) + * @name uncheck_node(obj) + * @param {mixed} obj an array can be used to uncheck multiple nodes + * @trigger uncheck_node.jstree + * @plugin checkbox + */ + this.uncheck_node = function (obj, e) { + if(this.settings.checkbox.tie_selection) { return this.deselect_node(obj, false, e); } + var t1, t2, dom; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.uncheck_node(obj[t1], e); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + dom = this.get_node(obj, true); + if(obj.state.checked) { + obj.state.checked = false; + this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, obj.id); + if(dom.length) { + dom.children('.jstree-anchor').removeClass('jstree-checked'); + } + /** + * triggered when an node is unchecked (only if tie_selection in checkbox settings is false) + * @event + * @name uncheck_node.jstree + * @param {Object} node + * @param {Array} selected the current selection + * @param {Object} event the event (if any) that triggered this uncheck_node + * @plugin checkbox + */ + this.trigger('uncheck_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e }); + } + }; + + /** + * checks all nodes in the tree (only if tie_selection in checkbox settings is false, otherwise select_all will be called internally) + * @name check_all() + * @trigger check_all.jstree, changed.jstree + * @plugin checkbox + */ + this.check_all = function () { + if(this.settings.checkbox.tie_selection) { return this.select_all(); } + var tmp = this._data.checkbox.selected.concat([]), i, j; + this._data.checkbox.selected = this._model.data[$.jstree.root].children_d.concat(); + for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) { + if(this._model.data[this._data.checkbox.selected[i]]) { + this._model.data[this._data.checkbox.selected[i]].state.checked = true; + } + } + this.redraw(true); + /** + * triggered when all nodes are checked (only if tie_selection in checkbox settings is false) + * @event + * @name check_all.jstree + * @param {Array} selected the current selection + * @plugin checkbox + */ + this.trigger('check_all', { 'selected' : this._data.checkbox.selected }); + }; + /** + * uncheck all checked nodes (only if tie_selection in checkbox settings is false, otherwise deselect_all will be called internally) + * @name uncheck_all() + * @trigger uncheck_all.jstree + * @plugin checkbox + */ + this.uncheck_all = function () { + if(this.settings.checkbox.tie_selection) { return this.deselect_all(); } + var tmp = this._data.checkbox.selected.concat([]), i, j; + for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) { + if(this._model.data[this._data.checkbox.selected[i]]) { + this._model.data[this._data.checkbox.selected[i]].state.checked = false; + } + } + this._data.checkbox.selected = []; + this.element.find('.jstree-checked').removeClass('jstree-checked'); + /** + * triggered when all nodes are unchecked (only if tie_selection in checkbox settings is false) + * @event + * @name uncheck_all.jstree + * @param {Object} node the previous selection + * @param {Array} selected the current selection + * @plugin checkbox + */ + this.trigger('uncheck_all', { 'selected' : this._data.checkbox.selected, 'node' : tmp }); + }; + /** + * checks if a node is checked (if tie_selection is on in the settings this function will return the same as is_selected) + * @name is_checked(obj) + * @param {mixed} obj + * @return {Boolean} + * @plugin checkbox + */ + this.is_checked = function (obj) { + if(this.settings.checkbox.tie_selection) { return this.is_selected(obj); } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + return obj.state.checked; + }; + /** + * get an array of all checked nodes (if tie_selection is on in the settings this function will return the same as get_selected) + * @name get_checked([full]) + * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + * @plugin checkbox + */ + this.get_checked = function (full) { + if(this.settings.checkbox.tie_selection) { return this.get_selected(full); } + return full ? $.map(this._data.checkbox.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.checkbox.selected; + }; + /** + * get an array of all top level checked nodes (ignoring children of checked nodes) (if tie_selection is on in the settings this function will return the same as get_top_selected) + * @name get_top_checked([full]) + * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + * @plugin checkbox + */ + this.get_top_checked = function (full) { + if(this.settings.checkbox.tie_selection) { return this.get_top_selected(full); } + var tmp = this.get_checked(true), + obj = {}, i, j, k, l; + for(i = 0, j = tmp.length; i < j; i++) { + obj[tmp[i].id] = tmp[i]; + } + for(i = 0, j = tmp.length; i < j; i++) { + for(k = 0, l = tmp[i].children_d.length; k < l; k++) { + if(obj[tmp[i].children_d[k]]) { + delete obj[tmp[i].children_d[k]]; + } + } + } + tmp = []; + for(i in obj) { + if(obj.hasOwnProperty(i)) { + tmp.push(i); + } + } + return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp; + }; + /** + * get an array of all bottom level checked nodes (ignoring selected parents) (if tie_selection is on in the settings this function will return the same as get_bottom_selected) + * @name get_bottom_checked([full]) + * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + * @plugin checkbox + */ + this.get_bottom_checked = function (full) { + if(this.settings.checkbox.tie_selection) { return this.get_bottom_selected(full); } + var tmp = this.get_checked(true), + obj = [], i, j; + for(i = 0, j = tmp.length; i < j; i++) { + if(!tmp[i].children.length) { + obj.push(tmp[i].id); + } + } + return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj; + }; + this.load_node = function (obj, callback) { + var k, l, i, j, c, tmp; + if(!$.isArray(obj) && !this.settings.checkbox.tie_selection) { + tmp = this.get_node(obj); + if(tmp && tmp.state.loaded) { + for(k = 0, l = tmp.children_d.length; k < l; k++) { + if(this._model.data[tmp.children_d[k]].state.checked) { + c = true; + this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, tmp.children_d[k]); + } + } + } + } + return parent.load_node.apply(this, arguments); + }; + this.get_state = function () { + var state = parent.get_state.apply(this, arguments); + if(this.settings.checkbox.tie_selection) { return state; } + state.checkbox = this._data.checkbox.selected.slice(); + return state; + }; + this.set_state = function (state, callback) { + var res = parent.set_state.apply(this, arguments); + if(res && state.checkbox) { + if(!this.settings.checkbox.tie_selection) { + this.uncheck_all(); + var _this = this; + $.each(state.checkbox, function (i, v) { + _this.check_node(v); + }); + } + delete state.checkbox; + this.set_state(state, callback); + return false; + } + return res; + }; + this.refresh = function (skip_loading, forget_state) { + if(this.settings.checkbox.tie_selection) { + this._data.checkbox.selected = []; + } + return parent.refresh.apply(this, arguments); + }; + }; + + // include the checkbox plugin by default + // $.jstree.defaults.plugins.push("checkbox"); + + +/** + * ### Conditionalselect plugin + * + * This plugin allows defining a callback to allow or deny node selection by user input (activate node method). + */ + + /** + * 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`. + * @name $.jstree.defaults.checkbox.visible + * @plugin checkbox + */ + $.jstree.defaults.conditionalselect = function () { return true; }; + $.jstree.plugins.conditionalselect = function (options, parent) { + // own function + this.activate_node = function (obj, e) { + if(this.settings.conditionalselect.call(this, this.get_node(obj), e)) { + return parent.activate_node.call(this, obj, e); + } + }; + }; + + +/** + * ### Contextmenu plugin + * + * Shows a context menu when a node is right-clicked. + */ + + /** + * stores all defaults for the contextmenu plugin + * @name $.jstree.defaults.contextmenu + * @plugin contextmenu + */ + $.jstree.defaults.contextmenu = { + /** + * a boolean indicating if the node should be selected when the context menu is invoked on it. Defaults to `true`. + * @name $.jstree.defaults.contextmenu.select_node + * @plugin contextmenu + */ + select_node : true, + /** + * a boolean indicating if the menu should be shown aligned with the node. Defaults to `true`, otherwise the mouse coordinates are used. + * @name $.jstree.defaults.contextmenu.show_at_node + * @plugin contextmenu + */ + show_at_node : true, + /** + * an object of actions, or a function that accepts a node and a callback function and calls the callback function with an object of actions available for that node (you can also return the items too). + * + * Each action consists of a key (a unique name) and a value which is an object with the following properties (only label and action are required). Once a menu item is activated the `action` function will be invoked with an object containing the following keys: item - the contextmenu item definition as seen below, reference - the DOM node that was used (the tree node), element - the contextmenu DOM element, position - an object with x/y properties indicating the position of the menu. + * + * * `separator_before` - a boolean indicating if there should be a separator before this item + * * `separator_after` - a boolean indicating if there should be a separator after this item + * * `_disabled` - a boolean indicating if this action should be disabled + * * `label` - a string - the name of the action (could be a function returning a string) + * * `title` - a string - an optional tooltip for the item + * * `action` - a function to be executed if this item is chosen, the function will receive + * * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class + * * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2) + * * `shortcut_label` - shortcut label (like for example `F2` for rename) + * * `submenu` - an object with the same structure as $.jstree.defaults.contextmenu.items which can be used to create a submenu - each key will be rendered as a separate option in a submenu that will appear once the current item is hovered + * + * @name $.jstree.defaults.contextmenu.items + * @plugin contextmenu + */ + items : function (o, cb) { // Could be an object directly + return { + "create" : { + "separator_before" : false, + "separator_after" : true, + "_disabled" : false, //(this.check("create_node", data.reference, {}, "last")), + "label" : "Create", + "action" : function (data) { + var inst = $.jstree.reference(data.reference), + obj = inst.get_node(data.reference); + inst.create_node(obj, {}, "last", function (new_node) { + try { + inst.edit(new_node); + } catch (ex) { + setTimeout(function () { inst.edit(new_node); },0); + } + }); + } + }, + "rename" : { + "separator_before" : false, + "separator_after" : false, + "_disabled" : false, //(this.check("rename_node", data.reference, this.get_parent(data.reference), "")), + "label" : "Rename", + /*! + "shortcut" : 113, + "shortcut_label" : 'F2', + "icon" : "glyphicon glyphicon-leaf", + */ + "action" : function (data) { + var inst = $.jstree.reference(data.reference), + obj = inst.get_node(data.reference); + inst.edit(obj); + } + }, + "remove" : { + "separator_before" : false, + "icon" : false, + "separator_after" : false, + "_disabled" : false, //(this.check("delete_node", data.reference, this.get_parent(data.reference), "")), + "label" : "Delete", + "action" : function (data) { + var inst = $.jstree.reference(data.reference), + obj = inst.get_node(data.reference); + if(inst.is_selected(obj)) { + inst.delete_node(inst.get_selected()); + } + else { + inst.delete_node(obj); + } + } + }, + "ccp" : { + "separator_before" : true, + "icon" : false, + "separator_after" : false, + "label" : "Edit", + "action" : false, + "submenu" : { + "cut" : { + "separator_before" : false, + "separator_after" : false, + "label" : "Cut", + "action" : function (data) { + var inst = $.jstree.reference(data.reference), + obj = inst.get_node(data.reference); + if(inst.is_selected(obj)) { + inst.cut(inst.get_top_selected()); + } + else { + inst.cut(obj); + } + } + }, + "copy" : { + "separator_before" : false, + "icon" : false, + "separator_after" : false, + "label" : "Copy", + "action" : function (data) { + var inst = $.jstree.reference(data.reference), + obj = inst.get_node(data.reference); + if(inst.is_selected(obj)) { + inst.copy(inst.get_top_selected()); + } + else { + inst.copy(obj); + } + } + }, + "paste" : { + "separator_before" : false, + "icon" : false, + "_disabled" : function (data) { + return !$.jstree.reference(data.reference).can_paste(); + }, + "separator_after" : false, + "label" : "Paste", + "action" : function (data) { + var inst = $.jstree.reference(data.reference), + obj = inst.get_node(data.reference); + inst.paste(obj); + } + } + } + } + }; + } + }; + + $.jstree.plugins.contextmenu = function (options, parent) { + this.bind = function () { + parent.bind.call(this); + + var last_ts = 0, cto = null, ex, ey; + this.element + .on("init.jstree loading.jstree ready.jstree", $.proxy(function () { + this.get_container_ul().addClass('jstree-contextmenu'); + }, this)) + .on("contextmenu.jstree", ".jstree-anchor", $.proxy(function (e, data) { + if (e.target.tagName.toLowerCase() === 'input') { + return; + } + e.preventDefault(); + last_ts = e.ctrlKey ? +new Date() : 0; + if(data || cto) { + last_ts = (+new Date()) + 10000; + } + if(cto) { + clearTimeout(cto); + } + if(!this.is_loading(e.currentTarget)) { + this.show_contextmenu(e.currentTarget, e.pageX, e.pageY, e); + } + }, this)) + .on("click.jstree", ".jstree-anchor", $.proxy(function (e) { + if(this._data.contextmenu.visible && (!last_ts || (+new Date()) - last_ts > 250)) { // work around safari & macOS ctrl+click + $.vakata.context.hide(); + } + last_ts = 0; + }, this)) + .on("touchstart.jstree", ".jstree-anchor", function (e) { + if(!e.originalEvent || !e.originalEvent.changedTouches || !e.originalEvent.changedTouches[0]) { + return; + } + ex = e.originalEvent.changedTouches[0].clientX; + ey = e.originalEvent.changedTouches[0].clientY; + cto = setTimeout(function () { + $(e.currentTarget).trigger('contextmenu', true); + }, 750); + }) + .on('touchmove.vakata.jstree', function (e) { + if(cto && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0] && (Math.abs(ex - e.originalEvent.changedTouches[0].clientX) > 10 || Math.abs(ey - e.originalEvent.changedTouches[0].clientY) > 10)) { + clearTimeout(cto); + $.vakata.context.hide(); + } + }) + .on('touchend.vakata.jstree', function (e) { + if(cto) { + clearTimeout(cto); + } + }); + + /*! + if(!('oncontextmenu' in document.body) && ('ontouchstart' in document.body)) { + var el = null, tm = null; + this.element + .on("touchstart", ".jstree-anchor", function (e) { + el = e.currentTarget; + tm = +new Date(); + $(document).one("touchend", function (e) { + e.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset); + e.currentTarget = e.target; + tm = ((+(new Date())) - tm); + if(e.target === el && tm > 600 && tm < 1000) { + e.preventDefault(); + $(el).trigger('contextmenu', e); + } + el = null; + tm = null; + }); + }); + } + */ + $(document).on("context_hide.vakata.jstree", $.proxy(function (e, data) { + this._data.contextmenu.visible = false; + $(data.reference).removeClass('jstree-context'); + }, this)); + }; + this.teardown = function () { + if(this._data.contextmenu.visible) { + $.vakata.context.hide(); + } + parent.teardown.call(this); + }; + + /** + * prepare and show the context menu for a node + * @name show_contextmenu(obj [, x, y]) + * @param {mixed} obj the node + * @param {Number} x the x-coordinate relative to the document to show the menu at + * @param {Number} y the y-coordinate relative to the document to show the menu at + * @param {Object} e the event if available that triggered the contextmenu + * @plugin contextmenu + * @trigger show_contextmenu.jstree + */ + this.show_contextmenu = function (obj, x, y, e) { + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + var s = this.settings.contextmenu, + d = this.get_node(obj, true), + a = d.children(".jstree-anchor"), + o = false, + i = false; + if(s.show_at_node || x === undefined || y === undefined) { + o = a.offset(); + x = o.left; + y = o.top + this._data.core.li_height; + } + if(this.settings.contextmenu.select_node && !this.is_selected(obj)) { + this.activate_node(obj, e); + } + + i = s.items; + if($.isFunction(i)) { + i = i.call(this, obj, $.proxy(function (i) { + this._show_contextmenu(obj, x, y, i); + }, this)); + } + if($.isPlainObject(i)) { + this._show_contextmenu(obj, x, y, i); + } + }; + /** + * show the prepared context menu for a node + * @name _show_contextmenu(obj, x, y, i) + * @param {mixed} obj the node + * @param {Number} x the x-coordinate relative to the document to show the menu at + * @param {Number} y the y-coordinate relative to the document to show the menu at + * @param {Number} i the object of items to show + * @plugin contextmenu + * @trigger show_contextmenu.jstree + * @private + */ + this._show_contextmenu = function (obj, x, y, i) { + var d = this.get_node(obj, true), + a = d.children(".jstree-anchor"); + $(document).one("context_show.vakata.jstree", $.proxy(function (e, data) { + var cls = 'jstree-contextmenu jstree-' + this.get_theme() + '-contextmenu'; + $(data.element).addClass(cls); + a.addClass('jstree-context'); + }, this)); + this._data.contextmenu.visible = true; + $.vakata.context.show(a, { 'x' : x, 'y' : y }, i); + /** + * triggered when the contextmenu is shown for a node + * @event + * @name show_contextmenu.jstree + * @param {Object} node the node + * @param {Number} x the x-coordinate of the menu relative to the document + * @param {Number} y the y-coordinate of the menu relative to the document + * @plugin contextmenu + */ + this.trigger('show_contextmenu', { "node" : obj, "x" : x, "y" : y }); + }; + }; + + // contextmenu helper + (function ($) { + var right_to_left = false, + vakata_context = { + element : false, + reference : false, + position_x : 0, + position_y : 0, + items : [], + html : "", + is_visible : false + }; + + $.vakata.context = { + settings : { + hide_onmouseleave : 0, + icons : true + }, + _trigger : function (event_name) { + $(document).triggerHandler("context_" + event_name + ".vakata", { + "reference" : vakata_context.reference, + "element" : vakata_context.element, + "position" : { + "x" : vakata_context.position_x, + "y" : vakata_context.position_y + } + }); + }, + _execute : function (i) { + i = vakata_context.items[i]; + return i && (!i._disabled || ($.isFunction(i._disabled) && !i._disabled({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }))) && i.action ? i.action.call(null, { + "item" : i, + "reference" : vakata_context.reference, + "element" : vakata_context.element, + "position" : { + "x" : vakata_context.position_x, + "y" : vakata_context.position_y + } + }) : false; + }, + _parse : function (o, is_callback) { + if(!o) { return false; } + if(!is_callback) { + vakata_context.html = ""; + vakata_context.items = []; + } + var str = "", + sep = false, + tmp; + + if(is_callback) { str += "<"+"ul>"; } + $.each(o, function (i, val) { + if(!val) { return true; } + vakata_context.items.push(val); + if(!sep && val.separator_before) { + str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>"; + } + sep = false; + str += "<"+"li class='" + (val._class || "") + (val._disabled === true || ($.isFunction(val._disabled) && val._disabled({ "item" : val, "reference" : vakata_context.reference, "element" : vakata_context.element })) ? " vakata-contextmenu-disabled " : "") + "' "+(val.shortcut?" data-shortcut='"+val.shortcut+"' ":'')+">"; + str += "<"+"a href='#' rel='" + (vakata_context.items.length - 1) + "' " + (val.title ? "title='" + val.title + "'" : "") + ">"; + if($.vakata.context.settings.icons) { + str += "<"+"i "; + if(val.icon) { + if(val.icon.indexOf("/") !== -1 || val.icon.indexOf(".") !== -1) { str += " style='background:url(\"" + val.icon + "\") center center no-repeat' "; } + else { str += " class='" + val.icon + "' "; } + } + str += "><"+"/i><"+"span class='vakata-contextmenu-sep'> <"+"/span>"; + } + str += ($.isFunction(val.label) ? val.label({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }) : val.label) + (val.shortcut?' '+ (val.shortcut_label || '') +'':'') + "<"+"/a>"; + if(val.submenu) { + tmp = $.vakata.context._parse(val.submenu, true); + if(tmp) { str += tmp; } + } + str += "<"+"/li>"; + if(val.separator_after) { + str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>"; + sep = true; + } + }); + str = str.replace(/
        • <\/li\>$/,""); + if(is_callback) { str += ""; } + /** + * triggered on the document when the contextmenu is parsed (HTML is built) + * @event + * @plugin contextmenu + * @name context_parse.vakata + * @param {jQuery} reference the element that was right clicked + * @param {jQuery} element the DOM element of the menu itself + * @param {Object} position the x & y coordinates of the menu + */ + if(!is_callback) { vakata_context.html = str; $.vakata.context._trigger("parse"); } + return str.length > 10 ? str : false; + }, + _show_submenu : function (o) { + o = $(o); + if(!o.length || !o.children("ul").length) { return; } + var e = o.children("ul"), + xl = o.offset().left, + x = xl + o.outerWidth(), + y = o.offset().top, + w = e.width(), + h = e.height(), + dw = $(window).width() + $(window).scrollLeft(), + dh = $(window).height() + $(window).scrollTop(); + // може да се спести е една проверка - дали няма някой от класовете вече нагоре + if(right_to_left) { + o[x - (w + 10 + o.outerWidth()) < 0 ? "addClass" : "removeClass"]("vakata-context-left"); + } + else { + o[x + w > dw && xl > dw - x ? "addClass" : "removeClass"]("vakata-context-right"); + } + if(y + h + 10 > dh) { + e.css("bottom","-1px"); + } + + //if does not fit - stick it to the side + if (o.hasClass('vakata-context-right')) { + if (xl < w) { + e.css("margin-right", xl - w); + } + } else { + if (dw - x < w) { + e.css("margin-left", dw - x - w); + } + } + + e.show(); + }, + show : function (reference, position, data) { + var o, e, x, y, w, h, dw, dh, cond = true; + if(vakata_context.element && vakata_context.element.length) { + vakata_context.element.width(''); + } + switch(cond) { + case (!position && !reference): + return false; + case (!!position && !!reference): + vakata_context.reference = reference; + vakata_context.position_x = position.x; + vakata_context.position_y = position.y; + break; + case (!position && !!reference): + vakata_context.reference = reference; + o = reference.offset(); + vakata_context.position_x = o.left + reference.outerHeight(); + vakata_context.position_y = o.top; + break; + case (!!position && !reference): + vakata_context.position_x = position.x; + vakata_context.position_y = position.y; + break; + } + if(!!reference && !data && $(reference).data('vakata_contextmenu')) { + data = $(reference).data('vakata_contextmenu'); + } + if($.vakata.context._parse(data)) { + vakata_context.element.html(vakata_context.html); + } + if(vakata_context.items.length) { + vakata_context.element.appendTo(document.body); + e = vakata_context.element; + x = vakata_context.position_x; + y = vakata_context.position_y; + w = e.width(); + h = e.height(); + dw = $(window).width() + $(window).scrollLeft(); + dh = $(window).height() + $(window).scrollTop(); + if(right_to_left) { + x -= (e.outerWidth() - $(reference).outerWidth()); + if(x < $(window).scrollLeft() + 20) { + x = $(window).scrollLeft() + 20; + } + } + if(x + w + 20 > dw) { + x = dw - (w + 20); + } + if(y + h + 20 > dh) { + y = dh - (h + 20); + } + + vakata_context.element + .css({ "left" : x, "top" : y }) + .show() + .find('a').first().focus().parent().addClass("vakata-context-hover"); + vakata_context.is_visible = true; + /** + * triggered on the document when the contextmenu is shown + * @event + * @plugin contextmenu + * @name context_show.vakata + * @param {jQuery} reference the element that was right clicked + * @param {jQuery} element the DOM element of the menu itself + * @param {Object} position the x & y coordinates of the menu + */ + $.vakata.context._trigger("show"); + } + }, + hide : function () { + if(vakata_context.is_visible) { + vakata_context.element.hide().find("ul").hide().end().find(':focus').blur().end().detach(); + vakata_context.is_visible = false; + /** + * triggered on the document when the contextmenu is hidden + * @event + * @plugin contextmenu + * @name context_hide.vakata + * @param {jQuery} reference the element that was right clicked + * @param {jQuery} element the DOM element of the menu itself + * @param {Object} position the x & y coordinates of the menu + */ + $.vakata.context._trigger("hide"); + } + } + }; + $(function () { + right_to_left = $(document.body).css("direction") === "rtl"; + var to = false; + + vakata_context.element = $("
            "); + vakata_context.element + .on("mouseenter", "li", function (e) { + e.stopImmediatePropagation(); + + if($.contains(this, e.relatedTarget)) { + // премахнато заради delegate mouseleave по-долу + // $(this).find(".vakata-context-hover").removeClass("vakata-context-hover"); + return; + } + + if(to) { clearTimeout(to); } + vakata_context.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(); + + $(this) + .siblings().find("ul").hide().end().end() + .parentsUntil(".vakata-context", "li").addBack().addClass("vakata-context-hover"); + $.vakata.context._show_submenu(this); + }) + // тестово - дали не натоварва? + .on("mouseleave", "li", function (e) { + if($.contains(this, e.relatedTarget)) { return; } + $(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover"); + }) + .on("mouseleave", function (e) { + $(this).find(".vakata-context-hover").removeClass("vakata-context-hover"); + if($.vakata.context.settings.hide_onmouseleave) { + to = setTimeout( + (function (t) { + return function () { $.vakata.context.hide(); }; + }(this)), $.vakata.context.settings.hide_onmouseleave); + } + }) + .on("click", "a", function (e) { + e.preventDefault(); + //}) + //.on("mouseup", "a", function (e) { + if(!$(this).blur().parent().hasClass("vakata-context-disabled") && $.vakata.context._execute($(this).attr("rel")) !== false) { + $.vakata.context.hide(); + } + }) + .on('keydown', 'a', function (e) { + var o = null; + switch(e.which) { + case 13: + case 32: + e.type = "click"; + e.preventDefault(); + $(e.currentTarget).trigger(e); + break; + case 37: + if(vakata_context.is_visible) { + vakata_context.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children('a').focus(); + e.stopImmediatePropagation(); + e.preventDefault(); + } + break; + case 38: + if(vakata_context.is_visible) { + o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(); + if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last(); } + o.addClass("vakata-context-hover").children('a').focus(); + e.stopImmediatePropagation(); + e.preventDefault(); + } + break; + case 39: + if(vakata_context.is_visible) { + vakata_context.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children('a').focus(); + e.stopImmediatePropagation(); + e.preventDefault(); + } + break; + case 40: + if(vakata_context.is_visible) { + o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(); + if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first(); } + o.addClass("vakata-context-hover").children('a').focus(); + e.stopImmediatePropagation(); + e.preventDefault(); + } + break; + case 27: + $.vakata.context.hide(); + e.preventDefault(); + break; + default: + //console.log(e.which); + break; + } + }) + .on('keydown', function (e) { + e.preventDefault(); + var a = vakata_context.element.find('.vakata-contextmenu-shortcut-' + e.which).parent(); + if(a.parent().not('.vakata-context-disabled')) { + a.click(); + } + }); + + $(document) + .on("mousedown.vakata.jstree", function (e) { + if(vakata_context.is_visible && vakata_context.element[0] !== e.target && !$.contains(vakata_context.element[0], e.target)) { + $.vakata.context.hide(); + } + }) + .on("context_show.vakata.jstree", function (e, data) { + vakata_context.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"); + if(right_to_left) { + vakata_context.element.addClass("vakata-context-rtl").css("direction", "rtl"); + } + // also apply a RTL class? + vakata_context.element.find("ul").hide().end(); + }); + }); + }($)); + // $.jstree.defaults.plugins.push("contextmenu"); + + +/** + * ### Drag'n'drop plugin + * + * Enables dragging and dropping of nodes in the tree, resulting in a move or copy operations. + */ + + /** + * stores all defaults for the drag'n'drop plugin + * @name $.jstree.defaults.dnd + * @plugin dnd + */ + $.jstree.defaults.dnd = { + /** + * a boolean indicating if a copy should be possible while dragging (by pressint the meta key or Ctrl). Defaults to `true`. + * @name $.jstree.defaults.dnd.copy + * @plugin dnd + */ + copy : true, + /** + * a number indicating how long a node should remain hovered while dragging to be opened. Defaults to `500`. + * @name $.jstree.defaults.dnd.open_timeout + * @plugin dnd + */ + open_timeout : 500, + /** + * a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the nodes about to be dragged as an argument (array) and the event that started the drag - return `false` to prevent dragging + * @name $.jstree.defaults.dnd.is_draggable + * @plugin dnd + */ + is_draggable : true, + /** + * a boolean indicating if checks should constantly be made while the user is dragging the node (as opposed to checking only on drop), default is `true` + * @name $.jstree.defaults.dnd.check_while_dragging + * @plugin dnd + */ + check_while_dragging : true, + /** + * a boolean indicating if nodes from this tree should only be copied with dnd (as opposed to moved), default is `false` + * @name $.jstree.defaults.dnd.always_copy + * @plugin dnd + */ + always_copy : false, + /** + * when dropping a node "inside", this setting indicates the position the node should go to - it can be an integer or a string: "first" (same as 0) or "last", default is `0` + * @name $.jstree.defaults.dnd.inside_pos + * @plugin dnd + */ + inside_pos : 0, + /** + * when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node + * @name $.jstree.defaults.dnd.drag_selection + * @plugin dnd + */ + drag_selection : true, + /** + * controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string "selected" which means only selected nodes can be dragged on touch devices. + * @name $.jstree.defaults.dnd.touch + * @plugin dnd + */ + touch : true, + /** + * controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target. + * @name $.jstree.defaults.dnd.large_drop_target + * @plugin dnd + */ + large_drop_target : false, + /** + * controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to "selected". + * @name $.jstree.defaults.dnd.large_drag_target + * @plugin dnd + */ + large_drag_target : false, + /** + * controls whether use HTML5 dnd api instead of classical. That will allow better integration of dnd events with other HTML5 controls. + * @reference http://caniuse.com/#feat=dragndrop + * @name $.jstree.defaults.dnd.use_html5 + * @plugin dnd + */ + use_html5: false + }; + var drg, elm; + // TODO: now check works by checking for each node individually, how about max_children, unique, etc? + $.jstree.plugins.dnd = function (options, parent) { + this.init = function (el, options) { + parent.init.call(this, el, options); + this.settings.dnd.use_html5 = this.settings.dnd.use_html5 && ('draggable' in document.createElement('span')); + }; + this.bind = function () { + parent.bind.call(this); + + this.element + .on(this.settings.dnd.use_html5 ? 'dragstart.jstree' : 'mousedown.jstree touchstart.jstree', this.settings.dnd.large_drag_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) { + if(this.settings.dnd.large_drag_target && $(e.target).closest('.jstree-node')[0] !== e.currentTarget) { + return true; + } + if(e.type === "touchstart" && (!this.settings.dnd.touch || (this.settings.dnd.touch === 'selected' && !$(e.currentTarget).closest('.jstree-node').children('.jstree-anchor').hasClass('jstree-clicked')))) { + return true; + } + var obj = this.get_node(e.target), + mlt = this.is_selected(obj) && this.settings.dnd.drag_selection ? this.get_top_selected().length : 1, + txt = (mlt > 1 ? mlt + ' ' + this.get_string('nodes') : this.get_text(e.currentTarget)); + if(this.settings.core.force_text) { + txt = $.vakata.html.escape(txt); + } + if(obj && obj.id && obj.id !== $.jstree.root && (e.which === 1 || e.type === "touchstart" || e.type === "dragstart") && + (this.settings.dnd.is_draggable === true || ($.isFunction(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_top_selected(true) : [obj]), e))) + ) { + drg = { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_top_selected() : [obj.id] }; + elm = e.currentTarget; + if (this.settings.dnd.use_html5) { + $.vakata.dnd._trigger('start', e, { 'helper': $(), 'element': elm, 'data': drg }); + } else { + this.element.trigger('mousedown.jstree'); + return $.vakata.dnd.start(e, drg, '
            ' + txt + '
            '); + } + } + }, this)); + if (this.settings.dnd.use_html5) { + this.element + .on('dragover.jstree', function (e) { + e.preventDefault(); + $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); + return false; + }) + //.on('dragenter.jstree', this.settings.dnd.large_drop_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) { + // e.preventDefault(); + // $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); + // return false; + // }, this)) + .on('drop.jstree', $.proxy(function (e) { + e.preventDefault(); + $.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg }); + return false; + }, this)); + } + }; + this.redraw_node = function(obj, deep, callback, force_render) { + obj = parent.redraw_node.apply(this, arguments); + if (obj && this.settings.dnd.use_html5) { + if (this.settings.dnd.large_drag_target) { + obj.setAttribute('draggable', true); + } else { + var i, j, tmp = null; + for(i = 0, j = obj.childNodes.length; i < j; i++) { + if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { + tmp = obj.childNodes[i]; + break; + } + } + if(tmp) { + tmp.setAttribute('draggable', true); + } + } + } + return obj; + }; + }; + + $(function() { + // bind only once for all instances + var lastmv = false, + laster = false, + lastev = false, + opento = false, + marker = $('
             
            ').hide(); //.appendTo('body'); + + $(document) + .on('dragover.vakata.jstree', function (e) { + if (elm) { + $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); + } + }) + .on('drop.vakata.jstree', function (e) { + if (elm) { + $.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg }); + elm = null; + drg = null; + } + }) + .on('dnd_start.vakata.jstree', function (e, data) { + lastmv = false; + lastev = false; + if(!data || !data.data || !data.data.jstree) { return; } + marker.appendTo(document.body); //.show(); + }) + .on('dnd_move.vakata.jstree', function (e, data) { + var isDifferentNode = data.event.target !== lastev.target; + if(opento) { + if (!data.event || data.event.type !== 'dragover' || isDifferentNode) { + clearTimeout(opento); + } + } + if(!data || !data.data || !data.data.jstree) { return; } + + // if we are hovering the marker image do nothing (can happen on "inside" drags) + if(data.event.target.id && data.event.target.id === 'jstree-marker') { + return; + } + lastev = data.event; + + var ins = $.jstree.reference(data.event.target), + ref = false, + off = false, + rel = false, + tmp, l, t, h, p, i, o, ok, t1, t2, op, ps, pr, ip, tm, is_copy, pn; + // if we are over an instance + if(ins && ins._data && ins._data.dnd) { + marker.attr('class', 'jstree-' + ins.get_theme() + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' )); + is_copy = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))); + data.helper + .children().attr('class', 'jstree-' + ins.get_theme() + ' jstree-' + ins.get_theme() + '-' + ins.get_theme_variant() + ' ' + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' )) + .find('.jstree-copy').first()[ is_copy ? 'show' : 'hide' ](); + + // if are hovering the container itself add a new root node + //console.log(data.event); + if( (data.event.target === ins.element[0] || data.event.target === ins.get_container_ul()[0]) && ins.get_container_ul().children().length === 0) { + ok = true; + for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) { + ok = ok && ins.check( (data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey)) ) ? "copy_node" : "move_node"), (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), $.jstree.root, 'last', { 'dnd' : true, 'ref' : ins.get_node($.jstree.root), 'pos' : 'i', 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }); + if(!ok) { break; } + } + if(ok) { + lastmv = { 'ins' : ins, 'par' : $.jstree.root, 'pos' : 'last' }; + marker.hide(); + data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok'); + if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { + data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move'; + } + return; + } + } + else { + // if we are hovering a tree node + ref = ins.settings.dnd.large_drop_target ? $(data.event.target).closest('.jstree-node').children('.jstree-anchor') : $(data.event.target).closest('.jstree-anchor'); + if(ref && ref.length && ref.parent().is('.jstree-closed, .jstree-open, .jstree-leaf')) { + off = ref.offset(); + rel = (data.event.pageY !== undefined ? data.event.pageY : data.event.originalEvent.pageY) - off.top; + h = ref.outerHeight(); + if(rel < h / 3) { + o = ['b', 'i', 'a']; + } + else if(rel > h - h / 3) { + o = ['a', 'i', 'b']; + } + else { + o = rel > h / 2 ? ['i', 'a', 'b'] : ['i', 'b', 'a']; + } + $.each(o, function (j, v) { + switch(v) { + case 'b': + l = off.left - 6; + t = off.top; + p = ins.get_parent(ref); + i = ref.parent().index(); + break; + case 'i': + ip = ins.settings.dnd.inside_pos; + tm = ins.get_node(ref.parent()); + l = off.left - 2; + t = off.top + h / 2 + 1; + p = tm.id; + i = ip === 'first' ? 0 : (ip === 'last' ? tm.children.length : Math.min(ip, tm.children.length)); + break; + case 'a': + l = off.left - 6; + t = off.top + h; + p = ins.get_parent(ref); + i = ref.parent().index() + 1; + break; + } + ok = true; + for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) { + op = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? "copy_node" : "move_node"; + ps = i; + if(op === "move_node" && v === 'a' && (data.data.origin && data.data.origin === ins) && p === ins.get_parent(data.data.nodes[t1])) { + pr = ins.get_node(p); + if(ps > $.inArray(data.data.nodes[t1], pr.children)) { + ps -= 1; + } + } + ok = ok && ( (ins && ins.settings && ins.settings.dnd && ins.settings.dnd.check_while_dragging === false) || ins.check(op, (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), p, ps, { 'dnd' : true, 'ref' : ins.get_node(ref.parent()), 'pos' : v, 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }) ); + if(!ok) { + if(ins && ins.last_error) { laster = ins.last_error(); } + break; + } + } + if(v === 'i' && ref.parent().is('.jstree-closed') && ins.settings.dnd.open_timeout) { + if (!data.event || data.event.type !== 'dragover' || isDifferentNode) { + if (opento) { clearTimeout(opento); } + opento = setTimeout((function (x, z) { return function () { x.open_node(z); }; }(ins, ref)), ins.settings.dnd.open_timeout); + } + } + if(ok) { + pn = ins.get_node(p, true); + if (!pn.hasClass('.jstree-dnd-parent')) { + $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); + pn.addClass('jstree-dnd-parent'); + } + lastmv = { 'ins' : ins, 'par' : p, 'pos' : v === 'i' && ip === 'last' && i === 0 && !ins.is_loaded(tm) ? 'last' : i }; + marker.css({ 'left' : l + 'px', 'top' : t + 'px' }).show(); + data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok'); + if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { + data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move'; + } + laster = {}; + o = true; + return false; + } + }); + if(o === true) { return; } + } + } + } + $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); + lastmv = false; + data.helper.find('.jstree-icon').removeClass('jstree-ok').addClass('jstree-er'); + if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { + //data.event.originalEvent.dataTransfer.dropEffect = 'none'; + } + marker.hide(); + }) + .on('dnd_scroll.vakata.jstree', function (e, data) { + if(!data || !data.data || !data.data.jstree) { return; } + marker.hide(); + lastmv = false; + lastev = false; + data.helper.find('.jstree-icon').first().removeClass('jstree-ok').addClass('jstree-er'); + }) + .on('dnd_stop.vakata.jstree', function (e, data) { + $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); + if(opento) { clearTimeout(opento); } + if(!data || !data.data || !data.data.jstree) { return; } + marker.hide().detach(); + var i, j, nodes = []; + if(lastmv) { + for(i = 0, j = data.data.nodes.length; i < j; i++) { + nodes[i] = data.data.origin ? data.data.origin.get_node(data.data.nodes[i]) : data.data.nodes[i]; + } + lastmv.ins[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? 'copy_node' : 'move_node' ](nodes, lastmv.par, lastmv.pos, false, false, false, data.data.origin); + } + else { + i = $(data.event.target).closest('.jstree'); + if(i.length && laster && laster.error && laster.error === 'check') { + i = i.jstree(true); + if(i) { + i.settings.core.error.call(this, laster); + } + } + } + lastev = false; + lastmv = false; + }) + .on('keyup.jstree keydown.jstree', function (e, data) { + data = $.vakata.dnd._get(); + if(data && data.data && data.data.jstree) { + if (e.type === "keyup" && e.which === 27) { + if (opento) { clearTimeout(opento); } + lastmv = false; + laster = false; + lastev = false; + opento = false; + marker.hide().detach(); + $.vakata.dnd._clean(); + } else { + data.helper.find('.jstree-copy').first()[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (e.metaKey || e.ctrlKey))) ? 'show' : 'hide' ](); + if(lastev) { + lastev.metaKey = e.metaKey; + lastev.ctrlKey = e.ctrlKey; + $.vakata.dnd._trigger('move', lastev); + } + } + } + }); + }); + + // helpers + (function ($) { + $.vakata.html = { + div : $('
            '), + escape : function (str) { + return $.vakata.html.div.text(str).html(); + }, + strip : function (str) { + return $.vakata.html.div.empty().append($.parseHTML(str)).text(); + } + }; + // private variable + var vakata_dnd = { + element : false, + target : false, + is_down : false, + is_drag : false, + helper : false, + helper_w: 0, + data : false, + init_x : 0, + init_y : 0, + scroll_l: 0, + scroll_t: 0, + scroll_e: false, + scroll_i: false, + is_touch: false + }; + $.vakata.dnd = { + settings : { + scroll_speed : 10, + scroll_proximity : 20, + helper_left : 5, + helper_top : 10, + threshold : 5, + threshold_touch : 10 + }, + _trigger : function (event_name, e, data) { + if (data === undefined) { + data = $.vakata.dnd._get(); + } + data.event = e; + $(document).triggerHandler("dnd_" + event_name + ".vakata", data); + }, + _get : function () { + return { + "data" : vakata_dnd.data, + "element" : vakata_dnd.element, + "helper" : vakata_dnd.helper + }; + }, + _clean : function () { + if(vakata_dnd.helper) { vakata_dnd.helper.remove(); } + if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; } + vakata_dnd = { + element : false, + target : false, + is_down : false, + is_drag : false, + helper : false, + helper_w: 0, + data : false, + init_x : 0, + init_y : 0, + scroll_l: 0, + scroll_t: 0, + scroll_e: false, + scroll_i: false, + is_touch: false + }; + $(document).off("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag); + $(document).off("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop); + }, + _scroll : function (init_only) { + if(!vakata_dnd.scroll_e || (!vakata_dnd.scroll_l && !vakata_dnd.scroll_t)) { + if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; } + return false; + } + if(!vakata_dnd.scroll_i) { + vakata_dnd.scroll_i = setInterval($.vakata.dnd._scroll, 100); + return false; + } + if(init_only === true) { return false; } + + var i = vakata_dnd.scroll_e.scrollTop(), + j = vakata_dnd.scroll_e.scrollLeft(); + vakata_dnd.scroll_e.scrollTop(i + vakata_dnd.scroll_t * $.vakata.dnd.settings.scroll_speed); + vakata_dnd.scroll_e.scrollLeft(j + vakata_dnd.scroll_l * $.vakata.dnd.settings.scroll_speed); + if(i !== vakata_dnd.scroll_e.scrollTop() || j !== vakata_dnd.scroll_e.scrollLeft()) { + /** + * triggered on the document when a drag causes an element to scroll + * @event + * @plugin dnd + * @name dnd_scroll.vakata + * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start + * @param {DOM} element the DOM element being dragged + * @param {jQuery} helper the helper shown next to the mouse + * @param {jQuery} event the element that is scrolling + */ + $.vakata.dnd._trigger("scroll", vakata_dnd.scroll_e); + } + }, + start : function (e, data, html) { + if(e.type === "touchstart" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { + e.pageX = e.originalEvent.changedTouches[0].pageX; + e.pageY = e.originalEvent.changedTouches[0].pageY; + e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); + } + if(vakata_dnd.is_drag) { $.vakata.dnd.stop({}); } + try { + e.currentTarget.unselectable = "on"; + e.currentTarget.onselectstart = function() { return false; }; + if(e.currentTarget.style) { + e.currentTarget.style.touchAction = "none"; + e.currentTarget.style.msTouchAction = "none"; + e.currentTarget.style.MozUserSelect = "none"; + } + } catch(ignore) { } + vakata_dnd.init_x = e.pageX; + vakata_dnd.init_y = e.pageY; + vakata_dnd.data = data; + vakata_dnd.is_down = true; + vakata_dnd.element = e.currentTarget; + vakata_dnd.target = e.target; + vakata_dnd.is_touch = e.type === "touchstart"; + if(html !== false) { + vakata_dnd.helper = $("
            ").html(html).css({ + "display" : "block", + "margin" : "0", + "padding" : "0", + "position" : "absolute", + "top" : "-2000px", + "lineHeight" : "16px", + "zIndex" : "10000" + }); + } + $(document).on("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag); + $(document).on("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop); + return false; + }, + drag : function (e) { + if(e.type === "touchmove" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { + e.pageX = e.originalEvent.changedTouches[0].pageX; + e.pageY = e.originalEvent.changedTouches[0].pageY; + e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); + } + if(!vakata_dnd.is_down) { return; } + if(!vakata_dnd.is_drag) { + if( + Math.abs(e.pageX - vakata_dnd.init_x) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) || + Math.abs(e.pageY - vakata_dnd.init_y) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) + ) { + if(vakata_dnd.helper) { + vakata_dnd.helper.appendTo(document.body); + vakata_dnd.helper_w = vakata_dnd.helper.outerWidth(); + } + vakata_dnd.is_drag = true; + $(vakata_dnd.target).one('click.vakata', false); + /** + * triggered on the document when a drag starts + * @event + * @plugin dnd + * @name dnd_start.vakata + * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start + * @param {DOM} element the DOM element being dragged + * @param {jQuery} helper the helper shown next to the mouse + * @param {Object} event the event that caused the start (probably mousemove) + */ + $.vakata.dnd._trigger("start", e); + } + else { return; } + } + + var d = false, w = false, + dh = false, wh = false, + dw = false, ww = false, + dt = false, dl = false, + ht = false, hl = false; + + vakata_dnd.scroll_t = 0; + vakata_dnd.scroll_l = 0; + vakata_dnd.scroll_e = false; + $($(e.target).parentsUntil("body").addBack().get().reverse()) + .filter(function () { + return (/^auto|scroll$/).test($(this).css("overflow")) && + (this.scrollHeight > this.offsetHeight || this.scrollWidth > this.offsetWidth); + }) + .each(function () { + var t = $(this), o = t.offset(); + if(this.scrollHeight > this.offsetHeight) { + if(o.top + t.height() - e.pageY < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; } + if(e.pageY - o.top < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; } + } + if(this.scrollWidth > this.offsetWidth) { + if(o.left + t.width() - e.pageX < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; } + if(e.pageX - o.left < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; } + } + if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) { + vakata_dnd.scroll_e = $(this); + return false; + } + }); + + if(!vakata_dnd.scroll_e) { + d = $(document); w = $(window); + dh = d.height(); wh = w.height(); + dw = d.width(); ww = w.width(); + dt = d.scrollTop(); dl = d.scrollLeft(); + if(dh > wh && e.pageY - dt < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; } + if(dh > wh && wh - (e.pageY - dt) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; } + if(dw > ww && e.pageX - dl < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; } + if(dw > ww && ww - (e.pageX - dl) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; } + if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) { + vakata_dnd.scroll_e = d; + } + } + if(vakata_dnd.scroll_e) { $.vakata.dnd._scroll(true); } + + if(vakata_dnd.helper) { + ht = parseInt(e.pageY + $.vakata.dnd.settings.helper_top, 10); + hl = parseInt(e.pageX + $.vakata.dnd.settings.helper_left, 10); + if(dh && ht + 25 > dh) { ht = dh - 50; } + if(dw && hl + vakata_dnd.helper_w > dw) { hl = dw - (vakata_dnd.helper_w + 2); } + vakata_dnd.helper.css({ + left : hl + "px", + top : ht + "px" + }); + } + /** + * triggered on the document when a drag is in progress + * @event + * @plugin dnd + * @name dnd_move.vakata + * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start + * @param {DOM} element the DOM element being dragged + * @param {jQuery} helper the helper shown next to the mouse + * @param {Object} event the event that caused this to trigger (most likely mousemove) + */ + $.vakata.dnd._trigger("move", e); + return false; + }, + stop : function (e) { + if(e.type === "touchend" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { + e.pageX = e.originalEvent.changedTouches[0].pageX; + e.pageY = e.originalEvent.changedTouches[0].pageY; + e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); + } + if(vakata_dnd.is_drag) { + /** + * triggered on the document when a drag stops (the dragged element is dropped) + * @event + * @plugin dnd + * @name dnd_stop.vakata + * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start + * @param {DOM} element the DOM element being dragged + * @param {jQuery} helper the helper shown next to the mouse + * @param {Object} event the event that caused the stop + */ + if (e.target !== vakata_dnd.target) { + $(vakata_dnd.target).off('click.vakata'); + } + $.vakata.dnd._trigger("stop", e); + } + else { + if(e.type === "touchend" && e.target === vakata_dnd.target) { + var to = setTimeout(function () { $(e.target).click(); }, 100); + $(e.target).one('click', function() { if(to) { clearTimeout(to); } }); + } + } + $.vakata.dnd._clean(); + return false; + } + }; + }($)); + + // include the dnd plugin by default + // $.jstree.defaults.plugins.push("dnd"); + + +/** + * ### Massload plugin + * + * Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading). + */ + + /** + * massload configuration + * + * It is possible to set this to a standard jQuery-like AJAX config. + * In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used. + * + * You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result. + * + * Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array. + * + * { + * "id1" : [{ "text" : "Child of ID1", "id" : "c1" }, { "text" : "Another child of ID1", "id" : "c2" }], + * "id2" : [{ "text" : "Child of ID2", "id" : "c3" }] + * } + * + * @name $.jstree.defaults.massload + * @plugin massload + */ + $.jstree.defaults.massload = null; + $.jstree.plugins.massload = function (options, parent) { + this.init = function (el, options) { + this._data.massload = {}; + parent.init.call(this, el, options); + }; + this._load_nodes = function (nodes, callback, is_callback, force_reload) { + var s = this.settings.massload, + nodesString = JSON.stringify(nodes), + toLoad = [], + m = this._model.data, + i, j, dom; + if (!is_callback) { + for(i = 0, j = nodes.length; i < j; i++) { + if(!m[nodes[i]] || ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || force_reload) ) { + toLoad.push(nodes[i]); + dom = this.get_node(nodes[i], true); + if (dom && dom.length) { + dom.addClass("jstree-loading").attr('aria-busy',true); + } + } + } + this._data.massload = {}; + if (toLoad.length) { + if($.isFunction(s)) { + return s.call(this, toLoad, $.proxy(function (data) { + var i, j; + if(data) { + for(i in data) { + if(data.hasOwnProperty(i)) { + this._data.massload[i] = data[i]; + } + } + } + for(i = 0, j = nodes.length; i < j; i++) { + dom = this.get_node(nodes[i], true); + if (dom && dom.length) { + dom.removeClass("jstree-loading").attr('aria-busy',false); + } + } + parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); + }, this)); + } + if(typeof s === 'object' && s && s.url) { + s = $.extend(true, {}, s); + if($.isFunction(s.url)) { + s.url = s.url.call(this, toLoad); + } + if($.isFunction(s.data)) { + s.data = s.data.call(this, toLoad); + } + return $.ajax(s) + .done($.proxy(function (data,t,x) { + var i, j; + if(data) { + for(i in data) { + if(data.hasOwnProperty(i)) { + this._data.massload[i] = data[i]; + } + } + } + for(i = 0, j = nodes.length; i < j; i++) { + dom = this.get_node(nodes[i], true); + if (dom && dom.length) { + dom.removeClass("jstree-loading").attr('aria-busy',false); + } + } + parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); + }, this)) + .fail($.proxy(function (f) { + parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); + }, this)); + } + } + } + return parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); + }; + this._load_node = function (obj, callback) { + var data = this._data.massload[obj.id], + rslt = null, dom; + if(data) { + rslt = this[typeof data === 'string' ? '_append_html_data' : '_append_json_data']( + obj, + typeof data === 'string' ? $($.parseHTML(data)).filter(function () { return this.nodeType !== 3; }) : data, + function (status) { callback.call(this, status); } + ); + dom = this.get_node(obj.id, true); + if (dom && dom.length) { + dom.removeClass("jstree-loading").attr('aria-busy',false); + } + delete this._data.massload[obj.id]; + return rslt; + } + return parent._load_node.call(this, obj, callback); + }; + }; + +/** + * ### Search plugin + * + * Adds search functionality to jsTree. + */ + + /** + * stores all defaults for the search plugin + * @name $.jstree.defaults.search + * @plugin search + */ + $.jstree.defaults.search = { + /** + * a jQuery-like AJAX config, which jstree uses if a server should be queried for results. + * + * A `str` (which is the search string) parameter will be added with the request, an optional `inside` parameter will be added if the search is limited to a node id. The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed. + * Leave this setting as `false` to not query the server. You can also set this to a function, which will be invoked in the instance's scope and receive 3 parameters - the search string, the callback to call with the array of nodes to load, and the optional node ID to limit the search to + * @name $.jstree.defaults.search.ajax + * @plugin search + */ + ajax : false, + /** + * Indicates if the search should be fuzzy or not (should `chnd3` match `child node 3`). Default is `false`. + * @name $.jstree.defaults.search.fuzzy + * @plugin search + */ + fuzzy : false, + /** + * Indicates if the search should be case sensitive. Default is `false`. + * @name $.jstree.defaults.search.case_sensitive + * @plugin search + */ + case_sensitive : false, + /** + * Indicates if the tree should be filtered (by default) to show only matching nodes (keep in mind this can be a heavy on large trees in old browsers). + * This setting can be changed at runtime when calling the search method. Default is `false`. + * @name $.jstree.defaults.search.show_only_matches + * @plugin search + */ + show_only_matches : false, + /** + * Indicates if the children of matched element are shown (when show_only_matches is true) + * This setting can be changed at runtime when calling the search method. Default is `false`. + * @name $.jstree.defaults.search.show_only_matches_children + * @plugin search + */ + show_only_matches_children : false, + /** + * Indicates if all nodes opened to reveal the search result, should be closed when the search is cleared or a new search is performed. Default is `true`. + * @name $.jstree.defaults.search.close_opened_onclear + * @plugin search + */ + close_opened_onclear : true, + /** + * Indicates if only leaf nodes should be included in search results. Default is `false`. + * @name $.jstree.defaults.search.search_leaves_only + * @plugin search + */ + search_leaves_only : false, + /** + * If set to a function it wil be called in the instance's scope with two arguments - search string and node (where node will be every node in the structure, so use with caution). + * If the function returns a truthy value the node will be considered a match (it might not be displayed if search_only_leaves is set to true and the node is not a leaf). Default is `false`. + * @name $.jstree.defaults.search.search_callback + * @plugin search + */ + search_callback : false + }; + + $.jstree.plugins.search = function (options, parent) { + this.bind = function () { + parent.bind.call(this); + + this._data.search.str = ""; + this._data.search.dom = $(); + this._data.search.res = []; + this._data.search.opn = []; + this._data.search.som = false; + this._data.search.smc = false; + this._data.search.hdn = []; + + this.element + .on("search.jstree", $.proxy(function (e, data) { + if(this._data.search.som && data.res.length) { + var m = this._model.data, i, j, p = [], k, l; + for(i = 0, j = data.res.length; i < j; i++) { + if(m[data.res[i]] && !m[data.res[i]].state.hidden) { + p.push(data.res[i]); + p = p.concat(m[data.res[i]].parents); + if(this._data.search.smc) { + for (k = 0, l = m[data.res[i]].children_d.length; k < l; k++) { + if (m[m[data.res[i]].children_d[k]] && !m[m[data.res[i]].children_d[k]].state.hidden) { + p.push(m[data.res[i]].children_d[k]); + } + } + } + } + } + p = $.vakata.array_remove_item($.vakata.array_unique(p), $.jstree.root); + this._data.search.hdn = this.hide_all(true); + this.show_node(p, true); + this.redraw(true); + } + }, this)) + .on("clear_search.jstree", $.proxy(function (e, data) { + if(this._data.search.som && data.res.length) { + this.show_node(this._data.search.hdn, true); + this.redraw(true); + } + }, this)); + }; + /** + * used to search the tree nodes for a given string + * @name search(str [, skip_async]) + * @param {String} str the search string + * @param {Boolean} skip_async if set to true server will not be queried even if configured + * @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers) + * @param {mixed} inside an optional node to whose children to limit the search + * @param {Boolean} append if set to true the results of this search are appended to the previous search + * @plugin search + * @trigger search.jstree + */ + this.search = function (str, skip_async, show_only_matches, inside, append, show_only_matches_children) { + if(str === false || $.trim(str.toString()) === "") { + return this.clear_search(); + } + inside = this.get_node(inside); + inside = inside && inside.id ? inside.id : null; + str = str.toString(); + var s = this.settings.search, + a = s.ajax ? s.ajax : false, + m = this._model.data, + f = null, + r = [], + p = [], i, j; + if(this._data.search.res.length && !append) { + this.clear_search(); + } + if(show_only_matches === undefined) { + show_only_matches = s.show_only_matches; + } + if(show_only_matches_children === undefined) { + show_only_matches_children = s.show_only_matches_children; + } + if(!skip_async && a !== false) { + if($.isFunction(a)) { + return a.call(this, str, $.proxy(function (d) { + if(d && d.d) { d = d.d; } + this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () { + this.search(str, true, show_only_matches, inside, append, show_only_matches_children); + }); + }, this), inside); + } + else { + a = $.extend({}, a); + if(!a.data) { a.data = {}; } + a.data.str = str; + if(inside) { + a.data.inside = inside; + } + if (this._data.search.lastRequest) { + this._data.search.lastRequest.abort(); + } + this._data.search.lastRequest = $.ajax(a) + .fail($.proxy(function () { + this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'search', 'id' : 'search_01', 'reason' : 'Could not load search parents', 'data' : JSON.stringify(a) }; + this.settings.core.error.call(this, this._data.core.last_error); + }, this)) + .done($.proxy(function (d) { + if(d && d.d) { d = d.d; } + this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () { + this.search(str, true, show_only_matches, inside, append, show_only_matches_children); + }); + }, this)); + return this._data.search.lastRequest; + } + } + if(!append) { + this._data.search.str = str; + this._data.search.dom = $(); + this._data.search.res = []; + this._data.search.opn = []; + this._data.search.som = show_only_matches; + this._data.search.smc = show_only_matches_children; + } + + f = new $.vakata.search(str, true, { caseSensitive : s.case_sensitive, fuzzy : s.fuzzy }); + $.each(m[inside ? inside : $.jstree.root].children_d, function (ii, i) { + var v = m[i]; + if(v.text && !v.state.hidden && (!s.search_leaves_only || (v.state.loaded && v.children.length === 0)) && ( (s.search_callback && s.search_callback.call(this, str, v)) || (!s.search_callback && f.search(v.text).isMatch) ) ) { + r.push(i); + p = p.concat(v.parents); + } + }); + if(r.length) { + p = $.vakata.array_unique(p); + for(i = 0, j = p.length; i < j; i++) { + if(p[i] !== $.jstree.root && m[p[i]] && this.open_node(p[i], null, 0) === true) { + this._data.search.opn.push(p[i]); + } + } + if(!append) { + this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #'))); + this._data.search.res = r; + } + else { + this._data.search.dom = this._data.search.dom.add($(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #')))); + this._data.search.res = $.vakata.array_unique(this._data.search.res.concat(r)); + } + this._data.search.dom.children(".jstree-anchor").addClass('jstree-search'); + } + /** + * triggered after search is complete + * @event + * @name search.jstree + * @param {jQuery} nodes a jQuery collection of matching nodes + * @param {String} str the search string + * @param {Array} res a collection of objects represeing the matching nodes + * @plugin search + */ + this.trigger('search', { nodes : this._data.search.dom, str : str, res : this._data.search.res, show_only_matches : show_only_matches }); + }; + /** + * used to clear the last search (removes classes and shows all nodes if filtering is on) + * @name clear_search() + * @plugin search + * @trigger clear_search.jstree + */ + this.clear_search = function () { + if(this.settings.search.close_opened_onclear) { + this.close_node(this._data.search.opn, 0); + } + /** + * triggered after search is complete + * @event + * @name clear_search.jstree + * @param {jQuery} nodes a jQuery collection of matching nodes (the result from the last search) + * @param {String} str the search string (the last search string) + * @param {Array} res a collection of objects represeing the matching nodes (the result from the last search) + * @plugin search + */ + this.trigger('clear_search', { 'nodes' : this._data.search.dom, str : this._data.search.str, res : this._data.search.res }); + if(this._data.search.res.length) { + this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(this._data.search.res, function (v) { + return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); + }).join(', #'))); + this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search"); + } + this._data.search.str = ""; + this._data.search.res = []; + this._data.search.opn = []; + this._data.search.dom = $(); + }; + + this.redraw_node = function(obj, deep, callback, force_render) { + obj = parent.redraw_node.apply(this, arguments); + if(obj) { + if($.inArray(obj.id, this._data.search.res) !== -1) { + var i, j, tmp = null; + for(i = 0, j = obj.childNodes.length; i < j; i++) { + if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { + tmp = obj.childNodes[i]; + break; + } + } + if(tmp) { + tmp.className += ' jstree-search'; + } + } + } + return obj; + }; + }; + + // helpers + (function ($) { + // from http://kiro.me/projects/fuse.html + $.vakata.search = function(pattern, txt, options) { + options = options || {}; + options = $.extend({}, $.vakata.search.defaults, options); + if(options.fuzzy !== false) { + options.fuzzy = true; + } + pattern = options.caseSensitive ? pattern : pattern.toLowerCase(); + var MATCH_LOCATION = options.location, + MATCH_DISTANCE = options.distance, + MATCH_THRESHOLD = options.threshold, + patternLen = pattern.length, + matchmask, pattern_alphabet, match_bitapScore, search; + if(patternLen > 32) { + options.fuzzy = false; + } + if(options.fuzzy) { + matchmask = 1 << (patternLen - 1); + pattern_alphabet = (function () { + var mask = {}, + i = 0; + for (i = 0; i < patternLen; i++) { + mask[pattern.charAt(i)] = 0; + } + for (i = 0; i < patternLen; i++) { + mask[pattern.charAt(i)] |= 1 << (patternLen - i - 1); + } + return mask; + }()); + match_bitapScore = function (e, x) { + var accuracy = e / patternLen, + proximity = Math.abs(MATCH_LOCATION - x); + if(!MATCH_DISTANCE) { + return proximity ? 1.0 : accuracy; + } + return accuracy + (proximity / MATCH_DISTANCE); + }; + } + search = function (text) { + text = options.caseSensitive ? text : text.toLowerCase(); + if(pattern === text || text.indexOf(pattern) !== -1) { + return { + isMatch: true, + score: 0 + }; + } + if(!options.fuzzy) { + return { + isMatch: false, + score: 1 + }; + } + var i, j, + textLen = text.length, + scoreThreshold = MATCH_THRESHOLD, + bestLoc = text.indexOf(pattern, MATCH_LOCATION), + binMin, binMid, + binMax = patternLen + textLen, + lastRd, start, finish, rd, charMatch, + score = 1, + locations = []; + if (bestLoc !== -1) { + scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold); + bestLoc = text.lastIndexOf(pattern, MATCH_LOCATION + patternLen); + if (bestLoc !== -1) { + scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold); + } + } + bestLoc = -1; + for (i = 0; i < patternLen; i++) { + binMin = 0; + binMid = binMax; + while (binMin < binMid) { + if (match_bitapScore(i, MATCH_LOCATION + binMid) <= scoreThreshold) { + binMin = binMid; + } else { + binMax = binMid; + } + binMid = Math.floor((binMax - binMin) / 2 + binMin); + } + binMax = binMid; + start = Math.max(1, MATCH_LOCATION - binMid + 1); + finish = Math.min(MATCH_LOCATION + binMid, textLen) + patternLen; + rd = new Array(finish + 2); + rd[finish + 1] = (1 << i) - 1; + for (j = finish; j >= start; j--) { + charMatch = pattern_alphabet[text.charAt(j - 1)]; + if (i === 0) { + rd[j] = ((rd[j + 1] << 1) | 1) & charMatch; + } else { + rd[j] = ((rd[j + 1] << 1) | 1) & charMatch | (((lastRd[j + 1] | lastRd[j]) << 1) | 1) | lastRd[j + 1]; + } + if (rd[j] & matchmask) { + score = match_bitapScore(i, j - 1); + if (score <= scoreThreshold) { + scoreThreshold = score; + bestLoc = j - 1; + locations.push(bestLoc); + if (bestLoc > MATCH_LOCATION) { + start = Math.max(1, 2 * MATCH_LOCATION - bestLoc); + } else { + break; + } + } + } + } + if (match_bitapScore(i + 1, MATCH_LOCATION) > scoreThreshold) { + break; + } + lastRd = rd; + } + return { + isMatch: bestLoc >= 0, + score: score + }; + }; + return txt === true ? { 'search' : search } : search(txt); + }; + $.vakata.search.defaults = { + location : 0, + distance : 100, + threshold : 0.6, + fuzzy : false, + caseSensitive : false + }; + }($)); + + // include the search plugin by default + // $.jstree.defaults.plugins.push("search"); + + +/** + * ### Sort plugin + * + * Automatically sorts all siblings in the tree according to a sorting function. + */ + + /** + * the settings function used to sort the nodes. + * It is executed in the tree's context, accepts two nodes as arguments and should return `1` or `-1`. + * @name $.jstree.defaults.sort + * @plugin sort + */ + $.jstree.defaults.sort = function (a, b) { + //return this.get_type(a) === this.get_type(b) ? (this.get_text(a) > this.get_text(b) ? 1 : -1) : this.get_type(a) >= this.get_type(b); + return this.get_text(a) > this.get_text(b) ? 1 : -1; + }; + $.jstree.plugins.sort = function (options, parent) { + this.bind = function () { + parent.bind.call(this); + this.element + .on("model.jstree", $.proxy(function (e, data) { + this.sort(data.parent, true); + }, this)) + .on("rename_node.jstree create_node.jstree", $.proxy(function (e, data) { + this.sort(data.parent || data.node.parent, false); + this.redraw_node(data.parent || data.node.parent, true); + }, this)) + .on("move_node.jstree copy_node.jstree", $.proxy(function (e, data) { + this.sort(data.parent, false); + this.redraw_node(data.parent, true); + }, this)); + }; + /** + * used to sort a node's children + * @private + * @name sort(obj [, deep]) + * @param {mixed} obj the node + * @param {Boolean} deep if set to `true` nodes are sorted recursively. + * @plugin sort + * @trigger search.jstree + */ + this.sort = function (obj, deep) { + var i, j; + obj = this.get_node(obj); + if(obj && obj.children && obj.children.length) { + obj.children.sort($.proxy(this.settings.sort, this)); + if(deep) { + for(i = 0, j = obj.children_d.length; i < j; i++) { + this.sort(obj.children_d[i], false); + } + } + } + }; + }; + + // include the sort plugin by default + // $.jstree.defaults.plugins.push("sort"); + +/** + * ### State plugin + * + * Saves the state of the tree (selected nodes, opened nodes) on the user's computer using available options (localStorage, cookies, etc) + */ + + var to = false; + /** + * stores all defaults for the state plugin + * @name $.jstree.defaults.state + * @plugin state + */ + $.jstree.defaults.state = { + /** + * A string for the key to use when saving the current tree (change if using multiple trees in your project). Defaults to `jstree`. + * @name $.jstree.defaults.state.key + * @plugin state + */ + key : 'jstree', + /** + * A space separated list of events that trigger a state save. Defaults to `changed.jstree open_node.jstree close_node.jstree`. + * @name $.jstree.defaults.state.events + * @plugin state + */ + events : 'changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree', + /** + * Time in milliseconds after which the state will expire. Defaults to 'false' meaning - no expire. + * @name $.jstree.defaults.state.ttl + * @plugin state + */ + ttl : false, + /** + * A function that will be executed prior to restoring state with one argument - the state object. Can be used to clear unwanted parts of the state. + * @name $.jstree.defaults.state.filter + * @plugin state + */ + filter : false, + /** + * Should loaded nodes be restored (setting this to true means that it is possible that the whole tree will be loaded for some users - use with caution). Defaults to `false` + * @name $.jstree.defaults.state.preserve_loaded + * @plugin state + */ + preserve_loaded : false + }; + $.jstree.plugins.state = function (options, parent) { + this.bind = function () { + parent.bind.call(this); + var bind = $.proxy(function () { + this.element.on(this.settings.state.events, $.proxy(function () { + if(to) { clearTimeout(to); } + to = setTimeout($.proxy(function () { this.save_state(); }, this), 100); + }, this)); + /** + * triggered when the state plugin is finished restoring the state (and immediately after ready if there is no state to restore). + * @event + * @name state_ready.jstree + * @plugin state + */ + this.trigger('state_ready'); + }, this); + this.element + .on("ready.jstree", $.proxy(function (e, data) { + this.element.one("restore_state.jstree", bind); + if(!this.restore_state()) { bind(); } + }, this)); + }; + /** + * save the state + * @name save_state() + * @plugin state + */ + this.save_state = function () { + var tm = this.get_state(); + if (!this.settings.state.preserve_loaded) { + delete tm.core.loaded; + } + var st = { 'state' : tm, 'ttl' : this.settings.state.ttl, 'sec' : +(new Date()) }; + $.vakata.storage.set(this.settings.state.key, JSON.stringify(st)); + }; + /** + * restore the state from the user's computer + * @name restore_state() + * @plugin state + */ + this.restore_state = function () { + var k = $.vakata.storage.get(this.settings.state.key); + if(!!k) { try { k = JSON.parse(k); } catch(ex) { return false; } } + if(!!k && k.ttl && k.sec && +(new Date()) - k.sec > k.ttl) { return false; } + if(!!k && k.state) { k = k.state; } + if(!!k && $.isFunction(this.settings.state.filter)) { k = this.settings.state.filter.call(this, k); } + if(!!k) { + if (!this.settings.state.preserve_loaded) { + delete k.core.loaded; + } + this.element.one("set_state.jstree", function (e, data) { data.instance.trigger('restore_state', { 'state' : $.extend(true, {}, k) }); }); + this.set_state(k); + return true; + } + return false; + }; + /** + * clear the state on the user's computer + * @name clear_state() + * @plugin state + */ + this.clear_state = function () { + return $.vakata.storage.del(this.settings.state.key); + }; + }; + + (function ($, undefined) { + $.vakata.storage = { + // simply specifying the functions in FF throws an error + set : function (key, val) { return window.localStorage.setItem(key, val); }, + get : function (key) { return window.localStorage.getItem(key); }, + del : function (key) { return window.localStorage.removeItem(key); } + }; + }($)); + + // include the state plugin by default + // $.jstree.defaults.plugins.push("state"); + +/** + * ### Types plugin + * + * Makes it possible to add predefined types for groups of nodes, which make it possible to easily control nesting rules and icon for each group. + */ + + /** + * An object storing all types as key value pairs, where the key is the type name and the value is an object that could contain following keys (all optional). + * + * * `max_children` the maximum number of immediate children this node type can have. Do not specify or set to `-1` for unlimited. + * * `max_depth` the maximum number of nesting this node type can have. A value of `1` would mean that the node can have children, but no grandchildren. Do not specify or set to `-1` for unlimited. + * * `valid_children` an array of node type strings, that nodes of this type can have as children. Do not specify or set to `-1` for no limits. + * * `icon` a string - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class. Omit to use the default icon from your theme. + * * `li_attr` an object of values which will be used to add HTML attributes on the resulting LI DOM node (merged with the node's own data) + * * `a_attr` an object of values which will be used to add HTML attributes on the resulting A DOM node (merged with the node's own data) + * + * There are two predefined types: + * + * * `#` represents the root of the tree, for example `max_children` would control the maximum number of root nodes. + * * `default` represents the default node - any settings here will be applied to all nodes that do not have a type specified. + * + * @name $.jstree.defaults.types + * @plugin types + */ + $.jstree.defaults.types = { + 'default' : {} + }; + $.jstree.defaults.types[$.jstree.root] = {}; + + $.jstree.plugins.types = function (options, parent) { + this.init = function (el, options) { + var i, j; + if(options && options.types && options.types['default']) { + for(i in options.types) { + if(i !== "default" && i !== $.jstree.root && options.types.hasOwnProperty(i)) { + for(j in options.types['default']) { + if(options.types['default'].hasOwnProperty(j) && options.types[i][j] === undefined) { + options.types[i][j] = options.types['default'][j]; + } + } + } + } + } + parent.init.call(this, el, options); + this._model.data[$.jstree.root].type = $.jstree.root; + }; + this.refresh = function (skip_loading, forget_state) { + parent.refresh.call(this, skip_loading, forget_state); + this._model.data[$.jstree.root].type = $.jstree.root; + }; + this.bind = function () { + this.element + .on('model.jstree', $.proxy(function (e, data) { + var m = this._model.data, + dpc = data.nodes, + t = this.settings.types, + i, j, c = 'default', k; + for(i = 0, j = dpc.length; i < j; i++) { + c = 'default'; + if(m[dpc[i]].original && m[dpc[i]].original.type && t[m[dpc[i]].original.type]) { + c = m[dpc[i]].original.type; + } + if(m[dpc[i]].data && m[dpc[i]].data.jstree && m[dpc[i]].data.jstree.type && t[m[dpc[i]].data.jstree.type]) { + c = m[dpc[i]].data.jstree.type; + } + m[dpc[i]].type = c; + if(m[dpc[i]].icon === true && t[c].icon !== undefined) { + m[dpc[i]].icon = t[c].icon; + } + if(t[c].li_attr !== undefined && typeof t[c].li_attr === 'object') { + for (k in t[c].li_attr) { + if (t[c].li_attr.hasOwnProperty(k)) { + if (k === 'id') { + continue; + } + else if (m[dpc[i]].li_attr[k] === undefined) { + m[dpc[i]].li_attr[k] = t[c].li_attr[k]; + } + else if (k === 'class') { + m[dpc[i]].li_attr['class'] = t[c].li_attr['class'] + ' ' + m[dpc[i]].li_attr['class']; + } + } + } + } + if(t[c].a_attr !== undefined && typeof t[c].a_attr === 'object') { + for (k in t[c].a_attr) { + if (t[c].a_attr.hasOwnProperty(k)) { + if (k === 'id') { + continue; + } + else if (m[dpc[i]].a_attr[k] === undefined) { + m[dpc[i]].a_attr[k] = t[c].a_attr[k]; + } + else if (k === 'href' && m[dpc[i]].a_attr[k] === '#') { + m[dpc[i]].a_attr['href'] = t[c].a_attr['href']; + } + else if (k === 'class') { + m[dpc[i]].a_attr['class'] = t[c].a_attr['class'] + ' ' + m[dpc[i]].a_attr['class']; + } + } + } + } + } + m[$.jstree.root].type = $.jstree.root; + }, this)); + parent.bind.call(this); + }; + this.get_json = function (obj, options, flat) { + var i, j, + m = this._model.data, + opt = options ? $.extend(true, {}, options, {no_id:false}) : {}, + tmp = parent.get_json.call(this, obj, opt, flat); + if(tmp === false) { return false; } + if($.isArray(tmp)) { + for(i = 0, j = tmp.length; i < j; i++) { + tmp[i].type = tmp[i].id && m[tmp[i].id] && m[tmp[i].id].type ? m[tmp[i].id].type : "default"; + if(options && options.no_id) { + delete tmp[i].id; + if(tmp[i].li_attr && tmp[i].li_attr.id) { + delete tmp[i].li_attr.id; + } + if(tmp[i].a_attr && tmp[i].a_attr.id) { + delete tmp[i].a_attr.id; + } + } + } + } + else { + tmp.type = tmp.id && m[tmp.id] && m[tmp.id].type ? m[tmp.id].type : "default"; + if(options && options.no_id) { + tmp = this._delete_ids(tmp); + } + } + return tmp; + }; + this._delete_ids = function (tmp) { + if($.isArray(tmp)) { + for(var i = 0, j = tmp.length; i < j; i++) { + tmp[i] = this._delete_ids(tmp[i]); + } + return tmp; + } + delete tmp.id; + if(tmp.li_attr && tmp.li_attr.id) { + delete tmp.li_attr.id; + } + if(tmp.a_attr && tmp.a_attr.id) { + delete tmp.a_attr.id; + } + if(tmp.children && $.isArray(tmp.children)) { + tmp.children = this._delete_ids(tmp.children); + } + return tmp; + }; + this.check = function (chk, obj, par, pos, more) { + if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; } + obj = obj && obj.id ? obj : this.get_node(obj); + par = par && par.id ? par : this.get_node(par); + var m = obj && obj.id ? (more && more.origin ? more.origin : $.jstree.reference(obj.id)) : null, tmp, d, i, j; + m = m && m._model && m._model.data ? m._model.data : null; + switch(chk) { + case "create_node": + case "move_node": + case "copy_node": + if(chk !== 'move_node' || $.inArray(obj.id, par.children) === -1) { + tmp = this.get_rules(par); + if(tmp.max_children !== undefined && tmp.max_children !== -1 && tmp.max_children === par.children.length) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_01', 'reason' : 'max_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + return false; + } + if(tmp.valid_children !== undefined && tmp.valid_children !== -1 && $.inArray((obj.type || 'default'), tmp.valid_children) === -1) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_02', 'reason' : 'valid_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + return false; + } + if(m && obj.children_d && obj.parents) { + d = 0; + for(i = 0, j = obj.children_d.length; i < j; i++) { + d = Math.max(d, m[obj.children_d[i]].parents.length); + } + d = d - obj.parents.length + 1; + } + if(d <= 0 || d === undefined) { d = 1; } + do { + if(tmp.max_depth !== undefined && tmp.max_depth !== -1 && tmp.max_depth < d) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_03', 'reason' : 'max_depth prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + return false; + } + par = this.get_node(par.parent); + tmp = this.get_rules(par); + d++; + } while(par); + } + break; + } + return true; + }; + /** + * used to retrieve the type settings object for a node + * @name get_rules(obj) + * @param {mixed} obj the node to find the rules for + * @return {Object} + * @plugin types + */ + this.get_rules = function (obj) { + obj = this.get_node(obj); + if(!obj) { return false; } + var tmp = this.get_type(obj, true); + if(tmp.max_depth === undefined) { tmp.max_depth = -1; } + if(tmp.max_children === undefined) { tmp.max_children = -1; } + if(tmp.valid_children === undefined) { tmp.valid_children = -1; } + return tmp; + }; + /** + * used to retrieve the type string or settings object for a node + * @name get_type(obj [, rules]) + * @param {mixed} obj the node to find the rules for + * @param {Boolean} rules if set to `true` instead of a string the settings object will be returned + * @return {String|Object} + * @plugin types + */ + this.get_type = function (obj, rules) { + obj = this.get_node(obj); + return (!obj) ? false : ( rules ? $.extend({ 'type' : obj.type }, this.settings.types[obj.type]) : obj.type); + }; + /** + * used to change a node's type + * @name set_type(obj, type) + * @param {mixed} obj the node to change + * @param {String} type the new type + * @plugin types + */ + this.set_type = function (obj, type) { + var m = this._model.data, t, t1, t2, old_type, old_icon, k, d, a; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.set_type(obj[t1], type); + } + return true; + } + t = this.settings.types; + obj = this.get_node(obj); + if(!t[type] || !obj) { return false; } + d = this.get_node(obj, true); + if (d && d.length) { + a = d.children('.jstree-anchor'); + } + old_type = obj.type; + old_icon = this.get_icon(obj); + obj.type = type; + if(old_icon === true || !t[old_type] || (t[old_type].icon !== undefined && old_icon === t[old_type].icon)) { + this.set_icon(obj, t[type].icon !== undefined ? t[type].icon : true); + } + + // remove old type props + if(t[old_type] && t[old_type].li_attr !== undefined && typeof t[old_type].li_attr === 'object') { + for (k in t[old_type].li_attr) { + if (t[old_type].li_attr.hasOwnProperty(k)) { + if (k === 'id') { + continue; + } + else if (k === 'class') { + m[obj.id].li_attr['class'] = (m[obj.id].li_attr['class'] || '').replace(t[old_type].li_attr[k], ''); + if (d) { d.removeClass(t[old_type].li_attr[k]); } + } + else if (m[obj.id].li_attr[k] === t[old_type].li_attr[k]) { + m[obj.id].li_attr[k] = null; + if (d) { d.removeAttr(k); } + } + } + } + } + if(t[old_type] && t[old_type].a_attr !== undefined && typeof t[old_type].a_attr === 'object') { + for (k in t[old_type].a_attr) { + if (t[old_type].a_attr.hasOwnProperty(k)) { + if (k === 'id') { + continue; + } + else if (k === 'class') { + m[obj.id].a_attr['class'] = (m[obj.id].a_attr['class'] || '').replace(t[old_type].a_attr[k], ''); + if (a) { a.removeClass(t[old_type].a_attr[k]); } + } + else if (m[obj.id].a_attr[k] === t[old_type].a_attr[k]) { + if (k === 'href') { + m[obj.id].a_attr[k] = '#'; + if (a) { a.attr('href', '#'); } + } + else { + delete m[obj.id].a_attr[k]; + if (a) { a.removeAttr(k); } + } + } + } + } + } + + // add new props + if(t[type].li_attr !== undefined && typeof t[type].li_attr === 'object') { + for (k in t[type].li_attr) { + if (t[type].li_attr.hasOwnProperty(k)) { + if (k === 'id') { + continue; + } + else if (m[obj.id].li_attr[k] === undefined) { + m[obj.id].li_attr[k] = t[type].li_attr[k]; + if (d) { + if (k === 'class') { + d.addClass(t[type].li_attr[k]); + } + else { + d.attr(k, t[type].li_attr[k]); + } + } + } + else if (k === 'class') { + m[obj.id].li_attr['class'] = t[type].li_attr[k] + ' ' + m[obj.id].li_attr['class']; + if (d) { d.addClass(t[type].li_attr[k]); } + } + } + } + } + if(t[type].a_attr !== undefined && typeof t[type].a_attr === 'object') { + for (k in t[type].a_attr) { + if (t[type].a_attr.hasOwnProperty(k)) { + if (k === 'id') { + continue; + } + else if (m[obj.id].a_attr[k] === undefined) { + m[obj.id].a_attr[k] = t[type].a_attr[k]; + if (a) { + if (k === 'class') { + a.addClass(t[type].a_attr[k]); + } + else { + a.attr(k, t[type].a_attr[k]); + } + } + } + else if (k === 'href' && m[obj.id].a_attr[k] === '#') { + m[obj.id].a_attr['href'] = t[type].a_attr['href']; + if (a) { a.attr('href', t[type].a_attr['href']); } + } + else if (k === 'class') { + m[obj.id].a_attr['class'] = t[type].a_attr['class'] + ' ' + m[obj.id].a_attr['class']; + if (a) { a.addClass(t[type].a_attr[k]); } + } + } + } + } + + return true; + }; + }; + // include the types plugin by default + // $.jstree.defaults.plugins.push("types"); + + +/** + * ### Unique plugin + * + * Enforces that no nodes with the same name can coexist as siblings. + */ + + /** + * stores all defaults for the unique plugin + * @name $.jstree.defaults.unique + * @plugin unique + */ + $.jstree.defaults.unique = { + /** + * Indicates if the comparison should be case sensitive. Default is `false`. + * @name $.jstree.defaults.unique.case_sensitive + * @plugin unique + */ + case_sensitive : false, + /** + * Indicates if white space should be trimmed before the comparison. Default is `false`. + * @name $.jstree.defaults.unique.trim_whitespace + * @plugin unique + */ + trim_whitespace : false, + /** + * A callback executed in the instance's scope when a new node is created and the name is already taken, the two arguments are the conflicting name and the counter. The default will produce results like `New node (2)`. + * @name $.jstree.defaults.unique.duplicate + * @plugin unique + */ + duplicate : function (name, counter) { + return name + ' (' + counter + ')'; + } + }; + + $.jstree.plugins.unique = function (options, parent) { + this.check = function (chk, obj, par, pos, more) { + if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; } + obj = obj && obj.id ? obj : this.get_node(obj); + par = par && par.id ? par : this.get_node(par); + if(!par || !par.children) { return true; } + var n = chk === "rename_node" ? pos : obj.text, + c = [], + s = this.settings.unique.case_sensitive, + w = this.settings.unique.trim_whitespace, + m = this._model.data, i, j, t; + for(i = 0, j = par.children.length; i < j; i++) { + t = m[par.children[i]].text; + if (!s) { + t = t.toLowerCase(); + } + if (w) { + t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + } + c.push(t); + } + if(!s) { n = n.toLowerCase(); } + if (w) { n = n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } + switch(chk) { + case "delete_node": + return true; + case "rename_node": + t = obj.text || ''; + if (!s) { + t = t.toLowerCase(); + } + if (w) { + t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + } + i = ($.inArray(n, c) === -1 || (obj.text && t === n)); + if(!i) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_01', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + } + return i; + case "create_node": + i = ($.inArray(n, c) === -1); + if(!i) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_04', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + } + return i; + case "copy_node": + i = ($.inArray(n, c) === -1); + if(!i) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_02', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + } + return i; + case "move_node": + i = ( (obj.parent === par.id && (!more || !more.is_multi)) || $.inArray(n, c) === -1); + if(!i) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_03', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + } + return i; + } + return true; + }; + this.create_node = function (par, node, pos, callback, is_loaded) { + if(!node || node.text === undefined) { + if(par === null) { + par = $.jstree.root; + } + par = this.get_node(par); + if(!par) { + return parent.create_node.call(this, par, node, pos, callback, is_loaded); + } + pos = pos === undefined ? "last" : pos; + if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { + return parent.create_node.call(this, par, node, pos, callback, is_loaded); + } + if(!node) { node = {}; } + var tmp, n, dpc, i, j, m = this._model.data, s = this.settings.unique.case_sensitive, w = this.settings.unique.trim_whitespace, cb = this.settings.unique.duplicate, t; + n = tmp = this.get_string('New node'); + dpc = []; + for(i = 0, j = par.children.length; i < j; i++) { + t = m[par.children[i]].text; + if (!s) { + t = t.toLowerCase(); + } + if (w) { + t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + } + dpc.push(t); + } + i = 1; + t = n; + if (!s) { + t = t.toLowerCase(); + } + if (w) { + t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + } + while($.inArray(t, dpc) !== -1) { + n = cb.call(this, tmp, (++i)).toString(); + t = n; + if (!s) { + t = t.toLowerCase(); + } + if (w) { + t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + } + } + node.text = n; + } + return parent.create_node.call(this, par, node, pos, callback, is_loaded); + }; + }; + + // include the unique plugin by default + // $.jstree.defaults.plugins.push("unique"); + + +/** + * ### Wholerow plugin + * + * Makes each node appear block level. Making selection easier. May cause slow down for large trees in old browsers. + */ + + var div = document.createElement('DIV'); + div.setAttribute('unselectable','on'); + div.setAttribute('role','presentation'); + div.className = 'jstree-wholerow'; + div.innerHTML = ' '; + $.jstree.plugins.wholerow = function (options, parent) { + this.bind = function () { + parent.bind.call(this); + + this.element + .on('ready.jstree set_state.jstree', $.proxy(function () { + this.hide_dots(); + }, this)) + .on("init.jstree loading.jstree ready.jstree", $.proxy(function () { + //div.style.height = this._data.core.li_height + 'px'; + this.get_container_ul().addClass('jstree-wholerow-ul'); + }, this)) + .on("deselect_all.jstree", $.proxy(function (e, data) { + this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked'); + }, this)) + .on("changed.jstree", $.proxy(function (e, data) { + this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked'); + var tmp = false, i, j; + for(i = 0, j = data.selected.length; i < j; i++) { + tmp = this.get_node(data.selected[i], true); + if(tmp && tmp.length) { + tmp.children('.jstree-wholerow').addClass('jstree-wholerow-clicked'); + } + } + }, this)) + .on("open_node.jstree", $.proxy(function (e, data) { + this.get_node(data.node, true).find('.jstree-clicked').parent().children('.jstree-wholerow').addClass('jstree-wholerow-clicked'); + }, this)) + .on("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) { + if(e.type === "hover_node" && this.is_disabled(data.node)) { return; } + this.get_node(data.node, true).children('.jstree-wholerow')[e.type === "hover_node"?"addClass":"removeClass"]('jstree-wholerow-hovered'); + }, this)) + .on("contextmenu.jstree", ".jstree-wholerow", $.proxy(function (e) { + if (this._data.contextmenu) { + e.preventDefault(); + var tmp = $.Event('contextmenu', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey, pageX : e.pageX, pageY : e.pageY }); + $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp); + } + }, this)) + /*! + .on("mousedown.jstree touchstart.jstree", ".jstree-wholerow", function (e) { + if(e.target === e.currentTarget) { + var a = $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor"); + e.target = a[0]; + a.trigger(e); + } + }) + */ + .on("click.jstree", ".jstree-wholerow", function (e) { + e.stopImmediatePropagation(); + var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); + $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); + }) + .on("dblclick.jstree", ".jstree-wholerow", function (e) { + e.stopImmediatePropagation(); + var tmp = $.Event('dblclick', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); + $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); + }) + .on("click.jstree", ".jstree-leaf > .jstree-ocl", $.proxy(function (e) { + e.stopImmediatePropagation(); + var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); + $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); + }, this)) + .on("mouseover.jstree", ".jstree-wholerow, .jstree-icon", $.proxy(function (e) { + e.stopImmediatePropagation(); + if(!this.is_disabled(e.currentTarget)) { + this.hover_node(e.currentTarget); + } + return false; + }, this)) + .on("mouseleave.jstree", ".jstree-node", $.proxy(function (e) { + this.dehover_node(e.currentTarget); + }, this)); + }; + this.teardown = function () { + if(this.settings.wholerow) { + this.element.find(".jstree-wholerow").remove(); + } + parent.teardown.call(this); + }; + this.redraw_node = function(obj, deep, callback, force_render) { + obj = parent.redraw_node.apply(this, arguments); + if(obj) { + var tmp = div.cloneNode(true); + //tmp.style.height = this._data.core.li_height + 'px'; + if($.inArray(obj.id, this._data.core.selected) !== -1) { tmp.className += ' jstree-wholerow-clicked'; } + if(this._data.core.focused && this._data.core.focused === obj.id) { tmp.className += ' jstree-wholerow-hovered'; } + obj.insertBefore(tmp, obj.childNodes[0]); + } + return obj; + }; + }; + // include the wholerow plugin by default + // $.jstree.defaults.plugins.push("wholerow"); + if(window.customElements && Object && Object.create) { + var proto = Object.create(HTMLElement.prototype); + proto.createdCallback = function () { + var c = { core : {}, plugins : [] }, i; + for(i in $.jstree.plugins) { + if($.jstree.plugins.hasOwnProperty(i) && this.attributes[i]) { + c.plugins.push(i); + if(this.getAttribute(i) && JSON.parse(this.getAttribute(i))) { + c[i] = JSON.parse(this.getAttribute(i)); + } + } + } + for(i in $.jstree.defaults.core) { + if($.jstree.defaults.core.hasOwnProperty(i) && this.attributes[i]) { + c.core[i] = JSON.parse(this.getAttribute(i)) || this.getAttribute(i); + } + } + $(this).jstree(c); + }; + // proto.attributeChangedCallback = function (name, previous, value) { }; + try { + window.customElements.define("vakata-jstree", function() {}, { prototype: proto }); + } catch (ignore) { } + } + +})); \ No newline at end of file diff --git a/src/main/webapp/resources/html/fileUpload.html b/src/main/webapp/resources/html/fileUpload.html index 442199ba..f44d73e4 100644 --- a/src/main/webapp/resources/html/fileUpload.html +++ b/src/main/webapp/resources/html/fileUpload.html @@ -162,7 +162,7 @@ - + diff --git a/src/main/webapp/resources/html/inputDateDialog.html b/src/main/webapp/resources/html/inputDateDialog.html index 759816a9..6d372f3a 100644 --- a/src/main/webapp/resources/html/inputDateDialog.html +++ b/src/main/webapp/resources/html/inputDateDialog.html @@ -72,7 +72,7 @@ - + diff --git a/src/main/webapp/resources/html/inputRsnDialog.html b/src/main/webapp/resources/html/inputRsnDialog.html index fb0d4b11..9ae00a85 100644 --- a/src/main/webapp/resources/html/inputRsnDialog.html +++ b/src/main/webapp/resources/html/inputRsnDialog.html @@ -55,7 +55,7 @@ - + diff --git a/src/main/webapp/resources/html/inputTtlDocNoDialog.html b/src/main/webapp/resources/html/inputTtlDocNoDialog.html index 2b17cfa6..2bd85852 100644 --- a/src/main/webapp/resources/html/inputTtlDocNoDialog.html +++ b/src/main/webapp/resources/html/inputTtlDocNoDialog.html @@ -76,7 +76,7 @@ - + diff --git a/src/main/webapp/resources/html/pdf.html b/src/main/webapp/resources/html/pdf.html index dfcf1a1d..4c64fa4c 100644 --- a/src/main/webapp/resources/html/pdf.html +++ b/src/main/webapp/resources/html/pdf.html @@ -40,7 +40,7 @@ - + diff --git a/src/main/webapp/resources/html/searchAddr.html b/src/main/webapp/resources/html/searchAddr.html index 0583b97b..f66d8c8f 100644 --- a/src/main/webapp/resources/html/searchAddr.html +++ b/src/main/webapp/resources/html/searchAddr.html @@ -113,7 +113,7 @@ - +