(function(a){if(typeof window.hotkeys=="undefined")throw"jsTree hotkeys: jQuery hotkeys plugin not included.";a.extend(a.tree.plugins,{hotkeys:{bound:[],disabled:false,defaults:{hover_mode:false,functions:{up:function(){a.tree.plugins.hotkeys.get_prev.apply(this);return false},down:function(){a.tree.plugins.hotkeys.get_next.apply(this);return false},left:function(){a.tree.plugins.hotkeys.get_left.apply(this);return false},right:function(){a.tree.plugins.hotkeys.get_right.apply(this);return false},
f2:function(){this.selected&&this.rename();return false},del:function(){this.selected&&this.remove();return false},"ctrl+c":function(){this.selected&&this.copy();return false},"ctrl+x":function(){this.selected&&this.cut();return false},"ctrl+v":function(){this.selected&&this.paste();return false}}},exec:function(c){if(a.tree.plugins.hotkeys.disabled)return false;var b=a.tree.focused();if(typeof b.settings.plugins.hotkeys!="undefined"){var d=a.extend(true,{},a.tree.plugins.hotkeys.defaults,b.settings.plugins.hotkeys);
if(typeof d.functions[c]=="function")return d.functions[c].apply(b)}},get_next:function(){var c=this.hovered||this.selected;return a.extend(true,{},a.tree.plugins.hotkeys.defaults,this.settings.plugins.hotkeys).hover_mode?this.hover_branch(this.next(c)):this.select_branch(this.next(c))},get_prev:function(){var c=this.hovered||this.selected;return a.extend(true,{},a.tree.plugins.hotkeys.defaults,this.settings.plugins.hotkeys).hover_mode?this.hover_branch(this.prev(c)):this.select_branch(this.prev(c))},
get_left:function(){var c=a.extend(true,{},a.tree.plugins.hotkeys.defaults,this.settings.plugins.hotkeys),b=this.hovered||this.selected;if(b)if(b.hasClass("open"))this.close_branch(b);else return c.hover_mode?this.hover_branch(this.parent(b)):this.select_branch(this.parent(b))},get_right:function(){var c=a.extend(true,{},a.tree.plugins.hotkeys.defaults,this.settings.plugins.hotkeys),b=this.hovered||this.selected;if(b)if(b.hasClass("closed"))this.open_branch(b);else return c.hover_mode?this.hover_branch(b.find("li:eq(0)")):
this.select_branch(b.find("li:eq(0)"))},callbacks:{oninit:function(){var c=a.extend(true,{},a.tree.plugins.hotkeys.defaults,this.settings.plugins.hotkeys),b;for(b in c.functions)if(c.functions.hasOwnProperty(b)&&a.inArray(b,a.tree.plugins.hotkeys.bound)==-1){(function(d){a(document).bind("keydown",{combi:d,disableInInput:true},function(){return a.tree.plugins.hotkeys.exec(d)})})(b);a.tree.plugins.hotkeys.bound.push(b)}}}}})})(jQuery);
