'),\r\n\t\t\t\t/*!\r\n\t\t\t\toi = obj.children(\"i:visible\"),\r\n\t\t\t\tai = a.children(\"i:visible\"),\r\n\t\t\t\tw1 = oi.width() * oi.length,\r\n\t\t\t\tw2 = ai.width() * ai.length,\r\n\t\t\t\t*/\r\n\t\t\t\tt = typeof default_text === 'string' ? default_text : this.get_text(obj),\r\n\t\t\t\th1 = $(\"<\"+\"div />\", { css : { \"position\" : \"absolute\", \"top\" : \"-200px\", \"left\" : (rtl ? \"0px\" : \"-1000px\"), \"visibility\" : \"hidden\" } }).appendTo(\"body\"),\r\n\t\t\t\th2 = $(\"<\"+\"input />\", {\r\n\t\t\t\t\t\t\"value\" : t,\r\n\t\t\t\t\t\t\"class\" : \"jstree-rename-input\",\r\n\t\t\t\t\t\t// \"size\" : t.length,\r\n\t\t\t\t\t\t\"css\" : {\r\n\t\t\t\t\t\t\t\"padding\" : \"0\",\r\n\t\t\t\t\t\t\t\"border\" : \"1px solid silver\",\r\n\t\t\t\t\t\t\t\"box-sizing\" : \"border-box\",\r\n\t\t\t\t\t\t\t\"display\" : \"inline-block\",\r\n\t\t\t\t\t\t\t\"height\" : (this._data.core.li_height) + \"px\",\r\n\t\t\t\t\t\t\t\"lineHeight\" : (this._data.core.li_height) + \"px\",\r\n\t\t\t\t\t\t\t\"width\" : \"150px\" // will be set a bit further down\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\"blur\" : $.proxy(function () {\r\n\t\t\t\t\t\t\tvar i = s.children(\".jstree-rename-input\"),\r\n\t\t\t\t\t\t\t\tv = i.val();\r\n\t\t\t\t\t\t\tif(v === \"\") { v = t; }\r\n\t\t\t\t\t\t\th1.remove();\r\n\t\t\t\t\t\t\ts.replaceWith(a);\r\n\t\t\t\t\t\t\ts.remove();\r\n\t\t\t\t\t\t\tthis.set_text(obj, t);\r\n\t\t\t\t\t\t\tif(this.rename_node(obj, v) === false) {\r\n\t\t\t\t\t\t\t\tthis.set_text(obj, t); // move this up? and fix #483\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}, this),\r\n\t\t\t\t\t\t\"keydown\" : function (event) {\r\n\t\t\t\t\t\t\tvar key = event.which;\r\n\t\t\t\t\t\t\tif(key === 27) {\r\n\t\t\t\t\t\t\t\tthis.value = t;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) {\r\n\t\t\t\t\t\t\t\tevent.stopImmediatePropagation();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(key === 27 || key === 13) {\r\n\t\t\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t\t\t\tthis.blur();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\"click\" : function (e) { e.stopImmediatePropagation(); },\r\n\t\t\t\t\t\t\"mousedown\" : function (e) { e.stopImmediatePropagation(); },\r\n\t\t\t\t\t\t\"keyup\" : function (event) {\r\n\t\t\t\t\t\t\th2.width(Math.min(h1.text(\"pW\" + this.value).width(),w));\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\"keypress\" : function(event) {\r\n\t\t\t\t\t\t\tif(event.which === 13) { return false; }\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}),\r\n\t\t\t\tfn = {\r\n\t\t\t\t\t\tfontFamily\t\t: a.css('fontFamily')\t\t|| '',\r\n\t\t\t\t\t\tfontSize\t\t: a.css('fontSize')\t\t\t|| '',\r\n\t\t\t\t\t\tfontWeight\t\t: a.css('fontWeight')\t\t|| '',\r\n\t\t\t\t\t\tfontStyle\t\t: a.css('fontStyle')\t\t|| '',\r\n\t\t\t\t\t\tfontStretch\t\t: a.css('fontStretch')\t\t|| '',\r\n\t\t\t\t\t\tfontVariant\t\t: a.css('fontVariant')\t\t|| '',\r\n\t\t\t\t\t\tletterSpacing\t: a.css('letterSpacing')\t|| '',\r\n\t\t\t\t\t\twordSpacing\t\t: a.css('wordSpacing')\t\t|| ''\r\n\t\t\t\t};\r\n\t\t\tthis.set_text(obj, \"\");\r\n\t\t\ts.attr('class', a.attr('class')).append(a.contents().clone()).append(h2);\r\n\t\t\ta.replaceWith(s);\r\n\t\t\th1.css(fn);\r\n\t\t\th2.css(fn).width(Math.min(h1.text(\"pW\" + h2[0].value).width(),w))[0].select();\r\n\t\t},\r\n\r\n\r\n\t\t/**\r\n\t\t * changes the theme\r\n\t\t * @name set_theme(theme_name [, theme_url])\r\n\t\t * @param {String} theme_name the name of the new theme to apply\r\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.\r\n\t\t * @trigger set_theme.jstree\r\n\t\t */\r\n\t\tset_theme : function (theme_name, theme_url) {\r\n\t\t\tif(!theme_name) { return false; }\r\n\t\t\tif(theme_url === true) {\r\n\t\t\t\tvar dir = this.settings.core.themes.dir;\r\n\t\t\t\tif(!dir) { dir = $.jstree.path + '/themes'; }\r\n\t\t\t\ttheme_url = dir + '/' + theme_name + '/style.css';\r\n\t\t\t}\r\n\t\t\tif(theme_url && $.inArray(theme_url, themes_loaded) === -1) {\r\n\t\t\t\t$('head').append('<'+'link rel=\"stylesheet\" href=\"' + theme_url + '\" type=\"text/css\" />');\r\n\t\t\t\tthemes_loaded.push(theme_url);\r\n\t\t\t}\r\n\t\t\tif(this._data.core.themes.name) {\r\n\t\t\t\tthis.element.removeClass('jstree-' + this._data.core.themes.name);\r\n\t\t\t}\r\n\t\t\tthis._data.core.themes.name = theme_name;\r\n\t\t\tthis.element.addClass('jstree-' + theme_name);\r\n\t\t\tthis.element[this.settings.core.themes.responsive ? 'addClass' : 'removeClass' ]('jstree-' + theme_name + '-responsive');\r\n\t\t\t/**\r\n\t\t\t * triggered when a theme is set\r\n\t\t\t * @event\r\n\t\t\t * @name set_theme.jstree\r\n\t\t\t * @param {String} theme the new theme\r\n\t\t\t */\r\n\t\t\tthis.trigger('set_theme', { 'theme' : theme_name });\r\n\t\t},\r\n\t\t/**\r\n\t\t * gets the name of the currently applied theme name\r\n\t\t * @name get_theme()\r\n\t\t * @return {String}\r\n\t\t */\r\n\t\tget_theme : function () { return this._data.core.themes.name; },\r\n\t\t/**\r\n\t\t * changes the theme variant (if the theme has variants)\r\n\t\t * @name set_theme_variant(variant_name)\r\n\t\t * @param {String|Boolean} variant_name the variant to apply (if `false` is used the current variant is removed)\r\n\t\t */\r\n\t\tset_theme_variant : function (variant_name) {\r\n\t\t\tif(this._data.core.themes.variant) {\r\n\t\t\t\tthis.element.removeClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant);\r\n\t\t\t}\r\n\t\t\tthis._data.core.themes.variant = variant_name;\r\n\t\t\tif(variant_name) {\r\n\t\t\t\tthis.element.addClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant);\r\n\t\t\t}\r\n\t\t},\r\n\t\t/**\r\n\t\t * gets the name of the currently applied theme variant\r\n\t\t * @name get_theme()\r\n\t\t * @return {String}\r\n\t\t */\r\n\t\tget_theme_variant : function () { return this._data.core.themes.variant; },\r\n\t\t/**\r\n\t\t * shows a striped background on the container (if the theme supports it)\r\n\t\t * @name show_stripes()\r\n\t\t */\r\n\t\tshow_stripes : function () { this._data.core.themes.stripes = true; this.get_container_ul().addClass(\"jstree-striped\"); },\r\n\t\t/**\r\n\t\t * hides the striped background on the container\r\n\t\t * @name hide_stripes()\r\n\t\t */\r\n\t\thide_stripes : function () { this._data.core.themes.stripes = false; this.get_container_ul().removeClass(\"jstree-striped\"); },\r\n\t\t/**\r\n\t\t * toggles the striped background on the container\r\n\t\t * @name toggle_stripes()\r\n\t\t */\r\n\t\ttoggle_stripes : function () { if(this._data.core.themes.stripes) { this.hide_stripes(); } else { this.show_stripes(); } },\r\n\t\t/**\r\n\t\t * shows the connecting dots (if the theme supports it)\r\n\t\t * @name show_dots()\r\n\t\t */\r\n\t\tshow_dots : function () { this._data.core.themes.dots = true; this.get_container_ul().removeClass(\"jstree-no-dots\"); },\r\n\t\t/**\r\n\t\t * hides the connecting dots\r\n\t\t * @name hide_dots()\r\n\t\t */\r\n\t\thide_dots : function () { this._data.core.themes.dots = false; this.get_container_ul().addClass(\"jstree-no-dots\"); },\r\n\t\t/**\r\n\t\t * toggles the connecting dots\r\n\t\t * @name toggle_dots()\r\n\t\t */\r\n\t\ttoggle_dots : function () { if(this._data.core.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },\r\n\t\t/**\r\n\t\t * show the node icons\r\n\t\t * @name show_icons()\r\n\t\t */\r\n\t\tshow_icons : function () { this._data.core.themes.icons = true; this.get_container_ul().removeClass(\"jstree-no-icons\"); },\r\n\t\t/**\r\n\t\t * hide the node icons\r\n\t\t * @name hide_icons()\r\n\t\t */\r\n\t\thide_icons : function () { this._data.core.themes.icons = false; this.get_container_ul().addClass(\"jstree-no-icons\"); },\r\n\t\t/**\r\n\t\t * toggle the node icons\r\n\t\t * @name toggle_icons()\r\n\t\t */\r\n\t\ttoggle_icons : function () { if(this._data.core.themes.icons) { this.hide_icons(); } else { this.show_icons(); } },\r\n\t\t/**\r\n\t\t * set the node icon for a node\r\n\t\t * @name set_icon(obj, icon)\r\n\t\t * @param {mixed} obj\r\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\r\n\t\t */\r\n\t\tset_icon : function (obj, icon) {\r\n\t\t\tvar t1, t2, dom, old;\r\n\t\t\tif($.isArray(obj)) {\r\n\t\t\t\tobj = obj.slice();\r\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\r\n\t\t\t\t\tthis.set_icon(obj[t1], icon);\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tobj = this.get_node(obj);\r\n\t\t\tif(!obj || obj.id === '#') { return false; }\r\n\t\t\told = obj.icon;\r\n\t\t\tobj.icon = icon;\r\n\t\t\tdom = this.get_node(obj, true).children(\".jstree-anchor\").children(\".jstree-themeicon\");\r\n\t\t\tif(icon === false) {\r\n\t\t\t\tthis.hide_icon(obj);\r\n\t\t\t}\r\n\t\t\telse if(icon === true) {\r\n\t\t\t\tdom.removeClass('jstree-themeicon-custom ' + old).css(\"background\",\"\").removeAttr(\"rel\");\r\n\t\t\t}\r\n\t\t\telse if(icon.indexOf(\"/\") === -1 && icon.indexOf(\".\") === -1) {\r\n\t\t\t\tdom.removeClass(old).css(\"background\",\"\");\r\n\t\t\t\tdom.addClass(icon + ' jstree-themeicon-custom').attr(\"rel\",icon);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tdom.removeClass(old).css(\"background\",\"\");\r\n\t\t\t\tdom.addClass('jstree-themeicon-custom').css(\"background\", \"url('\" + icon + \"') center center no-repeat\").attr(\"rel\",icon);\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t},\r\n\t\t/**\r\n\t\t * get the node icon for a node\r\n\t\t * @name get_icon(obj)\r\n\t\t * @param {mixed} obj\r\n\t\t * @return {String}\r\n\t\t */\r\n\t\tget_icon : function (obj) {\r\n\t\t\tobj = this.get_node(obj);\r\n\t\t\treturn (!obj || obj.id === '#') ? false : obj.icon;\r\n\t\t},\r\n\t\t/**\r\n\t\t * hide the icon on an individual node\r\n\t\t * @name hide_icon(obj)\r\n\t\t * @param {mixed} obj\r\n\t\t */\r\n\t\thide_icon : function (obj) {\r\n\t\t\tvar t1, t2;\r\n\t\t\tif($.isArray(obj)) {\r\n\t\t\t\tobj = obj.slice();\r\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\r\n\t\t\t\t\tthis.hide_icon(obj[t1]);\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tobj = this.get_node(obj);\r\n\t\t\tif(!obj || obj === '#') { return false; }\r\n\t\t\tobj.icon = false;\r\n\t\t\tthis.get_node(obj, true).children(\".jstree-anchor\").children(\".jstree-themeicon\").addClass('jstree-themeicon-hidden');\r\n\t\t\treturn true;\r\n\t\t},\r\n\t\t/**\r\n\t\t * show the icon on an individual node\r\n\t\t * @name show_icon(obj)\r\n\t\t * @param {mixed} obj\r\n\t\t */\r\n\t\tshow_icon : function (obj) {\r\n\t\t\tvar t1, t2, dom;\r\n\t\t\tif($.isArray(obj)) {\r\n\t\t\t\tobj = obj.slice();\r\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\r\n\t\t\t\t\tthis.show_icon(obj[t1]);\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tobj = this.get_node(obj);\r\n\t\t\tif(!obj || obj === '#') { return false; }\r\n\t\t\tdom = this.get_node(obj, true);\r\n\t\t\tobj.icon = dom.length ? dom.children(\".jstree-anchor\").children(\".jstree-themeicon\").attr('rel') : true;\r\n\t\t\tif(!obj.icon) { obj.icon = true; }\r\n\t\t\tdom.children(\".jstree-anchor\").children(\".jstree-themeicon\").removeClass('jstree-themeicon-hidden');\r\n\t\t\treturn true;\r\n\t\t}\r\n\t};\r\n\r\n\t// helpers\r\n\t$.vakata = {};\r\n\t// collect attributes\r\n\t$.vakata.attributes = function(node, with_values) {\r\n\t\tnode = $(node)[0];\r\n\t\tvar attr = with_values ? {} : [];\r\n\t\tif(node && node.attributes) {\r\n\t\t\t$.each(node.attributes, function (i, v) {\r\n\t\t\t\tif($.inArray(v.nodeName.toLowerCase(),['style','contenteditable','hasfocus','tabindex']) !== -1) { return; }\r\n\t\t\t\tif(v.value !== null && $.trim(v.value) !== '') {\r\n\t\t\t\t\tif(with_values) { attr[v.nodeName] = v.value; }\r\n\t\t\t\t\telse { attr.push(v.nodeName); }\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn attr;\r\n\t};\r\n\t$.vakata.array_unique = function(array) {\r\n\t\tvar a = [], i, j, l;\r\n\t\tfor(i = 0, l = array.length; i < l; i++) {\r\n\t\t\tfor(j = 0; j <= i; j++) {\r\n\t\t\t\tif(array[i] === array[j]) {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(j === i) { a.push(array[i]); }\r\n\t\t}\r\n\t\treturn a;\r\n\t};\r\n\t// remove item from array\r\n\t$.vakata.array_remove = function(array, from, to) {\r\n\t\tvar rest = array.slice((to || from) + 1 || array.length);\r\n\t\tarray.length = from < 0 ? array.length + from : from;\r\n\t\tarray.push.apply(array, rest);\r\n\t\treturn array;\r\n\t};\r\n\t// remove item from array\r\n\t$.vakata.array_remove_item = function(array, item) {\r\n\t\tvar tmp = $.inArray(item, array);\r\n\t\treturn tmp !== -1 ? $.vakata.array_remove(array, tmp) : array;\r\n\t};\r\n\r\n/**\r\n * ### Checkbox plugin\r\n *\r\n * This plugin renders checkbox icons in front of each node, making multiple selection much easier. \r\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.\r\n */\r\n\r\n\tvar _i = document.createElement('I');\r\n\t_i.className = 'jstree-icon jstree-checkbox';\r\n\t/**\r\n\t * stores all defaults for the checkbox plugin\r\n\t * @name $.jstree.defaults.checkbox\r\n\t * @plugin checkbox\r\n\t */\r\n\t$.jstree.defaults.checkbox = {\r\n\t\t/**\r\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`.\r\n\t\t * @name $.jstree.defaults.checkbox.visible\r\n\t\t * @plugin checkbox\r\n\t\t */\r\n\t\tvisible\t\t\t\t: true,\r\n\t\t/**\r\n\t\t * a boolean indicating if checkboxes should cascade down and have an undetermined state. Defaults to `true`.\r\n\t\t * @name $.jstree.defaults.checkbox.three_state\r\n\t\t * @plugin checkbox\r\n\t\t */\r\n\t\tthree_state\t\t\t: true,\r\n\t\t/**\r\n\t\t * a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`.\r\n\t\t * @name $.jstree.defaults.checkbox.whole_node\r\n\t\t * @plugin checkbox\r\n\t\t */\r\n\t\twhole_node\t\t\t: true,\r\n\t\t/**\r\n\t\t * a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`.\r\n\t\t * @name $.jstree.defaults.checkbox.keep_selected_style\r\n\t\t * @plugin checkbox\r\n\t\t */\r\n\t\tkeep_selected_style\t: true\r\n\t};\r\n\t$.jstree.plugins.checkbox = function (options, parent) {\r\n\t\tthis.bind = function () {\r\n\t\t\tparent.bind.call(this);\r\n\t\t\tthis._data.checkbox.uto = false;\r\n\t\t\tthis.element\r\n\t\t\t\t.on(\"init.jstree\", $.proxy(function () {\r\n\t\t\t\t\t\tthis._data.checkbox.visible = this.settings.checkbox.visible;\r\n\t\t\t\t\t\tif(!this.settings.checkbox.keep_selected_style) {\r\n\t\t\t\t\t\t\tthis.element.addClass('jstree-checkbox-no-clicked');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, this))\r\n\t\t\t\t.on(\"loading.jstree\", $.proxy(function () {\r\n\t\t\t\t\t\tthis[ this._data.checkbox.visible ? 'show_checkboxes' : 'hide_checkboxes' ]();\r\n\t\t\t\t\t}, this));\r\n\t\t\tif(this.settings.checkbox.three_state) {\r\n\t\t\t\tthis.element\r\n\t\t\t\t\t.on('changed.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree', $.proxy(function () {\r\n\t\t\t\t\t\t\tif(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); }\r\n\t\t\t\t\t\t\tthis._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50);\r\n\t\t\t\t\t\t}, this))\r\n\t\t\t\t\t.on('model.jstree', $.proxy(function (e, data) {\r\n\t\t\t\t\t\t\tvar m = this._model.data,\r\n\t\t\t\t\t\t\t\tp = m[data.parent],\r\n\t\t\t\t\t\t\t\tdpc = data.nodes,\r\n\t\t\t\t\t\t\t\tchd = [],\r\n\t\t\t\t\t\t\t\tc, i, j, k, l, tmp;\r\n\r\n\t\t\t\t\t\t\t// apply down\r\n\t\t\t\t\t\t\tif(p.state.selected) {\r\n\t\t\t\t\t\t\t\tfor(i = 0, j = dpc.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\t\tm[dpc[i]].state.selected = true;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tthis._data.core.selected = this._data.core.selected.concat(dpc);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tfor(i = 0, j = dpc.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\t\tif(m[dpc[i]].state.selected) {\r\n\t\t\t\t\t\t\t\t\t\tfor(k = 0, l = m[dpc[i]].children_d.length; k < l; k++) {\r\n\t\t\t\t\t\t\t\t\t\t\tm[m[dpc[i]].children_d[k]].state.selected = true;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tthis._data.core.selected = this._data.core.selected.concat(m[dpc[i]].children_d);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t// apply up\r\n\t\t\t\t\t\t\tfor(i = 0, j = p.children_d.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\tif(!m[p.children_d[i]].children.length) {\r\n\t\t\t\t\t\t\t\t\tchd.push(m[p.children_d[i]].parent);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tchd = $.vakata.array_unique(chd);\r\n\t\t\t\t\t\t\tfor(k = 0, l = chd.length; k < l; k++) {\r\n\t\t\t\t\t\t\t\tp = m[chd[k]];\r\n\t\t\t\t\t\t\t\twhile(p && p.id !== '#') {\r\n\t\t\t\t\t\t\t\t\tc = 0;\r\n\t\t\t\t\t\t\t\t\tfor(i = 0, j = p.children.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\t\t\tc += m[p.children[i]].state.selected;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tif(c === j) {\r\n\t\t\t\t\t\t\t\t\t\tp.state.selected = true;\r\n\t\t\t\t\t\t\t\t\t\tthis._data.core.selected.push(p.id);\r\n\t\t\t\t\t\t\t\t\t\ttmp = this.get_node(p, true);\r\n\t\t\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\r\n\t\t\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').addClass('jstree-clicked');\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tp = this.get_node(p.parent);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tthis._data.core.selected = $.vakata.array_unique(this._data.core.selected);\r\n\t\t\t\t\t\t}, this))\r\n\t\t\t\t\t.on('select_node.jstree', $.proxy(function (e, data) {\r\n\t\t\t\t\t\t\tvar obj = data.node,\r\n\t\t\t\t\t\t\t\tm = this._model.data,\r\n\t\t\t\t\t\t\t\tpar = this.get_node(obj.parent),\r\n\t\t\t\t\t\t\t\tdom = this.get_node(obj, true),\r\n\t\t\t\t\t\t\t\ti, j, c, tmp;\r\n\t\t\t\t\t\t\tthis._data.core.selected = $.vakata.array_unique(this._data.core.selected.concat(obj.children_d));\r\n\r\n\t\t\t\t\t\t\tfor(i = 0, j = obj.children_d.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\ttmp = m[obj.children_d[i]];\r\n\t\t\t\t\t\t\t\ttmp.state.selected = true;\r\n\t\t\t\t\t\t\t\tif(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) {\r\n\t\t\t\t\t\t\t\t\ttmp.original.state.undetermined = false;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\twhile(par && par.id !== '#') {\r\n\t\t\t\t\t\t\t\tc = 0;\r\n\t\t\t\t\t\t\t\tfor(i = 0, j = par.children.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\t\tc += m[par.children[i]].state.selected;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif(c === j) {\r\n\t\t\t\t\t\t\t\t\tpar.state.selected = true;\r\n\t\t\t\t\t\t\t\t\tthis._data.core.selected.push(par.id);\r\n\t\t\t\t\t\t\t\t\ttmp = this.get_node(par, true);\r\n\t\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\r\n\t\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').addClass('jstree-clicked');\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tpar = this.get_node(par.parent);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(dom.length) {\r\n\t\t\t\t\t\t\t\tdom.find('.jstree-anchor').addClass('jstree-clicked');\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}, this))\r\n\t\t\t\t\t.on('deselect_all.jstree', $.proxy(function (e, data) {\r\n\t\t\t\t\t\t\tvar obj = this.get_node('#'),\r\n\t\t\t\t\t\t\t\tm = this._model.data,\r\n\t\t\t\t\t\t\t\ti, j, tmp;\r\n\t\t\t\t\t\t\tfor(i = 0, j = obj.children_d.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\ttmp = m[obj.children_d[i]];\r\n\t\t\t\t\t\t\t\tif(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) {\r\n\t\t\t\t\t\t\t\t\ttmp.original.state.undetermined = false;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}, this))\r\n\t\t\t\t\t.on('deselect_node.jstree', $.proxy(function (e, data) {\r\n\t\t\t\t\t\t\tvar obj = data.node,\r\n\t\t\t\t\t\t\t\tdom = this.get_node(obj, true),\r\n\t\t\t\t\t\t\t\ti, j, tmp;\r\n\t\t\t\t\t\t\tif(obj && obj.original && obj.original.state && obj.original.state.undetermined) {\r\n\t\t\t\t\t\t\t\tobj.original.state.undetermined = false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tfor(i = 0, j = obj.children_d.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\ttmp = this._model.data[obj.children_d[i]];\r\n\t\t\t\t\t\t\t\ttmp.state.selected = false;\r\n\t\t\t\t\t\t\t\tif(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) {\r\n\t\t\t\t\t\t\t\t\ttmp.original.state.undetermined = false;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tfor(i = 0, j = obj.parents.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\ttmp = this._model.data[obj.parents[i]];\r\n\t\t\t\t\t\t\t\ttmp.state.selected = false;\r\n\t\t\t\t\t\t\t\tif(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) {\r\n\t\t\t\t\t\t\t\t\ttmp.original.state.undetermined = false;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\ttmp = this.get_node(obj.parents[i], true);\r\n\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\r\n\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').removeClass('jstree-clicked');\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\ttmp = [];\r\n\t\t\t\t\t\t\tfor(i = 0, j = this._data.core.selected.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\tif($.inArray(this._data.core.selected[i], obj.children_d) === -1 && $.inArray(this._data.core.selected[i], obj.parents) === -1) {\r\n\t\t\t\t\t\t\t\t\ttmp.push(this._data.core.selected[i]);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tthis._data.core.selected = $.vakata.array_unique(tmp);\r\n\t\t\t\t\t\t\tif(dom.length) {\r\n\t\t\t\t\t\t\t\tdom.find('.jstree-anchor').removeClass('jstree-clicked');\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}, this))\r\n\t\t\t\t\t.on('delete_node.jstree', $.proxy(function (e, data) {\r\n\t\t\t\t\t\t\tvar p = this.get_node(data.parent),\r\n\t\t\t\t\t\t\t\tm = this._model.data,\r\n\t\t\t\t\t\t\t\ti, j, c, tmp;\r\n\t\t\t\t\t\t\twhile(p && p.id !== '#') {\r\n\t\t\t\t\t\t\t\tc = 0;\r\n\t\t\t\t\t\t\t\tfor(i = 0, j = p.children.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\t\tc += m[p.children[i]].state.selected;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif(c === j) {\r\n\t\t\t\t\t\t\t\t\tp.state.selected = true;\r\n\t\t\t\t\t\t\t\t\tthis._data.core.selected.push(p.id);\r\n\t\t\t\t\t\t\t\t\ttmp = this.get_node(p, true);\r\n\t\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\r\n\t\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').addClass('jstree-clicked');\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tp = this.get_node(p.parent);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}, this))\r\n\t\t\t\t\t.on('move_node.jstree', $.proxy(function (e, data) {\r\n\t\t\t\t\t\t\tvar is_multi = data.is_multi,\r\n\t\t\t\t\t\t\t\told_par = data.old_parent,\r\n\t\t\t\t\t\t\t\tnew_par = this.get_node(data.parent),\r\n\t\t\t\t\t\t\t\tm = this._model.data,\r\n\t\t\t\t\t\t\t\tp, c, i, j, tmp;\r\n\t\t\t\t\t\t\tif(!is_multi) {\r\n\t\t\t\t\t\t\t\tp = this.get_node(old_par);\r\n\t\t\t\t\t\t\t\twhile(p && p.id !== '#') {\r\n\t\t\t\t\t\t\t\t\tc = 0;\r\n\t\t\t\t\t\t\t\t\tfor(i = 0, j = p.children.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\t\t\tc += m[p.children[i]].state.selected;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tif(c === j) {\r\n\t\t\t\t\t\t\t\t\t\tp.state.selected = true;\r\n\t\t\t\t\t\t\t\t\t\tthis._data.core.selected.push(p.id);\r\n\t\t\t\t\t\t\t\t\t\ttmp = this.get_node(p, true);\r\n\t\t\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\r\n\t\t\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').addClass('jstree-clicked');\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tp = this.get_node(p.parent);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tp = new_par;\r\n\t\t\t\t\t\t\twhile(p && p.id !== '#') {\r\n\t\t\t\t\t\t\t\tc = 0;\r\n\t\t\t\t\t\t\t\tfor(i = 0, j = p.children.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\t\tc += m[p.children[i]].state.selected;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif(c === j) {\r\n\t\t\t\t\t\t\t\t\tif(!p.state.selected) {\r\n\t\t\t\t\t\t\t\t\t\tp.state.selected = true;\r\n\t\t\t\t\t\t\t\t\t\tthis._data.core.selected.push(p.id);\r\n\t\t\t\t\t\t\t\t\t\ttmp = this.get_node(p, true);\r\n\t\t\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\r\n\t\t\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').addClass('jstree-clicked');\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\tif(p.state.selected) {\r\n\t\t\t\t\t\t\t\t\t\tp.state.selected = false;\r\n\t\t\t\t\t\t\t\t\t\tthis._data.core.selected = $.vakata.array_remove_item(this._data.core.selected, p.id);\r\n\t\t\t\t\t\t\t\t\t\ttmp = this.get_node(p, true);\r\n\t\t\t\t\t\t\t\t\t\tif(tmp && tmp.length) {\r\n\t\t\t\t\t\t\t\t\t\t\ttmp.children('.jstree-anchor').removeClass('jstree-clicked');\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tp = this.get_node(p.parent);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}, this));\r\n\t\t\t}\r\n\t\t};\r\n\t\t/**\r\n\t\t * set the undetermined state where and if necessary. Used internally.\r\n\t\t * @private\r\n\t\t * @name _undetermined()\r\n\t\t * @plugin checkbox\r\n\t\t */\r\n\t\tthis._undetermined = function () {\r\n\t\t\tvar i, j, m = this._model.data, s = this._data.core.selected, p = [], t = this;\r\n\t\t\tfor(i = 0, j = s.length; i < j; i++) {\r\n\t\t\t\tif(m[s[i]] && m[s[i]].parents) {\r\n\t\t\t\t\tp = p.concat(m[s[i]].parents);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// attempt for server side undetermined state\r\n\t\t\tthis.element.find('.jstree-closed').not(':has(.jstree-children)')\r\n\t\t\t\t.each(function () {\r\n\t\t\t\t\tvar tmp = t.get_node(this), tmp2;\r\n\t\t\t\t\tif(!tmp.state.loaded) {\r\n\t\t\t\t\t\tif(tmp.original && tmp.original.state && tmp.original.state.undetermined && tmp.original.state.undetermined === true) {\r\n\t\t\t\t\t\t\tp.push(tmp.id);\r\n\t\t\t\t\t\t\tp = p.concat(tmp.parents);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tfor(i = 0, j = tmp.children_d.length; i < j; i++) {\r\n\t\t\t\t\t\t\ttmp2 = m[tmp.children_d[i]];\r\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) {\r\n\t\t\t\t\t\t\t\tp.push(tmp2.id);\r\n\t\t\t\t\t\t\t\tp = p.concat(tmp2.parents);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\tp = $.vakata.array_unique(p);\r\n\t\t\tp = $.vakata.array_remove_item(p,'#');\r\n\r\n\t\t\tthis.element.find('.jstree-undetermined').removeClass('jstree-undetermined');\r\n\t\t\tfor(i = 0, j = p.length; i < j; i++) {\r\n\t\t\t\tif(!m[p[i]].state.selected) {\r\n\t\t\t\t\ts = this.get_node(p[i], true);\r\n\t\t\t\t\tif(s && s.length) {\r\n\t\t\t\t\t\ts.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-undetermined');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\tthis.redraw_node = function(obj, deep, is_callback) {\r\n\t\t\tobj = parent.redraw_node.call(this, obj, deep, is_callback);\r\n\t\t\tif(obj) {\r\n\t\t\t\tvar i, j, tmp = null;\r\n\t\t\t\tfor(i = 0, j = obj.childNodes.length; i < j; i++) {\r\n\t\t\t\t\tif(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf(\"jstree-anchor\") !== -1) {\r\n\t\t\t\t\t\ttmp = obj.childNodes[i];\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(tmp) {\r\n\t\t\t\t\ttmp.insertBefore(_i.cloneNode(false), tmp.childNodes[0]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(!is_callback && this.settings.checkbox.three_state) {\r\n\t\t\t\tif(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); }\r\n\t\t\t\tthis._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50);\r\n\t\t\t}\r\n\t\t\treturn obj;\r\n\t\t};\r\n\t\tthis.activate_node = function (obj, e) {\r\n\t\t\tif(this.settings.checkbox.whole_node || $(e.target).hasClass('jstree-checkbox')) {\r\n\t\t\t\te.ctrlKey = true;\r\n\t\t\t}\r\n\t\t\treturn parent.activate_node.call(this, obj, e);\r\n\t\t};\r\n\t\t/**\r\n\t\t * show the node checkbox icons\r\n\t\t * @name show_checkboxes()\r\n\t\t * @plugin checkbox\r\n\t\t */\r\n\t\tthis.show_checkboxes = function () { this._data.core.themes.checkboxes = true; this.get_container_ul().removeClass(\"jstree-no-checkboxes\"); };\r\n\t\t/**\r\n\t\t * hide the node checkbox icons\r\n\t\t * @name hide_checkboxes()\r\n\t\t * @plugin checkbox\r\n\t\t */\r\n\t\tthis.hide_checkboxes = function () { this._data.core.themes.checkboxes = false; this.get_container_ul().addClass(\"jstree-no-checkboxes\"); };\r\n\t\t/**\r\n\t\t * toggle the node icons\r\n\t\t * @name toggle_checkboxes()\r\n\t\t * @plugin checkbox\r\n\t\t */\r\n\t\tthis.toggle_checkboxes = function () { if(this._data.core.themes.checkboxes) { this.hide_checkboxes(); } else { this.show_checkboxes(); } };\r\n\t};\r\n\r\n\t// include the checkbox plugin by default\r\n\t// $.jstree.defaults.plugins.push(\"checkbox\");\r\n\r\n/**\r\n * ### Contextmenu plugin\r\n *\r\n * Shows a context menu when a node is right-clicked.\r\n */\r\n// TODO: move logic outside of function + check multiple move\r\n\r\n\t/**\r\n\t * stores all defaults for the contextmenu plugin\r\n\t * @name $.jstree.defaults.contextmenu\r\n\t * @plugin contextmenu\r\n\t */\r\n\t$.jstree.defaults.contextmenu = {\r\n\t\t/**\r\n\t\t * a boolean indicating if the node should be selected when the context menu is invoked on it. Defaults to `true`.\r\n\t\t * @name $.jstree.defaults.contextmenu.select_node\r\n\t\t * @plugin contextmenu\r\n\t\t */\r\n\t\tselect_node : true,\r\n\t\t/**\r\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.\r\n\t\t * @name $.jstree.defaults.contextmenu.show_at_node\r\n\t\t * @plugin contextmenu\r\n\t\t */\r\n\t\tshow_at_node : true,\r\n\t\t/**\r\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).\r\n\t\t * \r\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):\r\n\t\t * \r\n\t\t * * `separator_before` - a boolean indicating if there should be a separator before this item\r\n\t\t * * `separator_after` - a boolean indicating if there should be a separator after this item\r\n\t\t * * `_disabled` - a boolean indicating if this action should be disabled\r\n\t\t * * `label` - a string - the name of the action (could be a function returning a string)\r\n\t\t * * `action` - a function to be executed if this item is chosen\r\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\r\n\t\t * * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2)\r\n\t\t * * `shortcut_label` - shortcut label (like for example `F2` for rename)\r\n\t\t * \r\n\t\t * @name $.jstree.defaults.contextmenu.items\r\n\t\t * @plugin contextmenu\r\n\t\t */\r\n\t\titems : function (o, cb) { // Could be an object directly\r\n\t\t\treturn {\r\n\t\t\t\t\"create\" : {\r\n\t\t\t\t\t\"separator_before\"\t: false,\r\n\t\t\t\t\t\"separator_after\"\t: true,\r\n\t\t\t\t\t\"_disabled\"\t\t\t: false, //(this.check(\"create_node\", data.reference, {}, \"last\")),\r\n\t\t\t\t\t\"label\"\t\t\t\t: \"Create\",\r\n\t\t\t\t\t\"action\"\t\t\t: function (data) {\r\n\t\t\t\t\t\tvar inst = $.jstree.reference(data.reference),\r\n\t\t\t\t\t\t\tobj = inst.get_node(data.reference);\r\n\t\t\t\t\t\tinst.create_node(obj, {}, \"last\", function (new_node) {\r\n\t\t\t\t\t\t\tsetTimeout(function () { inst.edit(new_node); },0);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\t\"rename\" : {\r\n\t\t\t\t\t\"separator_before\"\t: false,\r\n\t\t\t\t\t\"separator_after\"\t: false,\r\n\t\t\t\t\t\"_disabled\"\t\t\t: false, //(this.check(\"rename_node\", data.reference, this.get_parent(data.reference), \"\")),\r\n\t\t\t\t\t\"label\"\t\t\t\t: \"Rename\",\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t\"shortcut\"\t\t\t: 113,\r\n\t\t\t\t\t\"shortcut_label\"\t: 'F2',\r\n\t\t\t\t\t\"icon\"\t\t\t\t: \"glyphicon glyphicon-leaf\",\r\n\t\t\t\t\t*/\r\n\t\t\t\t\t\"action\"\t\t\t: function (data) {\r\n\t\t\t\t\t\tvar inst = $.jstree.reference(data.reference),\r\n\t\t\t\t\t\t\tobj = inst.get_node(data.reference);\r\n\t\t\t\t\t\tinst.edit(obj);\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\t\"remove\" : {\r\n\t\t\t\t\t\"separator_before\"\t: false,\r\n\t\t\t\t\t\"icon\"\t\t\t\t: false,\r\n\t\t\t\t\t\"separator_after\"\t: false,\r\n\t\t\t\t\t\"_disabled\"\t\t\t: false, //(this.check(\"delete_node\", data.reference, this.get_parent(data.reference), \"\")),\r\n\t\t\t\t\t\"label\"\t\t\t\t: \"Delete\",\r\n\t\t\t\t\t\"action\"\t\t\t: function (data) {\r\n\t\t\t\t\t\tvar inst = $.jstree.reference(data.reference),\r\n\t\t\t\t\t\t\tobj = inst.get_node(data.reference);\r\n\t\t\t\t\t\tif(inst.is_selected(obj)) {\r\n\t\t\t\t\t\t\tinst.delete_node(inst.get_selected());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tinst.delete_node(obj);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\t\"ccp\" : {\r\n\t\t\t\t\t\"separator_before\"\t: true,\r\n\t\t\t\t\t\"icon\"\t\t\t\t: false,\r\n\t\t\t\t\t\"separator_after\"\t: false,\r\n\t\t\t\t\t\"label\"\t\t\t\t: \"Edit\",\r\n\t\t\t\t\t\"action\"\t\t\t: false,\r\n\t\t\t\t\t\"submenu\" : {\r\n\t\t\t\t\t\t\"cut\" : {\r\n\t\t\t\t\t\t\t\"separator_before\"\t: false,\r\n\t\t\t\t\t\t\t\"separator_after\"\t: false,\r\n\t\t\t\t\t\t\t\"label\"\t\t\t\t: \"Cut\",\r\n\t\t\t\t\t\t\t\"action\"\t\t\t: function (data) {\r\n\t\t\t\t\t\t\t\tvar inst = $.jstree.reference(data.reference),\r\n\t\t\t\t\t\t\t\t\tobj = inst.get_node(data.reference);\r\n\t\t\t\t\t\t\t\tif(inst.is_selected(obj)) {\r\n\t\t\t\t\t\t\t\t\tinst.cut(inst.get_selected());\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\tinst.cut(obj);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\"copy\" : {\r\n\t\t\t\t\t\t\t\"separator_before\"\t: false,\r\n\t\t\t\t\t\t\t\"icon\"\t\t\t\t: false,\r\n\t\t\t\t\t\t\t\"separator_after\"\t: false,\r\n\t\t\t\t\t\t\t\"label\"\t\t\t\t: \"Copy\",\r\n\t\t\t\t\t\t\t\"action\"\t\t\t: function (data) {\r\n\t\t\t\t\t\t\t\tvar inst = $.jstree.reference(data.reference),\r\n\t\t\t\t\t\t\t\t\tobj = inst.get_node(data.reference);\r\n\t\t\t\t\t\t\t\tif(inst.is_selected(obj)) {\r\n\t\t\t\t\t\t\t\t\tinst.copy(inst.get_selected());\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\tinst.copy(obj);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\"paste\" : {\r\n\t\t\t\t\t\t\t\"separator_before\"\t: false,\r\n\t\t\t\t\t\t\t\"icon\"\t\t\t\t: false,\r\n\t\t\t\t\t\t\t\"_disabled\"\t\t\t: function (data) {\r\n\t\t\t\t\t\t\t\treturn !$.jstree.reference(data.reference).can_paste();\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\"separator_after\"\t: false,\r\n\t\t\t\t\t\t\t\"label\"\t\t\t\t: \"Paste\",\r\n\t\t\t\t\t\t\t\"action\"\t\t\t: function (data) {\r\n\t\t\t\t\t\t\t\tvar inst = $.jstree.reference(data.reference),\r\n\t\t\t\t\t\t\t\t\tobj = inst.get_node(data.reference);\r\n\t\t\t\t\t\t\t\tinst.paste(obj);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t}\r\n\t};\r\n\r\n\t$.jstree.plugins.contextmenu = function (options, parent) {\r\n\t\tthis.bind = function () {\r\n\t\t\tparent.bind.call(this);\r\n\r\n\t\t\tvar last_ts = 0;\r\n\t\t\tthis.element\r\n\t\t\t\t.on(\"contextmenu.jstree\", \".jstree-anchor\", $.proxy(function (e) {\r\n\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\tlast_ts = e.ctrlKey ? e.timeStamp : 0;\r\n\t\t\t\t\t\tif(!this.is_loading(e.currentTarget)) {\r\n\t\t\t\t\t\t\tthis.show_contextmenu(e.currentTarget, e.pageX, e.pageY, e);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, this))\r\n\t\t\t\t.on(\"click.jstree\", \".jstree-anchor\", $.proxy(function (e) {\r\n\t\t\t\t\t\tif(this._data.contextmenu.visible && (!last_ts || e.timeStamp - last_ts > 250)) { // work around safari & macOS ctrl+click\r\n\t\t\t\t\t\t\t$.vakata.context.hide();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, this));\r\n\t\t\t/*\r\n\t\t\tif(!('oncontextmenu' in document.body) && ('ontouchstart' in document.body)) {\r\n\t\t\t\tvar el = null, tm = null;\r\n\t\t\t\tthis.element\r\n\t\t\t\t\t.on(\"touchstart\", \".jstree-anchor\", function (e) {\r\n\t\t\t\t\t\tel = e.currentTarget;\r\n\t\t\t\t\t\ttm = +new Date();\r\n\t\t\t\t\t\t$(document).one(\"touchend\", function (e) {\r\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);\r\n\t\t\t\t\t\t\te.currentTarget = e.target;\r\n\t\t\t\t\t\t\ttm = ((+(new Date())) - tm);\r\n\t\t\t\t\t\t\tif(e.target === el && tm > 600 && tm < 1000) {\r\n\t\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t\t$(el).trigger('contextmenu', e);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tel = null;\r\n\t\t\t\t\t\t\ttm = null;\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t*/\r\n\t\t\t$(document).on(\"context_hide.vakata\", $.proxy(function () { this._data.contextmenu.visible = false; }, this));\r\n\t\t};\r\n\t\tthis.teardown = function () {\r\n\t\t\tif(this._data.contextmenu.visible) {\r\n\t\t\t\t$.vakata.context.hide();\r\n\t\t\t}\r\n\t\t\tparent.teardown.call(this);\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * prepare and show the context menu for a node\r\n\t\t * @name show_contextmenu(obj [, x, y])\r\n\t\t * @param {mixed} obj the node\r\n\t\t * @param {Number} x the x-coordinate relative to the document to show the menu at\r\n\t\t * @param {Number} y the y-coordinate relative to the document to show the menu at\r\n\t\t * @param {Object} e the event if available that triggered the contextmenu\r\n\t\t * @plugin contextmenu\r\n\t\t * @trigger show_contextmenu.jstree\r\n\t\t */\r\n\t\tthis.show_contextmenu = function (obj, x, y, e) {\r\n\t\t\tobj = this.get_node(obj);\r\n\t\t\tif(!obj || obj.id === '#') { return false; }\r\n\t\t\tvar s = this.settings.contextmenu,\r\n\t\t\t\td = this.get_node(obj, true),\r\n\t\t\t\ta = d.children(\".jstree-anchor\"),\r\n\t\t\t\to = false,\r\n\t\t\t\ti = false;\r\n\t\t\tif(s.show_at_node || x === undefined || y === undefined) {\r\n\t\t\t\to = a.offset();\r\n\t\t\t\tx = o.left;\r\n\t\t\t\ty = o.top + this._data.core.li_height;\r\n\t\t\t}\r\n\t\t\tif(this.settings.contextmenu.select_node && !this.is_selected(obj)) {\r\n\t\t\t\tthis.activate_node(obj, e);\r\n\t\t\t}\r\n\r\n\t\t\ti = s.items;\r\n\t\t\tif($.isFunction(i)) {\r\n\t\t\t\ti = i.call(this, obj, $.proxy(function (i) {\r\n\t\t\t\t\tthis._show_contextmenu(obj, x, y, i);\r\n\t\t\t\t}, this));\r\n\t\t\t}\r\n\t\t\tif($.isPlainObject(i)) {\r\n\t\t\t\tthis._show_contextmenu(obj, x, y, i);\r\n\t\t\t}\r\n\t\t};\r\n\t\t/**\r\n\t\t * show the prepared context menu for a node\r\n\t\t * @name _show_contextmenu(obj, x, y, i)\r\n\t\t * @param {mixed} obj the node\r\n\t\t * @param {Number} x the x-coordinate relative to the document to show the menu at\r\n\t\t * @param {Number} y the y-coordinate relative to the document to show the menu at\r\n\t\t * @param {Number} i the object of items to show\r\n\t\t * @plugin contextmenu\r\n\t\t * @trigger show_contextmenu.jstree\r\n\t\t * @private\r\n\t\t */\r\n\t\tthis._show_contextmenu = function (obj, x, y, i) {\r\n\t\t\tvar d = this.get_node(obj, true),\r\n\t\t\t\ta = d.children(\".jstree-anchor\");\r\n\t\t\t$(document).one(\"context_show.vakata\", $.proxy(function (e, data) {\r\n\t\t\t\tvar cls = 'jstree-contextmenu jstree-' + this.get_theme() + '-contextmenu';\r\n\t\t\t\t$(data.element).addClass(cls);\r\n\t\t\t}, this));\r\n\t\t\tthis._data.contextmenu.visible = true;\r\n\t\t\t$.vakata.context.show(a, { 'x' : x, 'y' : y }, i);\r\n\t\t\t/**\r\n\t\t\t * triggered when the contextmenu is shown for a node\r\n\t\t\t * @event\r\n\t\t\t * @name show_contextmenu.jstree\r\n\t\t\t * @param {Object} node the node\r\n\t\t\t * @param {Number} x the x-coordinate of the menu relative to the document\r\n\t\t\t * @param {Number} y the y-coordinate of the menu relative to the document\r\n\t\t\t * @plugin contextmenu\r\n\t\t\t */\r\n\t\t\tthis.trigger('show_contextmenu', { \"node\" : obj, \"x\" : x, \"y\" : y });\r\n\t\t};\r\n\t};\r\n\r\n\t// contextmenu helper\r\n\t(function ($) {\r\n\t\tvar right_to_left = false,\r\n\t\t\tvakata_context = {\r\n\t\t\t\telement\t\t: false,\r\n\t\t\t\treference\t: false,\r\n\t\t\t\tposition_x\t: 0,\r\n\t\t\t\tposition_y\t: 0,\r\n\t\t\t\titems\t\t: [],\r\n\t\t\t\thtml\t\t: \"\",\r\n\t\t\t\tis_visible\t: false\r\n\t\t\t};\r\n\r\n\t\t$.vakata.context = {\r\n\t\t\tsettings : {\r\n\t\t\t\thide_onmouseleave\t: 0,\r\n\t\t\t\ticons\t\t\t\t: true\r\n\t\t\t},\r\n\t\t\t_trigger : function (event_name) {\r\n\t\t\t\t$(document).triggerHandler(\"context_\" + event_name + \".vakata\", {\r\n\t\t\t\t\t\"reference\"\t: vakata_context.reference,\r\n\t\t\t\t\t\"element\"\t: vakata_context.element,\r\n\t\t\t\t\t\"position\"\t: {\r\n\t\t\t\t\t\t\"x\" : vakata_context.position_x,\r\n\t\t\t\t\t\t\"y\" : vakata_context.position_y\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t\t_execute : function (i) {\r\n\t\t\t\ti = vakata_context.items[i];\r\n\t\t\t\treturn i && (!i._disabled || ($.isFunction(i._disabled) && !i._disabled({ \"item\" : i, \"reference\" : vakata_context.reference, \"element\" : vakata_context.element }))) && i.action ? i.action.call(null, {\r\n\t\t\t\t\t\t\t\"item\"\t\t: i,\r\n\t\t\t\t\t\t\t\"reference\"\t: vakata_context.reference,\r\n\t\t\t\t\t\t\t\"element\"\t: vakata_context.element,\r\n\t\t\t\t\t\t\t\"position\"\t: {\r\n\t\t\t\t\t\t\t\t\"x\" : vakata_context.position_x,\r\n\t\t\t\t\t\t\t\t\"y\" : vakata_context.position_y\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}) : false;\r\n\t\t\t},\r\n\t\t\t_parse : function (o, is_callback) {\r\n\t\t\t\tif(!o) { return false; }\r\n\t\t\t\tif(!is_callback) {\r\n\t\t\t\t\tvakata_context.html\t\t= \"\";\r\n\t\t\t\t\tvakata_context.items\t= [];\r\n\t\t\t\t}\r\n\t\t\t\tvar str = \"\",\r\n\t\t\t\t\tsep = false,\r\n\t\t\t\t\ttmp;\r\n\r\n\t\t\t\tif(is_callback) { str += \"<\"+\"ul>\"; }\r\n\t\t\t\t$.each(o, function (i, val) {\r\n\t\t\t\t\tif(!val) { return true; }\r\n\t\t\t\t\tvakata_context.items.push(val);\r\n\t\t\t\t\tif(!sep && val.separator_before) {\r\n\t\t\t\t\t\tstr += \"<\"+\"li class='vakata-context-separator'><\"+\"a href='#' \" + ($.vakata.context.settings.icons ? '' : 'style=\"margin-left:0px;\"') + \"> <\"+\"/a><\"+\"/li>\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsep = false;\r\n\t\t\t\t\tstr += \"<\"+\"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+\"' \":'')+\">\";\r\n\t\t\t\t\tstr += \"<\"+\"a href='#' rel='\" + (vakata_context.items.length - 1) + \"'>\";\r\n\t\t\t\t\tif($.vakata.context.settings.icons) {\r\n\t\t\t\t\t\tstr += \"<\"+\"i \";\r\n\t\t\t\t\t\tif(val.icon) {\r\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' \"; }\r\n\t\t\t\t\t\t\telse { str += \" class='\" + val.icon + \"' \"; }\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tstr += \"><\"+\"/i><\"+\"span class='vakata-contextmenu-sep'> <\"+\"/span>\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tstr += ($.isFunction(val.label) ? val.label({ \"item\" : i, \"reference\" : vakata_context.reference, \"element\" : vakata_context.element }) : val.label) + (val.shortcut?' ':'') + \"<\"+\"/a>\";\r\n\t\t\t\t\tif(val.submenu) {\r\n\t\t\t\t\t\ttmp = $.vakata.context._parse(val.submenu, true);\r\n\t\t\t\t\t\tif(tmp) { str += tmp; }\r\n\t\t\t\t\t}\r\n\t\t\t\t\tstr += \"<\"+\"/li>\";\r\n\t\t\t\t\tif(val.separator_after) {\r\n\t\t\t\t\t\tstr += \"<\"+\"li class='vakata-context-separator'><\"+\"a href='#' \" + ($.vakata.context.settings.icons ? '' : 'style=\"margin-left:0px;\"') + \"> <\"+\"/a><\"+\"/li>\";\r\n\t\t\t\t\t\tsep = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\tstr = str.replace(/<\\/li\\>$/,\"\");\r\n\t\t\t\tif(is_callback) { str += \"\"; }\r\n\t\t\t\t/**\r\n\t\t\t\t * triggered on the document when the contextmenu is parsed (HTML is built)\r\n\t\t\t\t * @event\r\n\t\t\t\t * @plugin contextmenu\r\n\t\t\t\t * @name context_parse.vakata\r\n\t\t\t\t * @param {jQuery} reference the element that was right clicked\r\n\t\t\t\t * @param {jQuery} element the DOM element of the menu itself\r\n\t\t\t\t * @param {Object} position the x & y coordinates of the menu\r\n\t\t\t\t */\r\n\t\t\t\tif(!is_callback) { vakata_context.html = str; $.vakata.context._trigger(\"parse\"); }\r\n\t\t\t\treturn str.length > 10 ? str : false;\r\n\t\t\t},\r\n\t\t\t_show_submenu : function (o) {\r\n\t\t\t\to = $(o);\r\n\t\t\t\tif(!o.length || !o.children(\"ul\").length) { return; }\r\n\t\t\t\tvar e = o.children(\"ul\"),\r\n\t\t\t\t\tx = o.offset().left + o.outerWidth(),\r\n\t\t\t\t\ty = o.offset().top,\r\n\t\t\t\t\tw = e.width(),\r\n\t\t\t\t\th = e.height(),\r\n\t\t\t\t\tdw = $(window).width() + $(window).scrollLeft(),\r\n\t\t\t\t\tdh = $(window).height() + $(window).scrollTop();\r\n\t\t\t\t// може да се спести е една проверка - дали няма някой от класовете вече нагоре\r\n\t\t\t\tif(right_to_left) {\r\n\t\t\t\t\to[x - (w + 10 + o.outerWidth()) < 0 ? \"addClass\" : \"removeClass\"](\"vakata-context-left\");\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\to[x + w + 10 > dw ? \"addClass\" : \"removeClass\"](\"vakata-context-right\");\r\n\t\t\t\t}\r\n\t\t\t\tif(y + h + 10 > dh) {\r\n\t\t\t\t\te.css(\"bottom\",\"-1px\");\r\n\t\t\t\t}\r\n\t\t\t\te.show();\r\n\t\t\t},\r\n\t\t\tshow : function (reference, position, data) {\r\n\t\t\t\tvar o, e, x, y, w, h, dw, dh, cond = true;\r\n\t\t\t\tif(vakata_context.element && vakata_context.element.length) {\r\n\t\t\t\t\tvakata_context.element.width('');\r\n\t\t\t\t}\r\n\t\t\t\tswitch(cond) {\r\n\t\t\t\t\tcase (!position && !reference):\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\tcase (!!position && !!reference):\r\n\t\t\t\t\t\tvakata_context.reference\t= reference;\r\n\t\t\t\t\t\tvakata_context.position_x\t= position.x;\r\n\t\t\t\t\t\tvakata_context.position_y\t= position.y;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase (!position && !!reference):\r\n\t\t\t\t\t\tvakata_context.reference\t= reference;\r\n\t\t\t\t\t\to = reference.offset();\r\n\t\t\t\t\t\tvakata_context.position_x\t= o.left + reference.outerHeight();\r\n\t\t\t\t\t\tvakata_context.position_y\t= o.top;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase (!!position && !reference):\r\n\t\t\t\t\t\tvakata_context.position_x\t= position.x;\r\n\t\t\t\t\t\tvakata_context.position_y\t= position.y;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tif(!!reference && !data && $(reference).data('vakata_contextmenu')) {\r\n\t\t\t\t\tdata = $(reference).data('vakata_contextmenu');\r\n\t\t\t\t}\r\n\t\t\t\tif($.vakata.context._parse(data)) {\r\n\t\t\t\t\tvakata_context.element.html(vakata_context.html);\r\n\t\t\t\t}\r\n\t\t\t\tif(vakata_context.items.length) {\r\n\t\t\t\t\te = vakata_context.element;\r\n\t\t\t\t\tx = vakata_context.position_x;\r\n\t\t\t\t\ty = vakata_context.position_y;\r\n\t\t\t\t\tw = e.width();\r\n\t\t\t\t\th = e.height();\r\n\t\t\t\t\tdw = $(window).width() + $(window).scrollLeft();\r\n\t\t\t\t\tdh = $(window).height() + $(window).scrollTop();\r\n\t\t\t\t\tif(right_to_left) {\r\n\t\t\t\t\t\tx -= e.outerWidth();\r\n\t\t\t\t\t\tif(x < $(window).scrollLeft() + 20) {\r\n\t\t\t\t\t\t\tx = $(window).scrollLeft() + 20;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(x + w + 20 > dw) {\r\n\t\t\t\t\t\tx = dw - (w + 20);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(y + h + 20 > dh) {\r\n\t\t\t\t\t\ty = dh - (h + 20);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvakata_context.element\r\n\t\t\t\t\t\t.css({ \"left\" : x, \"top\" : y })\r\n\t\t\t\t\t\t.show()\r\n\t\t\t\t\t\t.find('a:eq(0)').focus().parent().addClass(\"vakata-context-hover\");\r\n\t\t\t\t\tvakata_context.is_visible = true;\r\n\t\t\t\t\t/**\r\n\t\t\t\t\t * triggered on the document when the contextmenu is shown\r\n\t\t\t\t\t * @event\r\n\t\t\t\t\t * @plugin contextmenu\r\n\t\t\t\t\t * @name context_show.vakata\r\n\t\t\t\t\t * @param {jQuery} reference the element that was right clicked\r\n\t\t\t\t\t * @param {jQuery} element the DOM element of the menu itself\r\n\t\t\t\t\t * @param {Object} position the x & y coordinates of the menu\r\n\t\t\t\t\t */\r\n\t\t\t\t\t$.vakata.context._trigger(\"show\");\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\thide : function () {\r\n\t\t\t\tif(vakata_context.is_visible) {\r\n\t\t\t\t\tvakata_context.element.hide().find(\"ul\").hide().end().find(':focus').blur();\r\n\t\t\t\t\tvakata_context.is_visible = false;\r\n\t\t\t\t\t/**\r\n\t\t\t\t\t * triggered on the document when the contextmenu is hidden\r\n\t\t\t\t\t * @event\r\n\t\t\t\t\t * @plugin contextmenu\r\n\t\t\t\t\t * @name context_hide.vakata\r\n\t\t\t\t\t * @param {jQuery} reference the element that was right clicked\r\n\t\t\t\t\t * @param {jQuery} element the DOM element of the menu itself\r\n\t\t\t\t\t * @param {Object} position the x & y coordinates of the menu\r\n\t\t\t\t\t */\r\n\t\t\t\t\t$.vakata.context._trigger(\"hide\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\t$(function () {\r\n\t\t\tright_to_left = $(\"body\").css(\"direction\") === \"rtl\";\r\n\t\t\tvar to = false;\r\n\r\n\t\t\tvakata_context.element = $(\"\");\r\n\t\t\tvakata_context.element\r\n\t\t\t\t.on(\"mouseenter\", \"li\", function (e) {\r\n\t\t\t\t\te.stopImmediatePropagation();\r\n\r\n\t\t\t\t\tif($.contains(this, e.relatedTarget)) {\r\n\t\t\t\t\t\t// премахнато заради delegate mouseleave по-долу\r\n\t\t\t\t\t\t// $(this).find(\".vakata-context-hover\").removeClass(\"vakata-context-hover\");\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(to) { clearTimeout(to); }\r\n\t\t\t\t\tvakata_context.element.find(\".vakata-context-hover\").removeClass(\"vakata-context-hover\").end();\r\n\r\n\t\t\t\t\t$(this)\r\n\t\t\t\t\t\t.siblings().find(\"ul\").hide().end().end()\r\n\t\t\t\t\t\t.parentsUntil(\".vakata-context\", \"li\").addBack().addClass(\"vakata-context-hover\");\r\n\t\t\t\t\t$.vakata.context._show_submenu(this);\r\n\t\t\t\t})\r\n\t\t\t\t// тестово - дали не натоварва?\r\n\t\t\t\t.on(\"mouseleave\", \"li\", function (e) {\r\n\t\t\t\t\tif($.contains(this, e.relatedTarget)) { return; }\r\n\t\t\t\t\t$(this).find(\".vakata-context-hover\").addBack().removeClass(\"vakata-context-hover\");\r\n\t\t\t\t})\r\n\t\t\t\t.on(\"mouseleave\", function (e) {\r\n\t\t\t\t\t$(this).find(\".vakata-context-hover\").removeClass(\"vakata-context-hover\");\r\n\t\t\t\t\tif($.vakata.context.settings.hide_onmouseleave) {\r\n\t\t\t\t\t\tto = setTimeout(\r\n\t\t\t\t\t\t\t(function (t) {\r\n\t\t\t\t\t\t\t\treturn function () { $.vakata.context.hide(); };\r\n\t\t\t\t\t\t\t}(this)), $.vakata.context.settings.hide_onmouseleave);\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\t.on(\"click\", \"a\", function (e) {\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\t})\r\n\t\t\t\t.on(\"mouseup\", \"a\", function (e) {\r\n\t\t\t\t\tif(!$(this).blur().parent().hasClass(\"vakata-context-disabled\") && $.vakata.context._execute($(this).attr(\"rel\")) !== false) {\r\n\t\t\t\t\t\t$.vakata.context.hide();\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\t.on('keydown', 'a', function (e) {\r\n\t\t\t\t\t\tvar o = null;\r\n\t\t\t\t\t\tswitch(e.which) {\r\n\t\t\t\t\t\t\tcase 13:\r\n\t\t\t\t\t\t\tcase 32:\r\n\t\t\t\t\t\t\t\te.type = \"mouseup\";\r\n\t\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t\t$(e.currentTarget).trigger(e);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 37:\r\n\t\t\t\t\t\t\t\tif(vakata_context.is_visible) {\r\n\t\t\t\t\t\t\t\t\tvakata_context.element.find(\".vakata-context-hover\").last().parents(\"li:eq(0)\").find(\"ul\").hide().find(\".vakata-context-hover\").removeClass(\"vakata-context-hover\").end().end().children('a').focus();\r\n\t\t\t\t\t\t\t\t\te.stopImmediatePropagation();\r\n\t\t\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 38:\r\n\t\t\t\t\t\t\t\tif(vakata_context.is_visible) {\r\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();\r\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(); }\r\n\t\t\t\t\t\t\t\t\to.addClass(\"vakata-context-hover\").children('a').focus();\r\n\t\t\t\t\t\t\t\t\te.stopImmediatePropagation();\r\n\t\t\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 39:\r\n\t\t\t\t\t\t\t\tif(vakata_context.is_visible) {\r\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').focus();\r\n\t\t\t\t\t\t\t\t\te.stopImmediatePropagation();\r\n\t\t\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 40:\r\n\t\t\t\t\t\t\t\tif(vakata_context.is_visible) {\r\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();\r\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(); }\r\n\t\t\t\t\t\t\t\t\to.addClass(\"vakata-context-hover\").children('a').focus();\r\n\t\t\t\t\t\t\t\t\te.stopImmediatePropagation();\r\n\t\t\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase 27:\r\n\t\t\t\t\t\t\t\t$.vakata.context.hide();\r\n\t\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\t//console.log(e.which);\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t})\r\n\t\t\t\t.on('keydown', function (e) {\r\n\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\tvar a = vakata_context.element.find('.vakata-contextmenu-shortcut-' + e.which).parent();\r\n\t\t\t\t\tif(a.parent().not('.vakata-context-disabled')) {\r\n\t\t\t\t\t\ta.mouseup();\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\t.appendTo(\"body\");\r\n\r\n\t\t\t$(document)\r\n\t\t\t\t.on(\"mousedown\", function (e) {\r\n\t\t\t\t\tif(vakata_context.is_visible && !$.contains(vakata_context.element[0], e.target)) { $.vakata.context.hide(); }\r\n\t\t\t\t})\r\n\t\t\t\t.on(\"context_show.vakata\", function (e, data) {\r\n\t\t\t\t\tvakata_context.element.find(\"li:has(ul)\").children(\"a\").addClass(\"vakata-context-parent\");\r\n\t\t\t\t\tif(right_to_left) {\r\n\t\t\t\t\t\tvakata_context.element.addClass(\"vakata-context-rtl\").css(\"direction\", \"rtl\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// also apply a RTL class?\r\n\t\t\t\t\tvakata_context.element.find(\"ul\").hide().end();\r\n\t\t\t\t});\r\n\t\t});\r\n\t}($));\r\n\t// $.jstree.defaults.plugins.push(\"contextmenu\");\r\n\r\n/**\r\n * ### Drag'n'drop plugin\r\n *\r\n * Enables dragging and dropping of nodes in the tree, resulting in a move or copy operations.\r\n */\r\n\r\n\t/**\r\n\t * stores all defaults for the drag'n'drop plugin\r\n\t * @name $.jstree.defaults.dnd\r\n\t * @plugin dnd\r\n\t */\r\n\t$.jstree.defaults.dnd = {\r\n\t\t/**\r\n\t\t * a boolean indicating if a copy should be possible while dragging (by pressint the meta key or Ctrl). Defaults to `true`.\r\n\t\t * @name $.jstree.defaults.dnd.copy\r\n\t\t * @plugin dnd\r\n\t\t */\r\n\t\tcopy : true,\r\n\t\t/**\r\n\t\t * a number indicating how long a node should remain hovered while dragging to be opened. Defaults to `500`.\r\n\t\t * @name $.jstree.defaults.dnd.open_timeout\r\n\t\t * @plugin dnd\r\n\t\t */\r\n\t\topen_timeout : 500,\r\n\t\t/**\r\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) - return `false` to prevent dragging\r\n\t\t * @name $.jstree.defaults.dnd.is_draggable\r\n\t\t * @plugin dnd\r\n\t\t */\r\n\t\tis_draggable : true,\r\n\t\t/**\r\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`\r\n\t\t * @name $.jstree.defaults.dnd.check_while_dragging\r\n\t\t * @plugin dnd\r\n\t\t */\r\n\t\tcheck_while_dragging : true,\r\n\t\t/**\r\n\t\t * a boolean indicating if nodes from this tree should only be copied with dnd (as opposed to moved), default is `false`\r\n\t\t * @name $.jstree.defaults.dnd.always_copy\r\n\t\t * @plugin dnd\r\n\t\t */\r\n\t\talways_copy : false,\r\n\t\t/**\r\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`\r\n\t\t * @name $.jstree.defaults.dnd.inside_pos\r\n\t\t * @plugin dnd\r\n\t\t */\r\n\t\tinside_pos : 0\r\n\t};\r\n\t// TODO: now check works by checking for each node individually, how about max_children, unique, etc?\r\n\t// TODO: drop somewhere else - maybe demo only?\r\n\t$.jstree.plugins.dnd = function (options, parent) {\r\n\t\tthis.bind = function () {\r\n\t\t\tparent.bind.call(this);\r\n\r\n\t\t\tthis.element\r\n\t\t\t\t.on('mousedown.jstree touchstart.jstree', '.jstree-anchor', $.proxy(function (e) {\r\n\t\t\t\t\tvar obj = this.get_node(e.target),\r\n\t\t\t\t\t\tmlt = this.is_selected(obj) ? this.get_selected().length : 1;\r\n\t\t\t\t\tif(obj && obj.id && obj.id !== \"#\" && (e.which === 1 || e.type === \"touchstart\") &&\r\n\t\t\t\t\t\t(this.settings.dnd.is_draggable === true || ($.isFunction(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_selected(true) : [obj]))))\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tthis.element.trigger('mousedown.jstree');\r\n\t\t\t\t\t\treturn $.vakata.dnd.start(e, { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_selected() : [obj.id] }, '' + (mlt > 1 ? mlt + ' ' + this.get_string('nodes') : this.get_text(e.currentTarget, true)) + '+
');\r\n\t\t\t\t\t}\r\n\t\t\t\t}, this));\r\n\t\t};\r\n\t};\r\n\r\n\t$(function() {\r\n\t\t// bind only once for all instances\r\n\t\tvar lastmv = false,\r\n\t\t\tlaster = false,\r\n\t\t\topento = false,\r\n\t\t\tmarker = $('
').hide().appendTo('body');\r\n\r\n\t\t$(document)\r\n\t\t\t.bind('dnd_start.vakata', function (e, data) {\r\n\t\t\t\tlastmv = false;\r\n\t\t\t})\r\n\t\t\t.bind('dnd_move.vakata', function (e, data) {\r\n\t\t\t\tif(opento) { clearTimeout(opento); }\r\n\t\t\t\tif(!data.data.jstree) { return; }\r\n\r\n\t\t\t\t// if we are hovering the marker image do nothing (can happen on \"inside\" drags)\r\n\t\t\t\tif(data.event.target.id && data.event.target.id === 'jstree-marker') {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar ins = $.jstree.reference(data.event.target),\r\n\t\t\t\t\tref = false,\r\n\t\t\t\t\toff = false,\r\n\t\t\t\t\trel = false,\r\n\t\t\t\t\tl, t, h, p, i, o, ok, t1, t2, op, ps, pr, ip, tm;\r\n\t\t\t\t// if we are over an instance\r\n\t\t\t\tif(ins && ins._data && ins._data.dnd) {\r\n\t\t\t\t\tmarker.attr('class', 'jstree-' + ins.get_theme());\r\n\t\t\t\t\tdata.helper\r\n\t\t\t\t\t\t.children().attr('class', 'jstree-' + ins.get_theme())\r\n\t\t\t\t\t\t.find('.jstree-copy:eq(0)')[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? 'show' : 'hide' ]();\r\n\r\n\r\n\t\t\t\t\t// if are hovering the container itself add a new root node\r\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) {\r\n\t\t\t\t\t\tok = true;\r\n\t\t\t\t\t\tfor(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) {\r\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]), '#', 'last', { 'dnd' : true, 'ref' : ins.get_node('#'), 'pos' : 'i', 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) });\r\n\t\t\t\t\t\t\tif(!ok) { break; }\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(ok) {\r\n\t\t\t\t\t\t\tlastmv = { 'ins' : ins, 'par' : '#', 'pos' : 'last' };\r\n\t\t\t\t\t\t\tmarker.hide();\r\n\t\t\t\t\t\t\tdata.helper.find('.jstree-icon:eq(0)').removeClass('jstree-er').addClass('jstree-ok');\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t// if we are hovering a tree node\r\n\t\t\t\t\t\tref = $(data.event.target).closest('.jstree-anchor');\r\n\t\t\t\t\t\tif(ref && ref.length && ref.parent().is('.jstree-closed, .jstree-open, .jstree-leaf')) {\r\n\t\t\t\t\t\t\toff = ref.offset();\r\n\t\t\t\t\t\t\trel = data.event.pageY - off.top;\r\n\t\t\t\t\t\t\th = ref.height();\r\n\t\t\t\t\t\t\tif(rel < h / 3) {\r\n\t\t\t\t\t\t\t\to = ['b', 'i', 'a'];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse if(rel > h - h / 3) {\r\n\t\t\t\t\t\t\t\to = ['a', 'i', 'b'];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\to = rel > h / 2 ? ['i', 'a', 'b'] : ['i', 'b', 'a'];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t$.each(o, function (j, v) {\r\n\t\t\t\t\t\t\t\tswitch(v) {\r\n\t\t\t\t\t\t\t\t\tcase 'b':\r\n\t\t\t\t\t\t\t\t\t\tl = off.left - 6;\r\n\t\t\t\t\t\t\t\t\t\tt = off.top - 5;\r\n\t\t\t\t\t\t\t\t\t\tp = ins.get_parent(ref);\r\n\t\t\t\t\t\t\t\t\t\ti = ref.parent().index();\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\tcase 'i':\r\n\t\t\t\t\t\t\t\t\t\tip = ins.settings.dnd.inside_pos;\r\n\t\t\t\t\t\t\t\t\t\ttm = ins.get_node(ref.parent());\r\n\t\t\t\t\t\t\t\t\t\tl = off.left - 2;\r\n\t\t\t\t\t\t\t\t\t\tt = off.top - 5 + h / 2 + 1;\r\n\t\t\t\t\t\t\t\t\t\tp = tm.id;\r\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));\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\tcase 'a':\r\n\t\t\t\t\t\t\t\t\t\tl = off.left - 6;\r\n\t\t\t\t\t\t\t\t\t\tt = off.top - 5 + h;\r\n\t\t\t\t\t\t\t\t\t\tp = ins.get_parent(ref);\r\n\t\t\t\t\t\t\t\t\t\ti = ref.parent().index() + 1;\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t/*!\r\n\t\t\t\t\t\t\t\t// TODO: moving inside, but the node is not yet loaded?\r\n\t\t\t\t\t\t\t\t// the check will work anyway, as when moving the node will be loaded first and checked again\r\n\t\t\t\t\t\t\t\tif(v === 'i' && !ins.is_loaded(p)) { }\r\n\t\t\t\t\t\t\t\t*/\r\n\t\t\t\t\t\t\t\tok = true;\r\n\t\t\t\t\t\t\t\tfor(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) {\r\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\";\r\n\t\t\t\t\t\t\t\t\tps = i;\r\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])) {\r\n\t\t\t\t\t\t\t\t\t\tpr = ins.get_node(p);\r\n\t\t\t\t\t\t\t\t\t\tif(ps > $.inArray(data.data.nodes[t1], pr.children)) {\r\n\t\t\t\t\t\t\t\t\t\t\tps -= 1;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\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, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }) );\r\n\t\t\t\t\t\t\t\t\tif(!ok) {\r\n\t\t\t\t\t\t\t\t\t\tif(ins && ins.last_error) { laster = ins.last_error(); }\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif(ok) {\r\n\t\t\t\t\t\t\t\t\tif(v === 'i' && ref.parent().is('.jstree-closed') && ins.settings.dnd.open_timeout) {\r\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);\r\n\t\t\t\t\t\t\t\t\t}\r\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 };\r\n\t\t\t\t\t\t\t\t\tmarker.css({ 'left' : l + 'px', 'top' : t + 'px' }).show();\r\n\t\t\t\t\t\t\t\t\tdata.helper.find('.jstree-icon:eq(0)').removeClass('jstree-er').addClass('jstree-ok');\r\n\t\t\t\t\t\t\t\t\tlaster = {};\r\n\t\t\t\t\t\t\t\t\to = true;\r\n\t\t\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tif(o === true) { return; }\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tlastmv = false;\r\n\t\t\t\tdata.helper.find('.jstree-icon').removeClass('jstree-ok').addClass('jstree-er');\r\n\t\t\t\tmarker.hide();\r\n\t\t\t})\r\n\t\t\t.bind('dnd_scroll.vakata', function (e, data) {\r\n\t\t\t\tif(!data.data.jstree) { return; }\r\n\t\t\t\tmarker.hide();\r\n\t\t\t\tlastmv = false;\r\n\t\t\t\tdata.helper.find('.jstree-icon:eq(0)').removeClass('jstree-ok').addClass('jstree-er');\r\n\t\t\t})\r\n\t\t\t.bind('dnd_stop.vakata', function (e, data) {\r\n\t\t\t\tif(opento) { clearTimeout(opento); }\r\n\t\t\t\tif(!data.data.jstree) { return; }\r\n\t\t\t\tmarker.hide();\r\n\t\t\t\tvar i, j, nodes = [];\r\n\t\t\t\tif(lastmv) {\r\n\t\t\t\t\tfor(i = 0, j = data.data.nodes.length; i < j; i++) {\r\n\t\t\t\t\t\tnodes[i] = data.data.origin ? data.data.origin.get_node(data.data.nodes[i]) : data.data.nodes[i];\r\n\t\t\t\t\t\tif(data.data.origin) {\r\n\t\t\t\t\t\t\tnodes[i].instance = data.data.origin;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\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);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\ti = $(data.event.target).closest('.jstree');\r\n\t\t\t\t\tif(i.length && laster && laster.error && laster.error === 'check') {\r\n\t\t\t\t\t\ti = i.jstree(true);\r\n\t\t\t\t\t\tif(i) {\r\n\t\t\t\t\t\t\ti.settings.core.error.call(this, laster);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\t.bind('keyup keydown', function (e, data) {\r\n\t\t\t\tdata = $.vakata.dnd._get();\r\n\t\t\t\tif(data.data && data.data.jstree) {\r\n\t\t\t\t\tdata.helper.find('.jstree-copy:eq(0)')[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (e.metaKey || e.ctrlKey))) ? 'show' : 'hide' ]();\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t});\r\n\r\n\t// helpers\r\n\t(function ($) {\r\n\t\t// private variable\r\n\t\tvar vakata_dnd = {\r\n\t\t\telement\t: false,\r\n\t\t\tis_down\t: false,\r\n\t\t\tis_drag\t: false,\r\n\t\t\thelper\t: false,\r\n\t\t\thelper_w: 0,\r\n\t\t\tdata\t: false,\r\n\t\t\tinit_x\t: 0,\r\n\t\t\tinit_y\t: 0,\r\n\t\t\tscroll_l: 0,\r\n\t\t\tscroll_t: 0,\r\n\t\t\tscroll_e: false,\r\n\t\t\tscroll_i: false\r\n\t\t};\r\n\t\t$.vakata.dnd = {\r\n\t\t\tsettings : {\r\n\t\t\t\tscroll_speed\t\t: 10,\r\n\t\t\t\tscroll_proximity\t: 20,\r\n\t\t\t\thelper_left\t\t\t: 5,\r\n\t\t\t\thelper_top\t\t\t: 10,\r\n\t\t\t\tthreshold\t\t\t: 5\r\n\t\t\t},\r\n\t\t\t_trigger : function (event_name, e) {\r\n\t\t\t\tvar data = $.vakata.dnd._get();\r\n\t\t\t\tdata.event = e;\r\n\t\t\t\t$(document).triggerHandler(\"dnd_\" + event_name + \".vakata\", data);\r\n\t\t\t},\r\n\t\t\t_get : function () {\r\n\t\t\t\treturn {\r\n\t\t\t\t\t\"data\"\t\t: vakata_dnd.data,\r\n\t\t\t\t\t\"element\"\t: vakata_dnd.element,\r\n\t\t\t\t\t\"helper\"\t: vakata_dnd.helper\r\n\t\t\t\t};\r\n\t\t\t},\r\n\t\t\t_clean : function () {\r\n\t\t\t\tif(vakata_dnd.helper) { vakata_dnd.helper.remove(); }\r\n\t\t\t\tif(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; }\r\n\t\t\t\tvakata_dnd = {\r\n\t\t\t\t\telement\t: false,\r\n\t\t\t\t\tis_down\t: false,\r\n\t\t\t\t\tis_drag\t: false,\r\n\t\t\t\t\thelper\t: false,\r\n\t\t\t\t\thelper_w: 0,\r\n\t\t\t\t\tdata\t: false,\r\n\t\t\t\t\tinit_x\t: 0,\r\n\t\t\t\t\tinit_y\t: 0,\r\n\t\t\t\t\tscroll_l: 0,\r\n\t\t\t\t\tscroll_t: 0,\r\n\t\t\t\t\tscroll_e: false,\r\n\t\t\t\t\tscroll_i: false\r\n\t\t\t\t};\r\n\t\t\t\t$(document).off(\"mousemove touchmove\", $.vakata.dnd.drag);\r\n\t\t\t\t$(document).off(\"mouseup touchend\", $.vakata.dnd.stop);\r\n\t\t\t},\r\n\t\t\t_scroll : function (init_only) {\r\n\t\t\t\tif(!vakata_dnd.scroll_e || (!vakata_dnd.scroll_l && !vakata_dnd.scroll_t)) {\r\n\t\t\t\t\tif(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; }\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\tif(!vakata_dnd.scroll_i) {\r\n\t\t\t\t\tvakata_dnd.scroll_i = setInterval($.vakata.dnd._scroll, 100);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\tif(init_only === true) { return false; }\r\n\r\n\t\t\t\tvar i = vakata_dnd.scroll_e.scrollTop(),\r\n\t\t\t\t\tj = vakata_dnd.scroll_e.scrollLeft();\r\n\t\t\t\tvakata_dnd.scroll_e.scrollTop(i + vakata_dnd.scroll_t * $.vakata.dnd.settings.scroll_speed);\r\n\t\t\t\tvakata_dnd.scroll_e.scrollLeft(j + vakata_dnd.scroll_l * $.vakata.dnd.settings.scroll_speed);\r\n\t\t\t\tif(i !== vakata_dnd.scroll_e.scrollTop() || j !== vakata_dnd.scroll_e.scrollLeft()) {\r\n\t\t\t\t\t/**\r\n\t\t\t\t\t * triggered on the document when a drag causes an element to scroll\r\n\t\t\t\t\t * @event\r\n\t\t\t\t\t * @plugin dnd\r\n\t\t\t\t\t * @name dnd_scroll.vakata\r\n\t\t\t\t\t * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start\r\n\t\t\t\t\t * @param {DOM} element the DOM element being dragged\r\n\t\t\t\t\t * @param {jQuery} helper the helper shown next to the mouse\r\n\t\t\t\t\t * @param {jQuery} event the element that is scrolling\r\n\t\t\t\t\t */\r\n\t\t\t\t\t$.vakata.dnd._trigger(\"scroll\", vakata_dnd.scroll_e);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tstart : function (e, data, html) {\r\n\t\t\t\tif(e.type === \"touchstart\" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) {\r\n\t\t\t\t\te.pageX = e.originalEvent.changedTouches[0].pageX;\r\n\t\t\t\t\te.pageY = e.originalEvent.changedTouches[0].pageY;\r\n\t\t\t\t\te.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset);\r\n\t\t\t\t}\r\n\t\t\t\tif(vakata_dnd.is_drag) { $.vakata.dnd.stop({}); }\r\n\t\t\t\ttry {\r\n\t\t\t\t\te.currentTarget.unselectable = \"on\";\r\n\t\t\t\t\te.currentTarget.onselectstart = function() { return false; };\r\n\t\t\t\t\tif(e.currentTarget.style) { e.currentTarget.style.MozUserSelect = \"none\"; }\r\n\t\t\t\t} catch(ignore) { }\r\n\t\t\t\tvakata_dnd.init_x\t= e.pageX;\r\n\t\t\t\tvakata_dnd.init_y\t= e.pageY;\r\n\t\t\t\tvakata_dnd.data\t\t= data;\r\n\t\t\t\tvakata_dnd.is_down\t= true;\r\n\t\t\t\tvakata_dnd.element\t= e.currentTarget;\r\n\t\t\t\tif(html !== false) {\r\n\t\t\t\t\tvakata_dnd.helper = $(\"\").html(html).css({\r\n\t\t\t\t\t\t\"display\"\t\t: \"block\",\r\n\t\t\t\t\t\t\"margin\"\t\t: \"0\",\r\n\t\t\t\t\t\t\"padding\"\t\t: \"0\",\r\n\t\t\t\t\t\t\"position\"\t\t: \"absolute\",\r\n\t\t\t\t\t\t\"top\"\t\t\t: \"-2000px\",\r\n\t\t\t\t\t\t\"lineHeight\"\t: \"16px\",\r\n\t\t\t\t\t\t\"zIndex\"\t\t: \"10000\"\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\t$(document).bind(\"mousemove touchmove\", $.vakata.dnd.drag);\r\n\t\t\t\t$(document).bind(\"mouseup touchend\", $.vakata.dnd.stop);\r\n\t\t\t\treturn false;\r\n\t\t\t},\r\n\t\t\tdrag : function (e) {\r\n\t\t\t\tif(e.type === \"touchmove\" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) {\r\n\t\t\t\t\te.pageX = e.originalEvent.changedTouches[0].pageX;\r\n\t\t\t\t\te.pageY = e.originalEvent.changedTouches[0].pageY;\r\n\t\t\t\t\te.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset);\r\n\t\t\t\t}\r\n\t\t\t\tif(!vakata_dnd.is_down) { return; }\r\n\t\t\t\tif(!vakata_dnd.is_drag) {\r\n\t\t\t\t\tif(\r\n\t\t\t\t\t\tMath.abs(e.pageX - vakata_dnd.init_x) > $.vakata.dnd.settings.threshold ||\r\n\t\t\t\t\t\tMath.abs(e.pageY - vakata_dnd.init_y) > $.vakata.dnd.settings.threshold\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tif(vakata_dnd.helper) {\r\n\t\t\t\t\t\t\tvakata_dnd.helper.appendTo(\"body\");\r\n\t\t\t\t\t\t\tvakata_dnd.helper_w = vakata_dnd.helper.outerWidth();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tvakata_dnd.is_drag = true;\r\n\t\t\t\t\t\t/**\r\n\t\t\t\t\t\t * triggered on the document when a drag starts\r\n\t\t\t\t\t\t * @event\r\n\t\t\t\t\t\t * @plugin dnd\r\n\t\t\t\t\t\t * @name dnd_start.vakata\r\n\t\t\t\t\t\t * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start\r\n\t\t\t\t\t\t * @param {DOM} element the DOM element being dragged\r\n\t\t\t\t\t\t * @param {jQuery} helper the helper shown next to the mouse\r\n\t\t\t\t\t\t * @param {Object} event the event that caused the start (probably mousemove)\r\n\t\t\t\t\t\t */\r\n\t\t\t\t\t\t$.vakata.dnd._trigger(\"start\", e);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse { return; }\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar d = false, w = false,\r\n\t\t\t\t\tdh = false, wh = false,\r\n\t\t\t\t\tdw = false, ww = false,\r\n\t\t\t\t\tdt = false, dl = false,\r\n\t\t\t\t\tht = false, hl = false;\r\n\r\n\t\t\t\tvakata_dnd.scroll_t = 0;\r\n\t\t\t\tvakata_dnd.scroll_l = 0;\r\n\t\t\t\tvakata_dnd.scroll_e = false;\r\n\t\t\t\t$($(e.target).parentsUntil(\"body\").addBack().get().reverse())\r\n\t\t\t\t\t.filter(function () {\r\n\t\t\t\t\t\treturn\t(/^auto|scroll$/).test($(this).css(\"overflow\")) &&\r\n\t\t\t\t\t\t\t\t(this.scrollHeight > this.offsetHeight || this.scrollWidth > this.offsetWidth);\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.each(function () {\r\n\t\t\t\t\t\tvar t = $(this), o = t.offset();\r\n\t\t\t\t\t\tif(this.scrollHeight > this.offsetHeight) {\r\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; }\r\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; }\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(this.scrollWidth > this.offsetWidth) {\r\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; }\r\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; }\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(vakata_dnd.scroll_t || vakata_dnd.scroll_l) {\r\n\t\t\t\t\t\t\tvakata_dnd.scroll_e = $(this);\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\tif(!vakata_dnd.scroll_e) {\r\n\t\t\t\t\td = $(document); w = $(window);\r\n\t\t\t\t\tdh = d.height(); wh = w.height();\r\n\t\t\t\t\tdw = d.width(); ww = w.width();\r\n\t\t\t\t\tdt = d.scrollTop(); dl = d.scrollLeft();\r\n\t\t\t\t\tif(dh > wh && e.pageY - dt < $.vakata.dnd.settings.scroll_proximity)\t\t{ vakata_dnd.scroll_t = -1; }\r\n\t\t\t\t\tif(dh > wh && wh - (e.pageY - dt) < $.vakata.dnd.settings.scroll_proximity)\t{ vakata_dnd.scroll_t = 1; }\r\n\t\t\t\t\tif(dw > ww && e.pageX - dl < $.vakata.dnd.settings.scroll_proximity)\t\t{ vakata_dnd.scroll_l = -1; }\r\n\t\t\t\t\tif(dw > ww && ww - (e.pageX - dl) < $.vakata.dnd.settings.scroll_proximity)\t{ vakata_dnd.scroll_l = 1; }\r\n\t\t\t\t\tif(vakata_dnd.scroll_t || vakata_dnd.scroll_l) {\r\n\t\t\t\t\t\tvakata_dnd.scroll_e = d;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(vakata_dnd.scroll_e) { $.vakata.dnd._scroll(true); }\r\n\r\n\t\t\t\tif(vakata_dnd.helper) {\r\n\t\t\t\t\tht = parseInt(e.pageY + $.vakata.dnd.settings.helper_top, 10);\r\n\t\t\t\t\thl = parseInt(e.pageX + $.vakata.dnd.settings.helper_left, 10);\r\n\t\t\t\t\tif(dh && ht + 25 > dh) { ht = dh - 50; }\r\n\t\t\t\t\tif(dw && hl + vakata_dnd.helper_w > dw) { hl = dw - (vakata_dnd.helper_w + 2); }\r\n\t\t\t\t\tvakata_dnd.helper.css({\r\n\t\t\t\t\t\tleft\t: hl + \"px\",\r\n\t\t\t\t\t\ttop\t\t: ht + \"px\"\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\t/**\r\n\t\t\t\t * triggered on the document when a drag is in progress\r\n\t\t\t\t * @event\r\n\t\t\t\t * @plugin dnd\r\n\t\t\t\t * @name dnd_move.vakata\r\n\t\t\t\t * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start\r\n\t\t\t\t * @param {DOM} element the DOM element being dragged\r\n\t\t\t\t * @param {jQuery} helper the helper shown next to the mouse\r\n\t\t\t\t * @param {Object} event the event that caused this to trigger (most likely mousemove)\r\n\t\t\t\t */\r\n\t\t\t\t$.vakata.dnd._trigger(\"move\", e);\r\n\t\t\t},\r\n\t\t\tstop : function (e) {\r\n\t\t\t\tif(e.type === \"touchend\" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) {\r\n\t\t\t\t\te.pageX = e.originalEvent.changedTouches[0].pageX;\r\n\t\t\t\t\te.pageY = e.originalEvent.changedTouches[0].pageY;\r\n\t\t\t\t\te.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset);\r\n\t\t\t\t}\r\n\t\t\t\tif(vakata_dnd.is_drag) {\r\n\t\t\t\t\t/**\r\n\t\t\t\t\t * triggered on the document when a drag stops (the dragged element is dropped)\r\n\t\t\t\t\t * @event\r\n\t\t\t\t\t * @plugin dnd\r\n\t\t\t\t\t * @name dnd_stop.vakata\r\n\t\t\t\t\t * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start\r\n\t\t\t\t\t * @param {DOM} element the DOM element being dragged\r\n\t\t\t\t\t * @param {jQuery} helper the helper shown next to the mouse\r\n\t\t\t\t\t * @param {Object} event the event that caused the stop\r\n\t\t\t\t\t */\r\n\t\t\t\t\t$.vakata.dnd._trigger(\"stop\", e);\r\n\t\t\t\t}\r\n\t\t\t\t$.vakata.dnd._clean();\r\n\t\t\t}\r\n\t\t};\r\n\t}(jQuery));\r\n\r\n\t// include the dnd plugin by default\r\n\t// $.jstree.defaults.plugins.push(\"dnd\");\r\n\r\n\r\n/**\r\n * ### Search plugin\r\n *\r\n * Adds search functionality to jsTree.\r\n */\r\n\r\n\t/**\r\n\t * stores all defaults for the search plugin\r\n\t * @name $.jstree.defaults.search\r\n\t * @plugin search\r\n\t */\r\n\t$.jstree.defaults.search = {\r\n\t\t/**\r\n\t\t * a jQuery-like AJAX config, which jstree uses if a server should be queried for results. \r\n\t\t * \r\n\t\t * A `str` (which is the search string) parameter will be added with the request. The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed.\r\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 2 parameters - the search string and the callback to call with the array of nodes to load.\r\n\t\t * @name $.jstree.defaults.search.ajax\r\n\t\t * @plugin search\r\n\t\t */\r\n\t\tajax : false,\r\n\t\t/**\r\n\t\t * Indicates if the search should be fuzzy or not (should `chnd3` match `child node 3`). Default is `true`.\r\n\t\t * @name $.jstree.defaults.search.fuzzy\r\n\t\t * @plugin search\r\n\t\t */\r\n\t\tfuzzy : true,\r\n\t\t/**\r\n\t\t * Indicates if the search should be case sensitive. Default is `false`.\r\n\t\t * @name $.jstree.defaults.search.case_sensitive\r\n\t\t * @plugin search\r\n\t\t */\r\n\t\tcase_sensitive : false,\r\n\t\t/**\r\n\t\t * Indicates if the tree should be filtered to show only matching nodes (keep in mind this can be a heavy on large trees in old browsers). Default is `false`.\r\n\t\t * @name $.jstree.defaults.search.show_only_matches\r\n\t\t * @plugin search\r\n\t\t */\r\n\t\tshow_only_matches : false,\r\n\t\t/**\r\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`.\r\n\t\t * @name $.jstree.defaults.search.close_opened_onclear\r\n\t\t * @plugin search\r\n\t\t */\r\n\t\tclose_opened_onclear : true,\r\n\t\t/**\r\n\t\t * Indicates if only leaf nodes should be included in search results. Default is `false`.\r\n\t\t * @name $.jstree.defaults.search.search_leaves_only\r\n\t\t * @plugin search\r\n\t\t */\r\n\t\tsearch_leaves_only : false\r\n\t};\r\n\r\n\t$.jstree.plugins.search = function (options, parent) {\r\n\t\tthis.bind = function () {\r\n\t\t\tparent.bind.call(this);\r\n\r\n\t\t\tthis._data.search.str = \"\";\r\n\t\t\tthis._data.search.dom = $();\r\n\t\t\tthis._data.search.res = [];\r\n\t\t\tthis._data.search.opn = [];\r\n\r\n\t\t\tthis.element.on('before_open.jstree', $.proxy(function (e, data) {\r\n\t\t\t\tvar i, j, f, r = this._data.search.res, s = [], o = $();\r\n\t\t\t\tif(r && r.length) {\r\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(', #')));\r\n\t\t\t\t\tthis._data.search.dom.children(\".jstree-anchor\").addClass('jstree-search');\r\n\t\t\t\t\tif(this.settings.search.show_only_matches && this._data.search.res.length) {\r\n\t\t\t\t\t\tfor(i = 0, j = r.length; i < j; i++) {\r\n\t\t\t\t\t\t\ts = s.concat(this.get_node(r[i]).parents);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ts = $.vakata.array_remove_item($.vakata.array_unique(s),'#');\r\n\t\t\t\t\t\to = s.length ? $(this.element[0].querySelectorAll('#' + $.map(s, function (v) { return \"0123456789\".indexOf(v[0]) !== -1 ? '\\\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\\\$&') : v.replace($.jstree.idregex,'\\\\$&'); }).join(', #'))) : $();\r\n\r\n\t\t\t\t\t\tthis.element.find(\".jstree-node\").hide().filter('.jstree-last').filter(function() { return this.nextSibling; }).removeClass('jstree-last');\r\n\t\t\t\t\t\to = o.add(this._data.search.dom);\r\n\t\t\t\t\t\to.parentsUntil(\".jstree\").addBack().show()\r\n\t\t\t\t\t\t\t.filter(\".jstree-children\").each(function () { $(this).children(\".jstree-node:visible\").eq(-1).addClass(\"jstree-last\"); });\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}, this));\r\n\t\t\tif(this.settings.search.show_only_matches) {\r\n\t\t\t\tthis.element\r\n\t\t\t\t\t.on(\"search.jstree\", function (e, data) {\r\n\t\t\t\t\t\tif(data.nodes.length) {\r\n\t\t\t\t\t\t\t$(this).find(\".jstree-node\").hide().filter('.jstree-last').filter(function() { return this.nextSibling; }).removeClass('jstree-last');\r\n\t\t\t\t\t\t\tdata.nodes.parentsUntil(\".jstree\").addBack().show()\r\n\t\t\t\t\t\t\t\t.filter(\".jstree-children\").each(function () { $(this).children(\".jstree-node:visible\").eq(-1).addClass(\"jstree-last\"); });\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.on(\"clear_search.jstree\", function (e, data) {\r\n\t\t\t\t\t\tif(data.nodes.length) {\r\n\t\t\t\t\t\t\t$(this).find(\".jstree-node\").css(\"display\",\"\").filter('.jstree-last').filter(function() { return this.nextSibling; }).removeClass('jstree-last');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\t\t/**\r\n\t\t * used to search the tree nodes for a given string\r\n\t\t * @name search(str [, skip_async])\r\n\t\t * @param {String} str the search string\r\n\t\t * @param {Boolean} skip_async if set to true server will not be queried even if configured\r\n\t\t * @plugin search\r\n\t\t * @trigger search.jstree\r\n\t\t */\r\n\t\tthis.search = function (str, skip_async) {\r\n\t\t\tif(str === false || $.trim(str) === \"\") {\r\n\t\t\t\treturn this.clear_search();\r\n\t\t\t}\r\n\t\t\tvar s = this.settings.search,\r\n\t\t\t\ta = s.ajax ? s.ajax : false,\r\n\t\t\t\tf = null,\r\n\t\t\t\tr = [],\r\n\t\t\t\tp = [], i, j;\r\n\t\t\tif(this._data.search.res.length) {\r\n\t\t\t\tthis.clear_search();\r\n\t\t\t}\r\n\t\t\tif(!skip_async && a !== false) {\r\n\t\t\t\tif($.isFunction(a)) {\r\n\t\t\t\t\treturn a.call(this, str, $.proxy(function (d) {\r\n\t\t\t\t\t\t\tif(d && d.d) { d = d.d; }\r\n\t\t\t\t\t\t\tthis._load_nodes(!$.isArray(d) ? [] : d, function () {\r\n\t\t\t\t\t\t\t\tthis.search(str, true);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}, this));\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\ta = $.extend({}, a);\r\n\t\t\t\t\tif(!a.data) { a.data = {}; }\r\n\t\t\t\t\ta.data.str = str;\r\n\t\t\t\t\treturn $.ajax(a)\r\n\t\t\t\t\t\t.fail($.proxy(function () {\r\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) };\r\n\t\t\t\t\t\t\tthis.settings.core.error.call(this, this._data.core.last_error);\r\n\t\t\t\t\t\t}, this))\r\n\t\t\t\t\t\t.done($.proxy(function (d) {\r\n\t\t\t\t\t\t\tif(d && d.d) { d = d.d; }\r\n\t\t\t\t\t\t\tthis._load_nodes(!$.isArray(d) ? [] : d, function () {\r\n\t\t\t\t\t\t\t\tthis.search(str, true);\r\n\t\t\t\t\t\t\t}, true);\r\n\t\t\t\t\t\t}, this));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis._data.search.str = str;\r\n\t\t\tthis._data.search.dom = $();\r\n\t\t\tthis._data.search.res = [];\r\n\t\t\tthis._data.search.opn = [];\r\n\r\n\t\t\tf = new $.vakata.search(str, true, { caseSensitive : s.case_sensitive, fuzzy : s.fuzzy });\r\n\r\n\t\t\t$.each(this._model.data, function (i, v) {\r\n\t\t\t\tif(v.text && f.search(v.text).isMatch && (!s.search_leaves_only || (v.state.loaded && v.children.length === 0)) ) {\r\n\t\t\t\t\tr.push(i);\r\n\t\t\t\t\tp = p.concat(v.parents);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\tif(r.length) {\r\n\t\t\t\tp = $.vakata.array_unique(p);\r\n\t\t\t\tthis._search_open(p);\r\n\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(', #')));\r\n\t\t\t\tthis._data.search.res = r;\r\n\t\t\t\tthis._data.search.dom.children(\".jstree-anchor\").addClass('jstree-search');\r\n\t\t\t}\r\n\t\t\t/**\r\n\t\t\t * triggered after search is complete\r\n\t\t\t * @event\r\n\t\t\t * @name search.jstree\r\n\t\t\t * @param {jQuery} nodes a jQuery collection of matching nodes\r\n\t\t\t * @param {String} str the search string\r\n\t\t\t * @param {Array} res a collection of objects represeing the matching nodes\r\n\t\t\t * @plugin search\r\n\t\t\t */\r\n\t\t\tthis.trigger('search', { nodes : this._data.search.dom, str : str, res : this._data.search.res });\r\n\t\t};\r\n\t\t/**\r\n\t\t * used to clear the last search (removes classes and shows all nodes if filtering is on)\r\n\t\t * @name clear_search()\r\n\t\t * @plugin search\r\n\t\t * @trigger clear_search.jstree\r\n\t\t */\r\n\t\tthis.clear_search = function () {\r\n\t\t\tthis._data.search.dom.children(\".jstree-anchor\").removeClass(\"jstree-search\");\r\n\t\t\tif(this.settings.search.close_opened_onclear) {\r\n\t\t\t\tthis.close_node(this._data.search.opn, 0);\r\n\t\t\t}\r\n\t\t\t/**\r\n\t\t\t * triggered after search is complete\r\n\t\t\t * @event\r\n\t\t\t * @name clear_search.jstree\r\n\t\t\t * @param {jQuery} nodes a jQuery collection of matching nodes (the result from the last search)\r\n\t\t\t * @param {String} str the search string (the last search string)\r\n\t\t\t * @param {Array} res a collection of objects represeing the matching nodes (the result from the last search)\r\n\t\t\t * @plugin search\r\n\t\t\t */\r\n\t\t\tthis.trigger('clear_search', { 'nodes' : this._data.search.dom, str : this._data.search.str, res : this._data.search.res });\r\n\t\t\tthis._data.search.str = \"\";\r\n\t\t\tthis._data.search.res = [];\r\n\t\t\tthis._data.search.opn = [];\r\n\t\t\tthis._data.search.dom = $();\r\n\t\t};\r\n\t\t/**\r\n\t\t * opens nodes that need to be opened to reveal the search results. Used only internally.\r\n\t\t * @private\r\n\t\t * @name _search_open(d)\r\n\t\t * @param {Array} d an array of node IDs\r\n\t\t * @plugin search\r\n\t\t */\r\n\t\tthis._search_open = function (d) {\r\n\t\t\tvar t = this;\r\n\t\t\t$.each(d.concat([]), function (i, v) {\r\n\t\t\t\tif(v === \"#\") { return true; }\r\n\t\t\t\ttry { v = $('#' + v.replace($.jstree.idregex,'\\\\$&'), t.element); } catch(ignore) { }\r\n\t\t\t\tif(v && v.length) {\r\n\t\t\t\t\tif(t.is_closed(v)) {\r\n\t\t\t\t\t\tt._data.search.opn.push(v[0].id);\r\n\t\t\t\t\t\tt.open_node(v, function () { t._search_open(d); }, 0);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t};\r\n\t};\r\n\r\n\t// helpers\r\n\t(function ($) {\r\n\t\t// from http://kiro.me/projects/fuse.html\r\n\t\t$.vakata.search = function(pattern, txt, options) {\r\n\t\t\toptions = options || {};\r\n\t\t\tif(options.fuzzy !== false) {\r\n\t\t\t\toptions.fuzzy = true;\r\n\t\t\t}\r\n\t\t\tpattern = options.caseSensitive ? pattern : pattern.toLowerCase();\r\n\t\t\tvar MATCH_LOCATION\t= options.location || 0,\r\n\t\t\t\tMATCH_DISTANCE\t= options.distance || 100,\r\n\t\t\t\tMATCH_THRESHOLD\t= options.threshold || 0.6,\r\n\t\t\t\tpatternLen = pattern.length,\r\n\t\t\t\tmatchmask, pattern_alphabet, match_bitapScore, search;\r\n\t\t\tif(patternLen > 32) {\r\n\t\t\t\toptions.fuzzy = false;\r\n\t\t\t}\r\n\t\t\tif(options.fuzzy) {\r\n\t\t\t\tmatchmask = 1 << (patternLen - 1);\r\n\t\t\t\tpattern_alphabet = (function () {\r\n\t\t\t\t\tvar mask = {},\r\n\t\t\t\t\t\ti = 0;\r\n\t\t\t\t\tfor (i = 0; i < patternLen; i++) {\r\n\t\t\t\t\t\tmask[pattern.charAt(i)] = 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfor (i = 0; i < patternLen; i++) {\r\n\t\t\t\t\t\tmask[pattern.charAt(i)] |= 1 << (patternLen - i - 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn mask;\r\n\t\t\t\t}());\r\n\t\t\t\tmatch_bitapScore = function (e, x) {\r\n\t\t\t\t\tvar accuracy = e / patternLen,\r\n\t\t\t\t\t\tproximity = Math.abs(MATCH_LOCATION - x);\r\n\t\t\t\t\tif(!MATCH_DISTANCE) {\r\n\t\t\t\t\t\treturn proximity ? 1.0 : accuracy;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn accuracy + (proximity / MATCH_DISTANCE);\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tsearch = function (text) {\r\n\t\t\t\ttext = options.caseSensitive ? text : text.toLowerCase();\r\n\t\t\t\tif(pattern === text || text.indexOf(pattern) !== -1) {\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tisMatch: true,\r\n\t\t\t\t\t\tscore: 0\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\t\t\t\tif(!options.fuzzy) {\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tisMatch: false,\r\n\t\t\t\t\t\tscore: 1\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\t\t\t\tvar i, j,\r\n\t\t\t\t\ttextLen = text.length,\r\n\t\t\t\t\tscoreThreshold = MATCH_THRESHOLD,\r\n\t\t\t\t\tbestLoc = text.indexOf(pattern, MATCH_LOCATION),\r\n\t\t\t\t\tbinMin, binMid,\r\n\t\t\t\t\tbinMax = patternLen + textLen,\r\n\t\t\t\t\tlastRd, start, finish, rd, charMatch,\r\n\t\t\t\t\tscore = 1,\r\n\t\t\t\t\tlocations = [];\r\n\t\t\t\tif (bestLoc !== -1) {\r\n\t\t\t\t\tscoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold);\r\n\t\t\t\t\tbestLoc = text.lastIndexOf(pattern, MATCH_LOCATION + patternLen);\r\n\t\t\t\t\tif (bestLoc !== -1) {\r\n\t\t\t\t\t\tscoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbestLoc = -1;\r\n\t\t\t\tfor (i = 0; i < patternLen; i++) {\r\n\t\t\t\t\tbinMin = 0;\r\n\t\t\t\t\tbinMid = binMax;\r\n\t\t\t\t\twhile (binMin < binMid) {\r\n\t\t\t\t\t\tif (match_bitapScore(i, MATCH_LOCATION + binMid) <= scoreThreshold) {\r\n\t\t\t\t\t\t\tbinMin = binMid;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tbinMax = binMid;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tbinMid = Math.floor((binMax - binMin) / 2 + binMin);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbinMax = binMid;\r\n\t\t\t\t\tstart = Math.max(1, MATCH_LOCATION - binMid + 1);\r\n\t\t\t\t\tfinish = Math.min(MATCH_LOCATION + binMid, textLen) + patternLen;\r\n\t\t\t\t\trd = new Array(finish + 2);\r\n\t\t\t\t\trd[finish + 1] = (1 << i) - 1;\r\n\t\t\t\t\tfor (j = finish; j >= start; j--) {\r\n\t\t\t\t\t\tcharMatch = pattern_alphabet[text.charAt(j - 1)];\r\n\t\t\t\t\t\tif (i === 0) {\r\n\t\t\t\t\t\t\trd[j] = ((rd[j + 1] << 1) | 1) & charMatch;\r\n\t\t\t\t\t\t} else {\r\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];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (rd[j] & matchmask) {\r\n\t\t\t\t\t\t\tscore = match_bitapScore(i, j - 1);\r\n\t\t\t\t\t\t\tif (score <= scoreThreshold) {\r\n\t\t\t\t\t\t\t\tscoreThreshold = score;\r\n\t\t\t\t\t\t\t\tbestLoc = j - 1;\r\n\t\t\t\t\t\t\t\tlocations.push(bestLoc);\r\n\t\t\t\t\t\t\t\tif (bestLoc > MATCH_LOCATION) {\r\n\t\t\t\t\t\t\t\t\tstart = Math.max(1, 2 * MATCH_LOCATION - bestLoc);\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (match_bitapScore(i + 1, MATCH_LOCATION) > scoreThreshold) {\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tlastRd = rd;\r\n\t\t\t\t}\r\n\t\t\t\treturn {\r\n\t\t\t\t\tisMatch: bestLoc >= 0,\r\n\t\t\t\t\tscore: score\r\n\t\t\t\t};\r\n\t\t\t};\r\n\t\t\treturn txt === true ? { 'search' : search } : search(txt);\r\n\t\t};\r\n\t}(jQuery));\r\n\r\n\t// include the search plugin by default\r\n\t// $.jstree.defaults.plugins.push(\"search\");\r\n\r\n/**\r\n * ### Sort plugin\r\n *\r\n * Autmatically sorts all siblings in the tree according to a sorting function.\r\n */\r\n\r\n\t/**\r\n\t * the settings function used to sort the nodes.\r\n\t * It is executed in the tree's context, accepts two nodes as arguments and should return `1` or `-1`.\r\n\t * @name $.jstree.defaults.sort\r\n\t * @plugin sort\r\n\t */\r\n\t$.jstree.defaults.sort = function (a, b) {\r\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);\r\n\t\treturn this.get_text(a) > this.get_text(b) ? 1 : -1;\r\n\t};\r\n\t$.jstree.plugins.sort = function (options, parent) {\r\n\t\tthis.bind = function () {\r\n\t\t\tparent.bind.call(this);\r\n\t\t\tthis.element\r\n\t\t\t\t.on(\"model.jstree\", $.proxy(function (e, data) {\r\n\t\t\t\t\t\tthis.sort(data.parent, true);\r\n\t\t\t\t\t}, this))\r\n\t\t\t\t.on(\"rename_node.jstree create_node.jstree\", $.proxy(function (e, data) {\r\n\t\t\t\t\t\tthis.sort(data.parent || data.node.parent, false);\r\n\t\t\t\t\t\tthis.redraw_node(data.parent || data.node.parent, true);\r\n\t\t\t\t\t}, this))\r\n\t\t\t\t.on(\"move_node.jstree copy_node.jstree\", $.proxy(function (e, data) {\r\n\t\t\t\t\t\tthis.sort(data.parent, false);\r\n\t\t\t\t\t\tthis.redraw_node(data.parent, true);\r\n\t\t\t\t\t}, this));\r\n\t\t};\r\n\t\t/**\r\n\t\t * used to sort a node's children\r\n\t\t * @private\r\n\t\t * @name sort(obj [, deep])\r\n\t\t * @param {mixed} obj the node\r\n\t\t * @param {Boolean} deep if set to `true` nodes are sorted recursively.\r\n\t\t * @plugin sort\r\n\t\t * @trigger search.jstree\r\n\t\t */\r\n\t\tthis.sort = function (obj, deep) {\r\n\t\t\tvar i, j;\r\n\t\t\tobj = this.get_node(obj);\r\n\t\t\tif(obj && obj.children && obj.children.length) {\r\n\t\t\t\tobj.children.sort($.proxy(this.settings.sort, this));\r\n\t\t\t\tif(deep) {\r\n\t\t\t\t\tfor(i = 0, j = obj.children_d.length; i < j; i++) {\r\n\t\t\t\t\t\tthis.sort(obj.children_d[i], false);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t};\r\n\r\n\t// include the sort plugin by default\r\n\t// $.jstree.defaults.plugins.push(\"sort\");\r\n\r\n/**\r\n * ### State plugin\r\n *\r\n * Saves the state of the tree (selected nodes, opened nodes) on the user's computer using available options (localStorage, cookies, etc)\r\n */\r\n\r\n\tvar to = false;\r\n\t/**\r\n\t * stores all defaults for the state plugin\r\n\t * @name $.jstree.defaults.state\r\n\t * @plugin state\r\n\t */\r\n\t$.jstree.defaults.state = {\r\n\t\t/**\r\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`.\r\n\t\t * @name $.jstree.defaults.state.key\r\n\t\t * @plugin state\r\n\t\t */\r\n\t\tkey\t\t: 'jstree',\r\n\t\t/**\r\n\t\t * A space separated list of events that trigger a state save. Defaults to `changed.jstree open_node.jstree close_node.jstree`.\r\n\t\t * @name $.jstree.defaults.state.events\r\n\t\t * @plugin state\r\n\t\t */\r\n\t\tevents\t: 'changed.jstree open_node.jstree close_node.jstree',\r\n\t\t/**\r\n\t\t * Time in milliseconds after which the state will expire. Defaults to 'false' meaning - no expire.\r\n\t\t * @name $.jstree.defaults.state.ttl\r\n\t\t * @plugin state\r\n\t\t */\r\n\t\tttl\t\t: false,\r\n\t\t/**\r\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.\r\n\t\t * @name $.jstree.defaults.state.filter\r\n\t\t * @plugin state\r\n\t\t */\r\n\t\tfilter\t: false\r\n\t};\r\n\t$.jstree.plugins.state = function (options, parent) {\r\n\t\tthis.bind = function () {\r\n\t\t\tparent.bind.call(this);\r\n\t\t\tvar bind = $.proxy(function () {\r\n\t\t\t\tthis.element.on(this.settings.state.events, $.proxy(function () {\r\n\t\t\t\t\tif(to) { clearTimeout(to); }\r\n\t\t\t\t\tto = setTimeout($.proxy(function () { this.save_state(); }, this), 100);\r\n\t\t\t\t}, this));\r\n\t\t\t}, this);\r\n\t\t\tthis.element\r\n\t\t\t\t.on(\"ready.jstree\", $.proxy(function (e, data) {\r\n\t\t\t\t\t\tthis.element.one(\"restore_state.jstree\", bind);\r\n\t\t\t\t\t\tif(!this.restore_state()) { bind(); }\r\n\t\t\t\t\t}, this));\r\n\t\t};\r\n\t\t/**\r\n\t\t * save the state\r\n\t\t * @name save_state()\r\n\t\t * @plugin state\r\n\t\t */\r\n\t\tthis.save_state = function () {\r\n\t\t\tvar st = { 'state' : this.get_state(), 'ttl' : this.settings.state.ttl, 'sec' : +(new Date()) };\r\n\t\t\t$.vakata.storage.set(this.settings.state.key, JSON.stringify(st));\r\n\t\t};\r\n\t\t/**\r\n\t\t * restore the state from the user's computer\r\n\t\t * @name restore_state()\r\n\t\t * @plugin state\r\n\t\t */\r\n\t\tthis.restore_state = function () {\r\n\t\t\tvar k = $.vakata.storage.get(this.settings.state.key);\r\n\t\t\tif(!!k) { try { k = JSON.parse(k); } catch(ex) { return false; } }\r\n\t\t\tif(!!k && k.ttl && k.sec && +(new Date()) - k.sec > k.ttl) { return false; }\r\n\t\t\tif(!!k && k.state) { k = k.state; }\r\n\t\t\tif(!!k && $.isFunction(this.settings.state.filter)) { k = this.settings.state.filter.call(this, k); }\r\n\t\t\tif(!!k) {\r\n\t\t\t\tthis.element.one(\"set_state.jstree\", function (e, data) { data.instance.trigger('restore_state', { 'state' : $.extend(true, {}, k) }); });\r\n\t\t\t\tthis.set_state(k);\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t};\r\n\t\t/**\r\n\t\t * clear the state on the user's computer\r\n\t\t * @name clear_state()\r\n\t\t * @plugin state\r\n\t\t */\r\n\t\tthis.clear_state = function () {\r\n\t\t\treturn $.vakata.storage.del(this.settings.state.key);\r\n\t\t};\r\n\t};\r\n\r\n\t(function ($, undefined) {\r\n\t\t$.vakata.storage = {\r\n\t\t\t// simply specifying the functions in FF throws an error\r\n\t\t\tset : function (key, val) { return window.localStorage.setItem(key, val); },\r\n\t\t\tget : function (key) { return window.localStorage.getItem(key); },\r\n\t\t\tdel : function (key) { return window.localStorage.removeItem(key); }\r\n\t\t};\r\n\t}(jQuery));\r\n\r\n\t// include the state plugin by default\r\n\t// $.jstree.defaults.plugins.push(\"state\");\r\n\r\n/**\r\n * ### Types plugin\r\n *\r\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.\r\n */\r\n\r\n\t/**\r\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).\r\n\t * \r\n\t * * `max_children` the maximum number of immediate children this node type can have. Do not specify or set to `-1` for unlimited.\r\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.\r\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.\r\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.\r\n\t *\r\n\t * There are two predefined types:\r\n\t * \r\n\t * * `#` represents the root of the tree, for example `max_children` would control the maximum number of root nodes.\r\n\t * * `default` represents the default node - any settings here will be applied to all nodes that do not have a type specified.\r\n\t * \r\n\t * @name $.jstree.defaults.types\r\n\t * @plugin types\r\n\t */\r\n\t$.jstree.defaults.types = {\r\n\t\t'#' : {},\r\n\t\t'default' : {}\r\n\t};\r\n\r\n\t$.jstree.plugins.types = function (options, parent) {\r\n\t\tthis.init = function (el, options) {\r\n\t\t\tvar i, j;\r\n\t\t\tif(options && options.types && options.types['default']) {\r\n\t\t\t\tfor(i in options.types) {\r\n\t\t\t\t\tif(i !== \"default\" && i !== \"#\" && options.types.hasOwnProperty(i)) {\r\n\t\t\t\t\t\tfor(j in options.types['default']) {\r\n\t\t\t\t\t\t\tif(options.types['default'].hasOwnProperty(j) && options.types[i][j] === undefined) {\r\n\t\t\t\t\t\t\t\toptions.types[i][j] = options.types['default'][j];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tparent.init.call(this, el, options);\r\n\t\t\tthis._model.data['#'].type = '#';\r\n\t\t};\r\n\t\tthis.refresh = function (skip_loading) {\r\n\t\t\tparent.refresh.call(this, skip_loading);\r\n\t\t\tthis._model.data['#'].type = '#';\r\n\t\t};\r\n\t\tthis.bind = function () {\r\n\t\t\tthis.element\r\n\t\t\t\t.on('model.jstree', $.proxy(function (e, data) {\r\n\t\t\t\t\t\tvar m = this._model.data,\r\n\t\t\t\t\t\t\tdpc = data.nodes,\r\n\t\t\t\t\t\t\tt = this.settings.types,\r\n\t\t\t\t\t\t\ti, j, c = 'default';\r\n\t\t\t\t\t\tfor(i = 0, j = dpc.length; i < j; i++) {\r\n\t\t\t\t\t\t\tc = 'default';\r\n\t\t\t\t\t\t\tif(m[dpc[i]].original && m[dpc[i]].original.type && t[m[dpc[i]].original.type]) {\r\n\t\t\t\t\t\t\t\tc = m[dpc[i]].original.type;\r\n\t\t\t\t\t\t\t}\r\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]) {\r\n\t\t\t\t\t\t\t\tc = m[dpc[i]].data.jstree.type;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tm[dpc[i]].type = c;\r\n\t\t\t\t\t\t\tif(m[dpc[i]].icon === true && t[c].icon !== undefined) {\r\n\t\t\t\t\t\t\t\tm[dpc[i]].icon = t[c].icon;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, this));\r\n\t\t\tparent.bind.call(this);\r\n\t\t};\r\n\t\tthis.get_json = function (obj, options, flat) {\r\n\t\t\tvar i, j,\r\n\t\t\t\tm = this._model.data,\r\n\t\t\t\topt = options ? $.extend(true, {}, options, {no_id:false}) : {},\r\n\t\t\t\ttmp = parent.get_json.call(this, obj, opt, flat);\r\n\t\t\tif(tmp === false) { return false; }\r\n\t\t\tif($.isArray(tmp)) {\r\n\t\t\t\tfor(i = 0, j = tmp.length; i < j; i++) {\r\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\";\r\n\t\t\t\t\tif(options && options.no_id) {\r\n\t\t\t\t\t\tdelete tmp[i].id;\r\n\t\t\t\t\t\tif(tmp[i].li_attr && tmp[i].li_attr.id) {\r\n\t\t\t\t\t\t\tdelete tmp[i].li_attr.id;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\ttmp.type = tmp.id && m[tmp.id] && m[tmp.id].type ? m[tmp.id].type : \"default\";\r\n\t\t\t\tif(options && options.no_id) {\r\n\t\t\t\t\ttmp = this._delete_ids(tmp);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn tmp;\r\n\t\t};\r\n\t\tthis._delete_ids = function (tmp) {\r\n\t\t\tif($.isArray(tmp)) {\r\n\t\t\t\tfor(var i = 0, j = tmp.length; i < j; i++) {\r\n\t\t\t\t\ttmp[i] = this._delete_ids(tmp[i]);\r\n\t\t\t\t}\r\n\t\t\t\treturn tmp;\r\n\t\t\t}\r\n\t\t\tdelete tmp.id;\r\n\t\t\tif(tmp.li_attr && tmp.li_attr.id) {\r\n\t\t\t\tdelete tmp.li_attr.id;\r\n\t\t\t}\r\n\t\t\tif(tmp.children && $.isArray(tmp.children)) {\r\n\t\t\t\ttmp.children = this._delete_ids(tmp.children);\r\n\t\t\t}\r\n\t\t\treturn tmp;\r\n\t\t};\r\n\t\tthis.check = function (chk, obj, par, pos, more) {\r\n\t\t\tif(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; }\r\n\t\t\tobj = obj && obj.id ? obj : this.get_node(obj);\r\n\t\t\tpar = par && par.id ? par : this.get_node(par);\r\n\t\t\tvar m = obj && obj.id ? $.jstree.reference(obj.id) : null, tmp, d, i, j;\r\n\t\t\tm = m && m._model && m._model.data ? m._model.data : null;\r\n\t\t\tswitch(chk) {\r\n\t\t\t\tcase \"create_node\":\r\n\t\t\t\tcase \"move_node\":\r\n\t\t\t\tcase \"copy_node\":\r\n\t\t\t\t\tif(chk !== 'move_node' || $.inArray(obj.id, par.children) === -1) {\r\n\t\t\t\t\t\ttmp = this.get_rules(par);\r\n\t\t\t\t\t\tif(tmp.max_children !== undefined && tmp.max_children !== -1 && tmp.max_children === par.children.length) {\r\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 }) };\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(tmp.valid_children !== undefined && tmp.valid_children !== -1 && $.inArray(obj.type, tmp.valid_children) === -1) {\r\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 }) };\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(m && obj.children_d && obj.parents) {\r\n\t\t\t\t\t\t\td = 0;\r\n\t\t\t\t\t\t\tfor(i = 0, j = obj.children_d.length; i < j; i++) {\r\n\t\t\t\t\t\t\t\td = Math.max(d, m[obj.children_d[i]].parents.length);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\td = d - obj.parents.length + 1;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif(d <= 0 || d === undefined) { d = 1; }\r\n\t\t\t\t\t\tdo {\r\n\t\t\t\t\t\t\tif(tmp.max_depth !== undefined && tmp.max_depth !== -1 && tmp.max_depth < d) {\r\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 }) };\r\n\t\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tpar = this.get_node(par.parent);\r\n\t\t\t\t\t\t\ttmp = this.get_rules(par);\r\n\t\t\t\t\t\t\td++;\r\n\t\t\t\t\t\t} while(par);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t};\r\n\t\t/**\r\n\t\t * used to retrieve the type settings object for a node\r\n\t\t * @name get_rules(obj)\r\n\t\t * @param {mixed} obj the node to find the rules for\r\n\t\t * @return {Object}\r\n\t\t * @plugin types\r\n\t\t */\r\n\t\tthis.get_rules = function (obj) {\r\n\t\t\tobj = this.get_node(obj);\r\n\t\t\tif(!obj) { return false; }\r\n\t\t\tvar tmp = this.get_type(obj, true);\r\n\t\t\tif(tmp.max_depth === undefined) { tmp.max_depth = -1; }\r\n\t\t\tif(tmp.max_children === undefined) { tmp.max_children = -1; }\r\n\t\t\tif(tmp.valid_children === undefined) { tmp.valid_children = -1; }\r\n\t\t\treturn tmp;\r\n\t\t};\r\n\t\t/**\r\n\t\t * used to retrieve the type string or settings object for a node\r\n\t\t * @name get_type(obj [, rules])\r\n\t\t * @param {mixed} obj the node to find the rules for\r\n\t\t * @param {Boolean} rules if set to `true` instead of a string the settings object will be returned\r\n\t\t * @return {String|Object}\r\n\t\t * @plugin types\r\n\t\t */\r\n\t\tthis.get_type = function (obj, rules) {\r\n\t\t\tobj = this.get_node(obj);\r\n\t\t\treturn (!obj) ? false : ( rules ? $.extend({ 'type' : obj.type }, this.settings.types[obj.type]) : obj.type);\r\n\t\t};\r\n\t\t/**\r\n\t\t * used to change a node's type\r\n\t\t * @name set_type(obj, type)\r\n\t\t * @param {mixed} obj the node to change\r\n\t\t * @param {String} type the new type\r\n\t\t * @plugin types\r\n\t\t */\r\n\t\tthis.set_type = function (obj, type) {\r\n\t\t\tvar t, t1, t2, old_type, old_icon;\r\n\t\t\tif($.isArray(obj)) {\r\n\t\t\t\tobj = obj.slice();\r\n\t\t\t\tfor(t1 = 0, t2 = obj.length; t1 < t2; t1++) {\r\n\t\t\t\t\tthis.set_type(obj[t1], type);\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tt = this.settings.types;\r\n\t\t\tobj = this.get_node(obj);\r\n\t\t\tif(!t[type] || !obj) { return false; }\r\n\t\t\told_type = obj.type;\r\n\t\t\told_icon = this.get_icon(obj);\r\n\t\t\tobj.type = type;\r\n\t\t\tif(old_icon === true || (t[old_type] && t[old_type].icon && old_icon === t[old_type].icon)) {\r\n\t\t\t\tthis.set_icon(obj, t[type].icon !== undefined ? t[type].icon : true);\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t};\r\n\t};\r\n\t// include the types plugin by default\r\n\t// $.jstree.defaults.plugins.push(\"types\");\r\n\r\n/**\r\n * ### Unique plugin\r\n *\r\n * Enforces that no nodes with the same name can coexist as siblings.\r\n */\r\n\r\n\t$.jstree.plugins.unique = function (options, parent) {\r\n\t\tthis.check = function (chk, obj, par, pos, more) {\r\n\t\t\tif(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; }\r\n\t\t\tobj = obj && obj.id ? obj : this.get_node(obj);\r\n\t\t\tpar = par && par.id ? par : this.get_node(par);\r\n\t\t\tif(!par || !par.children) { return true; }\r\n\t\t\tvar n = chk === \"rename_node\" ? pos : obj.text,\r\n\t\t\t\tc = [],\r\n\t\t\t\tm = this._model.data, i, j;\r\n\t\t\tfor(i = 0, j = par.children.length; i < j; i++) {\r\n\t\t\t\tc.push(m[par.children[i]].text);\r\n\t\t\t}\r\n\t\t\tswitch(chk) {\r\n\t\t\t\tcase \"delete_node\":\r\n\t\t\t\t\treturn true;\r\n\t\t\t\tcase \"rename_node\":\r\n\t\t\t\t\ti = ($.inArray(n, c) === -1 || (obj.text && obj.text === n));\r\n\t\t\t\t\tif(!i) {\r\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 }) };\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn i;\r\n\t\t\t\tcase \"create_node\":\r\n\t\t\t\t\ti = ($.inArray(n, c) === -1);\r\n\t\t\t\t\tif(!i) {\r\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 }) };\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn i;\r\n\t\t\t\tcase \"copy_node\":\r\n\t\t\t\t\ti = ($.inArray(n, c) === -1);\r\n\t\t\t\t\tif(!i) {\r\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 }) };\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn i;\r\n\t\t\t\tcase \"move_node\":\r\n\t\t\t\t\ti = (obj.parent === par.id || $.inArray(n, c) === -1);\r\n\t\t\t\t\tif(!i) {\r\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 }) };\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t};\r\n\t\tthis.create_node = function (par, node, pos, callback, is_loaded) {\r\n\t\t\tif(!node || node.text === undefined) {\r\n\t\t\t\tif(par === null) {\r\n\t\t\t\t\tpar = \"#\";\r\n\t\t\t\t}\r\n\t\t\t\tpar = this.get_node(par);\r\n\t\t\t\tif(!par) {\r\n\t\t\t\t\treturn parent.create_node.call(this, par, node, pos, callback, is_loaded);\r\n\t\t\t\t}\r\n\t\t\t\tpos = pos === undefined ? \"last\" : pos;\r\n\t\t\t\tif(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {\r\n\t\t\t\t\treturn parent.create_node.call(this, par, node, pos, callback, is_loaded);\r\n\t\t\t\t}\r\n\t\t\t\tif(!node) { node = {}; }\r\n\t\t\t\tvar tmp, n, dpc, i, j, m = this._model.data;\r\n\t\t\t\tn = tmp = this.get_string('New node');\r\n\t\t\t\tdpc = [];\r\n\t\t\t\tfor(i = 0, j = par.children.length; i < j; i++) {\r\n\t\t\t\t\tdpc.push(m[par.children[i]].text);\r\n\t\t\t\t}\r\n\t\t\t\ti = 1;\r\n\t\t\t\twhile($.inArray(n, dpc) !== -1) {\r\n\t\t\t\t\tn = tmp + ' (' + (++i) + ')';\r\n\t\t\t\t}\r\n\t\t\t\tnode.text = n;\r\n\t\t\t}\r\n\t\t\treturn parent.create_node.call(this, par, node, pos, callback, is_loaded);\r\n\t\t};\r\n\t};\r\n\r\n\t// include the unique plugin by default\r\n\t// $.jstree.defaults.plugins.push(\"unique\");\r\n\r\n\r\n/**\r\n * ### Wholerow plugin\r\n *\r\n * Makes each node appear block level. Making selection easier. May cause slow down for large trees in old browsers.\r\n */\r\n\r\n\tvar div = document.createElement('DIV');\r\n\tdiv.setAttribute('unselectable','on');\r\n\tdiv.className = 'jstree-wholerow';\r\n\tdiv.innerHTML = ' ';\r\n\t$.jstree.plugins.wholerow = function (options, parent) {\r\n\t\tthis.bind = function () {\r\n\t\t\tparent.bind.call(this);\r\n\r\n\t\t\tthis.element\r\n\t\t\t\t.on('ready.jstree set_state.jstree', $.proxy(function () {\r\n\t\t\t\t\t\tthis.hide_dots();\r\n\t\t\t\t\t}, this))\r\n\t\t\t\t.on(\"init.jstree loading.jstree ready.jstree\", $.proxy(function () {\r\n\t\t\t\t\t\tdiv.style.height = this._data.core.li_height + 'px';\r\n\t\t\t\t\t\tthis.get_container_ul().addClass('jstree-wholerow-ul');\r\n\t\t\t\t\t}, this))\r\n\t\t\t\t.on(\"deselect_all.jstree\", $.proxy(function (e, data) {\r\n\t\t\t\t\t\tthis.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked');\r\n\t\t\t\t\t}, this))\r\n\t\t\t\t.on(\"changed.jstree\", $.proxy(function (e, data) {\r\n\t\t\t\t\t\tthis.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked');\r\n\t\t\t\t\t\tvar tmp = false, i, j;\r\n\t\t\t\t\t\tfor(i = 0, j = data.selected.length; i < j; i++) {\r\n\t\t\t\t\t\t\ttmp = this.get_node(data.selected[i], true);\r\n\t\t\t\t\t\t\tif(tmp && tmp.length) {\r\n\t\t\t\t\t\t\t\ttmp.children('.jstree-wholerow').addClass('jstree-wholerow-clicked');\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}, this))\r\n\t\t\t\t.on(\"open_node.jstree\", $.proxy(function (e, data) {\r\n\t\t\t\t\t\tthis.get_node(data.node, true).find('.jstree-clicked').parent().children('.jstree-wholerow').addClass('jstree-wholerow-clicked');\r\n\t\t\t\t\t}, this))\r\n\t\t\t\t.on(\"hover_node.jstree dehover_node.jstree\", $.proxy(function (e, data) {\r\n\t\t\t\t\t\tthis.get_node(data.node, true).children('.jstree-wholerow')[e.type === \"hover_node\"?\"addClass\":\"removeClass\"]('jstree-wholerow-hovered');\r\n\t\t\t\t\t}, this))\r\n\t\t\t\t.on(\"contextmenu.jstree\", \".jstree-wholerow\", $.proxy(function (e) {\r\n\t\t\t\t\t\te.preventDefault();\r\n\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 });\r\n\t\t\t\t\t\t$(e.currentTarget).closest(\".jstree-node\").children(\".jstree-anchor:eq(0)\").trigger(tmp);\r\n\t\t\t\t\t}, this))\r\n\t\t\t\t.on(\"click.jstree\", \".jstree-wholerow\", function (e) {\r\n\t\t\t\t\t\te.stopImmediatePropagation();\r\n\t\t\t\t\t\tvar tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });\r\n\t\t\t\t\t\t$(e.currentTarget).closest(\".jstree-node\").children(\".jstree-anchor:eq(0)\").trigger(tmp).focus();\r\n\t\t\t\t\t})\r\n\t\t\t\t.on(\"click.jstree\", \".jstree-leaf > .jstree-ocl\", $.proxy(function (e) {\r\n\t\t\t\t\t\te.stopImmediatePropagation();\r\n\t\t\t\t\t\tvar tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });\r\n\t\t\t\t\t\t$(e.currentTarget).closest(\".jstree-node\").children(\".jstree-anchor:eq(0)\").trigger(tmp).focus();\r\n\t\t\t\t\t}, this))\r\n\t\t\t\t.on(\"mouseover.jstree\", \".jstree-wholerow, .jstree-icon\", $.proxy(function (e) {\r\n\t\t\t\t\t\te.stopImmediatePropagation();\r\n\t\t\t\t\t\tthis.hover_node(e.currentTarget);\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}, this))\r\n\t\t\t\t.on(\"mouseleave.jstree\", \".jstree-node\", $.proxy(function (e) {\r\n\t\t\t\t\t\tthis.dehover_node(e.currentTarget);\r\n\t\t\t\t\t}, this));\r\n\t\t};\r\n\t\tthis.teardown = function () {\r\n\t\t\tif(this.settings.wholerow) {\r\n\t\t\t\tthis.element.find(\".jstree-wholerow\").remove();\r\n\t\t\t}\r\n\t\t\tparent.teardown.call(this);\r\n\t\t};\r\n\t\tthis.redraw_node = function(obj, deep, callback) {\r\n\t\t\tobj = parent.redraw_node.call(this, obj, deep, callback);\r\n\t\t\tif(obj) {\r\n\t\t\t\tvar tmp = div.cloneNode(true);\r\n\t\t\t\t//tmp.style.height = this._data.core.li_height + 'px';\r\n\t\t\t\tif($.inArray(obj.id, this._data.core.selected) !== -1) { tmp.className += ' jstree-wholerow-clicked'; }\r\n\t\t\t\tobj.insertBefore(tmp, obj.childNodes[0]);\r\n\t\t\t}\r\n\t\t\treturn obj;\r\n\t\t};\r\n\t};\r\n\t// include the wholerow plugin by default\r\n\t// $.jstree.defaults.plugins.push(\"wholerow\");\r\n\r\n}));","// additional icon on node (outside of anchor)\r\n(function ($, undefined) {\r\n\t\"use strict\";\r\n\tvar configIt = $('Configure it');\r\n\r\n\t$.jstree.defaults.configit = $.noop;\r\n\t$.jstree.plugins.configit = function (options, parent) {\r\n\t\tthis.bind = function () {\r\n\t\t\tparent.bind.call(this);\r\n\t\t};\r\n\t\tthis.teardown = function () {\r\n\t\t\tif(this.settings.configit) {\r\n\t\t\t\tthis.element.find(\".jstree-configit\").remove();\r\n\t\t\t}\r\n\t\t\tparent.teardown.call(this);\r\n\t\t};\r\n\t\tthis.redraw_node = function(obj, deep, callback) {\r\n\t\t\tobj = parent.redraw_node.call(this, obj, deep, callback);\r\n\t\t\tvar $obj = $(obj);\r\n\t\t\tif(obj && this.is_leaf(obj)) {\r\n\t\t\t\tvar tmp = configIt.clone();\r\n\t\t\t\tvar $a = $obj.find('a').eq(0);\r\n\t\t\t\tvar hide = $a.data('hideconfigit');\r\n\t\t\t\tif(!hide) {\r\n\t\t\t\t\ttmp.attr({\r\n\t\t\t\t\t\thref: $a.data('url'),\r\n\t\t\t\t\t\tid: $a.data('id')\r\n\t\t\t\t\t});\r\n\t\t\t\t\t$obj.append(tmp);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn obj;\r\n\t\t};\r\n\t};\r\n})(jQuery);","/**\r\n* jquery.matchHeight-min.js master\r\n* http://brm.io/jquery-match-height/\r\n* License: MIT\r\n*/\r\n(function(c){var n=-1,f=-1,g=function(a){return parseFloat(a)||0},r=function(a){var b=null,d=[];c(a).each(function(){var a=c(this),k=a.offset().top-g(a.css(\"margin-top\")),l=0=Math.floor(Math.abs(b-k))?d[d.length-1]=l.add(a):d.push(a);b=k});return d},p=function(a){var b={byRow:!0,property:\"height\",target:null,remove:!1};if(\"object\"===typeof a)return c.extend(b,a);\"boolean\"===typeof a?b.byRow=a:\"remove\"===a&&(b.remove=!0);return b},b=c.fn.matchHeight=\r\nfunction(a){a=p(a);if(a.remove){var e=this;this.css(a.property,\"\");c.each(b._groups,function(a,b){b.elements=b.elements.not(e)});return this}if(1>=this.length&&!a.target)return this;b._groups.push({elements:this,options:a});b._apply(this,a);return this};b._groups=[];b._throttle=80;b._maintainScroll=!1;b._beforeUpdate=null;b._afterUpdate=null;b._apply=function(a,e){var d=p(e),h=c(a),k=[h],l=c(window).scrollTop(),f=c(\"html\").outerHeight(!0),m=h.parents().filter(\":hidden\");m.each(function(){var a=c(this);\r\na.data(\"style-cache\",a.attr(\"style\"))});m.css(\"display\",\"block\");d.byRow&&!d.target&&(h.each(function(){var a=c(this),b=\"inline-block\"===a.css(\"display\")?\"inline-block\":\"block\";a.data(\"style-cache\",a.attr(\"style\"));a.css({display:b,\"padding-top\":\"0\",\"padding-bottom\":\"0\",\"margin-top\":\"0\",\"margin-bottom\":\"0\",\"border-top-width\":\"0\",\"border-bottom-width\":\"0\",height:\"100px\"})}),k=r(h),h.each(function(){var a=c(this);a.attr(\"style\",a.data(\"style-cache\")||\"\")}));c.each(k,function(a,b){var e=c(b),f=0;if(d.target)f=\r\nd.target.outerHeight(!1);else{if(d.byRow&&1>=e.length){e.css(d.property,\"\");return}e.each(function(){var a=c(this),b={display:\"inline-block\"===a.css(\"display\")?\"inline-block\":\"block\"};b[d.property]=\"\";a.css(b);a.outerHeight(!1)>f&&(f=a.outerHeight(!1));a.css(\"display\",\"\")})}e.each(function(){var a=c(this),b=0;d.target&&a.is(d.target)||(\"border-box\"!==a.css(\"box-sizing\")&&(b+=g(a.css(\"border-top-width\"))+g(a.css(\"border-bottom-width\")),b+=g(a.css(\"padding-top\"))+g(a.css(\"padding-bottom\"))),a.css(d.property,\r\nf-b))})});m.each(function(){var a=c(this);a.attr(\"style\",a.data(\"style-cache\")||null)});b._maintainScroll&&c(window).scrollTop(l/f*c(\"html\").outerHeight(!0));return this};b._applyDataApi=function(){var a={};c(\"[data-match-height], [data-mh]\").each(function(){var b=c(this),d=b.attr(\"data-mh\")||b.attr(\"data-match-height\");a[d]=d in a?a[d].add(b):b});c.each(a,function(){this.matchHeight(!0)})};var q=function(a){b._beforeUpdate&&b._beforeUpdate(a,b._groups);c.each(b._groups,function(){b._apply(this.elements,\r\nthis.options)});b._afterUpdate&&b._afterUpdate(a,b._groups)};b._update=function(a,e){if(e&&\"resize\"===e.type){var d=c(window).width();if(d===n)return;n=d}a?-1===f&&(f=setTimeout(function(){q(e);f=-1},b._throttle)):q(e)};c(b._applyDataApi);c(window).bind(\"load\",function(a){b._update(!1,a)});c(window).bind(\"resize orientationchange\",function(a){b._update(!0,a)})})(jQuery);","/*!\r\nChosen, a Select Box Enhancer for jQuery and Prototype\r\nby Patrick Filler for Harvest, http://getharvest.com\r\n\r\nVersion 1.4.1\r\nFull source at https://github.com/harvesthq/chosen\r\nCopyright (c) 2011-2015 Harvest http://getharvest.com\r\n\r\nMIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md\r\nThis file is generated by `grunt build`, do not edit it by hand.\r\n*/\r\n\r\n(function() {\r\n var $, AbstractChosen, Chosen, SelectParser, _ref,\r\n __hasProp = {}.hasOwnProperty,\r\n __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\r\n\r\n SelectParser = (function() {\r\n function SelectParser() {\r\n this.options_index = 0;\r\n this.parsed = [];\r\n }\r\n\r\n SelectParser.prototype.add_node = function(child) {\r\n if (child.nodeName.toUpperCase() === \"OPTGROUP\") {\r\n return this.add_group(child);\r\n } else {\r\n return this.add_option(child);\r\n }\r\n };\r\n\r\n SelectParser.prototype.add_group = function(group) {\r\n var group_position, option, _i, _len, _ref, _results;\r\n group_position = this.parsed.length;\r\n this.parsed.push({\r\n array_index: group_position,\r\n group: true,\r\n label: this.escapeExpression(group.label),\r\n title: group.title ? group.title : void 0,\r\n children: 0,\r\n disabled: group.disabled,\r\n classes: group.className\r\n });\r\n _ref = group.childNodes;\r\n _results = [];\r\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\r\n option = _ref[_i];\r\n _results.push(this.add_option(option, group_position, group.disabled));\r\n }\r\n return _results;\r\n };\r\n\r\n SelectParser.prototype.add_option = function(option, group_position, group_disabled) {\r\n if (option.nodeName.toUpperCase() === \"OPTION\") {\r\n if (option.text !== \"\") {\r\n if (group_position != null) {\r\n this.parsed[group_position].children += 1;\r\n }\r\n this.parsed.push({\r\n array_index: this.parsed.length,\r\n options_index: this.options_index,\r\n value: option.value,\r\n text: option.text,\r\n html: option.innerHTML,\r\n title: option.title ? option.title : void 0,\r\n selected: option.selected,\r\n disabled: group_disabled === true ? group_disabled : option.disabled,\r\n group_array_index: group_position,\r\n group_label: group_position != null ? this.parsed[group_position].label : null,\r\n classes: option.className,\r\n style: option.style.cssText\r\n });\r\n } else {\r\n this.parsed.push({\r\n array_index: this.parsed.length,\r\n options_index: this.options_index,\r\n empty: true\r\n });\r\n }\r\n return this.options_index += 1;\r\n }\r\n };\r\n\r\n SelectParser.prototype.escapeExpression = function(text) {\r\n var map, unsafe_chars;\r\n if ((text == null) || text === false) {\r\n return \"\";\r\n }\r\n if (!/[\\&\\<\\>\\\"\\'\\`]/.test(text)) {\r\n return text;\r\n }\r\n map = {\r\n \"<\": \"<\",\r\n \">\": \">\",\r\n '\"': \""\",\r\n \"'\": \"'\",\r\n \"`\": \"`\"\r\n };\r\n unsafe_chars = /&(?!\\w+;)|[\\<\\>\\\"\\'\\`]/g;\r\n return text.replace(unsafe_chars, function(chr) {\r\n return map[chr] || \"&\";\r\n });\r\n };\r\n\r\n return SelectParser;\r\n\r\n })();\r\n\r\n SelectParser.select_to_array = function(select) {\r\n var child, parser, _i, _len, _ref;\r\n parser = new SelectParser();\r\n _ref = select.childNodes;\r\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\r\n child = _ref[_i];\r\n parser.add_node(child);\r\n }\r\n return parser.parsed;\r\n };\r\n\r\n AbstractChosen = (function() {\r\n function AbstractChosen(form_field, options) {\r\n this.form_field = form_field;\r\n this.options = options != null ? options : {};\r\n if (!AbstractChosen.browser_is_supported()) {\r\n return;\r\n }\r\n this.is_multiple = this.form_field.multiple;\r\n this.set_default_text();\r\n this.set_default_values();\r\n this.setup();\r\n this.set_up_html();\r\n this.register_observers();\r\n this.on_ready();\r\n }\r\n\r\n AbstractChosen.prototype.set_default_values = function() {\r\n var _this = this;\r\n this.click_test_action = function(evt) {\r\n return _this.test_active_click(evt);\r\n };\r\n this.activate_action = function(evt) {\r\n return _this.activate_field(evt);\r\n };\r\n this.active_field = false;\r\n this.mouse_on_container = false;\r\n this.results_showing = false;\r\n this.result_highlighted = null;\r\n this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === \"\" ? this.options.allow_single_deselect : false;\r\n this.disable_search_threshold = this.options.disable_search_threshold || 0;\r\n this.disable_search = this.options.disable_search || false;\r\n this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;\r\n this.group_search = this.options.group_search != null ? this.options.group_search : true;\r\n this.search_contains = this.options.search_contains || false;\r\n this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;\r\n this.max_selected_options = this.options.max_selected_options || Infinity;\r\n this.inherit_select_classes = this.options.inherit_select_classes || false;\r\n this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;\r\n this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;\r\n return this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;\r\n };\r\n\r\n AbstractChosen.prototype.set_default_text = function() {\r\n if (this.form_field.getAttribute(\"data-placeholder\")) {\r\n this.default_text = this.form_field.getAttribute(\"data-placeholder\");\r\n } else if (this.is_multiple) {\r\n this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;\r\n } else {\r\n this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;\r\n }\r\n return this.results_none_found = this.form_field.getAttribute(\"data-no_results_text\") || this.options.no_results_text || AbstractChosen.default_no_result_text;\r\n };\r\n\r\n AbstractChosen.prototype.choice_label = function(item) {\r\n if (this.include_group_label_in_selected && (item.group_label != null)) {\r\n return \"\" + item.group_label + \"\" + item.html;\r\n } else {\r\n return item.html;\r\n }\r\n };\r\n\r\n AbstractChosen.prototype.mouse_enter = function() {\r\n return this.mouse_on_container = true;\r\n };\r\n\r\n AbstractChosen.prototype.mouse_leave = function() {\r\n return this.mouse_on_container = false;\r\n };\r\n\r\n AbstractChosen.prototype.input_focus = function(evt) {\r\n var _this = this;\r\n if (this.is_multiple) {\r\n if (!this.active_field) {\r\n return setTimeout((function() {\r\n return _this.container_mousedown();\r\n }), 50);\r\n }\r\n } else {\r\n if (!this.active_field) {\r\n return this.activate_field();\r\n }\r\n }\r\n };\r\n\r\n AbstractChosen.prototype.input_blur = function(evt) {\r\n var _this = this;\r\n if (!this.mouse_on_container) {\r\n this.active_field = false;\r\n return setTimeout((function() {\r\n return _this.blur_test();\r\n }), 100);\r\n }\r\n };\r\n\r\n AbstractChosen.prototype.results_option_build = function(options) {\r\n var content, data, _i, _len, _ref;\r\n content = '';\r\n _ref = this.results_data;\r\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\r\n data = _ref[_i];\r\n if (data.group) {\r\n content += this.result_add_group(data);\r\n } else {\r\n content += this.result_add_option(data);\r\n }\r\n if (options != null ? options.first : void 0) {\r\n if (data.selected && this.is_multiple) {\r\n this.choice_build(data);\r\n } else if (data.selected && !this.is_multiple) {\r\n this.single_set_selected_text(this.choice_label(data));\r\n }\r\n }\r\n }\r\n return content;\r\n };\r\n\r\n AbstractChosen.prototype.result_add_option = function(option) {\r\n var classes, option_el;\r\n if (!option.search_match) {\r\n return '';\r\n }\r\n if (!this.include_option_in_results(option)) {\r\n return '';\r\n }\r\n classes = [];\r\n if (!option.disabled && !(option.selected && this.is_multiple)) {\r\n classes.push(\"active-result\");\r\n }\r\n if (option.disabled && !(option.selected && this.is_multiple)) {\r\n classes.push(\"disabled-result\");\r\n }\r\n if (option.selected) {\r\n classes.push(\"result-selected\");\r\n }\r\n if (option.group_array_index != null) {\r\n classes.push(\"group-option\");\r\n }\r\n if (option.classes !== \"\") {\r\n classes.push(option.classes);\r\n }\r\n option_el = document.createElement(\"li\");\r\n option_el.className = classes.join(\" \");\r\n option_el.style.cssText = option.style;\r\n option_el.setAttribute(\"data-option-array-index\", option.array_index);\r\n option_el.innerHTML = option.search_text;\r\n if (option.title) {\r\n option_el.title = option.title;\r\n }\r\n return this.outerHTML(option_el);\r\n };\r\n\r\n AbstractChosen.prototype.result_add_group = function(group) {\r\n var classes, group_el;\r\n if (!(group.search_match || group.group_match)) {\r\n return '';\r\n }\r\n if (!(group.active_options > 0)) {\r\n return '';\r\n }\r\n classes = [];\r\n classes.push(\"group-result\");\r\n if (group.classes) {\r\n classes.push(group.classes);\r\n }\r\n group_el = document.createElement(\"li\");\r\n group_el.className = classes.join(\" \");\r\n group_el.innerHTML = group.search_text;\r\n if (group.title) {\r\n group_el.title = group.title;\r\n }\r\n return this.outerHTML(group_el);\r\n };\r\n\r\n AbstractChosen.prototype.results_update_field = function() {\r\n this.set_default_text();\r\n if (!this.is_multiple) {\r\n this.results_reset_cleanup();\r\n }\r\n this.result_clear_highlight();\r\n this.results_build();\r\n if (this.results_showing) {\r\n return this.winnow_results();\r\n }\r\n };\r\n\r\n AbstractChosen.prototype.reset_single_select_options = function() {\r\n var result, _i, _len, _ref, _results;\r\n _ref = this.results_data;\r\n _results = [];\r\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\r\n result = _ref[_i];\r\n if (result.selected) {\r\n _results.push(result.selected = false);\r\n } else {\r\n _results.push(void 0);\r\n }\r\n }\r\n return _results;\r\n };\r\n\r\n AbstractChosen.prototype.results_toggle = function() {\r\n if (this.results_showing) {\r\n return this.results_hide();\r\n } else {\r\n return this.results_show();\r\n }\r\n };\r\n\r\n AbstractChosen.prototype.results_search = function(evt) {\r\n if (this.results_showing) {\r\n return this.winnow_results();\r\n } else {\r\n return this.results_show();\r\n }\r\n };\r\n\r\n AbstractChosen.prototype.winnow_results = function() {\r\n var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;\r\n this.no_results_clear();\r\n results = 0;\r\n searchText = this.get_search_text();\r\n escapedSearchText = searchText.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, \"\\\\$&\");\r\n zregex = new RegExp(escapedSearchText, 'i');\r\n regex = this.get_search_regex(escapedSearchText);\r\n _ref = this.results_data;\r\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\r\n option = _ref[_i];\r\n option.search_match = false;\r\n results_group = null;\r\n if (this.include_option_in_results(option)) {\r\n if (option.group) {\r\n option.group_match = false;\r\n option.active_options = 0;\r\n }\r\n if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {\r\n results_group = this.results_data[option.group_array_index];\r\n if (results_group.active_options === 0 && results_group.search_match) {\r\n results += 1;\r\n }\r\n results_group.active_options += 1;\r\n }\r\n option.search_text = option.group ? option.label : option.html;\r\n if (!(option.group && !this.group_search)) {\r\n option.search_match = this.search_string_match(option.search_text, regex);\r\n if (option.search_match && !option.group) {\r\n results += 1;\r\n }\r\n if (option.search_match) {\r\n if (searchText.length) {\r\n startpos = option.search_text.search(zregex);\r\n text = option.search_text.substr(0, startpos + searchText.length) + '' + option.search_text.substr(startpos + searchText.length);\r\n option.search_text = text.substr(0, startpos) + '' + text.substr(startpos);\r\n }\r\n if (results_group != null) {\r\n results_group.group_match = true;\r\n }\r\n } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {\r\n option.search_match = true;\r\n }\r\n }\r\n }\r\n }\r\n this.result_clear_highlight();\r\n if (results < 1 && searchText.length) {\r\n this.update_results_content(\"\");\r\n return this.no_results(searchText);\r\n } else {\r\n this.update_results_content(this.results_option_build());\r\n return this.winnow_results_set_highlight();\r\n }\r\n };\r\n\r\n AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {\r\n var regex_anchor;\r\n regex_anchor = this.search_contains ? \"\" : \"^\";\r\n return new RegExp(regex_anchor + escaped_search_string, 'i');\r\n };\r\n\r\n AbstractChosen.prototype.search_string_match = function(search_string, regex) {\r\n var part, parts, _i, _len;\r\n if (regex.test(search_string)) {\r\n return true;\r\n } else if (this.enable_split_word_search && (search_string.indexOf(\" \") >= 0 || search_string.indexOf(\"[\") === 0)) {\r\n parts = search_string.replace(/\\[|\\]/g, \"\").split(\" \");\r\n if (parts.length) {\r\n for (_i = 0, _len = parts.length; _i < _len; _i++) {\r\n part = parts[_i];\r\n if (regex.test(part)) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n AbstractChosen.prototype.choices_count = function() {\r\n var option, _i, _len, _ref;\r\n if (this.selected_option_count != null) {\r\n return this.selected_option_count;\r\n }\r\n this.selected_option_count = 0;\r\n _ref = this.form_field.options;\r\n for (_i = 0, _len = _ref.length; _i < _len; _i++) {\r\n option = _ref[_i];\r\n if (option.selected) {\r\n this.selected_option_count += 1;\r\n }\r\n }\r\n return this.selected_option_count;\r\n };\r\n\r\n AbstractChosen.prototype.choices_click = function(evt) {\r\n evt.preventDefault();\r\n if (!(this.results_showing || this.is_disabled)) {\r\n return this.results_show();\r\n }\r\n };\r\n\r\n AbstractChosen.prototype.keyup_checker = function(evt) {\r\n var stroke, _ref;\r\n stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;\r\n this.search_field_scale();\r\n switch (stroke) {\r\n case 8:\r\n if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {\r\n return this.keydown_backstroke();\r\n } else if (!this.pending_backstroke) {\r\n this.result_clear_highlight();\r\n return this.results_search();\r\n }\r\n break;\r\n case 13:\r\n evt.preventDefault();\r\n if (this.results_showing) {\r\n return this.result_select(evt);\r\n }\r\n break;\r\n case 27:\r\n if (this.results_showing) {\r\n this.results_hide();\r\n }\r\n return true;\r\n case 9:\r\n case 38:\r\n case 40:\r\n case 16:\r\n case 91:\r\n case 17:\r\n break;\r\n default:\r\n return this.results_search();\r\n }\r\n };\r\n\r\n AbstractChosen.prototype.clipboard_event_checker = function(evt) {\r\n var _this = this;\r\n return setTimeout((function() {\r\n return _this.results_search();\r\n }), 50);\r\n };\r\n\r\n AbstractChosen.prototype.container_width = function() {\r\n if (this.options.width != null) {\r\n return this.options.width;\r\n } else {\r\n return \"\" + this.form_field.offsetWidth + \"px\";\r\n }\r\n };\r\n\r\n AbstractChosen.prototype.include_option_in_results = function(option) {\r\n if (this.is_multiple && (!this.display_selected_options && option.selected)) {\r\n return false;\r\n }\r\n if (!this.display_disabled_options && option.disabled) {\r\n return false;\r\n }\r\n if (option.empty) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n\r\n AbstractChosen.prototype.search_results_touchstart = function(evt) {\r\n this.touch_started = true;\r\n return this.search_results_mouseover(evt);\r\n };\r\n\r\n AbstractChosen.prototype.search_results_touchmove = function(evt) {\r\n this.touch_started = false;\r\n return this.search_results_mouseout(evt);\r\n };\r\n\r\n AbstractChosen.prototype.search_results_touchend = function(evt) {\r\n if (this.touch_started) {\r\n return this.search_results_mouseup(evt);\r\n }\r\n };\r\n\r\n AbstractChosen.prototype.outerHTML = function(element) {\r\n var tmp;\r\n if (element.outerHTML) {\r\n return element.outerHTML;\r\n }\r\n tmp = document.createElement(\"div\");\r\n tmp.appendChild(element);\r\n return tmp.innerHTML;\r\n };\r\n\r\n AbstractChosen.browser_is_supported = function() {\r\n if (window.navigator.appName === \"Microsoft Internet Explorer\") {\r\n return document.documentMode >= 8;\r\n }\r\n if (/iP(od|hone)/i.test(window.navigator.userAgent)) {\r\n return false;\r\n }\r\n if (/Android/i.test(window.navigator.userAgent)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n\r\n AbstractChosen.default_multiple_text = \"Select Some Options\";\r\n\r\n AbstractChosen.default_single_text = \"Select an Option\";\r\n\r\n AbstractChosen.default_no_result_text = \"No results match\";\r\n\r\n return AbstractChosen;\r\n\r\n })();\r\n\r\n $ = jQuery;\r\n\r\n $.fn.extend({\r\n chosen: function(options) {\r\n if (!AbstractChosen.browser_is_supported()) {\r\n return this;\r\n }\r\n return this.each(function(input_field) {\r\n var $this, chosen;\r\n $this = $(this);\r\n chosen = $this.data('chosen');\r\n if (options === 'destroy' && chosen instanceof Chosen) {\r\n chosen.destroy();\r\n } else if (!(chosen instanceof Chosen)) {\r\n $this.data('chosen', new Chosen(this, options));\r\n }\r\n });\r\n }\r\n });\r\n\r\n Chosen = (function(_super) {\r\n __extends(Chosen, _super);\r\n\r\n function Chosen() {\r\n _ref = Chosen.__super__.constructor.apply(this, arguments);\r\n return _ref;\r\n }\r\n\r\n Chosen.prototype.setup = function() {\r\n this.form_field_jq = $(this.form_field);\r\n this.current_selectedIndex = this.form_field.selectedIndex;\r\n return this.is_rtl = this.form_field_jq.hasClass(\"chosen-rtl\");\r\n };\r\n\r\n Chosen.prototype.set_up_html = function() {\r\n var container_classes, container_props;\r\n container_classes = [\"chosen-container\"];\r\n container_classes.push(\"chosen-container-\" + (this.is_multiple ? \"multi\" : \"single\"));\r\n if (this.inherit_select_classes && this.form_field.className) {\r\n container_classes.push(this.form_field.className);\r\n }\r\n if (this.is_rtl) {\r\n container_classes.push(\"chosen-rtl\");\r\n }\r\n container_props = {\r\n 'class': container_classes.join(' '),\r\n 'style': \"width: \" + (this.container_width()) + \";\",\r\n 'title': this.form_field.title\r\n };\r\n if (this.form_field.id.length) {\r\n container_props.id = this.form_field.id.replace(/[^\\w]/g, '_') + \"_chosen\";\r\n }\r\n this.container = $(\"\", container_props);\r\n if (this.is_multiple) {\r\n this.container.html('');\r\n } else {\r\n this.container.html('' + this.default_text + '
');\r\n }\r\n this.form_field_jq.hide().after(this.container);\r\n this.dropdown = this.container.find('div.chosen-drop').first();\r\n this.search_field = this.container.find('input').first();\r\n this.search_results = this.container.find('ul.chosen-results').first();\r\n this.search_field_scale();\r\n this.search_no_results = this.container.find('li.no-results').first();\r\n if (this.is_multiple) {\r\n this.search_choices = this.container.find('ul.chosen-choices').first();\r\n this.search_container = this.container.find('li.search-field').first();\r\n } else {\r\n this.search_container = this.container.find('div.chosen-search').first();\r\n this.selected_item = this.container.find('.chosen-single').first();\r\n }\r\n this.results_build();\r\n this.set_tab_index();\r\n return this.set_label_behavior();\r\n };\r\n\r\n Chosen.prototype.on_ready = function() {\r\n return this.form_field_jq.trigger(\"chosen:ready\", {\r\n chosen: this\r\n });\r\n };\r\n\r\n Chosen.prototype.register_observers = function() {\r\n var _this = this;\r\n this.container.bind('touchstart.chosen', function(evt) {\r\n _this.container_mousedown(evt);\r\n return evt.preventDefault();\r\n });\r\n this.container.bind('touchend.chosen', function(evt) {\r\n _this.container_mouseup(evt);\r\n return evt.preventDefault();\r\n });\r\n this.container.bind('mousedown.chosen', function(evt) {\r\n _this.container_mousedown(evt);\r\n });\r\n this.container.bind('mouseup.chosen', function(evt) {\r\n _this.container_mouseup(evt);\r\n });\r\n this.container.bind('mouseenter.chosen', function(evt) {\r\n _this.mouse_enter(evt);\r\n });\r\n this.container.bind('mouseleave.chosen', function(evt) {\r\n _this.mouse_leave(evt);\r\n });\r\n this.search_results.bind('mouseup.chosen', function(evt) {\r\n _this.search_results_mouseup(evt);\r\n });\r\n this.search_results.bind('mouseover.chosen', function(evt) {\r\n _this.search_results_mouseover(evt);\r\n });\r\n this.search_results.bind('mouseout.chosen', function(evt) {\r\n _this.search_results_mouseout(evt);\r\n });\r\n this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {\r\n _this.search_results_mousewheel(evt);\r\n });\r\n this.search_results.bind('touchstart.chosen', function(evt) {\r\n _this.search_results_touchstart(evt);\r\n });\r\n this.search_results.bind('touchmove.chosen', function(evt) {\r\n _this.search_results_touchmove(evt);\r\n });\r\n this.search_results.bind('touchend.chosen', function(evt) {\r\n _this.search_results_touchend(evt);\r\n });\r\n this.form_field_jq.bind(\"chosen:updated.chosen\", function(evt) {\r\n _this.results_update_field(evt);\r\n });\r\n this.form_field_jq.bind(\"chosen:activate.chosen\", function(evt) {\r\n _this.activate_field(evt);\r\n });\r\n this.form_field_jq.bind(\"chosen:open.chosen\", function(evt) {\r\n _this.container_mousedown(evt);\r\n });\r\n this.form_field_jq.bind(\"chosen:close.chosen\", function(evt) {\r\n _this.input_blur(evt);\r\n });\r\n this.search_field.bind('blur.chosen', function(evt) {\r\n _this.input_blur(evt);\r\n });\r\n this.search_field.bind('keyup.chosen', function(evt) {\r\n _this.keyup_checker(evt);\r\n });\r\n this.search_field.bind('keydown.chosen', function(evt) {\r\n _this.keydown_checker(evt);\r\n });\r\n this.search_field.bind('focus.chosen', function(evt) {\r\n _this.input_focus(evt);\r\n });\r\n this.search_field.bind('cut.chosen', function(evt) {\r\n _this.clipboard_event_checker(evt);\r\n });\r\n this.search_field.bind('paste.chosen', function(evt) {\r\n _this.clipboard_event_checker(evt);\r\n });\r\n if (this.is_multiple) {\r\n return this.search_choices.bind('click.chosen', function(evt) {\r\n _this.choices_click(evt);\r\n });\r\n } else {\r\n return this.container.bind('click.chosen', function(evt) {\r\n evt.preventDefault();\r\n });\r\n }\r\n };\r\n\r\n Chosen.prototype.destroy = function() {\r\n $(this.container[0].ownerDocument).unbind(\"click.chosen\", this.click_test_action);\r\n if (this.search_field[0].tabIndex) {\r\n this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;\r\n }\r\n this.container.remove();\r\n this.form_field_jq.removeData('chosen');\r\n return this.form_field_jq.show();\r\n };\r\n\r\n Chosen.prototype.search_field_disabled = function() {\r\n this.is_disabled = this.form_field_jq[0].disabled;\r\n if (this.is_disabled) {\r\n this.container.addClass('chosen-disabled');\r\n this.search_field[0].disabled = true;\r\n if (!this.is_multiple) {\r\n this.selected_item.unbind(\"focus.chosen\", this.activate_action);\r\n }\r\n return this.close_field();\r\n } else {\r\n this.container.removeClass('chosen-disabled');\r\n this.search_field[0].disabled = false;\r\n if (!this.is_multiple) {\r\n return this.selected_item.bind(\"focus.chosen\", this.activate_action);\r\n }\r\n }\r\n };\r\n\r\n Chosen.prototype.container_mousedown = function(evt) {\r\n if (!this.is_disabled) {\r\n if (evt && evt.type === \"mousedown\" && !this.results_showing) {\r\n evt.preventDefault();\r\n }\r\n if (!((evt != null) && ($(evt.target)).hasClass(\"search-choice-close\"))) {\r\n if (!this.active_field) {\r\n if (this.is_multiple) {\r\n this.search_field.val(\"\");\r\n }\r\n $(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);\r\n this.results_show();\r\n } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents(\"a.chosen-single\").length)) {\r\n evt.preventDefault();\r\n this.results_toggle();\r\n }\r\n return this.activate_field();\r\n }\r\n }\r\n };\r\n\r\n Chosen.prototype.container_mouseup = function(evt) {\r\n if (evt.target.nodeName === \"ABBR\" && !this.is_disabled) {\r\n return this.results_reset(evt);\r\n }\r\n };\r\n\r\n Chosen.prototype.search_results_mousewheel = function(evt) {\r\n var delta;\r\n if (evt.originalEvent) {\r\n delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;\r\n }\r\n if (delta != null) {\r\n evt.preventDefault();\r\n if (evt.type === 'DOMMouseScroll') {\r\n delta = delta * 40;\r\n }\r\n return this.search_results.scrollTop(delta + this.search_results.scrollTop());\r\n }\r\n };\r\n\r\n Chosen.prototype.blur_test = function(evt) {\r\n if (!this.active_field && this.container.hasClass(\"chosen-container-active\")) {\r\n return this.close_field();\r\n }\r\n };\r\n\r\n Chosen.prototype.close_field = function() {\r\n $(this.container[0].ownerDocument).unbind(\"click.chosen\", this.click_test_action);\r\n this.active_field = false;\r\n this.results_hide();\r\n this.container.removeClass(\"chosen-container-active\");\r\n this.clear_backstroke();\r\n this.show_search_field_default();\r\n return this.search_field_scale();\r\n };\r\n\r\n Chosen.prototype.activate_field = function() {\r\n this.container.addClass(\"chosen-container-active\");\r\n this.active_field = true;\r\n this.search_field.val(this.search_field.val());\r\n return this.search_field.focus();\r\n };\r\n\r\n Chosen.prototype.test_active_click = function(evt) {\r\n var active_container;\r\n active_container = $(evt.target).closest('.chosen-container');\r\n if (active_container.length && this.container[0] === active_container[0]) {\r\n return this.active_field = true;\r\n } else {\r\n return this.close_field();\r\n }\r\n };\r\n\r\n Chosen.prototype.results_build = function() {\r\n this.parsing = true;\r\n this.selected_option_count = null;\r\n this.results_data = SelectParser.select_to_array(this.form_field);\r\n if (this.is_multiple) {\r\n this.search_choices.find(\"li.search-choice\").remove();\r\n } else if (!this.is_multiple) {\r\n this.single_set_selected_text();\r\n if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {\r\n this.search_field[0].readOnly = true;\r\n this.container.addClass(\"chosen-container-single-nosearch\");\r\n } else {\r\n this.search_field[0].readOnly = false;\r\n this.container.removeClass(\"chosen-container-single-nosearch\");\r\n }\r\n }\r\n this.update_results_content(this.results_option_build({\r\n first: true\r\n }));\r\n this.search_field_disabled();\r\n this.show_search_field_default();\r\n this.search_field_scale();\r\n return this.parsing = false;\r\n };\r\n\r\n Chosen.prototype.result_do_highlight = function(el) {\r\n var high_bottom, high_top, maxHeight, visible_bottom, visible_top;\r\n if (el.length) {\r\n this.result_clear_highlight();\r\n this.result_highlight = el;\r\n this.result_highlight.addClass(\"highlighted\");\r\n maxHeight = parseInt(this.search_results.css(\"maxHeight\"), 10);\r\n visible_top = this.search_results.scrollTop();\r\n visible_bottom = maxHeight + visible_top;\r\n high_top = this.result_highlight.position().top + this.search_results.scrollTop();\r\n high_bottom = high_top + this.result_highlight.outerHeight();\r\n if (high_bottom >= visible_bottom) {\r\n return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);\r\n } else if (high_top < visible_top) {\r\n return this.search_results.scrollTop(high_top);\r\n }\r\n }\r\n };\r\n\r\n Chosen.prototype.result_clear_highlight = function() {\r\n if (this.result_highlight) {\r\n this.result_highlight.removeClass(\"highlighted\");\r\n }\r\n return this.result_highlight = null;\r\n };\r\n\r\n Chosen.prototype.results_show = function() {\r\n if (this.is_multiple && this.max_selected_options <= this.choices_count()) {\r\n this.form_field_jq.trigger(\"chosen:maxselected\", {\r\n chosen: this\r\n });\r\n return false;\r\n }\r\n this.container.addClass(\"chosen-with-drop\");\r\n this.results_showing = true;\r\n this.search_field.focus();\r\n this.search_field.val(this.search_field.val());\r\n this.winnow_results();\r\n return this.form_field_jq.trigger(\"chosen:showing_dropdown\", {\r\n chosen: this\r\n });\r\n };\r\n\r\n Chosen.prototype.update_results_content = function(content) {\r\n return this.search_results.html(content);\r\n };\r\n\r\n Chosen.prototype.results_hide = function() {\r\n if (this.results_showing) {\r\n this.result_clear_highlight();\r\n this.container.removeClass(\"chosen-with-drop\");\r\n this.form_field_jq.trigger(\"chosen:hiding_dropdown\", {\r\n chosen: this\r\n });\r\n }\r\n return this.results_showing = false;\r\n };\r\n\r\n Chosen.prototype.set_tab_index = function(el) {\r\n var ti;\r\n if (this.form_field.tabIndex) {\r\n ti = this.form_field.tabIndex;\r\n this.form_field.tabIndex = -1;\r\n return this.search_field[0].tabIndex = ti;\r\n }\r\n };\r\n\r\n Chosen.prototype.set_label_behavior = function() {\r\n var _this = this;\r\n this.form_field_label = this.form_field_jq.parents(\"label\");\r\n if (!this.form_field_label.length && this.form_field.id.length) {\r\n this.form_field_label = $(\"label[for='\" + this.form_field.id + \"']\");\r\n }\r\n if (this.form_field_label.length > 0) {\r\n return this.form_field_label.bind('click.chosen', function(evt) {\r\n if (_this.is_multiple) {\r\n return _this.container_mousedown(evt);\r\n } else {\r\n return _this.activate_field();\r\n }\r\n });\r\n }\r\n };\r\n\r\n Chosen.prototype.show_search_field_default = function() {\r\n if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {\r\n this.search_field.val(this.default_text);\r\n return this.search_field.addClass(\"default\");\r\n } else {\r\n this.search_field.val(\"\");\r\n return this.search_field.removeClass(\"default\");\r\n }\r\n };\r\n\r\n Chosen.prototype.search_results_mouseup = function(evt) {\r\n var target;\r\n target = $(evt.target).hasClass(\"active-result\") ? $(evt.target) : $(evt.target).parents(\".active-result\").first();\r\n if (target.length) {\r\n this.result_highlight = target;\r\n this.result_select(evt);\r\n return this.search_field.focus();\r\n }\r\n };\r\n\r\n Chosen.prototype.search_results_mouseover = function(evt) {\r\n var target;\r\n target = $(evt.target).hasClass(\"active-result\") ? $(evt.target) : $(evt.target).parents(\".active-result\").first();\r\n if (target) {\r\n return this.result_do_highlight(target);\r\n }\r\n };\r\n\r\n Chosen.prototype.search_results_mouseout = function(evt) {\r\n if ($(evt.target).hasClass(\"active-result\" || $(evt.target).parents('.active-result').first())) {\r\n return this.result_clear_highlight();\r\n }\r\n };\r\n\r\n Chosen.prototype.choice_build = function(item) {\r\n var choice, close_link,\r\n _this = this;\r\n choice = $('', {\r\n \"class\": \"search-choice\"\r\n }).html(\"\" + (this.choice_label(item)) + \"\");\r\n if (item.disabled) {\r\n choice.addClass('search-choice-disabled');\r\n } else {\r\n close_link = $('', {\r\n \"class\": 'search-choice-close',\r\n 'data-option-array-index': item.array_index\r\n });\r\n close_link.bind('click.chosen', function(evt) {\r\n return _this.choice_destroy_link_click(evt);\r\n });\r\n choice.append(close_link);\r\n }\r\n return this.search_container.before(choice);\r\n };\r\n\r\n Chosen.prototype.choice_destroy_link_click = function(evt) {\r\n evt.preventDefault();\r\n evt.stopPropagation();\r\n if (!this.is_disabled) {\r\n return this.choice_destroy($(evt.target));\r\n }\r\n };\r\n\r\n Chosen.prototype.choice_destroy = function(link) {\r\n if (this.result_deselect(link[0].getAttribute(\"data-option-array-index\"))) {\r\n this.show_search_field_default();\r\n if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {\r\n this.results_hide();\r\n }\r\n link.parents('li').first().remove();\r\n return this.search_field_scale();\r\n }\r\n };\r\n\r\n Chosen.prototype.results_reset = function() {\r\n this.reset_single_select_options();\r\n this.form_field.options[0].selected = true;\r\n this.single_set_selected_text();\r\n this.show_search_field_default();\r\n this.results_reset_cleanup();\r\n this.form_field_jq.trigger(\"change\");\r\n if (this.active_field) {\r\n return this.results_hide();\r\n }\r\n };\r\n\r\n Chosen.prototype.results_reset_cleanup = function() {\r\n this.current_selectedIndex = this.form_field.selectedIndex;\r\n return this.selected_item.find(\"abbr\").remove();\r\n };\r\n\r\n Chosen.prototype.result_select = function(evt) {\r\n var high, item;\r\n if (this.result_highlight) {\r\n high = this.result_highlight;\r\n this.result_clear_highlight();\r\n if (this.is_multiple && this.max_selected_options <= this.choices_count()) {\r\n this.form_field_jq.trigger(\"chosen:maxselected\", {\r\n chosen: this\r\n });\r\n return false;\r\n }\r\n if (this.is_multiple) {\r\n high.removeClass(\"active-result\");\r\n } else {\r\n this.reset_single_select_options();\r\n }\r\n item = this.results_data[high[0].getAttribute(\"data-option-array-index\")];\r\n item.selected = true;\r\n this.form_field.options[item.options_index].selected = true;\r\n this.selected_option_count = null;\r\n if (this.is_multiple) {\r\n this.choice_build(item);\r\n } else {\r\n this.single_set_selected_text(this.choice_label(item));\r\n }\r\n if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {\r\n this.results_hide();\r\n }\r\n this.search_field.val(\"\");\r\n if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {\r\n this.form_field_jq.trigger(\"change\", {\r\n 'selected': this.form_field.options[item.options_index].value\r\n });\r\n }\r\n this.current_selectedIndex = this.form_field.selectedIndex;\r\n evt.preventDefault();\r\n return this.search_field_scale();\r\n }\r\n };\r\n\r\n Chosen.prototype.single_set_selected_text = function(text) {\r\n if (text == null) {\r\n text = this.default_text;\r\n }\r\n if (text === this.default_text) {\r\n this.selected_item.addClass(\"chosen-default\");\r\n } else {\r\n this.single_deselect_control_build();\r\n this.selected_item.removeClass(\"chosen-default\");\r\n }\r\n return this.selected_item.find(\"span\").html(text);\r\n };\r\n\r\n Chosen.prototype.result_deselect = function(pos) {\r\n var result_data;\r\n result_data = this.results_data[pos];\r\n if (!this.form_field.options[result_data.options_index].disabled) {\r\n result_data.selected = false;\r\n this.form_field.options[result_data.options_index].selected = false;\r\n this.selected_option_count = null;\r\n this.result_clear_highlight();\r\n if (this.results_showing) {\r\n this.winnow_results();\r\n }\r\n this.form_field_jq.trigger(\"change\", {\r\n deselected: this.form_field.options[result_data.options_index].value\r\n });\r\n this.search_field_scale();\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n };\r\n\r\n Chosen.prototype.single_deselect_control_build = function() {\r\n if (!this.allow_single_deselect) {\r\n return;\r\n }\r\n if (!this.selected_item.find(\"abbr\").length) {\r\n this.selected_item.find(\"span\").first().after(\"\");\r\n }\r\n return this.selected_item.addClass(\"chosen-single-with-deselect\");\r\n };\r\n\r\n Chosen.prototype.get_search_text = function() {\r\n return $('').text($.trim(this.search_field.val())).html();\r\n };\r\n\r\n Chosen.prototype.winnow_results_set_highlight = function() {\r\n var do_high, selected_results;\r\n selected_results = !this.is_multiple ? this.search_results.find(\".result-selected.active-result\") : [];\r\n do_high = selected_results.length ? selected_results.first() : this.search_results.find(\".active-result\").first();\r\n if (do_high != null) {\r\n return this.result_do_highlight(do_high);\r\n }\r\n };\r\n\r\n Chosen.prototype.no_results = function(terms) {\r\n var no_results_html;\r\n no_results_html = $('' + this.results_none_found + ' \"\"');\r\n no_results_html.find(\"span\").first().html(terms);\r\n this.search_results.append(no_results_html);\r\n return this.form_field_jq.trigger(\"chosen:no_results\", {\r\n chosen: this\r\n });\r\n };\r\n\r\n Chosen.prototype.no_results_clear = function() {\r\n return this.search_results.find(\".no-results\").remove();\r\n };\r\n\r\n Chosen.prototype.keydown_arrow = function() {\r\n var next_sib;\r\n if (this.results_showing && this.result_highlight) {\r\n next_sib = this.result_highlight.nextAll(\"li.active-result\").first();\r\n if (next_sib) {\r\n return this.result_do_highlight(next_sib);\r\n }\r\n } else {\r\n return this.results_show();\r\n }\r\n };\r\n\r\n Chosen.prototype.keyup_arrow = function() {\r\n var prev_sibs;\r\n if (!this.results_showing && !this.is_multiple) {\r\n return this.results_show();\r\n } else if (this.result_highlight) {\r\n prev_sibs = this.result_highlight.prevAll(\"li.active-result\");\r\n if (prev_sibs.length) {\r\n return this.result_do_highlight(prev_sibs.first());\r\n } else {\r\n if (this.choices_count() > 0) {\r\n this.results_hide();\r\n }\r\n return this.result_clear_highlight();\r\n }\r\n }\r\n };\r\n\r\n Chosen.prototype.keydown_backstroke = function() {\r\n var next_available_destroy;\r\n if (this.pending_backstroke) {\r\n this.choice_destroy(this.pending_backstroke.find(\"a\").first());\r\n return this.clear_backstroke();\r\n } else {\r\n next_available_destroy = this.search_container.siblings(\"li.search-choice\").last();\r\n if (next_available_destroy.length && !next_available_destroy.hasClass(\"search-choice-disabled\")) {\r\n this.pending_backstroke = next_available_destroy;\r\n if (this.single_backstroke_delete) {\r\n return this.keydown_backstroke();\r\n } else {\r\n return this.pending_backstroke.addClass(\"search-choice-focus\");\r\n }\r\n }\r\n }\r\n };\r\n\r\n Chosen.prototype.clear_backstroke = function() {\r\n if (this.pending_backstroke) {\r\n this.pending_backstroke.removeClass(\"search-choice-focus\");\r\n }\r\n return this.pending_backstroke = null;\r\n };\r\n\r\n Chosen.prototype.keydown_checker = function(evt) {\r\n var stroke, _ref1;\r\n stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;\r\n this.search_field_scale();\r\n if (stroke !== 8 && this.pending_backstroke) {\r\n this.clear_backstroke();\r\n }\r\n switch (stroke) {\r\n case 8:\r\n this.backstroke_length = this.search_field.val().length;\r\n break;\r\n case 9:\r\n if (this.results_showing && !this.is_multiple) {\r\n this.result_select(evt);\r\n }\r\n this.mouse_on_container = false;\r\n break;\r\n case 13:\r\n if (this.results_showing) {\r\n evt.preventDefault();\r\n }\r\n break;\r\n case 32:\r\n if (this.disable_search) {\r\n evt.preventDefault();\r\n }\r\n break;\r\n case 38:\r\n evt.preventDefault();\r\n this.keyup_arrow();\r\n break;\r\n case 40:\r\n evt.preventDefault();\r\n this.keydown_arrow();\r\n break;\r\n }\r\n };\r\n\r\n Chosen.prototype.search_field_scale = function() {\r\n var div, f_width, h, style, style_block, styles, w, _i, _len;\r\n if (this.is_multiple) {\r\n h = 0;\r\n w = 0;\r\n style_block = \"position:absolute; left: -1000px; top: -1000px; display:none;\";\r\n styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];\r\n for (_i = 0, _len = styles.length; _i < _len; _i++) {\r\n style = styles[_i];\r\n style_block += style + \":\" + this.search_field.css(style) + \";\";\r\n }\r\n div = $('', {\r\n 'style': style_block\r\n });\r\n div.text(this.search_field.val());\r\n $('body').append(div);\r\n w = div.width() + 25;\r\n div.remove();\r\n f_width = this.container.outerWidth();\r\n if (w > f_width - 10) {\r\n w = f_width - 10;\r\n }\r\n return this.search_field.css({\r\n 'width': w + 'px'\r\n });\r\n }\r\n };\r\n\r\n return Chosen;\r\n\r\n })(AbstractChosen);\r\n\r\n}).call(this);\r\n","/* ========================================================================\r\n * bootstrap-switch - v3.3.2\r\n * http://www.bootstrap-switch.org\r\n * ========================================================================\r\n * Copyright 2012-2013 Mattia Larentis\r\n *\r\n * ========================================================================\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * ========================================================================\r\n */\r\n\r\n(function() {\r\n\tvar __slice = [].slice;\r\n\r\n\t(function($, window) {\r\n\t\t\"use strict\";\r\n\t\tvar BootstrapSwitch;\r\n\t\tBootstrapSwitch = (function() {\r\n\t\t\tfunction BootstrapSwitch(element, options) {\r\n\t\t\t\tif (options == null) {\r\n\t\t\t\t\toptions = {};\r\n\t\t\t\t}\r\n\t\t\t\tthis.$element = $(element);\r\n\t\t\t\tthis.options = $.extend({}, $.fn.bootstrapSwitch.defaults, {\r\n\t\t\t\t\tstate: this.$element.is(\":checked\"),\r\n\t\t\t\t\tsize: this.$element.data(\"size\"),\r\n\t\t\t\t\tanimate: this.$element.data(\"animate\"),\r\n\t\t\t\t\tdisabled: this.$element.is(\":disabled\"),\r\n\t\t\t\t\treadonly: this.$element.is(\"[readonly]\"),\r\n\t\t\t\t\tindeterminate: this.$element.data(\"indeterminate\"),\r\n\t\t\t\t\tinverse: this.$element.data(\"inverse\"),\r\n\t\t\t\t\tradioAllOff: this.$element.data(\"radio-all-off\"),\r\n\t\t\t\t\tonColor: this.$element.data(\"on-color\"),\r\n\t\t\t\t\toffColor: this.$element.data(\"off-color\"),\r\n\t\t\t\t\tonText: this.$element.data(\"on-text\"),\r\n\t\t\t\t\toffText: this.$element.data(\"off-text\"),\r\n\t\t\t\t\tlabelText: this.$element.data(\"label-text\"),\r\n\t\t\t\t\thandleWidth: this.$element.data(\"handle-width\"),\r\n\t\t\t\t\tlabelWidth: this.$element.data(\"label-width\"),\r\n\t\t\t\t\tbaseClass: this.$element.data(\"base-class\"),\r\n\t\t\t\t\twrapperClass: this.$element.data(\"wrapper-class\")\r\n\t\t\t\t}, options);\r\n\t\t\t\tthis.$wrapper = $(\"\", {\r\n\t\t\t\t\t\"class\": (function(_this) {\r\n\t\t\t\t\t\treturn function() {\r\n\t\t\t\t\t\t\tvar classes;\r\n\t\t\t\t\t\t\tclasses = [\"\" + _this.options.baseClass].concat(_this._getClasses(_this.options.wrapperClass));\r\n\t\t\t\t\t\t\tclasses.push(_this.options.state ? \"\" + _this.options.baseClass + \"-on\" : \"\" + _this.options.baseClass + \"-off\");\r\n\t\t\t\t\t\t\tif (_this.options.size != null) {\r\n\t\t\t\t\t\t\t\tclasses.push(\"\" + _this.options.baseClass + \"-\" + _this.options.size);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (_this.options.disabled) {\r\n\t\t\t\t\t\t\t\tclasses.push(\"\" + _this.options.baseClass + \"-disabled\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (_this.options.readonly) {\r\n\t\t\t\t\t\t\t\tclasses.push(\"\" + _this.options.baseClass + \"-readonly\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (_this.options.indeterminate) {\r\n\t\t\t\t\t\t\t\tclasses.push(\"\" + _this.options.baseClass + \"-indeterminate\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (_this.options.inverse) {\r\n\t\t\t\t\t\t\t\tclasses.push(\"\" + _this.options.baseClass + \"-inverse\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (_this.$element.attr(\"id\")) {\r\n\t\t\t\t\t\t\t\tclasses.push(\"\" + _this.options.baseClass + \"-id-\" + (_this.$element.attr(\"id\")));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn classes.join(\" \");\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t})(this)()\r\n\t\t\t\t});\r\n\t\t\t\tthis.$container = $(\"
\", {\r\n\t\t\t\t\t\"class\": \"\" + this.options.baseClass + \"-container\"\r\n\t\t\t\t});\r\n\t\t\t\tthis.$on = $(\"
\", {\r\n\t\t\t\t\thtml: this.options.onText,\r\n\t\t\t\t\t\"class\": \"\" + this.options.baseClass + \"-handle-on \" + this.options.baseClass + \"-\" + this.options.onColor\r\n\t\t\t\t});\r\n\t\t\t\tthis.$off = $(\"\", {\r\n\t\t\t\t\thtml: this.options.offText,\r\n\t\t\t\t\t\"class\": \"\" + this.options.baseClass + \"-handle-off \" + this.options.baseClass + \"-\" + this.options.offColor\r\n\t\t\t\t});\r\n\t\t\t\tthis.$label = $(\"\", {\r\n\t\t\t\t\thtml: this.options.labelText,\r\n\t\t\t\t\t\"class\": \"\" + this.options.baseClass + \"-label\"\r\n\t\t\t\t});\r\n\t\t\t\tthis.$element.on(\"init.bootstrapSwitch\", (function(_this) {\r\n\t\t\t\t\treturn function() {\r\n\t\t\t\t\t\treturn _this.options.onInit.apply(element, arguments);\r\n\t\t\t\t\t};\r\n\t\t\t\t})(this));\r\n\t\t\t\tthis.$element.on(\"switchChange.bootstrapSwitch\", (function(_this) {\r\n\t\t\t\t\treturn function() {\r\n\t\t\t\t\t\treturn _this.options.onSwitchChange.apply(element, arguments);\r\n\t\t\t\t\t};\r\n\t\t\t\t})(this));\r\n\t\t\t\tthis.$container = this.$element.wrap(this.$container).parent();\r\n\t\t\t\tthis.$wrapper = this.$container.wrap(this.$wrapper).parent();\r\n\t\t\t\tthis.$element.before(this.options.inverse ? this.$off : this.$on).before(this.$label).before(this.options.inverse ? this.$on : this.$off);\r\n\t\t\t\tif (this.options.indeterminate) {\r\n\t\t\t\t\tthis.$element.prop(\"indeterminate\", true);\r\n\t\t\t\t}\r\n\t\t\t\tthis._init();\r\n\t\t\t\tthis._elementHandlers();\r\n\t\t\t\tthis._handleHandlers();\r\n\t\t\t\tthis._labelHandlers();\r\n\t\t\t\tthis._formHandler();\r\n\t\t\t\tthis._externalLabelHandler();\r\n\t\t\t\tthis.$element.trigger(\"init.bootstrapSwitch\");\r\n\t\t\t}\r\n\r\n\t\t\tBootstrapSwitch.prototype._constructor = BootstrapSwitch;\r\n\r\n\t\t\tBootstrapSwitch.prototype.lastStateChange = 0;\r\n\r\n\t\t\tBootstrapSwitch.prototype.state = function(value, skip) {\r\n\t\t\t\tDate.now = Date.now || function() { return +new Date; };\r\n\r\n\t\t\t\t/* RC - FIX FOR DOUBLE PRESS */\r\n\t\t\t\tvar now = Date.now();\r\n\r\n\t\t\t\t// if switched in the last 0.2s, ignore\r\n\t\t\t\tif ( now - this.lastStateChange < 500) {\r\n\t\t\t\t\treturn this.$element;\r\n\t\t\t\t}\r\n\t\t\t\tthis.lastStateChange = now;\r\n\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.state;\r\n\t\t\t\t}\r\n\t\t\t\tif (this.options.disabled || this.options.readonly) {\r\n\t\t\t\t\treturn this.$element;\r\n\t\t\t\t}\r\n\t\t\t\tif (this.options.state && !this.options.radioAllOff && this.$element.is(\":radio\")) {\r\n\t\t\t\t\treturn this.$element;\r\n\t\t\t\t}\r\n\t\t\t\tif (this.options.indeterminate) {\r\n\t\t\t\t\tthis.indeterminate(false);\r\n\t\t\t\t}\r\n\t\t\t\tvalue = !!value;\r\n\t\t\t\tthis.$element.prop(\"checked\", value).trigger(\"change.bootstrapSwitch\", skip);\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.toggleState = function(skip) {\r\n\t\t\t\tif (this.options.disabled || this.options.readonly) {\r\n\t\t\t\t\treturn this.$element;\r\n\t\t\t\t}\r\n\t\t\t\tif (this.options.indeterminate) {\r\n\t\t\t\t\tthis.indeterminate(false);\r\n\t\t\t\t\treturn this.state(true);\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn this.$element.prop(\"checked\", !this.options.state).trigger(\"change.bootstrapSwitch\", skip);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.size = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.size;\r\n\t\t\t\t}\r\n\t\t\t\tif (this.options.size != null) {\r\n\t\t\t\t\tthis.$wrapper.removeClass(\"\" + this.options.baseClass + \"-\" + this.options.size);\r\n\t\t\t\t}\r\n\t\t\t\tif (value) {\r\n\t\t\t\t\tthis.$wrapper.addClass(\"\" + this.options.baseClass + \"-\" + value);\r\n\t\t\t\t}\r\n\t\t\t\tthis._width();\r\n\t\t\t\tthis._containerPosition();\r\n\t\t\t\tthis.options.size = value;\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.animate = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.animate;\r\n\t\t\t\t}\r\n\t\t\t\tvalue = !!value;\r\n\t\t\t\tif (value === this.options.animate) {\r\n\t\t\t\t\treturn this.$element;\r\n\t\t\t\t}\r\n\t\t\t\treturn this.toggleAnimate();\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.toggleAnimate = function() {\r\n\t\t\t\tthis.options.animate = !this.options.animate;\r\n\t\t\t\tthis.$wrapper.toggleClass(\"\" + this.options.baseClass + \"-animate\");\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.disabled = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.disabled;\r\n\t\t\t\t}\r\n\t\t\t\tvalue = !!value;\r\n\t\t\t\tif (value === this.options.disabled) {\r\n\t\t\t\t\treturn this.$element;\r\n\t\t\t\t}\r\n\t\t\t\treturn this.toggleDisabled();\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.toggleDisabled = function() {\r\n\t\t\t\tthis.options.disabled = !this.options.disabled;\r\n\t\t\t\tthis.$element.prop(\"disabled\", this.options.disabled);\r\n\t\t\t\tthis.$wrapper.toggleClass(\"\" + this.options.baseClass + \"-disabled\");\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.readonly = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.readonly;\r\n\t\t\t\t}\r\n\t\t\t\tvalue = !!value;\r\n\t\t\t\tif (value === this.options.readonly) {\r\n\t\t\t\t\treturn this.$element;\r\n\t\t\t\t}\r\n\t\t\t\treturn this.toggleReadonly();\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.toggleReadonly = function() {\r\n\t\t\t\tthis.options.readonly = !this.options.readonly;\r\n\t\t\t\tthis.$element.prop(\"readonly\", this.options.readonly);\r\n\t\t\t\tthis.$wrapper.toggleClass(\"\" + this.options.baseClass + \"-readonly\");\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.indeterminate = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.indeterminate;\r\n\t\t\t\t}\r\n\t\t\t\tvalue = !!value;\r\n\t\t\t\tif (value === this.options.indeterminate) {\r\n\t\t\t\t\treturn this.$element;\r\n\t\t\t\t}\r\n\t\t\t\treturn this.toggleIndeterminate();\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.toggleIndeterminate = function() {\r\n\t\t\t\tthis.options.indeterminate = !this.options.indeterminate;\r\n\t\t\t\tthis.$element.prop(\"indeterminate\", this.options.indeterminate);\r\n\t\t\t\tthis.$wrapper.toggleClass(\"\" + this.options.baseClass + \"-indeterminate\");\r\n\t\t\t\tthis._containerPosition();\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.inverse = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.inverse;\r\n\t\t\t\t}\r\n\t\t\t\tvalue = !!value;\r\n\t\t\t\tif (value === this.options.inverse) {\r\n\t\t\t\t\treturn this.$element;\r\n\t\t\t\t}\r\n\t\t\t\treturn this.toggleInverse();\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.toggleInverse = function() {\r\n\t\t\t\tvar $off, $on;\r\n\t\t\t\tthis.$wrapper.toggleClass(\"\" + this.options.baseClass + \"-inverse\");\r\n\t\t\t\t$on = this.$on.clone(true);\r\n\t\t\t\t$off = this.$off.clone(true);\r\n\t\t\t\tthis.$on.replaceWith($off);\r\n\t\t\t\tthis.$off.replaceWith($on);\r\n\t\t\t\tthis.$on = $off;\r\n\t\t\t\tthis.$off = $on;\r\n\t\t\t\tthis.options.inverse = !this.options.inverse;\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.onColor = function(value) {\r\n\t\t\t\tvar color;\r\n\t\t\t\tcolor = this.options.onColor;\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn color;\r\n\t\t\t\t}\r\n\t\t\t\tif (color != null) {\r\n\t\t\t\t\tthis.$on.removeClass(\"\" + this.options.baseClass + \"-\" + color);\r\n\t\t\t\t}\r\n\t\t\t\tthis.$on.addClass(\"\" + this.options.baseClass + \"-\" + value);\r\n\t\t\t\tthis.options.onColor = value;\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.offColor = function(value) {\r\n\t\t\t\tvar color;\r\n\t\t\t\tcolor = this.options.offColor;\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn color;\r\n\t\t\t\t}\r\n\t\t\t\tif (color != null) {\r\n\t\t\t\t\tthis.$off.removeClass(\"\" + this.options.baseClass + \"-\" + color);\r\n\t\t\t\t}\r\n\t\t\t\tthis.$off.addClass(\"\" + this.options.baseClass + \"-\" + value);\r\n\t\t\t\tthis.options.offColor = value;\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.onText = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.onText;\r\n\t\t\t\t}\r\n\t\t\t\tthis.$on.html(value);\r\n\t\t\t\tthis._width();\r\n\t\t\t\tthis._containerPosition();\r\n\t\t\t\tthis.options.onText = value;\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.offText = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.offText;\r\n\t\t\t\t}\r\n\t\t\t\tthis.$off.html(value);\r\n\t\t\t\tthis._width();\r\n\t\t\t\tthis._containerPosition();\r\n\t\t\t\tthis.options.offText = value;\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.labelText = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.labelText;\r\n\t\t\t\t}\r\n\t\t\t\tthis.$label.html(value);\r\n\t\t\t\tthis._width();\r\n\t\t\t\tthis.options.labelText = value;\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.handleWidth = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.handleWidth;\r\n\t\t\t\t}\r\n\t\t\t\tthis.options.handleWidth = value;\r\n\t\t\t\tthis._width();\r\n\t\t\t\tthis._containerPosition();\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.labelWidth = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.labelWidth;\r\n\t\t\t\t}\r\n\t\t\t\tthis.options.labelWidth = value;\r\n\t\t\t\tthis._width();\r\n\t\t\t\tthis._containerPosition();\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.baseClass = function(value) {\r\n\t\t\t\treturn this.options.baseClass;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.wrapperClass = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.wrapperClass;\r\n\t\t\t\t}\r\n\t\t\t\tif (!value) {\r\n\t\t\t\t\tvalue = $.fn.bootstrapSwitch.defaults.wrapperClass;\r\n\t\t\t\t}\r\n\t\t\t\tthis.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(\" \"));\r\n\t\t\t\tthis.$wrapper.addClass(this._getClasses(value).join(\" \"));\r\n\t\t\t\tthis.options.wrapperClass = value;\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.radioAllOff = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.radioAllOff;\r\n\t\t\t\t}\r\n\t\t\t\tvalue = !!value;\r\n\t\t\t\tif (value === this.options.radioAllOff) {\r\n\t\t\t\t\treturn this.$element;\r\n\t\t\t\t}\r\n\t\t\t\tthis.options.radioAllOff = value;\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.onInit = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.onInit;\r\n\t\t\t\t}\r\n\t\t\t\tif (!value) {\r\n\t\t\t\t\tvalue = $.fn.bootstrapSwitch.defaults.onInit;\r\n\t\t\t\t}\r\n\t\t\t\tthis.options.onInit = value;\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.onSwitchChange = function(value) {\r\n\t\t\t\tif (typeof value === \"undefined\") {\r\n\t\t\t\t\treturn this.options.onSwitchChange;\r\n\t\t\t\t}\r\n\t\t\t\tif (!value) {\r\n\t\t\t\t\tvalue = $.fn.bootstrapSwitch.defaults.onSwitchChange;\r\n\t\t\t\t}\r\n\t\t\t\tthis.options.onSwitchChange = value;\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype.destroy = function() {\r\n\t\t\t\tvar $form;\r\n\t\t\t\t$form = this.$element.closest(\"form\");\r\n\t\t\t\tif ($form.length) {\r\n\t\t\t\t\t$form.off(\"reset.bootstrapSwitch\").removeData(\"bootstrap-switch\");\r\n\t\t\t\t}\r\n\t\t\t\tthis.$container.children().not(this.$element).remove();\r\n\t\t\t\tthis.$element.unwrap().unwrap().off(\".bootstrapSwitch\").removeData(\"bootstrap-switch\");\r\n\t\t\t\treturn this.$element;\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype._width = function() {\r\n\t\t\t\tvar $handles, handleWidth;\r\n\t\t\t\t$handles = this.$on.add(this.$off);\r\n\t\t\t\t$handles.add(this.$label).css(\"width\", \"\");\r\n\t\t\t\thandleWidth = this.options.handleWidth === \"auto\" ? Math.max(this.$on.width(), this.$off.width()) : this.options.handleWidth;\r\n\t\t\t\t$handles.width(handleWidth);\r\n\t\t\t\tthis.$label.width((function(_this) {\r\n\t\t\t\t\treturn function(index, width) {\r\n\t\t\t\t\t\tif (_this.options.labelWidth !== \"auto\") {\r\n\t\t\t\t\t\t\treturn _this.options.labelWidth;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (width < handleWidth) {\r\n\t\t\t\t\t\t\treturn handleWidth;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\treturn width;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t})(this));\r\n\t\t\t\tthis._handleWidth = this.$on.outerWidth();\r\n\t\t\t\tthis._labelWidth = this.$label.outerWidth();\r\n\t\t\t\tthis.$container.width((this._handleWidth * 2) + this._labelWidth);\r\n\t\t\t\treturn this.$wrapper.width(this._handleWidth + this._labelWidth);\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype._containerPosition = function(state, callback) {\r\n\t\t\t\tif (state == null) {\r\n\t\t\t\t\tstate = this.options.state;\r\n\t\t\t\t}\r\n\t\t\t\tthis.$container.css(\"margin-left\", (function(_this) {\r\n\t\t\t\t\treturn function() {\r\n\t\t\t\t\t\tvar values;\r\n\t\t\t\t\t\tvalues = [0, \"-\" + _this._handleWidth + \"px\"];\r\n\t\t\t\t\t\tif (_this.options.indeterminate) {\r\n\t\t\t\t\t\t\treturn \"-\" + (_this._handleWidth / 2) + \"px\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (state) {\r\n\t\t\t\t\t\t\tif (_this.options.inverse) {\r\n\t\t\t\t\t\t\t\treturn values[1];\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\treturn values[0];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif (_this.options.inverse) {\r\n\t\t\t\t\t\t\t\treturn values[0];\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\treturn values[1];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t})(this));\r\n\t\t\t\tif (!callback) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\treturn setTimeout(function() {\r\n\t\t\t\t\treturn callback();\r\n\t\t\t\t}, 50);\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype._init = function() {\r\n\t\t\t\tvar init, initInterval;\r\n\t\t\t\tinit = (function(_this) {\r\n\t\t\t\t\treturn function() {\r\n\t\t\t\t\t\t_this._width();\r\n\t\t\t\t\t\treturn _this._containerPosition(null, function() {\r\n\t\t\t\t\t\t\tif (_this.options.animate) {\r\n\t\t\t\t\t\t\t\treturn _this.$wrapper.addClass(\"\" + _this.options.baseClass + \"-animate\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t};\r\n\t\t\t\t})(this);\r\n\t\t\t\tif (this.$wrapper.is(\":visible\")) {\r\n\t\t\t\t\treturn init();\r\n\t\t\t\t}\r\n\t\t\t\treturn initInterval = window.setInterval((function(_this) {\r\n\t\t\t\t\treturn function() {\r\n\t\t\t\t\t\tif (_this.$wrapper.is(\":visible\")) {\r\n\t\t\t\t\t\t\tinit();\r\n\t\t\t\t\t\t\treturn window.clearInterval(initInterval);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t})(this), 50);\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype._elementHandlers = function() {\r\n\t\t\t\treturn this.$element.on({\r\n\t\t\t\t\t\"change.bootstrapSwitch\": (function(_this) {\r\n\t\t\t\t\t\treturn function(e, skip) {\r\n\t\t\t\t\t\t\tvar state;\r\n\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t//e.stopImmediatePropagation();\r\n\t\t\t\t\t\t\tstate = _this.$element.is(\":checked\");\r\n\t\t\t\t\t\t\t_this._containerPosition(state);\r\n\t\t\t\t\t\t\tif (state === _this.options.state) {\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t_this.options.state = state;\r\n\t\t\t\t\t\t\t_this.$wrapper.toggleClass(\"\" + _this.options.baseClass + \"-off\").toggleClass(\"\" + _this.options.baseClass + \"-on\");\r\n\t\t\t\t\t\t\tif (!skip) {\r\n\t\t\t\t\t\t\t\tif (_this.$element.is(\":radio\")) {\r\n\t\t\t\t\t\t\t\t\t$(\"[name='\" + (_this.$element.attr('name')) + \"']\").not(_this.$element).prop(\"checked\", false).trigger(\"change.bootstrapSwitch\", true);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\treturn _this.$element.trigger(\"switchChange.bootstrapSwitch\", [state]);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t})(this),\r\n\t\t\t\t\t\"focus.bootstrapSwitch\": (function(_this) {\r\n\t\t\t\t\t\treturn function(e) {\r\n\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t//return _this.$wrapper.addClass(_this.options.baseClass + \"-focused\");\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t})(this),\r\n\t\t\t\t\t\"blur.bootstrapSwitch\": (function(_this) {\r\n\t\t\t\t\t\treturn function(e) {\r\n\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t//return _this.$wrapper.removeClass(_this.options.baseClass + \"-focused\");\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t})(this),\r\n\t\t\t\t\t\"keydown.bootstrapSwitch\": (function(_this) {\r\n\t\t\t\t\t\treturn function(e) {\r\n\t\t\t\t\t\t\tif (!e.which || _this.options.disabled || _this.options.readonly) {\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tswitch (e.which) {\r\n\t\t\t\t\t\t\t\tcase 37:\r\n\t\t\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t\te.stopImmediatePropagation();\r\n\t\t\t\t\t\t\t\treturn _this.state(false);\r\n\t\t\t\t\t\t\t\tcase 39:\r\n\t\t\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t\te.stopImmediatePropagation();\r\n\t\t\t\t\t\t\t\treturn _this.state(true);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t})(this)\r\n\t\t\t\t});\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype._handleHandlers = function() {\r\n\t\t\t\tthis.$on.on(\"click.bootstrapSwitch\", (function(_this) {\r\n\t\t\t\t\treturn function(event) {\r\n\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t\tevent.stopPropagation();\r\n\t\t\t\t\t\t_this.state(false);\r\n\t\t\t\t\t\treturn _this.$element.trigger(\"focus.bootstrapSwitch\");\r\n\t\t\t\t\t};\r\n\t\t\t\t})(this));\r\n\r\n\t\t\t\treturn this.$off.on(\"click.bootstrapSwitch\", (function(_this) {\r\n\t\t\t\t\treturn function(event) {\r\n\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t\tevent.stopPropagation();\r\n\t\t\t\t\t\t_this.state(true);\r\n\t\t\t\t\t\treturn _this.$element.trigger(\"focus.bootstrapSwitch\");\r\n\t\t\t\t\t};\r\n\t\t\t\t})(this));\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype._labelHandlers = function() {\r\n\t\t\t\treturn this.$label.on({\r\n\t\t\t\t\t\"mousedown.bootstrapSwitch touchstart.bootstrapSwitch\": (function(_this) {\r\n\t\t\t\t\t\treturn function(e) {\r\n\t\t\t\t\t\t\tif (_this._dragStart || _this.options.disabled || _this.options.readonly) {\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\te.stopPropagation();\r\n\t\t\t\t\t\t\t_this._dragStart = (e.pageX || e.originalEvent.touches[0].pageX) - parseInt(_this.$container.css(\"margin-left\"), 10);\r\n\t\t\t\t\t\t\tif (_this.options.animate) {\r\n\t\t\t\t\t\t\t\t_this.$wrapper.removeClass(\"\" + _this.options.baseClass + \"-animate\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn _this.$element.trigger(\"focus.bootstrapSwitch\");\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t})(this),\r\n\t\t\t\t\t\"mousemove.bootstrapSwitch touchmove.bootstrapSwitch\": (function(_this) {\r\n\t\t\t\t\t\treturn function(e) {\r\n\t\t\t\t\t\t\tvar difference;\r\n\t\t\t\t\t\t\tif (_this._dragStart == null) {\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\tdifference = (e.pageX || e.originalEvent.touches[0].pageX) - _this._dragStart;\r\n\t\t\t\t\t\t\tif (difference < -_this._handleWidth || difference > 0) {\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t_this._dragEnd = difference;\r\n\t\t\t\t\t\t\treturn _this.$container.css(\"margin-left\", \"\" + _this._dragEnd + \"px\");\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t})(this),\r\n\t\t\t\t\t\"mouseup.bootstrapSwitch touchend.bootstrapSwitch\": (function(_this) {\r\n\t\t\t\t\t\treturn function(e) {\r\n\t\t\t\t\t\t\tvar state;\r\n\t\t\t\t\t\t\tif (!_this._dragStart) {\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\tif (_this.options.animate) {\r\n\t\t\t\t\t\t\t\t_this.$wrapper.addClass(\"\" + _this.options.baseClass + \"-animate\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (_this._dragEnd) {\r\n\t\t\t\t\t\t\t\tstate = _this._dragEnd > -(_this._handleWidth / 2);\r\n\t\t\t\t\t\t\t\t_this._dragEnd = false;\r\n\t\t\t\t\t\t\t\t_this.state(_this.options.inverse ? !state : state);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t_this.state(!_this.options.state);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn _this._dragStart = false;\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t})(this),\r\n\t\t\t\t\t\"mouseleave.bootstrapSwitch\": (function(_this) {\r\n\t\t\t\t\t\treturn function(e) {\r\n\t\t\t\t\t\t\treturn _this.$label.trigger(\"mouseup.bootstrapSwitch\");\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t})(this)\r\n\t\t\t\t});\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype._externalLabelHandler = function() {\r\n\t\t\t\tvar $externalLabel;\r\n\t\t\t\t$externalLabel = this.$element.closest(\"label\");\r\n\t\t\t\treturn $externalLabel.on(\"click\", (function(_this) {\r\n\t\t\t\t\treturn function(event) {\r\n\t\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\t\tevent.stopImmediatePropagation();\r\n\t\t\t\t\t\tif (event.target === $externalLabel[0]) {\r\n\t\t\t\t\t\t\treturn _this.toggleState();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t})(this));\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype._formHandler = function() {\r\n\t\t\t\tvar $form;\r\n\t\t\t\t$form = this.$element.closest(\"form\");\r\n\t\t\t\tif ($form.data(\"bootstrap-switch\")) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\treturn $form.on(\"reset.bootstrapSwitch\", function() {\r\n\t\t\t\t\treturn window.setTimeout(function() {\r\n\t\t\t\t\t\treturn $form.find(\"input\").filter(function() {\r\n\t\t\t\t\t\t\treturn $(this).data(\"bootstrap-switch\");\r\n\t\t\t\t\t\t}).each(function() {\r\n\t\t\t\t\t\t\treturn $(this).bootstrapSwitch(\"state\", this.checked);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}, 1);\r\n\t\t\t\t}).data(\"bootstrap-switch\", true);\r\n\t\t\t};\r\n\r\n\t\t\tBootstrapSwitch.prototype._getClasses = function(classes) {\r\n\t\t\t\tvar c, cls, _i, _len;\r\n\t\t\t\tif (!$.isArray(classes)) {\r\n\t\t\t\t\treturn [\"\" + this.options.baseClass + \"-\" + classes];\r\n\t\t\t\t}\r\n\t\t\t\tcls = [];\r\n\t\t\t\tfor (_i = 0, _len = classes.length; _i < _len; _i++) {\r\n\t\t\t\t\tc = classes[_i];\r\n\t\t\t\t\tcls.push(\"\" + this.options.baseClass + \"-\" + c);\r\n\t\t\t\t}\r\n\t\t\t\treturn cls;\r\n\t\t\t};\r\n\r\n\t\t\treturn BootstrapSwitch;\r\n\r\n\t\t})();\r\n\t\t$.fn.bootstrapSwitch = function() {\r\n\t\t\tvar args, option, ret;\r\n\t\t\toption = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];\r\n\t\t\tret = this;\r\n\t\t\tthis.each(function() {\r\n\t\t\t\tvar $this, data;\r\n\t\t\t\t$this = $(this);\r\n\t\t\t\tdata = $this.data(\"bootstrap-switch\");\r\n\t\t\t\tif (!data) {\r\n\t\t\t\t\t$this.data(\"bootstrap-switch\", data = new BootstrapSwitch(this, option));\r\n\t\t\t\t}\r\n\t\t\t\tif (typeof option === \"string\") {\r\n\t\t\t\t\treturn ret = data[option].apply(data, args);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\treturn ret;\r\n\t\t};\r\n\t\t$.fn.bootstrapSwitch.Constructor = BootstrapSwitch;\r\n\t\treturn $.fn.bootstrapSwitch.defaults = {\r\n\t\t\tstate: true,\r\n\t\t\tsize: null,\r\n\t\t\tanimate: true,\r\n\t\t\tdisabled: false,\r\n\t\t\treadonly: false,\r\n\t\t\tindeterminate: false,\r\n\t\t\tinverse: false,\r\n\t\t\tradioAllOff: false,\r\n\t\t\tonColor: \"primary\",\r\n\t\t\toffColor: \"default\",\r\n\t\t\tonText: \"ON\",\r\n\t\t\toffText: \"OFF\",\r\n\t\t\tlabelText: \" \",\r\n\t\t\thandleWidth: \"auto\",\r\n\t\t\tlabelWidth: \"auto\",\r\n\t\t\tbaseClass: \"bootstrap-switch\",\r\n\t\t\twrapperClass: \"wrapper\",\r\n\t\t\tonInit: function() {},\r\n\t\t\tonSwitchChange: function() {}\r\n\t\t};\r\n\t})(window.jQuery, window);\r\n\r\n}).call(this);\r\n","/*\r\n\tBreakpoints.js\r\n\tversion 1.0\r\n\t\r\n\tCreates handy events for your responsive design breakpoints\r\n\t\r\n\tCopyright 2011 XOXCO, Inc\r\n\thttp://xoxco.com/\r\n\r\n\tDocumentation for this plugin lives here:\r\n\thttp://xoxco.com/projects/code/breakpoints\r\n\t\r\n\tLicensed under the MIT license:\r\n\thttp://www.opensource.org/licenses/mit-license.php\r\n\r\n*/\r\n(function($) {\r\n\r\n\tvar lastSize = 0;\r\n\tvar interval = null;\r\n\r\n\t$.fn.resetBreakpoints = function() {\r\n\t\t$(window).unbind('resize');\r\n\t\tif (interval) {\r\n\t\t\tclearInterval(interval);\r\n\t\t}\r\n\t\tlastSize = 0;\r\n\t};\r\n\t\r\n\t$.fn.setBreakpoints = function(settings) {\r\n\t\tvar options = jQuery.extend({\r\n\t\t\t\t\t\t\tdistinct: true,\r\n\t\t\t\t\t\t\tbreakpoints: new Array(320,480,768,1024)\r\n\t\t\t\t \t},settings);\r\n\r\n\r\n\t\tinterval = setInterval(function() {\r\n\t\r\n\t\t\tvar w = $(window).width();\r\n\t\t\tvar done = false;\r\n\t\t\t\r\n\t\t\tfor (var bp in options.breakpoints.sort(function(a,b) { return (b-a) })) {\r\n\t\t\t\r\n\t\t\t\t// fire onEnter when a browser expands into a new breakpoint\r\n\t\t\t\t// if in distinct mode, remove all other breakpoints first.\r\n\t\t\t\tif (!done && w >= options.breakpoints[bp] && lastSize < options.breakpoints[bp]) {\r\n\t\t\t\t\tif (options.distinct) {\r\n\t\t\t\t\t\tfor (var x in options.breakpoints.sort(function(a,b) { return (b-a) })) {\r\n\t\t\t\t\t\t\tif ($('body').hasClass('breakpoint-' + options.breakpoints[x])) {\r\n\t\t\t\t\t\t\t\t$('body').removeClass('breakpoint-' + options.breakpoints[x]);\r\n\t\t\t\t\t\t\t\t$(window).trigger('exitBreakpoint' + options.breakpoints[x]);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdone = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t$('body').addClass('breakpoint-' + options.breakpoints[bp]);\r\n\t\t\t\t\t$(window).trigger('enterBreakpoint' + options.breakpoints[bp]);\r\n\r\n\t\t\t\t}\t\t\t\t\r\n\r\n\t\t\t\t// fire onExit when browser contracts out of a larger breakpoint\r\n\t\t\t\tif (w < options.breakpoints[bp] && lastSize >= options.breakpoints[bp]) {\r\n\t\t\t\t\t$('body').removeClass('breakpoint-' + options.breakpoints[bp]);\r\n\t\t\t\t\t$(window).trigger('exitBreakpoint' + options.breakpoints[bp]);\r\n\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// if in distinct mode, fire onEnter when browser contracts into a smaller breakpoint\r\n\t\t\t\tif (\r\n\t\t\t\t\toptions.distinct && // only one breakpoint at a time\r\n\t\t\t\t\tw >= options.breakpoints[bp] && // and we are in this one\r\n\t\t\t\t\tw < options.breakpoints[bp-1] && // and smaller than the bigger one\r\n\t\t\t\t\tlastSize > w && // and we contracted\r\n\t\t\t\t\tlastSize >0 && // and this is not the first time\r\n\t\t\t\t\t!$('body').hasClass('breakpoint-' + options.breakpoints[bp]) // and we aren't already in this breakpoint\r\n\t\t\t\t\t) {\t\t\t\t\t\r\n\t\t\t\t\t$('body').addClass('breakpoint-' + options.breakpoints[bp]);\r\n\t\t\t\t\t$(window).trigger('enterBreakpoint' + options.breakpoints[bp]);\r\n\r\n\t\t\t\t}\t\t\t\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t// set up for next call\r\n\t\t\tif (lastSize != w) {\r\n\t\t\t\tlastSize = w;\r\n\t\t\t}\r\n\t\t},250);\r\n\t};\r\n\t\r\n})(jQuery);\r\n","/**\r\n * Copyright (c) 2007-2015 Ariel Flesler - afleslergmailcom | http://flesler.blogspot.com\r\n * Licensed under MIT\r\n * @author Ariel Flesler\r\n * @version 2.1.0\r\n */\r\n;(function(l){'use strict';l(['jquery'],function($){var k=$.scrollTo=function(a,b,c){return $(window).scrollTo(a,b,c)};k.defaults={axis:'xy',duration:0,limit:true};function isWin(a){return!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!==-1}$.fn.scrollTo=function(f,g,h){if(typeof g==='object'){h=g;g=0}if(typeof h==='function'){h={onAfter:h}}if(f==='max'){f=9e9}h=$.extend({},k.defaults,h);g=g||h.duration;var j=h.queue&&h.axis.length>1;if(j){g/=2}h.offset=both(h.offset);h.over=both(h.over);return this.each(function(){if(f===null)return;var d=isWin(this),elem=d?this.contentWindow||window:this,$elem=$(elem),targ=f,attr={},toff;switch(typeof targ){case'number':case'string':if(/^([+-]=?)?\\d+(\\.\\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=d?$(targ):$(targ,elem);if(!targ.length)return;case'object':if(targ.is||targ.style){toff=(targ=$(targ)).offset()}}var e=$.isFunction(h.offset)&&h.offset(elem,targ)||h.offset;$.each(h.axis.split(''),function(i,a){var b=a==='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,prev=$elem[key](),max=k.max(elem,a);if(toff){attr[key]=toff[pos]+(d?0:prev-$elem.offset()[pos]);if(h.margin){attr[key]-=parseInt(targ.css('margin'+b),10)||0;attr[key]-=parseInt(targ.css('border'+b+'Width'),10)||0}attr[key]+=e[pos]||0;if(h.over[pos]){attr[key]+=targ[a==='x'?'width':'height']()*h.over[pos]}}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)==='%'?parseFloat(c)/100*max:c}if(h.limit&&/^\\d+$/.test(attr[key])){attr[key]=attr[key]<=0?0:Math.min(attr[key],max)}if(!i&&h.axis.length>1){if(prev===attr[key]){attr={}}else if(j){animate(h.onAfterFirst);attr={}}}});animate(h.onAfter);function animate(a){var b=$.extend({},h,{queue:true,duration:g,complete:a&&function(){a.call(elem,targ,h)}});$elem.animate(attr,b)}})};k.max=function(a,b){var c=b==='x'?'Width':'Height',scroll='scroll'+c;if(!isWin(a))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,doc=a.ownerDocument||a.document,html=doc.documentElement,body=doc.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}$.Tween.propHooks.scrollLeft=$.Tween.propHooks.scrollTop={get:function(t){return $(t.elem)[t.prop]()},set:function(t){var a=this.get(t);if(t.options.interrupt&&t._last&&t._last!==a){return $(t.elem).stop()}var b=Math.round(t.now);if(a!==b){$(t.elem)[t.prop](b);t._last=this.get(t)}}};return k})}(typeof define==='function'&&define.amd?define:function(a,b){'use strict';if(typeof module!=='undefined'&&module.exports){module.exports=b(require('jquery'))}else{b(jQuery)}}));","/*global jQuery */\r\n/*jshint browser:true */\r\n/*!\r\n* FitVids 1.1\r\n*\r\n* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com\r\n* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/\r\n* Released under the WTFPL license - http://sam.zoy.org/wtfpl/\r\n*\r\n*/\r\n\r\n(function( $ ){\r\n\r\n \"use strict\";\r\n\r\n $.fn.fitVids = function( options ) {\r\n var settings = {\r\n customSelector: null\r\n };\r\n\r\n if(!document.getElementById('fit-vids-style')) {\r\n // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js\r\n var head = document.head || document.getElementsByTagName('head')[0];\r\n var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';\r\n var div = document.createElement('div');\r\n div.innerHTML = 'x
';\r\n head.appendChild(div.childNodes[1]);\r\n }\r\n\r\n if ( options ) {\r\n $.extend( settings, options );\r\n }\r\n\r\n return this.each(function(){\r\n var selectors = [\r\n \"iframe[src*='player.vimeo.com']\",\r\n \"iframe[src*='youtube.com']\",\r\n \"iframe[src*='youtube-nocookie.com']\",\r\n \"iframe[src*='kickstarter.com'][src*='video.html']\",\r\n \"object\",\r\n \"embed\"\r\n ];\r\n\r\n if (settings.customSelector) {\r\n selectors.push(settings.customSelector);\r\n }\r\n\r\n var $allVideos = $(this).find(selectors.join(','));\r\n $allVideos = $allVideos.not(\"object object\"); // SwfObj conflict patch\r\n\r\n $allVideos.each(function(){\r\n var $this = $(this);\r\n if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }\r\n var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),\r\n width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),\r\n aspectRatio = height / width;\r\n if(!$this.attr('id')){\r\n var videoID = 'fitvid' + Math.floor(Math.random()*999999);\r\n $this.attr('id', videoID);\r\n }\r\n $this.wrap('').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+\"%\");\r\n $this.removeAttr('height').removeAttr('width');\r\n });\r\n });\r\n };\r\n// Works with either jQuery or Zepto\r\n})( window.jQuery || window.Zepto );\r\n","/*\r\n Sticky-kit v1.1.1 | WTFPL | Leaf Corcoran 2014 | http://leafo.net\r\n*/\r\n(function(){var k,e;k=this.jQuery||window.jQuery;e=k(window);k.fn.stick_in_parent=function(d){var v,y,n,p,h,C,s,G,q,H;null==d&&(d={});s=d.sticky_class;y=d.inner_scrolling;C=d.recalc_every;h=d.parent;p=d.offset_top;n=d.spacer;v=d.bottoming;null==p&&(p=0);null==h&&(h=void 0);null==y&&(y=!0);null==s&&(s=\"is_stuck\");null==v&&(v=!0);G=function(a,d,q,z,D,t,r,E){var u,F,m,A,c,f,B,w,x,g,b;if(!a.data(\"sticky_kit\")){a.data(\"sticky_kit\",!0);f=a.parent();null!=h&&(f=f.closest(h));if(!f.length)throw\"failed to find stick parent\";\r\nu=m=!1;(g=null!=n?n&&a.closest(n):k(\"\"))&&g.css(\"position\",a.css(\"position\"));B=function(){var c,e,l;if(!E&&(c=parseInt(f.css(\"border-top-width\"),10),e=parseInt(f.css(\"padding-top\"),10),d=parseInt(f.css(\"padding-bottom\"),10),q=f.offset().top+c+e,z=f.height(),m&&(u=m=!1,null==n&&(a.insertAfter(g),g.detach()),a.css({position:\"\",top:\"\",width:\"\",bottom:\"\"}).removeClass(s),l=!0),D=a.offset().top-parseInt(a.css(\"margin-top\"),10)-p,t=a.outerHeight(!0),r=a.css(\"float\"),g&&g.css({width:a.outerWidth(!0),\r\nheight:t,display:a.css(\"display\"),\"vertical-align\":a.css(\"vertical-align\"),\"float\":r}),l))return b()};B();if(t!==z)return A=void 0,c=p,x=C,b=function(){var b,k,l,h;if(!E&&(null!=x&&(--x,0>=x&&(x=C,B())),l=e.scrollTop(),null!=A&&(k=l-A),A=l,m?(v&&(h=l+t+c>z+q,u&&!h&&(u=!1,a.css({position:\"fixed\",bottom:\"\",top:c}).trigger(\"sticky_kit:unbottom\"))),lb&&!u&&(c-=k,c=Math.max(b-t,c),c=Math.min(p,c),m&&a.css({top:c+\"px\"})))):l>D&&(m=!0,b={position:\"fixed\",top:c},b.width=\"border-box\"===a.css(\"box-sizing\")?a.outerWidth()+\"px\":a.width()+\"px\",a.css(b).addClass(s),null==n&&(a.after(g),\"left\"!==r&&\"right\"!==r||g.append(a)),a.trigger(\"sticky_kit:stick\")),m&&v&&(null==h&&(h=l+t+c>z+q),!u&&h)))return u=!0,\"static\"===f.css(\"position\")&&f.css({position:\"relative\"}),a.css({position:\"absolute\",bottom:d,top:\"auto\"}).trigger(\"sticky_kit:bottom\")},\r\nw=function(){B();return b()},F=function(){E=!0;e.off(\"touchmove\",b);e.off(\"scroll\",b);e.off(\"resize\",w);k(document.body).off(\"sticky_kit:recalc\",w);a.off(\"sticky_kit:detach\",F);a.removeData(\"sticky_kit\");a.css({position:\"\",bottom:\"\",top:\"\",width:\"\"});f.position(\"position\",\"\");if(m)return null==n&&(\"left\"!==r&&\"right\"!==r||a.insertAfter(g),g.remove()),a.removeClass(s)},e.on(\"touchmove\",b),e.on(\"scroll\",b),e.on(\"resize\",w),k(document.body).on(\"sticky_kit:recalc\",w),a.on(\"sticky_kit:detach\",F),setTimeout(b,\r\n0)}};q=0;for(H=this.length;q 0 || e.type === 'mousedown' || e.type === 'mousewheel'){\r\n\t\t\t\t\t\tbase.$body.stop();\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t// Adjust side menu on scroll and resize\r\n\t\t\tbase.$win.bind('scroll resize '.split(' ').join( base.namespace + ' '), function(){\r\n\t\t\t\tbase.throttle();\r\n\t\t\t});\r\n\r\n\t\t\tbase.update();\r\n\r\n\t\t\t// go to hash on page load\r\n\t\t\tif (o.useHash && base.winLoc.hash) {\r\n\t\t\t\tbase.animate(base.winLoc.hash);\r\n\t\t\t}\r\n\r\n\t\t\t// update menu\r\n\t\t\tbase.findLocation();\r\n\r\n\t\t\tif (o.scrollOnInit) {\r\n\t\t\t\t// update content class & hash\r\n\t\t\t\t$sel = base.$el.find( '.' + o.selectedClass + (o.selectedAppliedTo === o.link ? '' : ' ' + o.link) );\r\n\t\t\t\t// send true flag to signal initialization complete\r\n\t\t\t\tbase.animate( $sel.attr(o.targetAttr) || $sel.attr('href'), true );\r\n\t\t\t} else {\r\n\t\t\t\tbase.completed( true );\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tbase.update = function(){\r\n\t\t\tbase.$content = $('.' + o.contentClass);\r\n\t\t\tbase.leftMargin = parseInt( base.$content.css('margin-left'), 10);\r\n\t\t\tbase.rightMargin = parseInt( base.$content.css('margin-right'), 10);\r\n\r\n\t\t\t// Find specific menu links (this roundabout way is needed so ordinary links in the menu continue\r\n\t\t\t// to work - like the links to other demos)\r\n\t\t\tvar $l,\r\n\t\t\t\tlinks = o.selectedAppliedTo + (o.selectedAppliedTo === o.link ? '' : ' ' + o.link),\r\n\t\t\t\tl = '.' + o.externalLinks;\r\n\t\t\t// find links that don't have the externalLinks class nor contained within an externalLinks container\r\n\t\t\tbase.$links = $( base.$el.find(links).map(function(i, el){\r\n\t\t\t\t$l = $(el);\r\n\t\t\t\treturn (!$l.hasClass(l) && !$l.closest(l).length) ? el : null;\r\n\t\t\t}) );\r\n\t\t\tl = '.' + o.contentLinks;\r\n\t\t\t// add links inside the content - the links must have a 'visualNav' class name,\r\n\t\t\t// or be within a container of class 'visualNav'\r\n\t\t\tbase.$links.add( $(l + ',' + l + ' a') )\r\n\t\t\t\t// make them clickable\r\n\t\t\t\t.unbind('click.visualNav')\r\n\t\t\t\t.bind('click.visualNav', function(e, flag){\r\n\t\t\t\t\tvar $this = $( this );\r\n\t\t\t\t\t// contentLinks outside the menu can be anything, but if they are , make sure we get the href\r\n\t\t\t\t\t// just in case the o.link isn't an \r\n\t\t\t\t\tbase.animate( $this.attr(o.targetAttr) || $this.attr('href'), flag);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t});\r\n\t\t\t// find items (li's) based on links (a's)\r\n\t\t\tbase.$items = (o.selectedAppliedTo === o.link) ? base.$links :\r\n\t\t\t\t$( base.$links.map(function(){ return $(this).closest(o.selectedAppliedTo)[0]; }) );\r\n\r\n\t\t\tif (base.initialized) {\r\n\t\t\t\tbase.findLocation();\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tbase.animate = function(sel, flag){\r\n\t\t\tvar $t, targetOffset, animationTime, scrollTop,\r\n\t\t\t\t$sel = $(sel);\r\n\t\t\t// ignore non-existant targets & solitary '#'\r\n\t\t\tif (sel !== '#' && $sel.length) {\r\n\t\t\t\t$t = $(sel).eq(0).closest('.' + o.contentClass);\r\n\t\t\t\t// target is inside of a content block, so target the content block instead\r\n\t\t\t\tif ( $t.length ) { $sel = $t; }\r\n\t\t\t\tif ( $sel.length ) {\r\n\t\t\t\t\tbase.curHash = $sel[0].id || '';\r\n\t\t\t\t\tbase.$curContent = $sel;\r\n\t\t\t\t\t// callback before animation\r\n\t\t\t\t\tif (base.initialized && typeof o.beforeAnimation === 'function') {\r\n\t\t\t\t\t\to.beforeAnimation( base, $sel );\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttargetOffset = $sel.offset();\r\n\t\t\t\t\tscrollTop = Math.min( targetOffset.top, base.$doc.height() - base.$win.height() ) - o.offsetTop;\r\n\r\n\t\t\t\t\tif ( typeof o.animationTime === 'function' ) {\r\n\t\t\t\t\t\t// use animationTime function; default to 1200ms if nothing is returned\r\n\t\t\t\t\t\tanimationTime = ( o.animationTime( Math.abs( base.$body.scrollTop() - scrollTop ) ) ) || 1200;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tanimationTime = o.animationTime;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// get content top or top position if at the document bottom, then animate\r\n\t\t\t\t\tbase.$body.stop().animate({\r\n\t\t\t\t\t\tscrollLeft : Math.min( targetOffset.left, base.$doc.width() - base.$win.width() ) - base.leftMargin,\r\n\t\t\t\t\t\tscrollTop : scrollTop\r\n\t\t\t\t\t},{\r\n\t\t\t\t\t\tqueue : false,\r\n\t\t\t\t\t\tduration : base.initialized ? animationTime : 0,\r\n\t\t\t\t\t\teasing : o.easing[0], // added in case jQuery older than 1.4 is used\r\n\t\t\t\t\t\tspecialEasing : {\r\n\t\t\t\t\t\t\tscrollLeft : o.easing[0] || 'swing',\r\n\t\t\t\t\t\t\tscrollTop : o.easing[1] || o.easing[0] || 'swing'\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tcomplete : function(){\r\n\t\t\t\t\t\t\tbase.completed(flag);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tbase.throttle = function(){\r\n\t\t\tif (base.flag) { return; }\r\n\t\t\tbase.flag = true;\r\n\t\t\tbase.timer = setTimeout(function(){\r\n\t\t\t\tbase.flag = false;\r\n\t\t\t\t// find current menu item after the set time; works better with super fast scrolling\r\n\t\t\t\tbase.findLocation();\r\n\t\t\t}, 100);\r\n\t\t};\r\n\r\n\t\tbase.updateHash = function(){\r\n\t\t\tvar $fx, $node,\r\n\t\t\t\tid = ( o.selectedAppliedTo === o.link ) ?\r\n\t\t\t\tbase.$curItem.attr(o.targetAttr) || base.$curItem.attr('href') :\r\n\t\t\t\tbase.$curItem.find(o.link).attr(o.targetAttr) || base.$curItem.find(o.link).attr('href'),\r\n\t\t\t\thash = ( id || '' ).replace( /^#/, '' );\r\n\t\t\tif (id && hash !== '' && hash !== base.curHash) {\r\n\t\t\t\t$node = $( '#' + hash );\r\n\t\t\t\tbase.curHash = hash;\r\n\t\t\t\tif ( $node.length ) {\r\n\t\t\t\t\t$node.attr( 'id', '' );\r\n\t\t\t\t\t$fx = $( '' )\r\n\t\t\t\t\t\t.css({\r\n\t\t\t\t\t\t\tposition: 'absolute',\r\n\t\t\t\t\t\t\tvisibility: 'hidden',\r\n\t\t\t\t\t\t\ttop: $(document).scrollTop() + 'px'\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\t.attr( 'id', hash )\r\n\t\t\t\t\t\t.appendTo( document.body );\r\n\t\t\t\t}\r\n\t\t\t\tbase.setHash('#' + hash);\r\n\t\t\t\tif ( $node.length ) {\r\n\t\t\t\t\t$fx.remove();\r\n\t\t\t\t\t$node.attr( 'id', hash );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tbase.setHash = function(newHash){\r\n\t\t\tif (base.winLoc.hash !== newHash && newHash !== '#'){\r\n\t\t\t\tif (base.winLoc.replace){\r\n\t\t\t\t\tif (base.history != null) {\r\n\t\t\t\t\t\tbase.history.replaceState({}, '', newHash);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tbase.winLoc.replace(newHash);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// replace not supported by IE8/9... they get full history\r\n\t\t\t\t\tbase.winLoc.hash = newHash;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// flag is needed for initialization\r\n\t\tbase.completed = function(flag){\r\n\t\t\tif (o.useHash) { base.setHash('#' + base.curHash); }\r\n\r\n\t\t\t// callbacks\r\n\t\t\tif (base.initialized) {\r\n\t\t\t\t// callback when animation has completed\r\n\t\t\t\tif (typeof o.complete === 'function') {\r\n\t\t\t\t\to.complete( base, base.$curContent );\r\n\t\t\t\t}\r\n\t\t\t} else if (flag) {\r\n\t\t\t\tif (typeof o.initialized === 'function') {\r\n\t\t\t\t\t// callback( visNavObject, current content, current menu item )\r\n\t\t\t\t\to.initialized( base, base.$curContent );\r\n\t\t\t\t}\r\n\t\t\t\t// complete initialization\r\n\t\t\t\tbase.initialized = true;\r\n\t\t\t}\r\n\r\n\t\t\t// clear throttle flag, just in case\r\n\t\t\tbase.flag = false;\r\n\t\t};\r\n\r\n\t\t// Update menu\r\n\t\tbase.findLocation = function(){\r\n\t\t\tvar tar, locLeft, locTop, sel, elBottom, elHeight, elWidth, elRight,\r\n\t\t\t\twinWidth = base.$win.width(),\r\n\t\t\t\twinLeft = base.$win.scrollLeft(),\r\n\t\t\t\twinTop = base.$win.scrollTop(),\r\n\t\t\t\twinRight = winLeft + winWidth,\r\n\t\t\t\twinBottom = winTop + base.$win.height(),\r\n\t\t\t\tdocHeight = base.$doc.height();\r\n\t\t\tbase.$items.removeClass(o.inViewClass);\r\n\t\t\t// Make content fit on screen\r\n\t\t\tif (o.fitContent) {\r\n\t\t\t\tbase.$content.width( winWidth - base.leftMargin - base.rightMargin );\r\n\t\t\t}\r\n\t\t\t// cycling through each link during the scroll may be slow on some computers/browsers\r\n\t\t\tbase.$links.each(function(i){\r\n\t\t\t\tsel = $(this).attr(o.targetAttr);\r\n\t\t\t\ttar = (sel === '#' || sel.length <= 1) ? '' : $(sel); // ignore links that don't point anywhere\r\n\t\t\t\tif (tar.length) {\r\n\t\t\t\t\tlocTop = Math.ceil(tar.offset().top);\r\n\t\t\t\t\tlocLeft = Math.ceil(tar.offset().left);\r\n\t\t\t\t\telHeight = tar.outerHeight();\r\n\t\t\t\t\telBottom = locTop + elHeight + o.bottomMargin;\r\n\t\t\t\t\telWidth = tar.outerWidth();\r\n\t\t\t\t\telRight = locLeft + elWidth;\r\n\t\t\t\t\t// in view class\r\n\t\t\t\t\tif ( locTop < winBottom && ( locTop + elHeight - o.bottomMargin > winTop || elBottom > winBottom ) &&\r\n\t\t\t\t\t\tlocLeft < winRight && ( locLeft + elWidth - o.bottomMargin > winLeft || elRight > winRight ) ) {\r\n\t\t\t\t\t\tbase.$items.eq(i).addClass(o.inViewClass);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\t// add selected class. If at the document end, select the last element\r\n\t\t\tsel = ( winBottom + o.bottomMargin >= docHeight ) ? ':last' : ':first';\r\n\t\t\tbase.$items.removeClass(o.selectedClass);\r\n\t\t\tbase.$curItem = base.$items.filter('.' + o.inViewClass + sel).addClass(o.selectedClass);\r\n\r\n\t\t\t// update current content class while scrolling\r\n\t\t\tif (base.$curItem[0] !== base.$lastItem[0]) {\r\n\t\t\t\tbase.$lastItem = base.$curItem;\r\n\t\t\t\tbase.$content.removeClass(o.currentContent);\r\n\t\t\t\tsel = '.' + o.selectedClass + (o.selectedAppliedTo === o.link ? '' : ' ' + o.link);\r\n\t\t\t\ttar = base.$el.find(sel).attr(o.targetAttr);\r\n\t\t\t\tbase.$curContent = $(tar)\r\n\t\t\t\t\t.closest('.' + o.contentClass)\r\n\t\t\t\t\t.addClass(o.currentContent);\r\n\t\t\t\tif (base.initialized && typeof o.changed === 'function') {\r\n\t\t\t\t\to.changed( base, base.$curContent );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (o.useHash && base.initialized) {\r\n\t\t\t\tbase.updateHash();\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\t// Run initializer\r\n\t\tbase.init();\r\n\r\n\t};\r\n\r\n\t$.visualNav.defaultOptions = {\r\n\t\t// use link & targetAttr in case you want to use Home
\r\n\t\t// the link = 'div.link' and targetAttr = 'data-target'\r\n\t\tlink : 'a', // Add a link class, as necessary.\r\n\t\ttargetAttr : 'href', // added in case you have link = 'div' and attribute something like data-target.\r\n\t\tselectedAppliedTo : 'li', // to only apply to the link, use the same value as is in the link option.\r\n\t\tcontentClass : 'content', // content class to get height of the section.\r\n\t\tcontentLinks : 'visualNav', // class name of links inside the content that act like the visualNav menu (smooth scroll).\r\n\t\texternalLinks : 'external', // class name of links that link to external content.\r\n\t\tuseHash : true, // if true, the location hash will be updated.\r\n\r\n\t\t// Classes added to items\r\n\t\tinViewClass : 'inView', // css class added to items in the viewport.\r\n\t\tselectedClass : 'selected', // css class applied to menu when a link is selected (highlighted).\r\n\t\tcurrentContent : 'current', // css class applied to the content block when it is currently selected in the menu.\r\n\r\n\t\t// Appearance\r\n\t\tbottomMargin : 100, // Margin from the end of the page where the last menu item is used (in case the target is short).\r\n\t\tfitContent : false, // If true, the contentClass width will be adjusted to fit the browser window (for horizontal pages).\r\n\t\toffsetTop : 0, // add a top offset value (pixels) or jQuery element (height is measured), of any top menu or gap.\r\n\t\tscrollOnInit : false, // scroll to first item automatically on initialization\r\n\r\n\t\t// Animation\r\n\t\tanimationTime : 1200, // page scrolling time in milliseconds or function( distance ) { return milliseconds; }\r\n\t\tstopOnInteraction : true, // if the user presses any key or scrolls the mouse, the animation will cancel\r\n\t\teasing : [ 'swing', 'swing' ], // horizontal, vertical easing; if might be best to leave one axis as swing [ 'swing', 'easeInCirc' ]\r\n\r\n\t\t// Callbacks\r\n\t\tinitialized : null, // Callback executed when the visualNav plugin has finished initializing\r\n\t\tbeforeAnimation : null, // Callback executed before the animation begins moving to the targetted element\r\n\t\tcomplete : null, // Callback executed when the targetted element is in view and scrolling animation has completed\r\n\t\tchanged : null // Callback executed every time the current menu item changes\r\n\t};\r\n\r\n\t$.fn.visualNav = function(options){\r\n\t\treturn this.each(function(){\r\n\t\t\tvar nav = $(this).data('visualNav');\r\n\t\t\t// initialize visualNav but prevent multiple initializations\r\n\t\t\tif ((typeof(options)).match('object|undefined')){\r\n\t\t\t\tif (!nav) {\r\n\t\t\t\t\t(new $.visualNav(this, options));\r\n\t\t\t\t} else {\r\n\t\t\t\t\tnav.update();\r\n\t\t\t\t}\r\n\t\t\t} else if (typeof options === 'string' && /^(#|\\.)/.test(options)) {\r\n\t\t\t\t// string provided, check if it's an ID or class\r\n\t\t\t\tnav.animate(options);\r\n\t\t\t}\r\n\t\t});\r\n\t};\r\n\r\n// This function breaks the chain, but returns\r\n// the visualNav if it has been attached to the object.\r\n\t$.fn.getvisualNav = function(){\r\n\t\treturn this.data('visualNav');\r\n\t};\r\n\r\n})(jQuery);\r\n","/*!\r\n * headroom.js v0.7.0 - Give your page some headroom. Hide your header until you need it\r\n * Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/headroom.js\r\n * License: MIT\r\n */\r\n\r\n!function(a,b){\"use strict\";function c(a){this.callback=a,this.ticking=!1}function d(b){return b&&\"undefined\"!=typeof a&&(b===a||b.nodeType)}function e(a){if(arguments.length<=0)throw new Error(\"Missing arguments in extend function\");var b,c,f=a||{};for(c=1;ca,c=a+this.getViewportHeight()>this.getScrollerHeight();return b||c},toleranceExceeded:function(a,b){return Math.abs(a-this.lastKnownScrollY)>=this.tolerance[b]},shouldUnpin:function(a,b){var c=a>this.lastKnownScrollY,d=a>=this.offset;return c&&d&&b},shouldPin:function(a,b){var c=athis.lastKnownScrollY?\"down\":\"up\",c=this.toleranceExceeded(a,b);this.isOutOfBounds(a)||(a<=this.offset?this.top():this.notTop(),this.shouldUnpin(a,c)?this.unpin():this.shouldPin(a,c)&&this.pin(),this.lastKnownScrollY=a)}},g.options={tolerance:{up:0,down:0},offset:0,scroller:a,classes:{pinned:\"headroom--pinned\",unpinned:\"headroom--unpinned\",top:\"headroom--top\",notTop:\"headroom--not-top\",initial:\"headroom\"}},g.cutsTheMustard=\"undefined\"!=typeof h&&h.rAF&&h.bind&&h.classList,a.Headroom=g}(window,document);","/*!\r\n * headroom.js v0.7.0 - Give your page some headroom. Hide your header until you need it\r\n * Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/headroom.js\r\n * License: MIT\r\n */\r\n\r\n!function(a){a&&(a.fn.headroom=function(b){return this.each(function(){var c=a(this),d=c.data(\"headroom\"),e=\"object\"==typeof b&&b;e=a.extend(!0,{},Headroom.options,e),d||(d=new Headroom(this,e),d.init(),c.data(\"headroom\",d)),\"string\"==typeof b&&d[b]()})},a(\"[data-headroom]\").each(function(){var b=a(this);b.headroom(b.data())}))}(window.Zepto||window.jQuery);","/*\r\n * jQuery throttle / debounce - v1.1 - 3/7/2010\r\n * http://benalman.com/projects/jquery-throttle-debounce-plugin/\r\n * \r\n * Copyright (c) 2010 \"Cowboy\" Ben Alman\r\n * Dual licensed under the MIT and GPL licenses.\r\n * http://benalman.com/about/license/\r\n */\r\n(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!==\"boolean\"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);","(function(h){h.deparam=function(i,j){var d={},k={\"true\":!0,\"false\":!1,\"null\":null};h.each(i.replace(/\\+/g,\" \").split(\"&\"),function(i,l){var m;var a=l.split(\"=\"),c=decodeURIComponent(a[0]),g=d,f=0,b=c.split(\"][\"),e=b.length-1;/\\[/.test(b[0])&&/\\]$/.test(b[e])?(b[e]=b[e].replace(/\\]$/,\"\"),b=b.shift().split(\"[\").concat(b),e=b.length-1):e=0;if(2===a.length)if(a=decodeURIComponent(a[1]),j&&(a=a&&!isNaN(a)?+a:\"undefined\"===a?void 0:void 0!==k[a]?k[a]:a),e)for(;f<=e;f++)c=\"\"===b[f]?g.length:b[f],m=g[c]=\r\nf\r\n */\r\n\r\n!function(a){\"function\"==typeof define&&define.amd?define(\"position-calculator\",[\"jquery\"],a):jQuery.PositionCalculator=a(jQuery)}(function(a){\"use strict\";function b(a){return\"string\"==typeof a&&(\"window\"===a?a=q:\"document\"===a&&(a=r)),a}function c(a){var b=a.split(\" \");return{y:t.test(b[0])?b[0]:\"top\",x:u.test(b[1])?b[1]:\"left\"}}function d(a,b){return a===b?!0:a&&b?a.top===b.top&&a.left===b.left&&a.height===b.height&&a.width===b.width:!1}function e(b){var c=b[0];if(9===c.nodeType)return{width:b.outerWidth(),height:b.outerHeight(),top:0,left:0};if(a.isWindow(c))return{width:b.outerWidth(),height:b.outerHeight(),top:b.scrollTop(),left:b.scrollLeft()};if(c.preventDefault)return{width:0,height:0,top:c.pageY,left:c.pageX};var d=b.offset();return{width:b.outerWidth(),height:b.outerHeight(),top:d.top,left:d.left}}function f(b,c){var d=b[0];if(9!==d.nodeType){if(a.isWindow(d)&&(c.top=b.scrollTop(),c.left=b.scrollLeft()),d.preventDefault)return c.top=d.pageY,void(c.left=d.pageX);var e=b.offset();c.top=e.top,c.left=e.left}}function g(b){var c,d=b[0];return 9===d.nodeType?(d=s,c={top:0,left:0}):a.isWindow(d)?(d=s,c={top:b.scrollTop(),left:b.scrollLeft()}):c=b.offset(),{width:d.clientWidth,height:d.clientHeight,top:c.top+d.clientTop,left:c.left+d.clientLeft}}function h(b,c){var d,e=b[0];9===e.nodeType?(e=s,d={top:0,left:0}):a.isWindow(e)?(e=s,d={top:b.scrollTop(),left:b.scrollLeft()}):d=b.offset(),c.top=d.top+e.clientTop,c.left=d.left+e.clientLeft}function i(a,b){return{y:parseFloat(a.y)*(v.test(a.y)?b.height/100:1),x:parseFloat(a.x)*(v.test(a.x)?b.width/100:1),mirror:a.mirror}}function j(a,b,c){var d={top:0,left:0,middle:.5*a.height,center:.5*a.width,bottom:a.height,right:a.width};return 0!==b.y&&(d.middle+=b.y,b.mirror?(d.top+=\"top\"!==c.y?-1*b.y:b.y,d.bottom+=\"bottom\"!==c.y?-1*b.y:b.y):(d.top+=b.y,d.bottom+=b.y)),0!==b.x&&(d.center+=b.x,b.mirror?(d.left+=\"left\"!==c.x?-1*b.x:b.x,d.right+=\"right\"!==c.x?-1*b.x:b.x):(d.left+=b.x,d.right+=b.x)),d}function k(a){var b=[];return a.top>0&&b.push(\"top\"),a.left>0&&b.push(\"left\"),a.bottom<0&&b.push(\"bottom\"),a.right<0&&b.push(\"right\"),a.overflow=b.length?b:null,a}function l(a,b){var c={top:a.top-b.top,left:a.left-b.left,bottom:a.top+a.height-(b.top+b.height),right:a.left+a.width-(b.left+b.width),overflow:[]};return k(c)}function m(a,b,c,d){var e,f,g,h={y:b.y,x:b.x},i={y:c.y,x:c.x};if(-1!==d.overflow.indexOf(\"top\")&&(e=\"top\"),-1!==d.overflow.indexOf(\"bottom\")&&(e=e?null:\"bottom\"),-1!==d.overflow.indexOf(\"left\")&&(f=\"left\"),-1!==d.overflow.indexOf(\"right\")&&(f=f?null:\"right\"),!e&&!f)return null;switch(a=a===!0?\"both\":a,g=0,a){case\"item\":g=1;break;case\"target\":g=2;break;case\"both\":g=3}return 1&g&&(e&&(h.y=w[h.y]),f&&(h.x=w[h.x])),2&g&&(e&&(i.y=w[i.y]),f&&(i.x=w[i.x])),{item_at:h,tar_at:i}}function n(a,b,c){var d,e,f,g,h;return h=c?[\"top\",\"bottom\"]:[\"left\",\"right\"],d=a[h[0]],f=b[h[0]],e=-1*a[h[1]],g=-1*b[h[1]],0>d&&(d=0),0>e&&(e=0),0>f&&(f=0),0>g&&(g=0),0>d&&0>e?!0:0>f&&0>g?!1:f+g>d+e}function o(a,b){\"all\"===b&&(b=!0);var c=a.distance.overflow;if(!c.length)return a;for(var d,e,f=!1,g=!1,h=c.length-1;h>=0;h--)switch(d=c[h]){case\"top\":case\"bottom\":(!g&&b===!0||-1!==b.indexOf(d))&&(e=a.distance[d],a.moveBy.y+=e,a.distance.top-=e,a.distance.bottom-=e,g=!0);break;case\"left\":case\"right\":(!f&&b===!0||-1!==b.indexOf(d))&&(e=a.distance[d],a.moveBy.x+=e,a.distance.left-=e,a.distance.right-=e,f=!0)}return k(a.distance),a}function p(a){return this instanceof p?(this.options=this.$itm=this.$trg=this.$bnd=this.itmAt=this.trgAt=this.itmPos=this.trgPos=this.bndPos=this.itmOffset=this.trgOffset=null,void this._init(a)):new p(a)}var q=window,r=document,s=r.documentElement,t=/top|middle|bottom/,u=/left|center|right/,v=/%$/,w={left:\"right\",center:\"center\",right:\"left\",top:\"bottom\",middle:\"middle\",bottom:\"top\"};return p.prototype._init=function(d){var e=this.options=a.extend({},p.defaults,d);return e.item?(this.$itm=e.item.jquery?e.item:a(e.item),0===this.$itm.length?null:(this.$trg=e.target&&e.target.jquery?e.target:a(b(e.target)),this.$bnd=e.boundary&&e.boundary.jquery?e.boundary:a(b(e.boundary)),this.itmAt=c(e.itemAt),this.trgAt=c(e.targetAt),this.resize(),this)):null},p.prototype.resize=function(){var a=this.options,b=e(this.$itm),c=this.$trg.length?e(this.$trg):null;if(this.bndPos=this.$bnd.length?g(this.$bnd):null,!this.itmPos||!d(b,this.itmPos)){this.itmPos=b;var f=i(a.itemOffset,b);f.x=-1*f.x,f.y=-1*f.y,this.itmOffset=j(b,f,this.itmAt)}return this.trgPos&&d(c,this.trgPos)||(this.trgPos=c,c&&(this.trgOffset=j(c,i(a.targetOffset,c),this.trgAt))),this},p.prototype.calcVariant=function(a,b){var c={moveBy:null,distance:null,itemAt:null,targetAt:null};if(this.trgPos&&a&&b){var d={top:this.trgPos.top+this.trgOffset[b.y],left:this.trgPos.left+this.trgOffset[b.x]},e={top:d.top-this.itmOffset[a.y],left:d.left-this.itmOffset[a.x],height:this.itmPos.height,width:this.itmPos.width};c.moveBy={y:e.top-this.itmPos.top,x:e.left-this.itmPos.left},c.distance=this.bndPos?l(this.bndPos,e):null,c.itemAt=a.y+\" \"+a.x,c.targetAt=b.y+\" \"+b.x}else c.moveBy={y:0,x:0},c.distance=this.bndPos?l(this.bndPos,this.itmPos):null;return c},p.prototype.calculate=function(){if(null===this.itmPos)return null;var a=this.options;f(this.$itm,this.itmPos),this.trgPos&&f(this.$trg,this.trgPos),this.bndPos&&h(this.$bnd,this.bndPos);var b=this.calcVariant(this.itmAt,this.trgAt);if(!b.distance||!b.distance.overflow)return b;if(a.flip&&\"none\"!==a.flip&&this.trgPos){var c,d=m(a.flip,this.itmAt,this.trgAt,b.distance);if(d){if(c=this.calcVariant(d.item_at,d.tar_at),!c.distance.overflow)return c;var e={y:!1,x:!1};if(e.y=n(c.distance,b.distance,!0),e.x=n(c.distance,b.distance,!1),e.y!==e.x){if(b=this.calcVariant({y:e.y?d.item_at.y:this.itmAt.y,x:e.x?d.item_at.x:this.itmAt.x},{y:e.y?d.tar_at.y:this.trgAt.y,x:e.x?d.tar_at.x:this.trgAt.x}),!b.distance.overflow)return b}else e.y&&e.x&&(b=c)}}return a.stick&&\"none\"!==a.stick?o(b,a.stick):b},p.defaults={item:null,target:null,boundary:window,itemAt:\"top left\",targetAt:\"top left\",itemOffset:{y:0,x:0,mirror:!0},targetOffset:{y:0,x:0,mirror:!0},flip:\"none\",stick:\"none\"},p});\r\n","/**\r\n * @preserve\r\n * Project: Bootstrap Hover Dropdown\r\n * Author: Cameron Spear\r\n * Version: v2.1.3\r\n * Contributors: Mattia Larentis\r\n * Dependencies: Bootstrap's Dropdown plugin, jQuery\r\n * Description: A simple plugin to enable Bootstrap dropdowns to active on hover and provide a nice user experience.\r\n * License: MIT\r\n * Homepage: http://cameronspear.com/blog/bootstrap-dropdown-on-hover-plugin/\r\n */\r\n;(function ($, window, undefined) {\r\n // outside the scope of the jQuery plugin to\r\n // keep track of all dropdowns\r\n var $allDropdowns = $();\r\n\r\n // if instantlyCloseOthers is true, then it will instantly\r\n // shut other nav items when a new one is hovered over\r\n $.fn.dropdownHover = function (options) {\r\n // don't do anything if touch is supported\r\n // (plugin causes some issues on mobile)\r\n\t // DR - Replaced original touch check with one supporting MS pointer events as well\r\n if(Modernizr.touch || Modernizr.pointerevents) return this; // don't want to affect chaining\r\n\r\n // the element we really care about\r\n // is the dropdown-toggle's parent\r\n $allDropdowns = $allDropdowns.add(this.parent());\r\n\r\n return this.each(function () {\r\n var $this = $(this),\r\n $parent = $this.parent(),\r\n defaults = {\r\n delay: 500,\r\n hoverDelay: 0,\r\n instantlyCloseOthers: true\r\n },\r\n data = {\r\n delay: $(this).data('delay'),\r\n hoverDelay: $(this).data('hover-delay'),\r\n instantlyCloseOthers: $(this).data('close-others')\r\n },\r\n showEvent = 'show.bs.dropdown',\r\n hideEvent = 'hide.bs.dropdown',\r\n // shownEvent = 'shown.bs.dropdown',\r\n // hiddenEvent = 'hidden.bs.dropdown',\r\n settings = $.extend(true, {}, defaults, options, data),\r\n timeout, timeoutHover;\r\n\r\n $parent.hover(function (event) {\r\n // so a neighbor can't open the dropdown\r\n if(!$parent.hasClass('open') && !$this.is(event.target)) {\r\n // stop this event, stop executing any code\r\n // in this callback but continue to propagate\r\n return true;\r\n }\r\n\r\n openDropdown(event);\r\n }, function () {\r\n // clear timer for hover event\r\n window.clearTimeout(timeoutHover)\r\n timeout = window.setTimeout(function () {\r\n $this.attr('aria-expanded', 'false');\r\n $parent.removeClass('open');\r\n $this.trigger(hideEvent);\r\n }, settings.delay);\r\n });\r\n\r\n // this helps with button groups!\r\n $this.hover(function (event) {\r\n // this helps prevent a double event from firing.\r\n // see https://github.com/CWSpear/bootstrap-hover-dropdown/issues/55\r\n if(!$parent.hasClass('open') && !$parent.is(event.target)) {\r\n // stop this event, stop executing any code\r\n // in this callback but continue to propagate\r\n return true;\r\n }\r\n\r\n openDropdown(event);\r\n });\r\n\r\n // handle submenus\r\n $parent.find('.dropdown-submenu').each(function (){\r\n var $this = $(this);\r\n var subTimeout;\r\n $this.hover(function () {\r\n window.clearTimeout(subTimeout);\r\n $this.children('.dropdown-menu').show();\r\n // always close submenu siblings instantly\r\n $this.siblings().children('.dropdown-menu').hide();\r\n }, function () {\r\n var $submenu = $this.children('.dropdown-menu');\r\n subTimeout = window.setTimeout(function () {\r\n $submenu.hide();\r\n }, settings.delay);\r\n });\r\n });\r\n\r\n function openDropdown(event) {\r\n // clear dropdown timeout here so it doesnt close before it should\r\n window.clearTimeout(timeout);\r\n // restart hover timer\r\n window.clearTimeout(timeoutHover);\r\n\r\n // delay for hover event.\r\n timeoutHover = window.setTimeout(function () {\r\n $allDropdowns.find(':focus').blur();\r\n\r\n if(settings.instantlyCloseOthers === true)\r\n $allDropdowns.removeClass('open');\r\n\r\n // clear timer for hover event\r\n window.clearTimeout(timeoutHover);\r\n $this.attr('aria-expanded', 'true');\r\n $parent.addClass('open');\r\n $this.trigger(showEvent);\r\n }, settings.hoverDelay);\r\n }\r\n });\r\n };\r\n\r\n $(document).ready(function () {\r\n // apply dropdownHover to all elements with the data-hover=\"dropdown\" attribute\r\n $('[data-hover=\"dropdown\"]').dropdownHover();\r\n });\r\n})(jQuery, window);\r\n"]}