extranet/public/libs/jstree/jstree.min.js

4 lines
91 KiB
JavaScript
Raw Normal View History

2012-11-19 12:00:06 +00:00
/*! jstree - v1.0.0 - 2012-10-01
* http://jstree.com
* Copyright (c) 2012 Ivan Bozhanov; Licensed MIT, GPL */
(function(e){e.vakata={}})(jQuery),function(e){e.fn.vakata_reverse=[].reverse}(jQuery),function(e){jQuery.expr[":"].vakata_icontains=function(e,t,n){return(e.textContent||e.innerText||"").toLowerCase().indexOf(n[3].toLowerCase())>=0}}(jQuery),function(e){e.vakata.array_remove=function(e,t,n){var r=e.slice((n||t)+1||e.length);return e.length=t<0?e.length+t:t,e.push.apply(e,r),e}}(jQuery),function(e){e.vakata.array_unique=function(e){var t=[],n,r,i;for(n=0,i=e.length;n<i;n++){for(r=0;r<=n;r++)if(e[n]===e[r])break;r===n&&t.push(e[n])}return t}}(jQuery),function(e){e.vakata.attributes=function(t,n){t=e(t)[0];var r=n?{}:[];return e.each(t.attributes,function(t,i){if(e.inArray(i.nodeName.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])!==-1)return;i.nodeValue!==null&&e.trim(i.nodeValue)!==""&&(n?r[i.nodeName]=i.nodeValue:r.push(i.nodeName))}),r}}(jQuery),function(e){var t;e.vakata.get_scrollbar_width=function(){var n,r;return t||(/msie/.test(navigator.userAgent.toLowerCase())?(n=e('<textarea cols="10" rows="2"></textarea>').css({position:"absolute",top:-1e3,left:0}).appendTo("body"),r=e('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({position:"absolute",top:-1e3,left:0}).appendTo("body"),t=n.width()-r.width(),n.add(r).remove()):(n=e("<div />").css({width:100,height:100,overflow:"auto",position:"absolute",top:-1e3,left:0}).prependTo("body").append("<div />").find("div").css({width:"100%",height:200}),t=100-n.width(),n.parent().remove())),t}}(jQuery),function(e){e.vakata.css={get_css:function(e,t,n){e=e.toLowerCase();var r=n.cssRules||n.rules,i=0;do{if(r.length&&i>r.length+5)return!1;if(r[i].selectorText&&r[i].selectorText.toLowerCase()===e)return t===!0?(n.removeRule&&n.removeRule(i),n.deleteRule&&n.deleteRule(i),!0):r[i]}while(r[++i]);return!1},add_css:function(t,n){return e.jstree.css.get_css(t,!1,n)?!1:(n.insertRule?n.insertRule(t+" { }",0):n.addRule(t,null,0),e.vakata.css.get_css(t))},remove_css:function(t,n){return e.vakata.css.get_css(t,!0,n)},add_sheet:function(t){var n=!1,r=!0;if(t.str)return t.title&&(n=e("style[id='"+t.title+"-stylesheet']")[0]),n?r=!1:(n=document.createElement("style"),n.setAttribute("type","text/css"),t.title&&n.setAttribute("id",t.title+"-stylesheet")),n.styleSheet?r?(document.getElementsByTagName("head")[0].appendChild(n),n.styleSheet.cssText=t.str):n.styleSheet.cssText=n.styleSheet.cssText+" "+t.str:(n.appendChild(document.createTextNode(t.str)),document.getElementsByTagName("head")[0].appendChild(n)),n.sheet||n.styleSheet;if(t.url){if(!document.createStyleSheet)return n=document.createElement("link"),n.rel="stylesheet",n.type="text/css",n.media="all",n.href=t.url,document.getElementsByTagName("head")[0].appendChild(n),n.styleSheet;try{n=document.createStyleSheet(t.url)}catch(i){}}}}}(jQuery),function(e){var t={element:!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};e.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5},_trigger:function(t,n){var r=e.vakata.dnd._get();r.event=n,e(document).triggerHandler("dnd_"+t+".vakata",r)},_get:function(){return{data:t.data,element:t.element,helper:t.helper}},_clean:function(){t.helper&&t.helper.remove(),t.scroll_i&&(clearInterval(t.scroll_i),t.scroll_i=!1),t={element:!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},e(document).unbind("mousemove",e.vakata.dnd.drag),e(document).unbind("mouseup",e.vakata.dnd.stop)},_scroll:function(n){if(!t.scroll_e||!t.scroll_l&&!t.scroll_t)return t.scroll_i&&(clearInterval(t.scroll_i),t.scroll_i=!1),!1;if(!t.scroll_i)return t.scroll_i=setInterval(e.vakata.dnd._scroll,100),!1;if(n===!0)return!1;var r=t.scroll_e.scrollTop(),i=t.scroll_e.scrollLeft();t.scroll_e.scrollTop(r+t.scroll_t*e.vakata.dnd.settings.scroll_speed),t.scroll_e.scrollLeft(i+t.scroll_l*e.vakata.dnd.settings.scroll_speed),(r!==t.scroll_e.scrollTop()||i!==t.scroll_e.scrollLeft())&&e.vakata.dnd._trigger("scroll",t.scroll_e)},start:functi