Lines Matching refs:obj

172 			obj = null;
175 if(!obj || !obj.length) {
176 try { obj = $(needle); } catch (ignore) { }
178 if(!obj || !obj.length) {
179 try { obj = $('#' + needle.replace($.jstree.idregex,'\\$&')); } catch (ignore) { }
181 if(obj && obj.length && (obj = obj.closest('.jstree')).length && (obj = obj.data('jstree'))) {
182 tmp = obj;
941 get_node : function (obj, as_dom) { argument
942 if(obj && obj.id) {
943 obj = obj.id;
947 if(this._model.data[obj]) {
948 obj = this._model.data[obj];
950 else if(typeof obj === "string" && this._model.data[obj.replace(/^#/, '')]) {
951 obj = this._model.data[obj.replace(/^#/, '')];
953 …else if(typeof obj === "string" && (dom = $('#' + obj.replace($.jstree.idregex,'\\$&'), this.eleme…
954 obj = this._model.data[dom.closest('.jstree-node').attr('id')];
956 …else if((dom = $(obj, this.element)).length && this._model.data[dom.closest('.jstree-node').attr('…
957 obj = this._model.data[dom.closest('.jstree-node').attr('id')];
959 else if((dom = $(obj, this.element)).length && dom.hasClass('jstree')) {
960 obj = this._model.data['#'];
967obj = obj.id === '#' ? this.element : $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.elemen…
969 return obj;
980 get_path : function (obj, glue, ids) { argument
981 obj = obj.parents ? obj : this.get_node(obj);
982 if(!obj || obj.id === '#' || !obj.parents) {
986 p.push(ids ? obj.id : obj.text);
987 for(i = 0, j = obj.parents.length; i < j; i++) {
988 p.push(ids ? obj.parents[i] : this.get_text(obj.parents[i]));
1000 get_next_dom : function (obj, strict) { argument
1002 obj = this.get_node(obj, true);
1003 if(obj[0] === this.element[0]) {
1010 if(!obj || !obj.length) {
1014 tmp = obj[0];
1020 if(obj.hasClass("jstree-open")) {
1021 tmp = this._firstChild(obj.children('.jstree-children')[0]);
1029 tmp = obj[0];
1036 return obj.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first();
1045 get_prev_dom : function (obj, strict) { argument
1047 obj = this.get_node(obj, true);
1048 if(obj[0] === this.element[0]) {
1055 if(!obj || !obj.length) {
1059 tmp = obj[0];
1065 tmp = obj[0];
1070 obj = $(tmp);
1071 while(obj.hasClass("jstree-open")) {
1072 obj = obj.children(".jstree-children").first().children(".jstree-node:visible:last");
1074 return obj;
1076 tmp = obj[0].parentNode.parentNode;
1085 get_parent : function (obj) { argument
1086 obj = this.get_node(obj);
1087 if(!obj || obj.id === '#') {
1090 return obj.parent;
1098 get_children_dom : function (obj) { argument
1099 obj = this.get_node(obj, true);
1100 if(obj[0] === this.element[0]) {
1103 if(!obj || !obj.length) {
1106 return obj.children(".jstree-children").children(".jstree-node");
1114 is_parent : function (obj) { argument
1115 obj = this.get_node(obj);
1116 return obj && (obj.state.loaded === false || obj.children.length > 0);
1124 is_loaded : function (obj) { argument
1125 obj = this.get_node(obj);
1126 return obj && obj.state.loaded;
1134 is_loading : function (obj) { argument
1135 obj = this.get_node(obj);
1136 return obj && obj.state && obj.state.loading;
1144 is_open : function (obj) { argument
1145 obj = this.get_node(obj);
1146 return obj && obj.state.opened;
1154 is_closed : function (obj) { argument
1155 obj = this.get_node(obj);
1156 return obj && this.is_parent(obj) && !obj.state.opened;
1164 is_leaf : function (obj) { argument
1165 return !this.is_parent(obj);
1175 load_node : function (obj, callback) { argument
1177 if($.isArray(obj)) {
1178 this._load_nodes(obj.slice(), callback);
1181 obj = this.get_node(obj);
1182 if(!obj) {
1183 if(callback) { callback.call(this, obj, false); }
1187 if(obj.state.loaded) {
1188 obj.state.loaded = false;
1189 for(k = 0, l = obj.children_d.length; k < l; k++) {
1190 for(i = 0, j = obj.parents.length; i < j; i++) {
1191 …this._model.data[obj.parents[i]].children_d = $.vakata.array_remove_item(this._model.data[obj.pare…
1193 if(this._model.data[obj.children_d[k]].state.selected) {
1195 …this._data.core.selected = $.vakata.array_remove_item(this._data.core.selected, obj.children_d[k]);
1197 delete this._model.data[obj.children_d[k]];
1199 obj.children = [];
1200 obj.children_d = [];
1202 …this.trigger('changed', { 'action' : 'load_node', 'node' : obj, 'selected' : this._data.core.selec…
1205 obj.state.failed = false;
1206 obj.state.loading = true;
1207 this.get_node(obj, true).addClass("jstree-loading").attr('aria-busy',true);
1208 this._load_node(obj, $.proxy(function (status) {
1209 obj = this._model.data[obj.id];
1210 obj.state.loading = false;
1211 obj.state.loaded = status;
1212 obj.state.failed = !obj.state.loaded;
1213 var dom = this.get_node(obj, true);
1214 …if(obj.state.loaded && !obj.children.length && dom && dom.length && !dom.hasClass('jstree-leaf')) {
1225 this.trigger('load_node', { "node" : obj, "status" : status });
1227 callback.call(this, obj, status);
1270 load_all : function (obj, callback) { argument
1271 if(!obj) { obj = '#'; }
1272 obj = this.get_node(obj);
1273 if(!obj) { return false; }
1276 c = m[obj.id].children_d,
1278 if(obj.state && !obj.state.loaded) {
1279 to_load.push(obj.id);
1288 this.load_all(obj, callback);
1298 if(callback) { callback.call(this, obj); }
1299 this.trigger('load_all', { "node" : obj });
1310 _load_node : function (obj, callback) { argument
1314 if(obj.id === '#') {
1315 …return this._append_html_data(obj, this._data.core.original_container_html.clone(true), function (…
1325 return s.call(this, obj, $.proxy(function (d) {
1329 …this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string'…
1339 s.url = s.url.call(this, obj);
1342 s.data = s.data.call(this, obj);
1348 return this._append_json_data(obj, d, function (status) { callback.call(this, status); });
1352 …return this._append_html_data(obj, $($.parseHTML(d)).filter(function () { return this.nodeType !==…
1355 …ore_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : x }) };
1361 …ore_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : f }) };
1366 if(obj.id === '#') {
1367 return this._append_json_data(obj, t, function (status) {
1372 …, 'id' : 'core_05', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) };
1379 if(obj.id === '#') {
1380 …return this._append_html_data(obj, $($.parseHTML(s)).filter(function () { return this.nodeType !==…
1385 …, 'id' : 'core_06', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) };
1399 _node_changed : function (obj) { argument
1400 obj = this.get_node(obj);
1401 if(obj) {
1402 this._model.changed.push(obj.id);
2239 var obj = this.get_node(node),
2244 if(!obj) { return false; }
2245 if(obj.id === '#') { return this.redraw(true); }
2251 if(obj.children.length && obj.state.loaded) {
2255 for(i = 0, j = obj.children.length; i < j; i++) {
2256 k.appendChild(this.redraw_node(obj.children[i], true, true));
2271 var obj = this.get_node(node),
2286 if(!obj) { return false; }
2287 if(obj.id === '#') { return this.redraw(true); }
2288 deep = deep || obj.children.length === 0;
2289obj.id) : this.element[0].querySelector('#' + ("0123456789".indexOf(obj.id[0]) !== -1 ? '\\3' + ob…
2294 …par = obj.parent !== '#' ? $('#' + obj.parent.replace($.jstree.idregex,'\\$&'), this.element)[0] :…
2295 if(par !== null && (!par || !m[obj.parent].state.opened)) {
2298 ind = $.inArray(obj.id, par === null ? m['#'].children : m[obj.parent].children);
2311 if(!deep && obj.children.length && !node.children('.jstree-children').length) {
2326 for(i in obj.li_attr) {
2327 if(obj.li_attr.hasOwnProperty(i)) {
2330 node.setAttribute(i, obj.li_attr[i]);
2333 c += obj.li_attr[i];
2337 if(!obj.a_attr.id) {
2338 obj.a_attr.id = obj.id + '_anchor';
2340 node.setAttribute('aria-selected', !!obj.state.selected);
2341 node.setAttribute('aria-level', obj.parents.length);
2342 node.setAttribute('aria-labelledby', obj.a_attr.id);
2343 if(obj.state.disabled) {
2347 if(obj.state.loaded && !obj.children.length) {
2351 c += obj.state.opened && obj.state.loaded ? ' jstree-open' : ' jstree-closed';
2352 node.setAttribute('aria-expanded', (obj.state.opened && obj.state.loaded) );
2354 if(obj.parent !== null && m[obj.parent].children[m[obj.parent].children.length - 1] === obj.id) {
2357 node.id = obj.id;
2359 …c = ( obj.state.selected ? ' jstree-clicked' : '') + ( obj.state.disabled ? ' jstree-disabled' : '…
2360 for(j in obj.a_attr) {
2361 if(obj.a_attr.hasOwnProperty(j)) {
2362 if(j === 'href' && obj.a_attr[j] === '#') { continue; }
2364 node.childNodes[1].setAttribute(j, obj.a_attr[j]);
2367 c += ' ' + obj.a_attr[j];
2374 if((obj.icon && obj.icon !== true) || obj.icon === false) {
2375 if(obj.icon === false) {
2378 else if(obj.icon.indexOf('/') === -1 && obj.icon.indexOf('.') === -1) {
2379 node.childNodes[1].childNodes[0].className += ' ' + obj.icon + ' jstree-themeicon-custom';
2382 node.childNodes[1].childNodes[0].style.backgroundImage = 'url('+obj.icon+')';
2390 node.childNodes[1].appendChild(d.createTextNode(obj.text));
2393 node.childNodes[1].innerHTML += obj.text;
2397 if(deep && obj.children.length && (obj.state.opened || force_render) && obj.state.loaded) {
2401 for(i = 0, j = obj.children.length; i < j; i++) {
2402 k.appendChild(this.redraw_node(obj.children[i], deep, true));
2442 if(obj.state.opened && !obj.state.loaded) {
2443 obj.state.opened = false;
2445 this.open_node(obj.id, false, 0);
2458 open_node : function (obj, callback, animation) { argument
2460 if($.isArray(obj)) {
2461 obj = obj.slice();
2462 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2463 this.open_node(obj[t1], callback, animation);
2467 obj = this.get_node(obj);
2468 if(!obj || obj.id === '#') {
2472 if(!this.is_closed(obj)) {
2474 callback.call(this, obj, false);
2478 if(!this.is_loaded(obj)) {
2479 if(this.is_loading(obj)) {
2481 this.open_node(obj, callback, animation);
2484 this.load_node(obj, function (o, ok) {
2489 d = this.get_node(obj, true);
2495 if(obj.children.length && !this._firstChild(d.children('.jstree-children')[0])) {
2496 this.draw_children(obj);
2500 this.trigger('before_open', { "node" : obj });
2505 this.trigger('before_open', { "node" : obj });
2512 t.trigger("after_open", { "node" : obj });
2516 obj.state.opened = true;
2518 callback.call(this, obj, true);
2527 this.trigger('before_open', { "node" : obj });
2535 this.trigger('open_node', { "node" : obj });
2543 this.trigger("after_open", { "node" : obj });
2553 _open_to : function (obj) { argument
2554 obj = this.get_node(obj);
2555 if(!obj || obj.id === '#') {
2558 var i, j, p = obj.parents;
2564 return $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element);
2573 close_node : function (obj, animation) { argument
2575 if($.isArray(obj)) {
2576 obj = obj.slice();
2577 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2578 this.close_node(obj[t1], animation);
2582 obj = this.get_node(obj);
2583 if(!obj || obj.id === '#') {
2586 if(this.is_closed(obj)) {
2591 d = this.get_node(obj, true);
2604 t.trigger("after_close", { "node" : obj });
2608 obj.state.opened = false;
2615 this.trigger('close_node',{ "node" : obj });
2623 this.trigger("after_close", { "node" : obj });
2631 toggle_node : function (obj) { argument
2633 if($.isArray(obj)) {
2634 obj = obj.slice();
2635 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2636 this.toggle_node(obj[t1]);
2640 if(this.is_closed(obj)) {
2641 return this.open_node(obj);
2643 if(this.is_open(obj)) {
2644 return this.close_node(obj);
2655 open_all : function (obj, animation, original_obj) { argument
2656 if(!obj) { obj = '#'; }
2657 obj = this.get_node(obj);
2658 if(!obj) { return false; }
2659 var dom = obj.id === '#' ? this.get_container_ul() : this.get_node(obj, true), i, j, _this;
2661 for(i = 0, j = obj.children_d.length; i < j; i++) {
2662 if(this.is_closed(this._model.data[obj.children_d[i]])) {
2663 this._model.data[obj.children_d[i]].state.opened = true;
2666 return this.trigger('open_all', { "node" : obj });
2670 dom = this.is_closed(obj) ? dom.find('.jstree-closed').addBack() : dom.find('.jstree-closed');
2695 close_all : function (obj, animation) { argument
2696 if(!obj) { obj = '#'; }
2697 obj = this.get_node(obj);
2698 if(!obj) { return false; }
2699 var dom = obj.id === '#' ? this.get_container_ul() : this.get_node(obj, true),
2702 for(i = 0, j = obj.children_d.length; i < j; i++) {
2703 this._model.data[obj.children_d[i]].state.opened = false;
2705 return this.trigger('close_all', { "node" : obj });
2707 dom = this.is_open(obj) ? dom.find('.jstree-open').addBack() : dom.find('.jstree-open');
2715 this.trigger('close_all', { "node" : obj });
2723 is_disabled : function (obj) { argument
2724 obj = this.get_node(obj);
2725 return obj && obj.state && obj.state.disabled;
2733 enable_node : function (obj) { argument
2735 if($.isArray(obj)) {
2736 obj = obj.slice();
2737 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2738 this.enable_node(obj[t1]);
2742 obj = this.get_node(obj);
2743 if(!obj || obj.id === '#') {
2746 obj.state.disabled = false;
2747 …this.get_node(obj,true).children('.jstree-anchor').removeClass('jstree-disabled').attr('aria-disab…
2754 this.trigger('enable_node', { 'node' : obj });
2762 disable_node : function (obj) { argument
2764 if($.isArray(obj)) {
2765 obj = obj.slice();
2766 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2767 this.disable_node(obj[t1]);
2771 obj = this.get_node(obj);
2772 if(!obj || obj.id === '#') {
2775 obj.state.disabled = true;
2776 …this.get_node(obj,true).children('.jstree-anchor').addClass('jstree-disabled').attr('aria-disabled…
2783 this.trigger('disable_node', { 'node' : obj });
2793 activate_node : function (obj, e) { argument
2794 if(this.is_disabled(obj)) {
2803 …shiftKey && (!this._data.core.last_clicked || !this.get_parent(obj) || this.get_parent(obj) !== th…
2804 …(!this.settings.core.multiple && (e.metaKey || e.ctrlKey || e.shiftKey) && this.is_selected(obj)) {
2805 this.deselect_node(obj, false, e);
2809 this.select_node(obj, false, false, e);
2810 this._data.core.last_clicked = this.get_node(obj);
2815 var o = this.get_node(obj).id,
2835 …this.trigger('changed', { 'action' : 'select_node', 'node' : this.get_node(obj), 'selected' : this…
2838 if(!this.is_selected(obj)) {
2839 this.select_node(obj, false, false, e);
2842 this.deselect_node(obj, false, e);
2852 this.trigger('activate_node', { 'node' : this.get_node(obj) });
2861 hover_node : function (obj) { argument
2862 obj = this.get_node(obj, true);
2863 if(!obj || !obj.length || obj.children('.jstree-hovered').length) {
2869 obj.children('.jstree-anchor').addClass('jstree-hovered');
2876 this.trigger('hover_node', { 'node' : this.get_node(obj) });
2877 setTimeout(function () { t.attr('aria-activedescendant', obj[0].id); }, 0);
2886 dehover_node : function (obj) { argument
2887 obj = this.get_node(obj, true);
2888 if(!obj || !obj.length || !obj.children('.jstree-hovered').length) {
2891 obj.children('.jstree-anchor').removeClass('jstree-hovered');
2898 this.trigger('dehover_node', { 'node' : this.get_node(obj) });
2908 select_node : function (obj, supress_event, prevent_open, e) { argument
2910 if($.isArray(obj)) {
2911 obj = obj.slice();
2912 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2913 this.select_node(obj[t1], supress_event, prevent_open, e);
2917 obj = this.get_node(obj);
2918 if(!obj || obj.id === '#') {
2921 dom = this.get_node(obj, true);
2922 if(!obj.state.selected) {
2923 obj.state.selected = true;
2924 this._data.core.selected.push(obj.id);
2926 dom = this._open_to(obj);
2939 … this.trigger('select_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e });
2950 …this.trigger('changed', { 'action' : 'select_node', 'node' : obj, 'selected' : this._data.core.sel…
2961 deselect_node : function (obj, supress_event, e) { argument
2963 if($.isArray(obj)) {
2964 obj = obj.slice();
2965 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2966 this.deselect_node(obj[t1], supress_event, e);
2970 obj = this.get_node(obj);
2971 if(!obj || obj.id === '#') {
2974 dom = this.get_node(obj, true);
2975 if(obj.state.selected) {
2976 obj.state.selected = false;
2977 this._data.core.selected = $.vakata.array_remove_item(this._data.core.selected, obj.id);
2989 …this.trigger('deselect_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }…
2991 …this.trigger('changed', { 'action' : 'deselect_node', 'node' : obj, 'selected' : this._data.core.s…
3054 is_selected : function (obj) { argument
3055 obj = this.get_node(obj);
3056 if(!obj || obj.id === '#') {
3059 return obj.state.selected;
3078 obj = {}, i, j, k, l;
3080 obj[tmp[i].id] = tmp[i];
3084 if(obj[tmp[i].children_d[k]]) {
3085 delete obj[tmp[i].children_d[k]];
3090 for(i in obj) {
3091 if(obj.hasOwnProperty(i)) {
3105 obj = [], i, j;
3108 obj.push(tmp[i].id);
3111 return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj;
3274 refresh_node : function (obj) { argument
3275 obj = this.get_node(obj);
3276 if(!obj || obj.id === '#') { return false; }
3278 to_load.push(obj.id);
3279 if(obj.state.opened === true) { opened.push(obj.id); }
3280 this.get_node(obj, true).find('.jstree-open').each(function() { opened.push(this.id); });
3291 this.trigger('refresh_node', { 'node' : obj, 'nodes' : nodes });
3301 set_id : function (obj, id) { argument
3302 obj = this.get_node(obj);
3303 if(!obj || obj.id === '#') { return false; }
3307 m[obj.parent].children[$.inArray(obj.id, m[obj.parent].children)] = id;
3308 for(i = 0, j = obj.parents.length; i < j; i++) {
3309 m[obj.parents[i]].children_d[$.inArray(obj.id, m[obj.parents[i]].children_d)] = id;
3312 for(i = 0, j = obj.children.length; i < j; i++) {
3313 m[obj.children[i]].parent = id;
3315 for(i = 0, j = obj.children_d.length; i < j; i++) {
3316 m[obj.children_d[i]].parents[$.inArray(obj.id, m[obj.children_d[i]].parents)] = id;
3318 i = $.inArray(obj.id, this._data.core.selected);
3321 i = this.get_node(obj.id, true);
3324 if(this.element.attr('aria-activedescendant') === obj.id) {
3328 delete m[obj.id];
3329 obj.id = id;
3330 obj.li_attr.id = id;
3331 m[id] = obj;
3340 get_text : function (obj) { argument
3341 obj = this.get_node(obj);
3342 return (!obj || obj.id === '#') ? false : obj.text;
3353 set_text : function (obj, val) { argument
3355 if($.isArray(obj)) {
3356 obj = obj.slice();
3357 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3358 this.set_text(obj[t1], val);
3362 obj = this.get_node(obj);
3363 if(!obj || obj.id === '#') { return false; }
3364 obj.text = val;
3365 if(this.get_node(obj, true).length) {
3366 this.redraw_node(obj.id);
3375 this.trigger('set_text',{ "obj" : obj, "text" : val });
3390 get_json : function (obj, options, flat) { argument
3391 obj = this.get_node(obj || '#');
3392 if(!obj) { return false; }
3395 'id' : obj.id,
3396 'text' : obj.text,
3397 'icon' : this.get_icon(obj),
3398 'li_attr' : $.extend(true, {}, obj.li_attr),
3399 'a_attr' : $.extend(true, {}, obj.a_attr),
3401 'data' : options && options.no_data ? false : $.extend(true, {}, obj.data)
3405 tmp.parent = obj.parent;
3411 for(i in obj.state) {
3412 if(obj.state.hasOwnProperty(i)) {
3413 tmp.state[i] = obj.state[i];
3426 if(options && options.flat && obj.id !== '#') {
3430 for(i = 0, j = obj.children.length; i < j; i++) {
3432 this.get_json(obj.children[i], options, flat);
3435 tmp.children.push(this.get_json(obj.children[i], options));
3439 return options && options.flat ? flat : (obj.id === '#' ? tmp.children : tmp);
3539 rename_node : function (obj, val) { argument
3541 if($.isArray(obj)) {
3542 obj = obj.slice();
3543 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3544 this.rename_node(obj[t1], val);
3548 obj = this.get_node(obj);
3549 if(!obj || obj.id === '#') { return false; }
3550 old = obj.text;
3551 if(!this.check("rename_node", obj, this.get_parent(obj), val)) {
3555 this.set_text(obj, val); // .apply(this, Array.prototype.slice.call(arguments))
3564 this.trigger('rename_node', { "node" : obj, "text" : val, "old" : old });
3574 delete_node : function (obj) { argument
3576 if($.isArray(obj)) {
3577 obj = obj.slice();
3578 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3579 this.delete_node(obj[t1]);
3583 obj = this.get_node(obj);
3584 if(!obj || obj.id === '#') { return false; }
3585 par = this.get_node(obj.parent);
3586 pos = $.inArray(obj.id, par.children);
3588 if(!this.check("delete_node", obj, par, pos)) {
3595 tmp = obj.children_d.concat([]);
3596 tmp.push(obj.id);
3598 for(i = 0, j = obj.parents.length; i < j; i++) {
3599 pos = $.inArray(tmp[k], this._model.data[obj.parents[i]].children_d);
3601 …this._model.data[obj.parents[i]].children_d = $.vakata.array_remove(this._model.data[obj.parents[i…
3619 this.trigger('delete_node', { "node" : obj, "parent" : par.id });
3621 …this.trigger('changed', { 'action' : 'delete_node', 'node' : obj, 'selected' : this._data.core.sel…
3640 check : function (chk, obj, par, pos, more) { argument
3641 obj = obj && obj.id ? obj : this.get_node(obj);
3643 var tmp = chk.match(/^move_node|copy_node|create_node$/i) ? par : obj,
3646 …if((!more || !more.is_multi) && (obj.id === par.id || $.inArray(obj.id, par.children) === pos || $…
3647 …hild', 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false,…
3654 …+ chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false,…
3658 …if(chc === false || ($.isFunction(chc) && chc.call(this, chk, obj, par, pos, more) === false) || (…
3659 …+ chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false,…
3684 move_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { argument
3691 …return this.load_node(par, function () { this.move_node(obj, par, pos, callback, true, false, orig…
3694 if($.isArray(obj)) {
3695 if(obj.length === 1) {
3696 obj = obj[0];
3700 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3701 if((tmp = this.move_node(obj[t1], par, pos, callback, is_loaded, false, origin))) {
3710 obj = obj && obj.id ? obj : this.get_node(obj);
3712 if(!obj || obj.id === '#') { return false; }
3714 old_par = (obj.parent || '#').toString();
3716 old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id));
3718 …._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.…
3720 obj = old_ins._model.data[obj.id];
3724 if((tmp = this.copy_node(obj, par, pos, callback, is_loaded, false, origin))) {
3725 if(old_ins) { old_ins.delete_node(obj); }
3754 …if(!this.check("move_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (o…
3758 if(obj.parent === new_par.id) {
3760 tmp = $.inArray(obj.id, dpc);
3769 tmp[pos] = obj.id;
3776 tmp = obj.children_d.concat();
3777 tmp.push(obj.id);
3778 for(i = 0, j = obj.parents.length; i < j; i++) {
3780 p = old_ins._model.data[obj.parents[i]].children_d;
3786 old_ins._model.data[obj.parents[i]].children_d = dpc;
3788 …data[old_par].children = $.vakata.array_remove_item(old_ins._model.data[old_par].children, obj.id);
3798 dpc[pos] = obj.id;
3800 new_par.children_d.push(obj.id);
3801 new_par.children_d = new_par.children_d.concat(obj.children_d);
3804 obj.parent = new_par.id;
3807 p = obj.parents.length;
3808 obj.parents = tmp;
3812 for(i = 0, j = obj.children_d.length; i < j; i++) {
3813 …this._model.data[obj.children_d[i]].parents = this._model.data[obj.children_d[i]].parents.slice(0,…
3814 Array.prototype.push.apply(this._model.data[obj.children_d[i]].parents, tmp);
3828 if(callback) { callback.call(this, obj, new_par, pos); }
3842 …this.trigger('move_node', { "node" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : …
3843 return obj.id;
3857 copy_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { argument
3864 …return this.load_node(par, function () { this.copy_node(obj, par, pos, callback, true, false, orig…
3867 if($.isArray(obj)) {
3868 if(obj.length === 1) {
3869 obj = obj[0];
3873 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3874 if((tmp = this.copy_node(obj[t1], par, pos, callback, is_loaded, true, origin))) {
3883 obj = obj && obj.id ? obj : this.get_node(obj);
3884 if(!obj || obj.id === '#') { return false; }
3886 old_par = (obj.parent || '#').toString();
3888 old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id));
3892 obj = old_ins._model.data[obj.id];
3918 …if(!this.check("copy_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (o…
3922 node = old_ins ? old_ins.get_json(obj, { no_id : true, no_data : true, no_state : true }) : obj;
3928 if(obj && obj.state && obj.state.loaded === false) { tmp.state.loaded = false; }
3971obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_ins && …
3980 cut : function (obj) { argument
3981 if(!obj) { obj = this._data.core.selected.concat(); }
3982 if(!$.isArray(obj)) { obj = [obj]; }
3983 if(!obj.length) { return false; }
3985 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3986 o = this.get_node(obj[t1]);
3999 this.trigger('cut', { "node" : obj });
4007 copy : function (obj) { argument
4008 if(!obj) { obj = this._data.core.selected.concat(); }
4009 if(!$.isArray(obj)) { obj = [obj]; }
4010 if(!obj.length) { return false; }
4012 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4013 o = this.get_node(obj[t1]);
4026 this.trigger('copy', { "node" : obj });
4051 paste : function (obj, pos) { argument
4052 obj = this.get_node(obj);
4053 … if(!obj || !ccp_mode || !ccp_mode.match(/^(copy_node|move_node)$/) || !ccp_node) { return false; }
4054 if(this[ccp_mode](ccp_node, obj, pos, false, false, false, ccp_inst)) {
4063 this.trigger('paste', { "parent" : obj.id, "node" : ccp_node, "mode" : ccp_mode });
4091 edit : function (obj, default_text) { argument
4093 obj = this.get_node(obj);
4094 if(!obj) { return false; }
4100 tmp = obj;
4101 default_text = typeof default_text === 'string' ? default_text : obj.text;
4102 this.set_text(obj, "");
4103 obj = this._open_to(obj);
4108 a = obj.children('.jstree-anchor');
4138 this.set_text(obj, t);
4139 …if(this.rename_node(obj, $('<div></div>').text(v)[this.settings.core.force_text ? 'text' : 'html']…
4140 this.set_text(obj, t); // move this up? and fix #483
4291 set_icon : function (obj, icon) { argument
4293 if($.isArray(obj)) {
4294 obj = obj.slice();
4295 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4296 this.set_icon(obj[t1], icon);
4300 obj = this.get_node(obj);
4301 if(!obj || obj.id === '#') { return false; }
4302 old = obj.icon;
4303 obj.icon = icon === true || icon === null || icon === undefined || icon === '' ? true : icon;
4304 dom = this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon");
4306 this.hide_icon(obj);
4310 if(old === false) { this.show_icon(obj); }
4315 if(old === false) { this.show_icon(obj); }
4320 if(old === false) { this.show_icon(obj); }
4330 get_icon : function (obj) { argument
4331 obj = this.get_node(obj);
4332 return (!obj || obj.id === '#') ? false : obj.icon;
4339 hide_icon : function (obj) { argument
4341 if($.isArray(obj)) {
4342 obj = obj.slice();
4343 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4344 this.hide_icon(obj[t1]);
4348 obj = this.get_node(obj);
4349 if(!obj || obj === '#') { return false; }
4350 obj.icon = false;
4351 …this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon").addClass('jstree…
4359 show_icon : function (obj) { argument
4361 if($.isArray(obj)) {
4362 obj = obj.slice();
4363 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4364 this.show_icon(obj[t1]);
4368 obj = this.get_node(obj);
4369 if(!obj || obj === '#') { return false; }
4370 dom = this.get_node(obj, true);
4371obj.icon = dom.length ? dom.children(".jstree-anchor").children(".jstree-themeicon").attr('rel') :…
4372 if(!obj.icon) { obj.icon = true; }
4581 var obj = data.node,
4583 par = this.get_node(obj.parent),
4584 dom = this.get_node(obj, true),
4589 …ted = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected.concat(obj.children_d));
4590 for(i = 0, j = obj.children_d.length; i < j; i++) {
4591 tmp = m[obj.children_d[i]];
4627 var obj = this.get_node('#'),
4630 for(i = 0, j = obj.children_d.length; i < j; i++) {
4631 tmp = m[obj.children_d[i]];
4638 var obj = data.node,
4639 dom = this.get_node(obj, true),
4641 if(obj && obj.original && obj.original.state && obj.original.state.undetermined) {
4642 obj.original.state.undetermined = false;
4647 for(i = 0, j = obj.children_d.length; i < j; i++) {
4648 tmp = this._model.data[obj.children_d[i]];
4658 for(i = 0, j = obj.parents.length; i < j; i++) {
4659 tmp = this._model.data[obj.parents[i]];
4664 tmp = this.get_node(obj.parents[i], true);
4674 …n') === -1 || $.inArray(this._data[ t ? 'core' : 'checkbox' ].selected[i], obj.children_d) === -1)…
4675 …f('up') === -1 || $.inArray(this._data[ t ? 'core' : 'checkbox' ].selected[i], obj.parents) === -1)
4841 this.redraw_node = function(obj, deep, is_callback, force_render) { argument
4842 obj = parent.redraw_node.apply(this, arguments);
4843 if(obj) {
4845 for(i = 0, j = obj.childNodes.length; i < j; i++) {
4846 …if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree…
4847 tmp = obj.childNodes[i];
4852 …if(!this.settings.checkbox.tie_selection && this._model.data[obj.id].state.checked) { tmp.classNam…
4860 return obj;
4886 this.is_undetermined = function (obj) { argument
4887 obj = this.get_node(obj);
4889 …if(!obj || obj.state[ t ? 'selected' : 'checked' ] === true || s.indexOf('undetermined') === -1 ||…
4892 if(!obj.state.loaded && obj.original.state.undetermined === true) {
4895 for(i = 0, j = obj.children_d.length; i < j; i++) {
4896 …if($.inArray(obj.children_d[i], d) !== -1 || (!m[obj.children_d[i]].state.loaded && m[obj.children…
4903 this.activate_node = function (obj, e) { argument
4908 return parent.activate_node.call(this, obj, e);
4910 if(this.is_disabled(obj)) {
4913 if(this.is_checked(obj)) {
4914 this.uncheck_node(obj, e);
4917 this.check_node(obj, e);
4919 this.trigger('activate_node', { 'node' : this.get_node(obj) });
4929 this.check_node = function (obj, e) { argument
4930 if(this.settings.checkbox.tie_selection) { return this.select_node(obj, false, true, e); }
4932 if($.isArray(obj)) {
4933 obj = obj.slice();
4934 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4935 this.check_node(obj[t1], e);
4939 obj = this.get_node(obj);
4940 if(!obj || obj.id === '#') {
4943 dom = this.get_node(obj, true);
4944 if(!obj.state.checked) {
4945 obj.state.checked = true;
4946 this._data.checkbox.selected.push(obj.id);
4959 …this.trigger('check_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e …
4969 this.uncheck_node = function (obj, e) { argument
4970 if(this.settings.checkbox.tie_selection) { return this.deselect_node(obj, false, e); }
4972 if($.isArray(obj)) {
4973 obj = obj.slice();
4974 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4975 this.uncheck_node(obj[t1], e);
4979 obj = this.get_node(obj);
4980 if(!obj || obj.id === '#') {
4983 dom = this.get_node(obj, true);
4984 if(obj.state.checked) {
4985 obj.state.checked = false;
4986 this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, obj.id);
4999 …this.trigger('uncheck_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : …
5060 this.is_checked = function (obj) { argument
5061 if(this.settings.checkbox.tie_selection) { return this.is_selected(obj); }
5062 obj = this.get_node(obj);
5063 if(!obj || obj.id === '#') { return false; }
5064 return obj.state.checked;
5087 obj = {}, i, j, k, l;
5089 obj[tmp[i].id] = tmp[i];
5093 if(obj[tmp[i].children_d[k]]) {
5094 delete obj[tmp[i].children_d[k]];
5099 for(i in obj) {
5100 if(obj.hasOwnProperty(i)) {
5116 obj = [], i, j;
5119 obj.push(tmp[i].id);
5122 return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj;
5124 this.load_node = function (obj, callback) { argument
5126 if(!$.isArray(obj) && !this.settings.checkbox.tie_selection) {
5127 tmp = this.get_node(obj);
5216 obj = inst.get_node(data.reference);
5217 inst.create_node(obj, {}, "last", function (new_node) {
5234 obj = inst.get_node(data.reference);
5235 inst.edit(obj);
5246 obj = inst.get_node(data.reference);
5247 if(inst.is_selected(obj)) {
5251 inst.delete_node(obj);
5268 obj = inst.get_node(data.reference);
5269 if(inst.is_selected(obj)) {
5273 inst.cut(obj);
5284 obj = inst.get_node(data.reference);
5285 if(inst.is_selected(obj)) {
5289 inst.copy(obj);
5303 obj = inst.get_node(data.reference);
5304 inst.paste(obj);
5399 this.show_contextmenu = function (obj, x, y, e) { argument
5400 obj = this.get_node(obj);
5401 if(!obj || obj.id === '#') { return false; }
5403 d = this.get_node(obj, true),
5412 if(this.settings.contextmenu.select_node && !this.is_selected(obj)) {
5413 this.activate_node(obj, e);
5418 i = i.call(this, obj, $.proxy(function (i) {
5419 this._show_contextmenu(obj, x, y, i);
5423 this._show_contextmenu(obj, x, y, i);
5437 this._show_contextmenu = function (obj, x, y, i) { argument
5438 var d = this.get_node(obj, true),
5455 this.trigger('show_contextmenu', { "node" : obj, "x" : x, "y" : y });
5867 var obj = this.get_node(e.target),
5868 …mlt = this.is_selected(obj) && this.settings.dnd.drag_selection ? this.get_top_selected().length :…
5873 if(obj && obj.id && obj.id !== "#" && (e.which === 1 || e.type === "touchstart") &&
5874 …le) && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_top_selected(true) : [obj]))))
5877 … true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_top_selected…
6383 this._load_node = function (obj, callback) { argument
6384 var d = this._data.massload[obj.id];
6386 …return this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === '…
6388 delete this._data.massload[obj.id];
6391 return parent._load_node.call(this, obj, callback);
6821 this.sort = function (obj, deep) { argument
6823 obj = this.get_node(obj);
6824 if(obj && obj.children && obj.children.length) {
6825 obj.children.sort($.proxy(this.settings.sort, this));
6827 for(i = 0, j = obj.children_d.length; i < j; i++) {
6828 this.sort(obj.children_d[i], false);
7019 this.get_json = function (obj, options, flat) { argument
7023 tmp = parent.get_json.call(this, obj, opt, flat);
7066 this.check = function (chk, obj, par, pos, more) { argument
7067 if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; }
7068 obj = obj && obj.id ? obj : this.get_node(obj);
7070 …var m = obj && obj.id ? (more && more.origin ? more.origin : $.jstree.reference(obj.id)) : null, t…
7076 if(chk !== 'move_node' || $.inArray(obj.id, par.children) === -1) {
7079 …+ chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false,…
7082 …if(tmp.valid_children !== undefined && tmp.valid_children !== -1 && $.inArray((obj.type || 'defaul…
7083 …+ chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false,…
7086 if(m && obj.children_d && obj.parents) {
7088 for(i = 0, j = obj.children_d.length; i < j; i++) {
7089 d = Math.max(d, m[obj.children_d[i]].parents.length);
7091 d = d - obj.parents.length + 1;
7096 …+ chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false,…
7115 this.get_rules = function (obj) { argument
7116 obj = this.get_node(obj);
7117 if(!obj) { return false; }
7118 var tmp = this.get_type(obj, true);
7132 this.get_type = function (obj, rules) { argument
7133 obj = this.get_node(obj);
7134 …return (!obj) ? false : ( rules ? $.extend({ 'type' : obj.type }, this.settings.types[obj.type]) :…
7143 this.set_type = function (obj, type) { argument
7145 if($.isArray(obj)) {
7146 obj = obj.slice();
7147 for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
7148 this.set_type(obj[t1], type);
7153 obj = this.get_node(obj);
7154 if(!t[type] || !obj) { return false; }
7155 old_type = obj.type;
7156 old_icon = this.get_icon(obj);
7157 obj.type = type;
7159 this.set_icon(obj, t[type].icon !== undefined ? t[type].icon : true);
7196 this.check = function (chk, obj, par, pos, more) { argument
7197 if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; }
7198 obj = obj && obj.id ? obj : this.get_node(obj);
7201 var n = chk === "rename_node" ? pos : obj.text,
7213 … i = ($.inArray(n, c) === -1 || (obj.text && obj.text[ s ? 'toString' : 'toLowerCase']() === n));
7215 …+ chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false,…
7221 …+ chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false,…
7227 …+ chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false,…
7231 i = ( (obj.parent === par.id && (!more || !more.is_multi)) || $.inArray(n, c) === -1);
7233 …+ chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false,…
7357 this.redraw_node = function(obj, deep, callback, force_render) { argument
7358 obj = parent.redraw_node.apply(this, arguments);
7359 if(obj) {
7362 …if($.inArray(obj.id, this._data.core.selected) !== -1) { tmp.className += ' jstree-wholerow-clicke…
7363 …if(this._data.core.focused && this._data.core.focused === obj.id) { tmp.className += ' jstree-whol…
7364 obj.insertBefore(tmp, obj.childNodes[0]);
7366 return obj;