From 40723aaa58fcee4496b25ac82ebc55eaefa3fb4d Mon Sep 17 00:00:00 2001 From: David Craig Date: Fri, 26 Feb 2016 14:43:14 +1300 Subject: [PATCH] Fix undeclared variable in UploadField.js --- admin/javascript/dist/bundle-lib.js | 2 +- javascript/dist/UploadField.js | 134 ++++++++++++---------------- javascript/src/UploadField.js | 3 +- 3 files changed, 60 insertions(+), 79 deletions(-) diff --git a/admin/javascript/dist/bundle-lib.js b/admin/javascript/dist/bundle-lib.js index 96030f465..fd9d2ca64 100644 --- a/admin/javascript/dist/bundle-lib.js +++ b/admin/javascript/dist/bundle-lib.js @@ -16,4 +16,4 @@ o.splice(a--,1);break}return o},has:function(e){var t=H(e);return this.filter(fu });var i=this[0],n=i&&i.ownerDocument;return n?i===n.body?H.offset.bodyOffset(i):wt(i,n,n.documentElement):null},H.offset={bodyOffset:function(e){var t=e.offsetTop,i=e.offsetLeft;return H.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(H.css(e,"marginTop"))||0,i+=parseFloat(H.css(e,"marginLeft"))||0),{top:t,left:i}},setOffset:function(e,t,i){var n=H.css(e,"position");"static"===n&&(e.style.position="relative");var s,a,r=H(e),o=r.offset(),l=H.css(e,"top"),h=H.css(e,"left"),c=("absolute"===n||"fixed"===n)&&H.inArray("auto",[l,h])>-1,d={},u={};c?(u=r.position(),s=u.top,a=u.left):(s=parseFloat(l)||0,a=parseFloat(h)||0),H.isFunction(t)&&(t=t.call(e,i,o)),null!=t.top&&(d.top=t.top-o.top+s),null!=t.left&&(d.left=t.left-o.left+a),"using"in t?t.using.call(e,d):r.css(d)}},H.fn.extend({position:function(){if(!this[0])return null;var e=this[0],t=this.offsetParent(),i=this.offset(),n=jt.test(t[0].nodeName)?{top:0,left:0}:t.offset();return i.top-=parseFloat(H.css(e,"marginTop"))||0,i.left-=parseFloat(H.css(e,"marginLeft"))||0,n.top+=parseFloat(H.css(t[0],"borderTopWidth"))||0,n.left+=parseFloat(H.css(t[0],"borderLeftWidth"))||0,{top:i.top-n.top,left:i.left-n.left}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||N.body;e&&!jt.test(e.nodeName)&&"static"===H.css(e,"position");)e=e.offsetParent;return e})}}),H.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,i){var n=/Y/.test(i);H.fn[e]=function(s){return H.access(this,function(e,s,a){var r=E(e);return a===t?r?i in r?r[i]:H.support.boxModel&&r.document.documentElement[s]||r.document.body[s]:e[s]:void(r?r.scrollTo(n?H(r).scrollLeft():a,n?a:H(r).scrollTop()):e[s]=a)},e,s,arguments.length,null)}}),H.each({Height:"height",Width:"width"},function(e,i){var n="client"+e,s="scroll"+e,a="offset"+e;H.fn["inner"+e]=function(){var e=this[0];return e?e.style?parseFloat(H.css(e,i,"padding")):this[i]():null},H.fn["outer"+e]=function(e){var t=this[0];return t?t.style?parseFloat(H.css(t,i,e?"margin":"border")):this[i]():null},H.fn[i]=function(e){return H.access(this,function(e,i,r){var o,l,h,c;return H.isWindow(e)?(o=e.document,l=o.documentElement[n],H.support.boxModel&&l||o.body&&o.body[n]||l):9===e.nodeType?(o=e.documentElement,o[n]>=o[s]?o[n]:Math.max(e.body[s],o[s],e.body[a],o[a])):r===t?(h=H.css(e,i),c=parseFloat(h),H.isNumeric(c)?c:h):void H(e).css(i,r)},i,e,arguments.length,null)}}),e.jQuery=e.$=H,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return H})}(window)},{}],26:[function(require,module,exports){var JSON=JSON||{};!function(){function f(e){return 10>e?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var i,n,s,a,r,o=gap,l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),"function"==typeof rep&&(l=rep.call(t,e,l)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(gap+=indent,r=[],"[object Array]"===Object.prototype.toString.apply(l)){for(a=l.length,i=0;a>i;i+=1)r[i]=str(i,l)||"null";return s=0===r.length?"[]":gap?"[\n"+gap+r.join(",\n"+gap)+"\n"+o+"]":"["+r.join(",")+"]",gap=o,s}if(rep&&"object"==typeof rep)for(a=rep.length,i=0;a>i;i+=1)n=rep[i],"string"==typeof n&&(s=str(n,l),s&&r.push(quote(n)+(gap?": ":":")+s));else for(n in l)Object.hasOwnProperty.call(l,n)&&(s=str(n,l),s&&r.push(quote(n)+(gap?": ":":")+s));return s=0===r.length?"{}":gap?"{\n"+gap+r.join(",\n"+gap)+"\n"+o+"}":"{"+r.join(",")+"}",gap=o,s}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(e){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(e){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(e,t,i){var n;if(gap="",indent="","number"==typeof i)for(n=0;i>n;n+=1)indent+=" ";else"string"==typeof i&&(indent=i);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var i,n,s=e[t];if(s&&"object"==typeof s)for(i in s)Object.hasOwnProperty.call(s,i)&&(n=walk(s,i),void 0!==n?s[i]=n:delete s[i]);return reviver.call(e,t,s)}var j;if(cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()},{}],27:[function(e,t,i){"use strict";!function(){if(!jQuery||!jQuery.jstree){var e=!1,t=!1,i=!1;!function(n){n.vakata={},n.vakata.css={get_css:function(e,t,i){e=e.toLowerCase();var n=i.cssRules||i.rules,s=0;do{if(n.length&&s>n.length+5)return!1;if(n[s].selectorText&&n[s].selectorText.toLowerCase()==e)return t===!0?(i.removeRule&&i.removeRule(s),i.deleteRule&&i.deleteRule(s),!0):n[s]}while(n[++s]);return!1},add_css:function(e,t){return n.jstree.css.get_css(e,!1,t)?!1:(t.insertRule?t.insertRule(e+" { }",0):t.addRule(e,null,0),n.vakata.css.get_css(e))},remove_css:function(e,t){return n.vakata.css.get_css(e,!0,t)},add_sheet:function(e){}};var s=[],a=-1,r={},o={};n.fn.jstree=function(e){var t="string"==typeof e,i=Array.prototype.slice.call(arguments,1),a=this;if(t){if("_"==e.substring(0,1))return a;this.each(function(){var t=s[n.data(this,"jstree_instance_id")],r=t&&n.isFunction(t[e])?t[e].apply(t,i):t;return"undefined"!=typeof r&&(0===e.indexOf("is_")||r!==!0&&r!==!1)?(a=r,!1):void 0})}else this.each(function(){var t=n.data(this,"jstree_instance_id"),a=[],o=e?n.extend({},!0,e):{},l=n(this),h=!1,c=[];a=a.concat(i),l.data("jstree")&&a.push(l.data("jstree")),o=a.length?n.extend.apply(null,[!0,o].concat(a)):o,"undefined"!=typeof t&&s[t]&&s[t].destroy(),t=parseInt(s.push({}),10)-1,n.data(this,"jstree_instance_id",t),o.plugins=n.isArray(o.plugins)?o.plugins:n.jstree.defaults.plugins.slice(),o.plugins.unshift("core"),o.plugins=o.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(","),h=n.extend(!0,{},n.jstree.defaults,o),h.plugins=o.plugins,n.each(r,function(e,t){-1===n.inArray(e,h.plugins)?(h[e]=null,delete h[e]):c.push(e)}),h.plugins=c,s[t]=new n.jstree._instance(t,n(this).addClass("jstree jstree-"+t),h),n.each(s[t]._get_settings().plugins,function(e,i){s[t].data[i]={}}),n.each(s[t]._get_settings().plugins,function(e,i){r[i]&&r[i].__init.apply(s[t])}),setTimeout(function(){s[t]&&s[t].init()},0)});return a},n.jstree={defaults:{plugins:[]},_focused:function(){return s[a]||null},_reference:function(e){if(s[e])return s[e];var t=n(e);return t.length||"string"!=typeof e||(t=n("#"+e)),t.length?s[t.closest(".jstree").data("jstree_instance_id")]||null:null},_instance:function(e,t,i){this.data={core:{}},this.get_settings=function(){return n.extend(!0,{},i)},this._get_settings=function(){return i},this.get_index=function(){return e},this.get_container=function(){return t},this.get_container_ul=function(){return t.children("ul:eq(0)")},this._set_settings=function(e){i=n.extend(!0,{},i,e)}},_fn:{},plugin:function(e,t){t=n.extend({},{__init:n.noop,__destroy:n.noop,_fn:{},defaults:!1},t),r[e]=t,n.jstree.defaults[e]=t.defaults,n.each(t._fn,function(t,i){i.plugin=e,i.old=n.jstree._fn[t],n.jstree._fn[t]=function(){var e,s=i,a=Array.prototype.slice.call(arguments),r=new n.Event("before.jstree"),o=!1;if(this.data.core.locked!==!0||"unlock"===t||"is_locked"===t){do{if(s&&s.plugin&&-1!==n.inArray(s.plugin,this._get_settings().plugins))break;s=s.old}while(s);if(s){if(0===t.indexOf("_"))e=s.apply(this,a);else{if(e=this.get_container().triggerHandler(r,{func:t,inst:this,args:a,plugin:s.plugin}),e===!1)return;"undefined"!=typeof e&&(a=e),e=s.apply(n.extend({},this,{__callback:function(e){this.get_container().triggerHandler(t+".jstree",{inst:this,args:a,rslt:e,rlbk:o})},__rollback:function(){return o=this.get_rollback()},__call_old:function(e){return s.old.apply(this,e?Array.prototype.slice.call(arguments,1):a)}}),a)}return e}}},n.jstree._fn[t].old=i.old,n.jstree._fn[t].plugin=e})},rollback:function(e){e&&(n.isArray(e)||(e=[e]),n.each(e,function(e,t){s[t.i].set_rollback(t.h,t.d)}))}},n.jstree._fn=n.jstree._instance.prototype={},n(function(){var s=navigator.userAgent.toLowerCase(),a=(s.match(/.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],r=".jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } .jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } .jstree-rtl li { margin-left:0; margin-right:18px; } .jstree > ul > li { margin-left:0px; } .jstree-rtl > ul > li { margin-right:0px; } .jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } .jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } .jstree a:focus { outline: none; } .jstree a > ins { height:16px; width:16px; } .jstree a > .jstree-icon { margin-right:3px; } .jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } li.jstree-open > ul { display:block; } li.jstree-closed > ul { display:none; } ";if(/msie/.test(s)&&6==parseInt(a,10)){e=!0;try{document.execCommand("BackgroundImageCache",!1,!0)}catch(o){}r+=".jstree li { height:18px; margin-left:0; margin-right:0; } .jstree li li { margin-left:18px; } .jstree-rtl li li { margin-left:0px; margin-right:18px; } li.jstree-open ul { display:block; } li.jstree-closed ul { display:none !important; } .jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } .jstree li a ins { height:16px; width:16px; margin-right:3px; } .jstree-rtl li a ins { margin-right:0px; margin-left:3px; } "}/msie/.test(s)&&7==parseInt(a,10)&&(t=!0,r+=".jstree li a { border-width:0 !important; padding:0px 2px !important; } "),!/compatible/.test(s)&&/mozilla/.test(s)&&parseFloat(a,10)<1.9&&(i=!0,r+=".jstree ins { display:-moz-inline-box; } .jstree li { line-height:12px; } .jstree a { display:-moz-inline-box; } .jstree .jstree-no-icons .jstree-checkbox { display:-moz-inline-stack !important; } "),n.vakata.css.add_sheet({str:r,title:"jstree"})}),n.jstree.plugin("core",{__init:function(){this.data.core.locked=!1,this.data.core.to_open=this.get_settings().core.initially_open,this.data.core.to_load=this.get_settings().core.initially_load},defaults:{html_titles:!1,animation:500,initially_open:[],initially_load:[],open_parents:!0,notify_plugins:!0,rtl:!1,load_open:!1,strings:{loading:"Loading ...",new_node:"New node",multiple_selection:"Multiple selection"}},_fn:{init:function(){this.set_focus(),this._get_settings().core.rtl&&this.get_container().addClass("jstree-rtl").css("direction","rtl"),this.get_container().html(""),this.data.core.li_height=this.get_container_ul().find("li.jstree-closed, li.jstree-leaf").eq(0).height()||18,this.get_container().delegate("li > ins","click.jstree",n.proxy(function(e){var t=n(e.target);this.toggle_node(t)},this)).bind("mousedown.jstree",n.proxy(function(){this.set_focus()},this)).bind("dblclick.jstree",function(e){var t;if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){t=window.getSelection();try{t.removeAllRanges(),t.collapse()}catch(i){}}}),this._get_settings().core.notify_plugins&&this.get_container().bind("load_node.jstree",n.proxy(function(e,t){var i=this._get_node(t.rslt.obj),s=this;-1===i&&(i=this.get_container_ul()),i.length&&i.find("li").each(function(){var e=n(this);e.data("jstree")&&n.each(e.data("jstree"),function(t,i){s.data[t]&&n.isFunction(s["_"+t+"_notify"])&&s["_"+t+"_notify"].call(s,e,i)})})},this)),this._get_settings().core.load_open&&this.get_container().bind("load_node.jstree",n.proxy(function(e,t){var i=this._get_node(t.rslt.obj),s=this;-1===i&&(i=this.get_container_ul()),i.length&&i.find("li.jstree-open:not(:has(ul))").each(function(){s.load_node(this,n.noop,n.noop)})},this)),this.__callback(),this.load_node(-1,function(){this.loaded(),this.reload_nodes()})},destroy:function(){var e,t=this.get_index(),i=this._get_settings(),o=this;if(n.each(i.plugins,function(e,t){try{r[t].__destroy.apply(o)}catch(i){}}),this.__callback(),this.is_focused())for(e in s)if(s.hasOwnProperty(e)&&e!=t){s[e].set_focus();break}t===a&&(a=-1),this.get_container().unbind(".jstree").undelegate(".jstree").removeData("jstree_instance_id").find("[class^='jstree']").andSelf().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),n(document).unbind(".jstree-"+t).undelegate(".jstree-"+t),s[t]=null,delete s[t]},_core_notify:function(e,t){t.opened&&this.open_node(e,!1,!0)},lock:function(){this.data.core.locked=!0,this.get_container().children("ul").addClass("jstree-locked").css("opacity","0.7"),this.__callback({})},unlock:function(){this.data.core.locked=!1,this.get_container().children("ul").removeClass("jstree-locked").css("opacity","1"),this.__callback({})},is_locked:function(){return this.data.core.locked},save_opened:function(){var e=this;this.data.core.to_open=[],this.get_container_ul().find("li.jstree-open").each(function(){this.id&&e.data.core.to_open.push("#"+this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"))}),this.__callback(e.data.core.to_open)},save_loaded:function(){},reload_nodes:function(e){var t=this,i=!0,s=[],a=[];e||(this.data.core.reopen=!1,this.data.core.refreshing=!0,this.data.core.to_open=n.map(n.makeArray(this.data.core.to_open),function(e){return"#"+e.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")}),this.data.core.to_load=n.map(n.makeArray(this.data.core.to_load),function(e){return"#"+e.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")}),this.data.core.to_open.length&&(this.data.core.to_load=this.data.core.to_load.concat(this.data.core.to_open))),this.data.core.to_load.length&&(n.each(this.data.core.to_load,function(e,t){return"#"==t?!0:void(n(t).length?s.push(t):a.push(t))}),s.length&&(this.data.core.to_load=a,n.each(s,function(e,n){t._is_loaded(n)||(t.load_node(n,function(){t.reload_nodes(!0)},function(){t.reload_nodes(!0)}),i=!1)}))),this.data.core.to_open.length&&n.each(this.data.core.to_open,function(e,i){t.open_node(i,!1,!0)}),i&&(this.data.core.reopen&&clearTimeout(this.data.core.reopen),this.data.core.reopen=setTimeout(function(){t.__callback({},t)},50),this.data.core.refreshing=!1,this.reopen())},reopen:function(){var e=this;this.data.core.to_open.length&&n.each(this.data.core.to_open,function(t,i){e.open_node(i,!1,!0)}),this.__callback({})},refresh:function(e,t,i){var n=this;this.save_opened(),e||(e=-1),e=this._get_node(e),e||(e=-1),-1!==e?e.children("UL").remove():this.get_container_ul().empty(),this.load_node(e,function(){n.__callback({obj:e}),n.reload_nodes(),t&&t.call(this)},i)},loaded:function(){this.__callback()},set_focus:function(){if(!this.is_focused()){var e=n.jstree._focused();e&&e.unset_focus(),this.get_container().addClass("jstree-focused"),a=this.get_index(),this.__callback()}},is_focused:function(){return a==this.get_index()},unset_focus:function(){this.is_focused()&&(this.get_container().removeClass("jstree-focused"),a=-1),this.__callback()},_get_node:function(e){var t=n(e,this.get_container());return t.is(".jstree")||-1==e?-1:(t=t.closest("li",this.get_container()),t.length?t:!1)},_get_next:function(e,t){return e=this._get_node(e),-1===e?this.get_container().find("> ul > li:first-child"):e.length?t?e.nextAll("li").size()>0?e.nextAll("li:eq(0)"):!1:e.hasClass("jstree-open")?e.find("li:eq(0)"):e.nextAll("li").size()>0?e.nextAll("li:eq(0)"):e.parentsUntil(".jstree","li").next("li").eq(0):!1},_get_prev:function(e,t){if(e=this._get_node(e),-1===e)return this.get_container().find("> ul > li:last-child");if(!e.length)return!1;if(t)return e.prevAll("li").length>0?e.prevAll("li:eq(0)"):!1;if(e.prev("li").length){for(e=e.prev("li").eq(0);e.hasClass("jstree-open");)e=e.children("ul:eq(0)").children("li:last");return e}var i=e.parentsUntil(".jstree","li:eq(0)");return i.length?i:!1},_get_parent:function(e){if(e=this._get_node(e),-1==e||!e.length)return!1;var t=e.parentsUntil(".jstree","li:eq(0)");return t.length?t:-1},_get_children:function(e){return e=this._get_node(e),-1===e?this.get_container().children("ul:eq(0)").children("li"):e.length?e.children("ul:eq(0)").children("li"):!1},get_path:function(e,t){var i=[],n=this;return e=this._get_node(e),-1!==e&&e&&e.length?(e.parentsUntil(".jstree","li").each(function(){i.push(t?this.id:n.get_text(this))}),i.reverse(),i.push(t?e.attr("id"):this.get_text(e)),i):!1},_get_string:function(e){return this._get_settings().core.strings[e]||e},is_open:function(e){return e=this._get_node(e),e&&-1!==e&&e.hasClass("jstree-open")},is_closed:function(e){return e=this._get_node(e),e&&-1!==e&&e.hasClass("jstree-closed")},is_leaf:function(e){return e=this._get_node(e),e&&-1!==e&&e.hasClass("jstree-leaf")},correct_state:function(e){return e=this._get_node(e),e&&-1!==e?(e.removeClass("jstree-closed jstree-open").addClass("jstree-leaf").children("ul").remove(),void this.__callback({obj:e})):!1},open_node:function(t,i,n){if(t=this._get_node(t),!t.length)return!1;if(!t.hasClass("jstree-closed"))return i&&i.call(),!1;var s=n||e?0:this._get_settings().core.animation,a=this;this._is_loaded(t)?(this._get_settings().core.open_parents&&t.parentsUntil(".jstree",".jstree-closed").each(function(){a.open_node(this,!1,!0)}),s&&t.children("ul").css("display","none"),t.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading"),s?t.children("ul").stop(!0,!0).slideDown(s,function(){this.style.display="",a.after_open(t)}):a.after_open(t),this.__callback({obj:t}),i&&i.call()):(t.children("a").addClass("jstree-loading"),this.load_node(t,function(){a.open_node(t,i,n)},i))},after_open:function(e){this.__callback({obj:e})},close_node:function(t,i){t=this._get_node(t);var n=i||e?0:this._get_settings().core.animation,s=this;return t.length&&t.hasClass("jstree-open")?(n&&t.children("ul").attr("style","display:block !important"),t.removeClass("jstree-open").addClass("jstree-closed"),n?t.children("ul").stop(!0,!0).slideUp(n,function(){this.style.display="",s.after_close(t)}):s.after_close(t),void this.__callback({obj:t})):!1},after_close:function(e){this.__callback({obj:e})},toggle_node:function(e){return e=this._get_node(e),e.hasClass("jstree-closed")?this.open_node(e):e.hasClass("jstree-open")?this.close_node(e):void 0},open_all:function(e,t,i){e=e?this._get_node(e):-1,e&&-1!==e||(e=this.get_container_ul()),i?e=e.find("li.jstree-closed"):(i=e,e=e.is(".jstree-closed")?e.find("li.jstree-closed").andSelf():e.find("li.jstree-closed"));var n=this;e.each(function(){var e=this;n._is_loaded(this)?n.open_node(this,!1,!t):n.open_node(this,function(){n.open_all(e,t,i)},!t)}),0===i.find("li.jstree-closed").length&&this.__callback({obj:i})},close_all:function(e,t){var i=this;e=e?this._get_node(e):this.get_container(),e&&-1!==e||(e=this.get_container_ul()),e.find("li.jstree-open").andSelf().each(function(){i.close_node(this,!t)}),this.__callback({obj:e})},clean_node:function(e){e=e&&-1!=e?n(e):this.get_container_ul(),e=e.is("li")?e.find("li").andSelf():e.find("li"),e.removeClass("jstree-last").filter("li:last-child").addClass("jstree-last").end().filter(":has(li)").not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed"),e.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove(),this.__callback({obj:e})},get_rollback:function(){return this.__callback(),{i:this.get_index(),h:this.get_container().children("ul").clone(!0),d:this.data}},set_rollback:function(e,t){this.get_container().empty().append(e),this.data=t,this.__callback()},load_node:function(e,t,i){this.__callback({obj:e})},_is_loaded:function(e){return!0},create_node:function(e,t,i,s,a){e=this._get_node(e),t="undefined"==typeof t?"last":t;var r,o=n("
  • "),l=this._get_settings().core;if(-1!==e&&!e.length)return!1;if(!a&&!this._is_loaded(e))return this.load_node(e,function(){this.create_node(e,t,i,s,!0)}),!1;switch(this.__rollback(),"string"==typeof i&&(i={data:i}),i||(i={}),i.attr&&o.attr(i.attr),i.metadata&&o.data(i.metadata),i.state&&o.addClass("jstree-"+i.state),i.data||(i.data=this._get_string("new_node")),n.isArray(i.data)||(r=i.data,i.data=[],i.data.push(r)),n.each(i.data,function(e,t){r=n(""),n.isFunction(t)&&(t=t.call(this,i)),"string"==typeof t?r.attr("href","#")[l.html_titles?"html":"text"](t):(t.attr||(t.attr={}),t.attr.href||(t.attr.href="#"),r.attr(t.attr)[l.html_titles?"html":"text"](t.title),t.language&&r.addClass(t.language)),r.prepend(" "),!t.icon&&i.icon&&(t.icon=i.icon),t.icon&&(-1===t.icon.indexOf("/")?r.children("ins").addClass(t.icon):r.children("ins").css("background","url('"+t.icon+"') center center no-repeat")),o.append(r)}),o.prepend(" "),-1===e&&(e=this.get_container(),"before"===t&&(t="first"),"after"===t&&(t="last")),t){case"before":e.before(o),r=this._get_parent(e);break;case"after":e.after(o),r=this._get_parent(e);break;case"inside":case"first":e.children("ul").length||e.append("