mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
831 lines
146 KiB
JavaScript
831 lines
146 KiB
JavaScript
(function () {
|
|
if (!jQuery || !jQuery.jstree) {
|
|
var r = !1, s = !1, t = !1; (function (b) {
|
|
b.vakata = {}; b.vakata.css = {
|
|
get_css: function (a, b, c) { a = a.toLowerCase(); var e = c.cssRules || c.rules, d = 0; do { if (e.length && d > e.length + 5) break; if (e[d].selectorText && e[d].selectorText.toLowerCase() == a) return !0 === b ? (c.removeRule && c.removeRule(d), c.deleteRule && c.deleteRule(d), !0) : e[d] } while (e[++d]); return !1 }, add_css: function (a, c) { if (b.jstree.css.get_css(a, !1, c)) return !1; c.insertRule ? c.insertRule(a + " { }", 0) : c.addRule(a, null, 0); return b.vakata.css.get_css(a) },
|
|
remove_css: function (a, c) { return b.vakata.css.get_css(a, !0, c) }, add_sheet: function (a) {
|
|
var c = !1, e = !0; if (a.str) return a.title && (c = b("style[id='" + a.title + "-stylesheet']")[0]), c ? e = !1 : (c = document.createElement("style"), c.setAttribute("type", "text/css"), a.title && c.setAttribute("id", a.title + "-stylesheet")), c.styleSheet ? e ? (document.getElementsByTagName("head")[0].appendChild(c), c.styleSheet.cssText = a.str) : c.styleSheet.cssText = c.styleSheet.cssText + " " + a.str : (c.appendChild(document.createTextNode(a.str)), document.getElementsByTagName("head")[0].appendChild(c)),
|
|
c.sheet || c.styleSheet; if (a.url) if (document.createStyleSheet) try { document.createStyleSheet(a.url) } catch (d) { } else return c = document.createElement("link"), c.rel = "stylesheet", c.type = "text/css", c.media = "all", c.href = a.url, document.getElementsByTagName("head")[0].appendChild(c), c.styleSheet
|
|
}
|
|
}; var a = [], c = -1, d = {}, e = {}; b.fn.jstree = function (f) {
|
|
var c = "string" == typeof f, e = Array.prototype.slice.call(arguments, 1), h = this; if (c) {
|
|
if ("_" == f.substring(0, 1)) return h; this.each(function () {
|
|
var c = a[b.data(this, "jstree_instance_id")],
|
|
c = c && b.isFunction(c[f]) ? c[f].apply(c, e) : c; if ("undefined" !== typeof c && (0 === f.indexOf("is_") || !0 !== c && !1 !== c)) return h = c, !1
|
|
})
|
|
} else this.each(function () {
|
|
var c = b.data(this, "jstree_instance_id"), g = [], h = f ? b.extend({}, !0, f) : {}, n = b(this), q = !1, u = [], g = g.concat(e); n.data("jstree") && g.push(n.data("jstree")); h = g.length ? b.extend.apply(null, [!0, h].concat(g)) : h; "undefined" !== typeof c && a[c] && a[c].destroy(); c = parseInt(a.push({}), 10) - 1; b.data(this, "jstree_instance_id", c); h.plugins = b.isArray(h.plugins) ? h.plugins : b.jstree.defaults.plugins.slice();
|
|
h.plugins.unshift("core"); h.plugins = h.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g, "$1$2$4").replace(/,,+/g, ",").replace(/,$/, "").split(","); q = b.extend(!0, {}, b.jstree.defaults, h); q.plugins = h.plugins; b.each(d, function (a, f) { -1 === b.inArray(a, q.plugins) ? (q[a] = null, delete q[a]) : u.push(a) }); q.plugins = u; a[c] = new b.jstree._instance(c, b(this).addClass("jstree jstree-" + c), q); b.each(a[c]._get_settings().plugins, function (b, f) { a[c].data[f] = {} }); b.each(a[c]._get_settings().plugins, function (b, f) {
|
|
d[f] &&
|
|
d[f].__init.apply(a[c])
|
|
}); setTimeout(function () { a[c] && a[c].init() }, 0)
|
|
}); return h
|
|
}; b.jstree = {
|
|
defaults: { plugins: [] }, _focused: function () { return a[c] || null }, _reference: function (f) { if (a[f]) return a[f]; var c = b(f); c.length || "string" !== typeof f || (c = b("#" + f)); return c.length ? a[c.closest(".jstree").data("jstree_instance_id")] || null : null }, _instance: function (a, c, e) {
|
|
this.data = { core: {} }; this.get_settings = function () { return b.extend(!0, {}, e) }; this._get_settings = function () { return e }; this.get_index = function () { return a };
|
|
this.get_container = function () { return c }; this.get_container_ul = function () { return c.children("ul:eq(0)") }; this._set_settings = function (a) { e = b.extend(!0, {}, e, a) }
|
|
}, _fn: {}, plugin: function (a, c) {
|
|
c = b.extend({}, { __init: b.noop, __destroy: b.noop, _fn: {}, defaults: !1 }, c); d[a] = c; b.jstree.defaults[a] = c.defaults; b.each(c._fn, function (c, e) {
|
|
e.plugin = a; e.old = b.jstree._fn[c]; b.jstree._fn[c] = function () {
|
|
var a, f = e, d = Array.prototype.slice.call(arguments); a = new b.Event("before.jstree"); var g = !1; if (!0 !== this.data.core.locked ||
|
|
"unlock" === c || "is_locked" === c) {
|
|
do { if (f && f.plugin && -1 !== b.inArray(f.plugin, this._get_settings().plugins)) break; f = f.old } while (f); if (f) {
|
|
if (0 === c.indexOf("_")) a = f.apply(this, d); else {
|
|
a = this.get_container().triggerHandler(a, { func: c, inst: this, args: d, plugin: f.plugin }); if (!1 === a) return; "undefined" !== typeof a && (d = a); a = f.apply(b.extend({}, this, {
|
|
__callback: function (a) { this.get_container().triggerHandler(c + ".jstree", { inst: this, args: d, rslt: a, rlbk: g }) }, __rollback: function () { return g = this.get_rollback() }, __call_old: function (a) {
|
|
return f.old.apply(this,
|
|
a ? Array.prototype.slice.call(arguments, 1) : d)
|
|
}
|
|
}), d)
|
|
} return a
|
|
}
|
|
}
|
|
}; b.jstree._fn[c].old = e.old; b.jstree._fn[c].plugin = a
|
|
})
|
|
}, rollback: function (f) { f && (b.isArray(f) || (f = [f]), b.each(f, function (b, f) { a[f.i].set_rollback(f.h, f.d) })) }
|
|
}; b.jstree._fn = b.jstree._instance.prototype = {}; b(function () {
|
|
var a = navigator.userAgent.toLowerCase(), c = (a.match(/.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [0, "0"])[1], e = ".jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } .jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } .jstree-rtl li { margin-left:0; margin-right:18px; } .jstree > ul > li { margin-left:0px; } .jstree-rtl > ul > li { margin-right:0px; } .jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } .jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } .jstree a:focus { outline: none; } .jstree a > ins { height:16px; width:16px; } .jstree a > .jstree-icon { margin-right:3px; } .jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } li.jstree-open > ul { display:block; } li.jstree-closed > ul { display:none; } ";
|
|
if (/msie/.test(a) && 6 == parseInt(c, 10)) { r = !0; try { document.execCommand("BackgroundImageCache", !1, !0) } catch (d) { } e += ".jstree li { height:18px; margin-left:0; margin-right:0; } .jstree li li { margin-left:18px; } .jstree-rtl li li { margin-left:0px; margin-right:18px; } li.jstree-open ul { display:block; } li.jstree-closed ul { display:none !important; } .jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } .jstree li a ins { height:16px; width:16px; margin-right:3px; } .jstree-rtl li a ins { margin-right:0px; margin-left:3px; } " } /msie/.test(a) &&
|
|
7 == parseInt(c, 10) && (s = !0, e += ".jstree li a { border-width:0 !important; padding:0px 2px !important; } "); !/compatible/.test(a) && /mozilla/.test(a) && 1.9 > parseFloat(c, 10) && (t = !0, e += ".jstree ins { display:-moz-inline-box; } .jstree li { line-height:12px; } .jstree a { display:-moz-inline-box; } .jstree .jstree-no-icons .jstree-checkbox { display:-moz-inline-stack !important; } "); b.vakata.css.add_sheet({ str: e, title: "jstree" })
|
|
}); b.jstree.plugin("core", {
|
|
__init: function () {
|
|
this.data.core.locked = !1; this.data.core.to_open =
|
|
this.get_settings().core.initially_open; this.data.core.to_load = this.get_settings().core.initially_load
|
|
}, defaults: { html_titles: !1, animation: 500, initially_open: [], initially_load: [], open_parents: !0, notify_plugins: !0, rtl: !1, load_open: !1, strings: { loading: "Loading ...", new_node: "New node", multiple_selection: "Multiple selection" } }, _fn: {
|
|
init: function () {
|
|
this.set_focus(); this._get_settings().core.rtl && this.get_container().addClass("jstree-rtl").css("direction", "rtl"); this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins> </ins><a class='jstree-loading' href='#'><ins class='jstree-icon'> </ins>" +
|
|
this._get_string("loading") + "</a></li></ul>"); this.data.core.li_height = this.get_container_ul().find("li.jstree-closed, li.jstree-leaf").eq(0).height() || 18; this.get_container().delegate("li > ins", "click.jstree", b.proxy(function (a) { a = b(a.target); this.toggle_node(a) }, this)).bind("mousedown.jstree", b.proxy(function () { this.set_focus() }, this)).bind("dblclick.jstree", function (a) {
|
|
if (document.selection && document.selection.empty) document.selection.empty(); else if (window.getSelection) {
|
|
a = window.getSelection();
|
|
try { a.removeAllRanges(), a.collapse() } catch (b) { }
|
|
}
|
|
}); this._get_settings().core.notify_plugins && this.get_container().bind("load_node.jstree", b.proxy(function (a, c) { var e = this._get_node(c.rslt.obj), d = this; -1 === e && (e = this.get_container_ul()); e.length && e.find("li").each(function () { var a = b(this); a.data("jstree") && b.each(a.data("jstree"), function (c, f) { d.data[c] && b.isFunction(d["_" + c + "_notify"]) && d["_" + c + "_notify"].call(d, a, f) }) }) }, this)); this._get_settings().core.load_open && this.get_container().bind("load_node.jstree",
|
|
b.proxy(function (a, c) { var e = this._get_node(c.rslt.obj), d = this; -1 === e && (e = this.get_container_ul()); e.length && e.find("li.jstree-open:not(:has(ul))").each(function () { d.load_node(this, b.noop, b.noop) }) }, this)); this.__callback(); this.load_node(-1, function () { this.loaded(); this.reload_nodes() })
|
|
}, destroy: function () {
|
|
var f, e = this.get_index(), l = this._get_settings(), h = this; b.each(l.plugins, function (a, b) { try { d[b].__destroy.apply(h) } catch (c) { } }); this.__callback(); if (this.is_focused()) for (f in a) if (a.hasOwnProperty(f) &&
|
|
f != e) { a[f].set_focus(); break } e === c && (c = -1); this.get_container().unbind(".jstree").undelegate(".jstree").removeData("jstree_instance_id").find("[class^='jstree']").addBack().attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig, "") }); b(document).unbind(".jstree-" + e).undelegate(".jstree-" + e); a[e] = null; delete a[e]
|
|
}, _core_notify: function (a, b) { b.opened && this.open_node(a, !1, !0) }, lock: function () {
|
|
this.data.core.locked = !0; this.get_container().children("ul").addClass("jstree-locked").css("opacity",
|
|
"0.7"); this.__callback({})
|
|
}, unlock: function () { this.data.core.locked = !1; this.get_container().children("ul").removeClass("jstree-locked").css("opacity", "1"); this.__callback({}) }, is_locked: function () { return this.data.core.locked }, save_opened: function () {
|
|
var a = this; this.data.core.to_open = []; this.get_container_ul().find("li.jstree-open").each(function () {
|
|
this.id && a.data.core.to_open.push("#" + this.id.toString().replace(/^#/, "").replace(/\\\//g, "/").replace(/\//g, "\\/").replace(/\\\./g, ".").replace(/\./g,
|
|
"\\.").replace(/\:/g, "\\:"))
|
|
}); this.__callback(a.data.core.to_open)
|
|
}, save_loaded: function () { }, reload_nodes: function (a) {
|
|
var c = this, e = !0, d = [], m = []; a || (this.data.core.reopen = !1, this.data.core.refreshing = !0, this.data.core.to_open = b.map(b.makeArray(this.data.core.to_open), function (a) { return "#" + a.toString().replace(/^#/, "").replace(/\\\//g, "/").replace(/\//g, "\\/").replace(/\\\./g, ".").replace(/\./g, "\\.").replace(/\:/g, "\\:") }), this.data.core.to_load = b.map(b.makeArray(this.data.core.to_load), function (a) {
|
|
return "#" +
|
|
a.toString().replace(/^#/, "").replace(/\\\//g, "/").replace(/\//g, "\\/").replace(/\\\./g, ".").replace(/\./g, "\\.").replace(/\:/g, "\\:")
|
|
}), this.data.core.to_open.length && (this.data.core.to_load = this.data.core.to_load.concat(this.data.core.to_open))); this.data.core.to_load.length && (b.each(this.data.core.to_load, function (a, c) { if ("#" == c) return !0; b(c).length ? d.push(c) : m.push(c) }), d.length && (this.data.core.to_load = m, b.each(d, function (a, b) {
|
|
c._is_loaded(b) || (c.load_node(b, function () { c.reload_nodes(!0) }, function () { c.reload_nodes(!0) }),
|
|
e = !1)
|
|
}))); this.data.core.to_open.length && b.each(this.data.core.to_open, function (a, b) { c.open_node(b, !1, !0) }); e && (this.data.core.reopen && clearTimeout(this.data.core.reopen), this.data.core.reopen = setTimeout(function () { c.__callback({}, c) }, 50), this.data.core.refreshing = !1, this.reopen())
|
|
}, reopen: function () { var a = this; this.data.core.to_open.length && b.each(this.data.core.to_open, function (b, c) { a.open_node(c, !1, !0) }); this.__callback({}) }, refresh: function (a) {
|
|
var b = this; this.save_opened(); a || (a = -1); (a = this._get_node(a)) ||
|
|
(a = -1); -1 !== a ? a.children("UL").remove() : this.get_container_ul().empty(); this.load_node(a, function () { b.__callback({ obj: a }); b.reload_nodes() })
|
|
}, loaded: function () { this.__callback() }, set_focus: function () { if (!this.is_focused()) { var a = b.jstree._focused(); a && a.unset_focus(); this.get_container().addClass("jstree-focused"); c = this.get_index(); this.__callback() } }, is_focused: function () { return c == this.get_index() }, unset_focus: function () {
|
|
this.is_focused() && (this.get_container().removeClass("jstree-focused"), c =
|
|
-1); this.__callback()
|
|
}, _get_node: function (a) { var c = b(a, this.get_container()); if (c.is(".jstree") || -1 == a) return -1; c = c.closest("li", this.get_container()); return c.length ? c : !1 }, _get_next: function (a, b) { a = this._get_node(a); return -1 === a ? this.get_container().find("> ul > li:first-child") : a.length ? b ? 0 < a.nextAll("li").size() ? a.nextAll("li:eq(0)") : !1 : a.hasClass("jstree-open") ? a.find("li:eq(0)") : 0 < a.nextAll("li").size() ? a.nextAll("li:eq(0)") : a.parentsUntil(".jstree", "li").next("li").eq(0) : !1 }, _get_prev: function (a,
|
|
b) { a = this._get_node(a); if (-1 === a) return this.get_container().find("> ul > li:last-child"); if (!a.length) return !1; if (b) return 0 < a.prevAll("li").length ? a.prevAll("li:eq(0)") : !1; if (a.prev("li").length) { for (a = a.prev("li").eq(0) ; a.hasClass("jstree-open") ;) a = a.children("ul:eq(0)").children("li:last"); return a } var c = a.parentsUntil(".jstree", "li:eq(0)"); return c.length ? c : !1 }, _get_parent: function (a) { a = this._get_node(a); if (-1 == a || !a.length) return !1; a = a.parentsUntil(".jstree", "li:eq(0)"); return a.length ? a : -1 },
|
|
_get_children: function (a) { a = this._get_node(a); return -1 === a ? this.get_container().children("ul:eq(0)").children("li") : a.length ? a.children("ul:eq(0)").children("li") : !1 }, get_path: function (a, b) { var c = [], e = this; a = this._get_node(a); if (-1 === a || !a || !a.length) return !1; a.parentsUntil(".jstree", "li").each(function () { c.push(b ? this.id : e.get_text(this)) }); c.reverse(); c.push(b ? a.attr("id") : this.get_text(a)); return c }, _get_string: function (a) { return this._get_settings().core.strings[a] || a }, is_open: function (a) {
|
|
return (a =
|
|
this._get_node(a)) && -1 !== a && a.hasClass("jstree-open")
|
|
}, is_closed: function (a) { return (a = this._get_node(a)) && -1 !== a && a.hasClass("jstree-closed") }, is_leaf: function (a) { return (a = this._get_node(a)) && -1 !== a && a.hasClass("jstree-leaf") }, correct_state: function (a) { a = this._get_node(a); if (!a || -1 === a) return !1; a.removeClass("jstree-closed jstree-open").addClass("jstree-leaf").children("ul").remove(); this.__callback({ obj: a }) }, open_node: function (a, b, c) {
|
|
a = this._get_node(a); if (!a.length) return !1; if (!a.hasClass("jstree-closed")) return b &&
|
|
b.call(), !1; var e = c || r ? 0 : this._get_settings().core.animation, d = this; this._is_loaded(a) ? (this._get_settings().core.open_parents && a.parentsUntil(".jstree", ".jstree-closed").each(function () { d.open_node(this, !1, !0) }), e && a.children("ul").css("display", "none"), a.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading"), e ? a.children("ul").stop(!0, !0).slideDown(e, function () { this.style.display = ""; d.after_open(a) }) : d.after_open(a), this.__callback({ obj: a }), b && b.call()) :
|
|
(a.children("a").addClass("jstree-loading"), this.load_node(a, function () { d.open_node(a, b, c) }, b))
|
|
}, after_open: function (a) { this.__callback({ obj: a }) }, close_node: function (a, b) {
|
|
a = this._get_node(a); var c = b || r ? 0 : this._get_settings().core.animation, e = this; if (!a.length || !a.hasClass("jstree-open")) return !1; c && a.children("ul").attr("style", "display:block !important"); a.removeClass("jstree-open").addClass("jstree-closed"); c ? a.children("ul").stop(!0, !0).slideUp(c, function () { this.style.display = ""; e.after_close(a) }) :
|
|
e.after_close(a); this.__callback({ obj: a })
|
|
}, after_close: function (a) { this.__callback({ obj: a }) }, toggle_node: function (a) { a = this._get_node(a); if (a.hasClass("jstree-closed")) return this.open_node(a); if (a.hasClass("jstree-open")) return this.close_node(a) }, open_all: function (a, b, c) {
|
|
(a = a ? this._get_node(a) : -1) && -1 !== a || (a = this.get_container_ul()); c ? a = a.find("li.jstree-closed") : (c = a, a = a.is(".jstree-closed") ? a.find("li.jstree-closed").addBack() : a.find("li.jstree-closed")); var e = this; a.each(function () {
|
|
var a = this;
|
|
e._is_loaded(this) ? e.open_node(this, !1, !b) : e.open_node(this, function () { e.open_all(a, b, c) }, !b)
|
|
}); 0 === c.find("li.jstree-closed").length && this.__callback({ obj: c })
|
|
}, close_all: function (a, b) { var c = this; (a = a ? this._get_node(a) : this.get_container()) && -1 !== a || (a = this.get_container_ul()); a.find("li.jstree-open").addBack().each(function () { c.close_node(this, !b) }); this.__callback({ obj: a }) }, clean_node: function (a) {
|
|
a = a && -1 != a ? b(a) : this.get_container_ul(); a = a.is("li") ? a.find("li").addBack() : a.find("li"); a.removeClass("jstree-last").filter("li:last-child").addClass("jstree-last").end().filter(":has(li)").not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");
|
|
a.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove(); this.__callback({ obj: a })
|
|
}, get_rollback: function () { this.__callback(); return { i: this.get_index(), h: this.get_container().children("ul").clone(!0), d: this.data } }, set_rollback: function (a, b) { this.get_container().empty().append(a); this.data = b; this.__callback() }, load_node: function (a, b, c) { this.__callback({ obj: a }) }, _is_loaded: function (a) { return !0 }, create_node: function (a, c, e, d, m) {
|
|
a = this._get_node(a); c = "undefined" === typeof c ?
|
|
"last" : c; var k = b("<li />"), p = this._get_settings().core, n; if (-1 !== a && !a.length) return !1; if (!m && !this._is_loaded(a)) return this.load_node(a, function () { this.create_node(a, c, e, d, !0) }), !1; this.__rollback(); "string" === typeof e && (e = { data: e }); e || (e = {}); e.attr && k.attr(e.attr); e.metadata && k.data(e.metadata); e.state && k.addClass("jstree-" + e.state); e.data || (e.data = this._get_string("new_node")); b.isArray(e.data) || (n = e.data, e.data = [], e.data.push(n)); b.each(e.data, function (a, c) {
|
|
n = b("<a />"); b.isFunction(c) && (c = c.call(this,
|
|
e)); if ("string" == typeof c) n.attr("href", "#")[p.html_titles ? "html" : "text"](c); else c.attr || (c.attr = {}), c.attr.href || (c.attr.href = "#"), n.attr(c.attr)[p.html_titles ? "html" : "text"](c.title), c.language && n.addClass(c.language); n.prepend("<ins class='jstree-icon'> </ins>"); !c.icon && e.icon && (c.icon = e.icon); c.icon && (-1 === c.icon.indexOf("/") ? n.children("ins").addClass(c.icon) : n.children("ins").css("background", "url('" + c.icon + "') center center no-repeat")); k.append(n)
|
|
}); k.prepend("<ins class='jstree-icon'> </ins>");
|
|
-1 === a && (a = this.get_container(), "before" === c && (c = "first"), "after" === c && (c = "last")); switch (c) {
|
|
case "before": a.before(k); n = this._get_parent(a); break; case "after": a.after(k); n = this._get_parent(a); break; case "inside": case "first": a.children("ul").length || a.append("<ul />"); a.children("ul").prepend(k); n = a; break; case "last": a.children("ul").length || a.append("<ul />"); a.children("ul").append(k); n = a; break; default: a.children("ul").length || a.append("<ul />"), c || (c = 0), n = a.children("ul").children("li").eq(c),
|
|
n.length ? n.before(k) : a.children("ul").append(k), n = a
|
|
} if (-1 === n || n.get(0) === this.get_container().get(0)) n = -1; this.clean_node(n); this.__callback({ obj: k, parent: n }); d && d.call(this, k); return k
|
|
}, get_text: function (a) { a = this._get_node(a); if (!a.length) return !1; var c = this._get_settings().core.html_titles; a = a.children("a:eq(0)"); if (c) return a = a.clone(), a.children("INS").remove(), a.html(); a = a.contents().filter(function () { return 3 == this.nodeType })[0]; return a.nodeValue }, set_text: function (a, c) {
|
|
a = this._get_node(a);
|
|
if (!a.length) return !1; a = a.children("a:eq(0)"); if (this._get_settings().core.html_titles) { var b = a.children("INS").clone(); a.html(c).prepend(b); this.__callback({ obj: a, name: c }); return !0 } a = a.contents().filter(function () { return 3 == this.nodeType })[0]; this.__callback({ obj: a, name: c }); return a.nodeValue = c
|
|
}, rename_node: function (a, c) { a = this._get_node(a); this.__rollback(); a && a.length && this.set_text.apply(this, Array.prototype.slice.call(arguments)) && this.__callback({ obj: a, name: c }) }, delete_node: function (a) {
|
|
a = this._get_node(a);
|
|
if (!a.length) return !1; this.__rollback(); var c = this._get_parent(a), e = b([]), d = this; a.each(function () { e = e.add(d._get_prev(this)) }); a = a.detach(); -1 !== c && 0 === c.find("> ul > li").length && c.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); this.clean_node(c); this.__callback({ obj: a, prev: e, parent: c }); return a
|
|
}, prepare_move: function (a, c, d, h, m) {
|
|
var k = {}; k.ot = b.jstree._reference(a) || this; k.o = k.ot._get_node(a); k.r = -1 === c ? -1 : this._get_node(c); k.p = "undefined" === typeof d || !1 === d ? "last" : d; if (m || !e.o ||
|
|
e.o[0] !== k.o[0] || e.r[0] !== k.r[0] || e.p !== k.p) {
|
|
k.ot = b.jstree._reference(k.o) || this; k.rt = b.jstree._reference(k.r) || this; if (-1 !== k.r && k.r) {
|
|
if (!/^(before|after)$/.test(k.p) && !this._is_loaded(k.r)) return this.load_node(k.r, function () { this.prepare_move(a, c, d, h, !0) }); switch (k.p) {
|
|
case "before": k.cp = k.r.index(); k.cr = k.rt._get_parent(k.r); break; case "after": k.cp = k.r.index() + 1; k.cr = k.rt._get_parent(k.r); break; case "inside": case "first": k.cp = 0; k.cr = k.r; break; case "last": k.cp = k.r.find(" > ul > li").length; k.cr =
|
|
k.r; break; default: k.cp = k.p, k.cr = k.r
|
|
}
|
|
} else switch (k.cr = -1, k.p) { case "first": case "before": case "inside": k.cp = 0; break; case "after": case "last": k.cp = k.rt.get_container().find(" > ul > li").length; break; default: k.cp = k.p } k.np = -1 == k.cr ? k.rt.get_container() : k.cr; k.op = k.ot._get_parent(k.o); k.cop = k.o.index(); -1 === k.op && (k.op = k.ot ? k.ot.get_container() : this.get_container()); !/^(before|after)$/.test(k.p) && k.op && k.np && k.op[0] === k.np[0] && k.o.index() < k.cp && k.cp++; k.or = k.np.find(" > ul > li:nth-child(" + (k.cp + 1) +
|
|
")"); e = k
|
|
} this.__callback(e); h && h.call(this, e)
|
|
}, check_move: function () { var a = e, c = !0, b = -1 === a.r ? this.get_container() : a.r; if (!a || !a.o || a.or[0] === a.o[0]) return !1; if (!a.cy) { if (a.op && a.np && a.op[0] === a.np[0] && a.cp - 1 === a.o.index()) return !1; a.o.each(function () { if (-1 !== b.parentsUntil(".jstree", "li").addBack().index(this)) return c = !1 }) } return c }, move_node: function (a, c, d, h, m, k) {
|
|
if (!m) return this.prepare_move(a, c, d, function (a) { this.move_node(a, !1, !1, h, !0, k) }); h && (e.cy = !0); if (!k && !this.check_move()) return !1; this.__rollback();
|
|
c = !1; h ? (c = a.o.clone(!0), c.find("*[id]").addBack().each(function () { this.id && (this.id = "copy_" + this.id) })) : c = a.o; a.or.length ? a.or.before(c) : (a.np.children("ul").length || b("<ul />").appendTo(a.np), a.np.children("ul:eq(0)").append(c)); try { a.ot.clean_node(a.op), a.rt.clean_node(a.np), a.op.find("> ul > li").length || a.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove() } catch (p) { } h && (e.cy = !0, e.oc = c); this.__callback(e); return e
|
|
}, _get_move: function () { return e }
|
|
}
|
|
})
|
|
})(jQuery);
|
|
(function (b) {
|
|
var a, c, d; b(function () {
|
|
/msie/.test(navigator.userAgent.toLowerCase()) ? (c = b('<textarea cols="10" rows="2"></textarea>').css({ position: "absolute", top: -1E3, left: 0 }).appendTo("body"), d = b('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({ position: "absolute", top: -1E3, left: 0 }).appendTo("body"), a = c.width() - d.width(), c.add(d).remove()) : (c = b("<div />").css({ width: 100, height: 100, overflow: "auto", position: "absolute", top: -1E3, left: 0 }).prependTo("body").append("<div />").find("div").css({
|
|
width: "100%",
|
|
height: 200
|
|
}), a = 100 - c.width(), c.parent().remove())
|
|
}); b.jstree.plugin("ui", {
|
|
__init: function () {
|
|
this.data.ui.selected = b(); this.data.ui.last_selected = !1; this.data.ui.hovered = null; this.data.ui.to_select = this.get_settings().ui.initially_select; this.get_container().delegate("a", "click.jstree", b.proxy(function (a) { a.preventDefault(); a.currentTarget.blur(); b(a.currentTarget).hasClass("jstree-loading") || this.select_node(a.currentTarget, !0, a) }, this)).delegate("a", "mouseenter.jstree", b.proxy(function (a) {
|
|
b(a.currentTarget).hasClass("jstree-loading") ||
|
|
this.hover_node(a.target)
|
|
}, this)).delegate("a", "mouseleave.jstree", b.proxy(function (a) { b(a.currentTarget).hasClass("jstree-loading") || this.dehover_node(a.target) }, this)).bind("reopen.jstree", b.proxy(function () { this.reselect() }, this)).bind("get_rollback.jstree", b.proxy(function () { this.dehover_node(); this.save_selected() }, this)).bind("set_rollback.jstree", b.proxy(function () { this.reselect() }, this)).bind("close_node.jstree", b.proxy(function (a, c) {
|
|
var d = this._get_settings().ui, l = this._get_node(c.rslt.obj),
|
|
h = l && l.length ? l.children("ul").find("a.jstree-clicked") : b(), m = this; !1 !== d.selected_parent_close && h.length && h.each(function () { m.deselect_node(this); "select_parent" === d.selected_parent_close && m.select_node(l) })
|
|
}, this)).bind("delete_node.jstree", b.proxy(function (a, c) {
|
|
var b = this._get_settings().ui.select_prev_on_delete, d = this._get_node(c.rslt.obj), d = d && d.length ? d.find("a.jstree-clicked") : [], h = this; d.each(function () { h.deselect_node(this) }); b && d.length && c.rslt.prev.each(function () {
|
|
if (this.parentNode) return h.select_node(this),
|
|
!1
|
|
})
|
|
}, this)).bind("move_node.jstree", b.proxy(function (a, c) { c.rslt.cy && c.rslt.oc.find("a.jstree-clicked").removeClass("jstree-clicked") }, this))
|
|
}, defaults: { select_limit: -1, select_multiple_modifier: "ctrl", select_range_modifier: "shift", selected_parent_close: "select_parent", selected_parent_open: !0, select_prev_on_delete: !0, disable_selecting_children: !1, initially_select: [] }, _fn: {
|
|
_get_node: function (a, c) {
|
|
if ("undefined" === typeof a || null === a) return c ? this.data.ui.selected : this.data.ui.last_selected; var d = b(a,
|
|
this.get_container()); if (d.is(".jstree") || -1 == a) return -1; d = d.closest("li", this.get_container()); return d.length ? d : !1
|
|
}, _ui_notify: function (a, c) { c.selected && this.select_node(a, !1) }, save_selected: function () { var a = this; this.data.ui.to_select = []; this.data.ui.selected.each(function () { this.id && a.data.ui.to_select.push("#" + this.id.toString().replace(/^#/, "").replace(/\\\//g, "/").replace(/\//g, "\\/").replace(/\\\./g, ".").replace(/\./g, "\\.").replace(/\:/g, "\\:")) }); this.__callback(this.data.ui.to_select) },
|
|
reselect: function () { var a = this, c = this.data.ui.to_select, c = b.map(b.makeArray(c), function (a) { return "#" + a.toString().replace(/^#/, "").replace(/\\\//g, "/").replace(/\//g, "\\/").replace(/\\\./g, ".").replace(/\./g, "\\.").replace(/\:/g, "\\:") }); b.each(c, function (c, b) { b && "#" !== b && a.select_node(b) }); this.data.ui.selected = this.data.ui.selected.filter(function () { return this.parentNode }); this.__callback() }, refresh: function (a) { this.save_selected(); return this.__call_old() }, hover_node: function (a) {
|
|
a = this._get_node(a);
|
|
if (!a.length) return !1; a.hasClass("jstree-hovered") || this.dehover_node(); this.data.ui.hovered = a.children("a").addClass("jstree-hovered").parent(); this._fix_scroll(a); this.__callback({ obj: a })
|
|
}, dehover_node: function () { var a = this.data.ui.hovered, c; if (!a || !a.length) return !1; c = a.children("a").removeClass("jstree-hovered").parent(); this.data.ui.hovered[0] === c[0] && (this.data.ui.hovered = null); this.__callback({ obj: a }) }, select_node: function (a, c, b) {
|
|
a = this._get_node(a); if (-1 == a || !a || !a.length) return !1; var d = this._get_settings().ui,
|
|
h = "on" == d.select_multiple_modifier || !1 !== d.select_multiple_modifier && b && b[d.select_multiple_modifier + "Key"], m = !1 !== d.select_range_modifier && b && b[d.select_range_modifier + "Key"] && this.data.ui.last_selected && this.data.ui.last_selected[0] !== a[0] && this.data.ui.last_selected.parent()[0] === a.parent()[0], k = this.is_selected(a), p = !0, n = this; if (c) {
|
|
if (d.disable_selecting_children && h && (a.parentsUntil(".jstree", "li").children("a.jstree-clicked").length || a.children("ul").find("a.jstree-clicked:eq(0)").length)) return !1;
|
|
p = !1; switch (!0) {
|
|
case m: this.data.ui.last_selected.addClass("jstree-last-selected"); a = a[a.index() < this.data.ui.last_selected.index() ? "nextUntil" : "prevUntil"](".jstree-last-selected").addBack(); -1 == d.select_limit || a.length < d.select_limit ? (this.data.ui.last_selected.removeClass("jstree-last-selected"), this.data.ui.selected.each(function () { this !== n.data.ui.last_selected[0] && n.deselect_node(this) }), k = !1, p = !0) : p = !1; break; case k && !h: this.deselect_all(); k = !1; p = !0; break; case !k && !h: if (-1 == d.select_limit ||
|
|
0 < d.select_limit) this.deselect_all(), p = !0; break; case k && h: this.deselect_node(a); break; case !k && h: if (-1 == d.select_limit || this.data.ui.selected.length + 1 <= d.select_limit) p = !0
|
|
}
|
|
} p && !k && (m || (this.data.ui.last_selected = a), a.children("a").addClass("jstree-clicked"), d.selected_parent_open && a.parents(".jstree-closed").each(function () { n.open_node(this, !1, !0) }), this.data.ui.selected = this.data.ui.selected.add(a), this._fix_scroll(a.eq(0)), this.__callback({ obj: a, e: b }))
|
|
}, _fix_scroll: function (c) {
|
|
var b = this.get_container()[0];
|
|
b.scrollHeight > b.offsetHeight && (c = this._get_node(c)) && -1 !== c && c.length && c.is(":visible") && (c = c.offset().top - this.get_container().offset().top, 0 > c && (b.scrollTop = b.scrollTop + c - 1), c + this.data.core.li_height + (b.scrollWidth > b.offsetWidth ? a : 0) > b.offsetHeight && (b.scrollTop += c - b.offsetHeight + this.data.core.li_height + 1 + (b.scrollWidth > b.offsetWidth ? a : 0)))
|
|
}, deselect_node: function (a) {
|
|
a = this._get_node(a); if (!a.length) return !1; this.is_selected(a) && (a.children("a").removeClass("jstree-clicked"), this.data.ui.selected =
|
|
this.data.ui.selected.not(a), this.data.ui.last_selected.get(0) === a.get(0) && (this.data.ui.last_selected = this.data.ui.selected.eq(0)), this.__callback({ obj: a }))
|
|
}, toggle_select: function (a) { a = this._get_node(a); if (!a.length) return !1; this.is_selected(a) ? this.deselect_node(a) : this.select_node(a) }, is_selected: function (a) { return 0 <= this.data.ui.selected.index(this._get_node(a)) }, get_selected: function (a) { return a ? b(a).find("a.jstree-clicked").parent() : this.data.ui.selected }, deselect_all: function (a) {
|
|
a = a ? b(a).find("a.jstree-clicked").parent() :
|
|
this.get_container().find("a.jstree-clicked").parent(); a.children("a.jstree-clicked").removeClass("jstree-clicked"); this.data.ui.selected = b([]); this.data.ui.last_selected = !1; this.__callback({ obj: a })
|
|
}
|
|
}
|
|
}); b.jstree.defaults.plugins.push("ui")
|
|
})(jQuery); (function (b) {
|
|
b.jstree.plugin("crrm", {
|
|
__init: function () {
|
|
this.get_container().bind("move_node.jstree", b.proxy(function (a, c) {
|
|
if (this._get_settings().crrm.move.open_onmove) {
|
|
var b = this; c.rslt.np.parentsUntil(".jstree").addBack().filter(".jstree-closed").each(function () {
|
|
b.open_node(this,
|
|
!1, !0)
|
|
})
|
|
}
|
|
}, this))
|
|
}, defaults: { input_width_limit: 200, move: { always_copy: !1, open_onmove: !0, default_position: "last", check_move: function (a) { return !0 } } }, _fn: {
|
|
_show_input: function (a, c) {
|
|
a = this._get_node(a); var d = this._get_settings().core.rtl, e = this._get_settings().crrm.input_width_limit, f = a.children("ins").width(), g = a.find("> a:visible > ins").width() * a.find("> a:visible > ins").length, l = this.get_text(a), h = b("<div />", { css: { position: "absolute", top: "-200px", left: d ? "0px" : "-1000px", visibility: "hidden" } }).appendTo("body"),
|
|
m = a.css("position", "relative").append(b("<input />", {
|
|
value: l, "class": "jstree-rename-input", css: { padding: "0", border: "1px solid silver", position: "absolute", left: d ? "auto" : f + g + 4 + "px", right: d ? f + g + 4 + "px" : "auto", top: "0px", height: this.data.core.li_height - 2 + "px", lineHeight: this.data.core.li_height - 2 + "px", width: "150px" }, blur: b.proxy(function () { var b = a.children(".jstree-rename-input"), d = b.val(); "" === d && (d = l); h.remove(); b.remove(); this.set_text(a, l); this.rename_node(a, d); c.call(this, a, d, l); a.css("position", "") },
|
|
this), keyup: function (a) { a = a.keyCode || a.which; 27 == a ? (this.value = l, this.blur()) : 13 == a ? this.blur() : m.width(Math.min(h.text("pW" + this.value).width(), e)) }, keypress: function (a) { if (13 == (a.keyCode || a.which)) return !1 }
|
|
})).children(".jstree-rename-input"); this.set_text(a, ""); h.css({
|
|
fontFamily: m.css("fontFamily") || "", fontSize: m.css("fontSize") || "", fontWeight: m.css("fontWeight") || "", fontStyle: m.css("fontStyle") || "", fontStretch: m.css("fontStretch") || "", fontVariant: m.css("fontVariant") || "", letterSpacing: m.css("letterSpacing") ||
|
|
"", wordSpacing: m.css("wordSpacing") || ""
|
|
}); m.width(Math.min(h.text("pW" + m[0].value).width(), e))[0].select()
|
|
}, rename: function (a) { a = this._get_node(a); this.__rollback(); var c = this.__callback; this._show_input(a, function (a, b, f) { c.call(this, { obj: a, new_name: b, old_name: f }) }) }, create: function (a, c, d, e, f) {
|
|
var g = this; (a = this._get_node(a)) || (a = -1); this.__rollback(); return this.create_node(a, c, d, function (a) {
|
|
var c = this._get_parent(a), d = b(a).index(); e && e.call(this, a); c.length && c.hasClass("jstree-closed") && this.open_node(c,
|
|
!1, !0); f ? g.__callback({ obj: a, name: this.get_text(a), parent: c, position: d }) : this._show_input(a, function (a, b, e) { g.__callback({ obj: a, name: b, parent: c, position: d }) })
|
|
})
|
|
}, remove: function (a) { a = this._get_node(a, !0); var c = this._get_parent(a), b = this._get_prev(a); this.__rollback(); a = this.delete_node(a); !1 !== a && this.__callback({ obj: a, prev: b, parent: c }) }, check_move: function () { return this.__call_old() && this._get_settings().crrm.move.check_move.call(this, this._get_move()) ? !0 : !1 }, move_node: function (a, c, b, e, f, g) {
|
|
var l =
|
|
this._get_settings().crrm.move; if (!f) return "undefined" === typeof b && (b = l.default_position), "inside" !== b || l.default_position.match(/^(before|after)$/) || (b = l.default_position), this.__call_old(!0, a, c, b, e, !1, g); if (!0 === l.always_copy || "multitree" === l.always_copy && a.rt.get_index() !== a.ot.get_index()) e = !0; this.__call_old(!0, a, c, b, e, !0, g)
|
|
}, cut: function (a) { a = this._get_node(a, !0); if (!a || !a.length) return !1; this.data.crrm.cp_nodes = !1; this.data.crrm.ct_nodes = a; this.__callback({ obj: a }) }, copy: function (a) {
|
|
a = this._get_node(a,
|
|
!0); if (!a || !a.length) return !1; this.data.crrm.ct_nodes = !1; this.data.crrm.cp_nodes = a; this.__callback({ obj: a })
|
|
}, paste: function (a) {
|
|
a = this._get_node(a); if (!a || !a.length) return !1; var c = this.data.crrm.ct_nodes ? this.data.crrm.ct_nodes : this.data.crrm.cp_nodes; if (!this.data.crrm.ct_nodes && !this.data.crrm.cp_nodes) return !1; this.data.crrm.ct_nodes && (this.move_node(this.data.crrm.ct_nodes, a), this.data.crrm.ct_nodes = !1); this.data.crrm.cp_nodes && this.move_node(this.data.crrm.cp_nodes, a, !1, !0); this.__callback({
|
|
obj: a,
|
|
nodes: c
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})(jQuery); (function (b) {
|
|
var a = []; b.jstree._themes = !1; b.jstree.plugin("themes", {
|
|
__init: function () { this.get_container().bind("init.jstree", b.proxy(function () { var a = this._get_settings().themes; this.data.themes.dots = a.dots; this.data.themes.icons = a.icons; this.set_theme(a.theme, a.url) }, this)).bind("loaded.jstree", b.proxy(function () { this.data.themes.dots ? this.show_dots() : this.hide_dots(); this.data.themes.icons ? this.show_icons() : this.hide_icons() }, this)) }, defaults: {
|
|
theme: "default", url: !1, dots: !0,
|
|
icons: !0
|
|
}, _fn: {
|
|
set_theme: function (c, d) { if (!c) return !1; d || (d = b.jstree._themes + c + "/style.css"); -1 == b.inArray(d, a) && (b.vakata.css.add_sheet({ url: d }), a.push(d)); this.data.themes.theme != c && (this.get_container().removeClass("jstree-" + this.data.themes.theme), this.data.themes.theme = c); this.get_container().addClass("jstree-" + c); this.data.themes.dots ? this.show_dots() : this.hide_dots(); this.data.themes.icons ? this.show_icons() : this.hide_icons(); this.__callback() }, get_theme: function () { return this.data.themes.theme },
|
|
show_dots: function () { this.data.themes.dots = !0; this.get_container().children("ul").removeClass("jstree-no-dots") }, hide_dots: function () { this.data.themes.dots = !1; this.get_container().children("ul").addClass("jstree-no-dots") }, toggle_dots: function () { this.data.themes.dots ? this.hide_dots() : this.show_dots() }, show_icons: function () { this.data.themes.icons = !0; this.get_container().children("ul").removeClass("jstree-no-icons") }, hide_icons: function () { this.data.themes.icons = !1; this.get_container().children("ul").addClass("jstree-no-icons") },
|
|
toggle_icons: function () { this.data.themes.icons ? this.hide_icons() : this.show_icons() }
|
|
}
|
|
}); b(function () { !1 === b.jstree._themes && b("script").each(function () { if (this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)) return b.jstree._themes = this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/, "") + "themes/", !1 }); !1 === b.jstree._themes && (b.jstree._themes = "themes/") }); b.jstree.defaults.plugins.push("themes")
|
|
})(jQuery); (function (b) {
|
|
var a = []; b.jstree.plugin("hotkeys", {
|
|
__init: function () {
|
|
if ("undefined" ===
|
|
typeof b.hotkeys) throw "jsTree hotkeys: jQuery hotkeys plugin not included."; if (!this.data.ui) throw "jsTree hotkeys: jsTree UI plugin not included."; b.each(this._get_settings().hotkeys, function (c, d) { !1 !== d && -1 == b.inArray(c, a) && (b(document).bind("keydown", c, function (a) { a: { var d = b.jstree._focused(), g; if (d && d.data && d.data.hotkeys && d.data.hotkeys.enabled && (g = d._get_settings().hotkeys[c])) { a = g.call(d, a); break a } a = void 0 } return a }), a.push(c)) }); this.get_container().bind("lock.jstree", b.proxy(function () {
|
|
this.data.hotkeys.enabled &&
|
|
(this.data.hotkeys.enabled = !1, this.data.hotkeys.revert = !0)
|
|
}, this)).bind("unlock.jstree", b.proxy(function () { this.data.hotkeys.revert && (this.data.hotkeys.enabled = !0) }, this)); this.enable_hotkeys()
|
|
}, defaults: {
|
|
up: function () { this.hover_node(this._get_prev(this.data.ui.hovered || this.data.ui.last_selected || -1)); return !1 }, "ctrl+up": function () { this.hover_node(this._get_prev(this.data.ui.hovered || this.data.ui.last_selected || -1)); return !1 }, "shift+up": function () {
|
|
this.hover_node(this._get_prev(this.data.ui.hovered ||
|
|
this.data.ui.last_selected || -1)); return !1
|
|
}, down: function () { this.hover_node(this._get_next(this.data.ui.hovered || this.data.ui.last_selected || -1)); return !1 }, "ctrl+down": function () { this.hover_node(this._get_next(this.data.ui.hovered || this.data.ui.last_selected || -1)); return !1 }, "shift+down": function () { this.hover_node(this._get_next(this.data.ui.hovered || this.data.ui.last_selected || -1)); return !1 }, left: function () {
|
|
var a = this.data.ui.hovered || this.data.ui.last_selected; a && (a.hasClass("jstree-open") ? this.close_node(a) :
|
|
this.hover_node(this._get_prev(a))); return !1
|
|
}, "ctrl+left": function () { var a = this.data.ui.hovered || this.data.ui.last_selected; a && (a.hasClass("jstree-open") ? this.close_node(a) : this.hover_node(this._get_prev(a))); return !1 }, "shift+left": function () { var a = this.data.ui.hovered || this.data.ui.last_selected; a && (a.hasClass("jstree-open") ? this.close_node(a) : this.hover_node(this._get_prev(a))); return !1 }, right: function () {
|
|
var a = this.data.ui.hovered || this.data.ui.last_selected; a && a.length && (a.hasClass("jstree-closed") ?
|
|
this.open_node(a) : this.hover_node(this._get_next(a))); return !1
|
|
}, "ctrl+right": function () { var a = this.data.ui.hovered || this.data.ui.last_selected; a && a.length && (a.hasClass("jstree-closed") ? this.open_node(a) : this.hover_node(this._get_next(a))); return !1 }, "shift+right": function () { var a = this.data.ui.hovered || this.data.ui.last_selected; a && a.length && (a.hasClass("jstree-closed") ? this.open_node(a) : this.hover_node(this._get_next(a))); return !1 }, space: function () {
|
|
this.data.ui.hovered && this.data.ui.hovered.children("a:eq(0)").click();
|
|
return !1
|
|
}, "ctrl+space": function (a) { a.type = "click"; this.data.ui.hovered && this.data.ui.hovered.children("a:eq(0)").trigger(a); return !1 }, "shift+space": function (a) { a.type = "click"; this.data.ui.hovered && this.data.ui.hovered.children("a:eq(0)").trigger(a); return !1 }, f2: function () { this.rename(this.data.ui.hovered || this.data.ui.last_selected) }, del: function () { this.remove(this.data.ui.hovered || this._get_node(null)) }
|
|
}, _fn: {
|
|
enable_hotkeys: function () { this.data.hotkeys.enabled = !0 }, disable_hotkeys: function () {
|
|
this.data.hotkeys.enabled =
|
|
!1
|
|
}
|
|
}
|
|
})
|
|
})(jQuery); (function (b) {
|
|
b.jstree.plugin("json_data", {
|
|
__init: function () { this._get_settings().json_data.progressive_unload && this.get_container().bind("after_close.jstree", function (a, c) { c.rslt.obj.children("ul").remove() }) }, defaults: { data: !1, ajax: !1, correct_state: !0, progressive_render: !1, progressive_unload: !1 }, _fn: {
|
|
load_node: function (a, c, b) { var e = this; this.load_node_json(a, function () { e.__callback({ obj: e._get_node(a) }); c.call(this) }, b) }, _is_loaded: function (a) {
|
|
var c = this._get_settings().json_data;
|
|
a = this._get_node(a); return -1 == a || !a || !c.ajax && !c.progressive_render && !b.isFunction(c.data) || a.is(".jstree-open, .jstree-leaf") || 0 < a.children("ul").children("li").length
|
|
}, refresh: function (a) { a = this._get_node(a); var c = this._get_settings().json_data; a && -1 !== a && c.progressive_unload && (b.isFunction(c.data) || c.ajax) && a.removeData("jstree_children"); return this.__call_old() }, load_node_json: function (a, c, d) {
|
|
var e = this.get_settings().json_data, f, g = function () { }; f = function () { }; if ((a = this._get_node(a)) && -1 !== a &&
|
|
(e.progressive_render || e.progressive_unload) && !a.is(".jstree-open, .jstree-leaf") && 0 === a.children("ul").children("li").length && a.data("jstree_children")) { if (f = this._parse_json(a.data("jstree_children"), a)) a.append(f), e.progressive_unload || a.removeData("jstree_children"); this.clean_node(a); c && c.call(this) } else {
|
|
if (a && -1 !== a) { if (a.data("jstree_is_loading")) return; a.data("jstree_is_loading", !0) } switch (!0) {
|
|
case !e.data && !e.ajax: throw "Neither data nor ajax settings supplied."; case b.isFunction(e.data): e.data.call(this,
|
|
a, b.proxy(function (b) { (b = this._parse_json(b, a)) ? (-1 !== a && a ? (a.append(b).children("a.jstree-loading").removeClass("jstree-loading"), a.removeData("jstree_is_loading")) : this.get_container().children("ul").empty().append(b.children()), this.clean_node(a), c && c.call(this)) : (-1 !== a && a ? (a.children("a.jstree-loading").removeClass("jstree-loading"), a.removeData("jstree_is_loading"), e.correct_state && this.correct_state(a)) : e.correct_state && this.get_container().children("ul").empty(), d && d.call(this)) }, this)); break;
|
|
case !!e.data && !e.ajax || !!e.data && !!e.ajax && (!a || -1 === a): a && -1 != a || ((f = this._parse_json(e.data, a)) ? (this.get_container().children("ul").empty().append(f.children()), this.clean_node()) : e.correct_state && this.get_container().children("ul").empty()); c && c.call(this); break; case !e.data && !!e.ajax || !!e.data && !!e.ajax && a && -1 !== a: g = function (b, c, f) {
|
|
var k = this.get_settings().json_data.ajax.error; k && k.call(this, b, c, f); -1 != a && a.length ? (a.children("a.jstree-loading").removeClass("jstree-loading"), a.removeData("jstree_is_loading"),
|
|
"success" === c && e.correct_state && this.correct_state(a)) : "success" === c && e.correct_state && this.get_container().children("ul").empty(); d && d.call(this)
|
|
}, f = function (d, f, m) {
|
|
var k = this.get_settings().json_data.ajax.success; k && (d = k.call(this, d, f, m) || d); if ("" === d || d && d.toString && "" === d.toString().replace(/^[\s\n]+$/, "") || !b.isArray(d) && !b.isPlainObject(d)) return g.call(this, m, f, ""); (d = this._parse_json(d, a)) ? (-1 !== a && a ? (a.append(d).children("a.jstree-loading").removeClass("jstree-loading"), a.removeData("jstree_is_loading")) :
|
|
this.get_container().children("ul").empty().append(d.children()), this.clean_node(a), c && c.call(this)) : -1 !== a && a ? (a.children("a.jstree-loading").removeClass("jstree-loading"), a.removeData("jstree_is_loading"), e.correct_state && (this.correct_state(a), c && c.call(this))) : e.correct_state && (this.get_container().children("ul").empty(), c && c.call(this))
|
|
}, e.ajax.context = this, e.ajax.error = g, e.ajax.success = f, e.ajax.dataType || (e.ajax.dataType = "json"), b.isFunction(e.ajax.url) && (e.ajax.url = e.ajax.url.call(this, a)),
|
|
b.isFunction(e.ajax.data) && (e.ajax.data = e.ajax.data.call(this, a)), b.ajax(e.ajax)
|
|
}
|
|
}
|
|
}, _parse_json: function (a, c, d) {
|
|
var e = !1, f = this._get_settings(), g = f.json_data, l = f.core.html_titles, h; if (!a) return e; g.progressive_unload && c && -1 !== c && c.data("jstree_children", e); if (b.isArray(a)) { e = b("<ul>"); if (!a.length) return !1; f = 0; for (g = a.length; f < g; f++) h = this._parse_json(a[f], c, !0), h.length && (e = e.append(h)); e = e.children() } else {
|
|
"string" == typeof a && (a = { data: a }); if (!a.data && "" !== a.data) return e; e = b("<li />"); a.attr && e.attr(a.attr);
|
|
a.metadata && e.data(a.metadata); a.state && e.addClass("jstree-" + a.state); b.isArray(a.data) || (h = a.data, a.data = [], a.data.push(h)); b.each(a.data, function (c, d) {
|
|
h = b("<a />"); b.isFunction(d) && (d = d.call(this, a)); if ("string" == typeof d) h.attr("href", "#")[l ? "html" : "text"](d); else d.attr || (d.attr = {}), d.attr.href || (d.attr.href = "#"), h.attr(d.attr)[l ? "html" : "text"](d.title), d.language && h.addClass(d.language); h.prepend("<ins class='jstree-icon'> </ins>"); !d.icon && a.icon && (d.icon = a.icon); d.icon && (-1 === d.icon.indexOf("/") ?
|
|
h.children("ins").addClass(d.icon) : h.children("ins").css("background", "url('" + d.icon + "') center center no-repeat")); e.append(h)
|
|
}); e.prepend("<ins class='jstree-icon'> </ins>"); a.children && (g.progressive_render && "open" !== a.state ? e.addClass("jstree-closed").data("jstree_children", a.children) : (g.progressive_unload && e.data("jstree_children", a.children), b.isArray(a.children) && a.children.length && (h = this._parse_json(a.children, c, !0), h.length && (c = b("<ul />"), c.append(h), e.append(c)))))
|
|
} d || (d = b("<ul />"),
|
|
d.append(e), e = d); return e
|
|
}, get_json: function (a, c, d, e) {
|
|
var f = [], g = this._get_settings(), l = this, h, m, k, p, n, q; (a = this._get_node(a)) && -1 !== a || (a = this.get_container().find("> ul > li")); c = b.isArray(c) ? c : ["id", "class"]; !e && this.data.types && c.push(g.types.type_attr); d = b.isArray(d) ? d : []; a.each(function () {
|
|
k = b(this); h = { data: [] }; c.length && (h.attr = {}); b.each(c, function (a, b) {
|
|
(m = k.attr(b)) && m.length && m.replace(/jstree[^ ]*/ig, "").length && (h.attr[b] = (" " + m).replace(/ jstree[^ ]*/ig, "").replace(/\s+$/ig, " ").replace(/^ /,
|
|
"").replace(/ $/, ""))
|
|
}); k.hasClass("jstree-open") && (h.state = "open"); k.hasClass("jstree-closed") && (h.state = "closed"); k.data() && (h.metadata = k.data()); p = k.children("a"); p.each(function () {
|
|
n = b(this); d.length || -1 !== b.inArray("languages", g.plugins) || n.children("ins").get(0).style.backgroundImage.length || n.children("ins").get(0).className && n.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig, "").length ? (q = !1, -1 !== b.inArray("languages", g.plugins) && b.isArray(g.languages) && g.languages.length && b.each(g.languages,
|
|
function (a, b) { if (n.hasClass(b)) return q = b, !1 }), m = { attr: {}, title: l.get_text(n, q) }, b.each(d, function (a, b) { m.attr[b] = (" " + (n.attr(b) || "")).replace(/ jstree[^ ]*/ig, "").replace(/\s+$/ig, " ").replace(/^ /, "").replace(/ $/, "") }), -1 !== b.inArray("languages", g.plugins) && b.isArray(g.languages) && g.languages.length && b.each(g.languages, function (a, b) { if (n.hasClass(b)) return m.language = b, !0 }), n.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig, "").replace(/^\s+$/ig, "").length && (m.icon = n.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,
|
|
"").replace(/\s+$/ig, " ").replace(/^ /, "").replace(/ $/, "")), n.children("ins").get(0).style.backgroundImage.length && (m.icon = n.children("ins").get(0).style.backgroundImage.replace("url(", "").replace(")", ""))) : m = l.get_text(n); 1 < p.length ? h.data.push(m) : h.data = m
|
|
}); k = k.find("> ul > li"); k.length && (h.children = l.get_json(k, c, d, !0)); f.push(h)
|
|
}); return f
|
|
}
|
|
}
|
|
})
|
|
})(jQuery); (function (b) {
|
|
var a = !1; b.jstree.plugin("languages", {
|
|
__init: function () { this._load_css() }, defaults: [], _fn: {
|
|
set_lang: function (c) {
|
|
var d = this._get_settings().languages,
|
|
e = !1, f = ".jstree-" + this.get_index() + " a"; if (!b.isArray(d) || 0 === d.length) return !1; if (-1 == b.inArray(c, d)) if (d[c]) c = d[c]; else return !1; if (c == this.data.languages.current_language) return !0; e = b.vakata.css.get_css(f + "." + this.data.languages.current_language, !1, a); !1 !== e && (e.style.display = "none"); e = b.vakata.css.get_css(f + "." + c, !1, a); !1 !== e && (e.style.display = ""); this.data.languages.current_language = c; this.__callback(c); return !0
|
|
}, get_lang: function () { return this.data.languages.current_language }, _get_string: function (a,
|
|
d) { var e = this._get_settings().languages, f = this._get_settings().core.strings; b.isArray(e) && e.length && (d = d && -1 != b.inArray(d, e) ? d : this.data.languages.current_language); return f[d] && f[d][a] ? f[d][a] : f[a] ? f[a] : a }, get_text: function (a, d) {
|
|
a = this._get_node(a) || this.data.ui.last_selected; if (!a.size()) return !1; var e = this._get_settings().languages, f = this._get_settings().core.html_titles; b.isArray(e) && e.length ? (d = d && -1 != b.inArray(d, e) ? d : this.data.languages.current_language, a = a.children("a." + d)) : a = a.children("a:eq(0)");
|
|
if (f) return a = a.clone(), a.children("INS").remove(), a.html(); a = a.contents().filter(function () { return 3 == this.nodeType })[0]; return a.nodeValue
|
|
}, set_text: function (a, d, e) {
|
|
a = this._get_node(a) || this.data.ui.last_selected; if (!a.size()) return !1; var f = this._get_settings().languages, g = this._get_settings().core.html_titles; b.isArray(f) && f.length ? (e = e && -1 != b.inArray(e, f) ? e : this.data.languages.current_language, a = a.children("a." + e)) : a = a.children("a:eq(0)"); if (g) return f = a.children("INS").clone(), a.html(d).prepend(f),
|
|
this.__callback({ obj: a, name: d, lang: e }), !0; a = a.contents().filter(function () { return 3 == this.nodeType })[0]; this.__callback({ obj: a, name: d, lang: e }); return a.nodeValue = d
|
|
}, _load_css: function () {
|
|
var c = this._get_settings().languages, d = "/* languages css */", e = ".jstree-" + this.get_index() + " a", f; if (b.isArray(c) && c.length) {
|
|
this.data.languages.current_language = c[0]; for (f = 0; f < c.length; f++) d += e + "." + c[f] + " {", c[f] != this.data.languages.current_language && (d += " display:none; "), d += " } "; a = b.vakata.css.add_sheet({
|
|
str: d,
|
|
title: "jstree-languages"
|
|
})
|
|
}
|
|
}, create_node: function (a, d, e, f) { return this.__call_old(!0, a, d, e, function (a) { var c = this._get_settings().languages, d = a.children("a"), e; if (b.isArray(c) && c.length) { for (e = 0; e < c.length; e++) d.is("." + c[e]) || a.append(d.eq(0).clone().removeClass(c.join(" ")).addClass(c[e])); d.not("." + c.join(", .")).remove() } f && f.call(this, a) }) }
|
|
}
|
|
})
|
|
})(jQuery); (function (b) {
|
|
b.jstree.plugin("cookies", {
|
|
__init: function () {
|
|
if ("undefined" === typeof b.cookie) throw "jsTree cookie: jQuery cookie plugin not included.";
|
|
var a = this._get_settings().cookies, c; a.save_loaded && (c = b.cookie(a.save_loaded)) && c.length && (this.data.core.to_load = c.split(",")); a.save_opened && (c = b.cookie(a.save_opened)) && c.length && (this.data.core.to_open = c.split(",")); a.save_selected && (c = b.cookie(a.save_selected)) && c.length && this.data.ui && (this.data.ui.to_select = c.split(",")); this.get_container().one((this.data.ui ? "reselect" : "reopen") + ".jstree", b.proxy(function () {
|
|
this.get_container().bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree",
|
|
b.proxy(function (a) { this._get_settings().cookies.auto_save && this.save_cookie((a.handleObj.namespace + a.handleObj.type).replace("jstree", "")) }, this))
|
|
}, this))
|
|
}, defaults: { save_loaded: "jstree_load", save_opened: "jstree_open", save_selected: "jstree_select", auto_save: !0, cookie_options: {} }, _fn: {
|
|
save_cookie: function (a) {
|
|
if (!this.data.core.refreshing) {
|
|
var c = this._get_settings().cookies; if (a) switch (a) {
|
|
case "open_node": case "close_node": c.save_opened && (this.save_opened(), b.cookie(c.save_opened, this.data.core.to_open.join(","),
|
|
c.cookie_options)); c.save_loaded && (this.save_loaded(), b.cookie(c.save_loaded, this.data.core.to_load.join(","), c.cookie_options)); break; case "select_node": case "deselect_node": c.save_selected && this.data.ui && (this.save_selected(), b.cookie(c.save_selected, this.data.ui.to_select.join(","), c.cookie_options))
|
|
} else c.save_loaded && (this.save_loaded(), b.cookie(c.save_loaded, this.data.core.to_load.join(","), c.cookie_options)), c.save_opened && (this.save_opened(), b.cookie(c.save_opened, this.data.core.to_open.join(","),
|
|
c.cookie_options)), c.save_selected && this.data.ui && (this.save_selected(), b.cookie(c.save_selected, this.data.ui.to_select.join(","), c.cookie_options))
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})(jQuery); (function (b) {
|
|
b.jstree.plugin("sort", {
|
|
__init: function () {
|
|
this.get_container().bind("load_node.jstree", b.proxy(function (a, b) { var d = this._get_node(b.rslt.obj), d = -1 === d ? this.get_container().children("ul") : d.children("ul"); this.sort(d) }, this)).bind("rename_node.jstree create_node.jstree create.jstree", b.proxy(function (a, b) { this.sort(b.rslt.obj.parent()) },
|
|
this)).bind("move_node.jstree", b.proxy(function (a, b) { var d = -1 == b.rslt.np ? this.get_container() : b.rslt.np; this.sort(d.children("ul")) }, this))
|
|
}, defaults: function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1 }, _fn: { sort: function (a) { var c = this._get_settings().sort, d = this; a.append(b.makeArray(a.children("li")).sort(b.proxy(c, d))); a.find("> li > ul").each(function () { d.sort(b(this)) }); this.clean_node(a) } }
|
|
})
|
|
})(jQuery); (function (b) {
|
|
var a = !1, c = !1, d = !1, e = !1, f = !1, g = !1, l = !1, h = !1, m = !1; b.vakata.dnd = {
|
|
is_down: !1,
|
|
is_drag: !1, helper: !1, scroll_spd: 10, init_x: 0, init_y: 0, threshold: 5, helper_left: 5, helper_top: 10, user_data: {}, drag_start: function (a, c, d) {
|
|
b.vakata.dnd.is_drag && b.vakata.drag_stop({}); try { a.currentTarget.unselectable = "on", a.currentTarget.onselectstart = function () { return !1 }, a.currentTarget.style && (a.currentTarget.style.MozUserSelect = "none") } catch (e) { } b.vakata.dnd.init_x = a.pageX; b.vakata.dnd.init_y = a.pageY; b.vakata.dnd.user_data = c; b.vakata.dnd.is_down = !0; b.vakata.dnd.helper = b("<div id='vakata-dragged' />").html(d);
|
|
b(document).bind("mousemove", b.vakata.dnd.drag); b(document).bind("mouseup", b.vakata.dnd.drag_stop); return !1
|
|
}, drag: function (a) {
|
|
if (b.vakata.dnd.is_down) {
|
|
if (!b.vakata.dnd.is_drag) if (5 < Math.abs(a.pageX - b.vakata.dnd.init_x) || 5 < Math.abs(a.pageY - b.vakata.dnd.init_y)) b.vakata.dnd.helper.appendTo("body"), b.vakata.dnd.is_drag = !0, b(document).triggerHandler("drag_start.vakata", { event: a, data: b.vakata.dnd.user_data }); else return; if ("mousemove" === a.type) {
|
|
var c = b(document), d = c.scrollTop(), c = c.scrollLeft(); 20 > a.pageY -
|
|
d ? (g && "down" === l && (clearInterval(g), g = !1), g || (l = "up", g = setInterval(function () { b(document).scrollTop(b(document).scrollTop() - b.vakata.dnd.scroll_spd) }, 150))) : g && "up" === l && (clearInterval(g), g = !1); 20 > b(window).height() - (a.pageY - d) ? (g && "up" === l && (clearInterval(g), g = !1), g || (l = "down", g = setInterval(function () { b(document).scrollTop(b(document).scrollTop() + b.vakata.dnd.scroll_spd) }, 150))) : g && "down" === l && (clearInterval(g), g = !1); 20 > a.pageX - c ? (f && "right" === h && (clearInterval(f), f = !1), f || (h = "left", f = setInterval(function () {
|
|
b(document).scrollLeft(b(document).scrollLeft() -
|
|
b.vakata.dnd.scroll_spd)
|
|
}, 150))) : f && "left" === h && (clearInterval(f), f = !1); 20 > b(window).width() - (a.pageX - c) ? (f && "left" === h && (clearInterval(f), f = !1), f || (h = "right", f = setInterval(function () { b(document).scrollLeft(b(document).scrollLeft() + b.vakata.dnd.scroll_spd) }, 150))) : f && "right" === h && (clearInterval(f), f = !1)
|
|
} b.vakata.dnd.helper.css({ left: a.pageX + b.vakata.dnd.helper_left + "px", top: a.pageY + b.vakata.dnd.helper_top + "px" }); b(document).triggerHandler("drag.vakata", { event: a, data: b.vakata.dnd.user_data })
|
|
}
|
|
}, drag_stop: function (a) {
|
|
f &&
|
|
clearInterval(f); g && clearInterval(g); b(document).unbind("mousemove", b.vakata.dnd.drag); b(document).unbind("mouseup", b.vakata.dnd.drag_stop); b(document).triggerHandler("drag_stop.vakata", { event: a, data: b.vakata.dnd.user_data }); b.vakata.dnd.helper.remove(); b.vakata.dnd.init_x = 0; b.vakata.dnd.init_y = 0; b.vakata.dnd.user_data = {}; b.vakata.dnd.is_down = !1; b.vakata.dnd.is_drag = !1
|
|
}
|
|
}; b(function () {
|
|
b.vakata.css.add_sheet({
|
|
str: "#vakata-dragged { display:block; margin:0 0 0 0; padding:4px 4px 4px 24px; position:absolute; top:-2000px; line-height:16px; z-index:10000; } ",
|
|
title: "vakata"
|
|
})
|
|
}); b.jstree.plugin("dnd", {
|
|
__init: function () {
|
|
this.data.dnd = { active: !1, after: !1, inside: !1, before: !1, off: !1, prepared: !1, w: 0, to1: !1, to2: !1, cof: !1, cw: !1, ch: !1, i1: !1, i2: !1, mto: !1 }; this.get_container().bind("mouseenter.jstree", b.proxy(function (c) {
|
|
b.vakata.dnd.is_drag && b.vakata.dnd.user_data.jstree && (this.data.themes && (d.attr("class", "jstree-" + this.data.themes.theme), e && e.attr("class", "jstree-" + this.data.themes.theme), b.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme)),
|
|
c.currentTarget === c.target && b.vakata.dnd.user_data.obj && b(b.vakata.dnd.user_data.obj).length && b(b.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0] !== c.target && (c = b.jstree._reference(c.target), c.data.dnd.foreign ? (c = c._get_settings().dnd.drag_check.call(this, { o: a, r: c.get_container(), is_root: !0 }), !0 !== c && !0 !== c.inside && !0 !== c.before && !0 !== c.after || b.vakata.dnd.helper.children("ins").attr("class", "jstree-ok")) : (c.prepare_move(a, c.get_container(), "last"), c.check_move() && b.vakata.dnd.helper.children("ins").attr("class",
|
|
"jstree-ok"))))
|
|
}, this)).bind("mouseup.jstree", b.proxy(function (c) {
|
|
if (b.vakata.dnd.is_drag && b.vakata.dnd.user_data.jstree && c.currentTarget === c.target && b.vakata.dnd.user_data.obj && b(b.vakata.dnd.user_data.obj).length && b(b.vakata.dnd.user_data.obj).parents(".jstree:eq(0)")[0] !== c.target) {
|
|
var d = b.jstree._reference(c.currentTarget); d.data.dnd.foreign ? (c = d._get_settings().dnd.drag_check.call(this, { o: a, r: d.get_container(), is_root: !0 }), !0 !== c && !0 !== c.inside && !0 !== c.before && !0 !== c.after || d._get_settings().dnd.drag_finish.call(this,
|
|
{ o: a, r: d.get_container(), is_root: !0 })) : d.move_node(a, d.get_container(), "last", c[d._get_settings().dnd.copy_modifier + "Key"])
|
|
}
|
|
}, this)).bind("mouseleave.jstree", b.proxy(function (a) {
|
|
if (a.relatedTarget && a.relatedTarget.id && "jstree-marker-line" === a.relatedTarget.id) return !1; b.vakata.dnd.is_drag && b.vakata.dnd.user_data.jstree && (this.data.dnd.i1 && clearInterval(this.data.dnd.i1), this.data.dnd.i2 && clearInterval(this.data.dnd.i2), this.data.dnd.to1 && clearTimeout(this.data.dnd.to1), this.data.dnd.to2 && clearTimeout(this.data.dnd.to2),
|
|
b.vakata.dnd.helper.children("ins").hasClass("jstree-ok") && b.vakata.dnd.helper.children("ins").attr("class", "jstree-invalid"))
|
|
}, this)).bind("mousemove.jstree", b.proxy(function (a) {
|
|
if (b.vakata.dnd.is_drag && b.vakata.dnd.user_data.jstree) {
|
|
var c = this.get_container()[0]; a.pageX + 24 > this.data.dnd.cof.left + this.data.dnd.cw ? (this.data.dnd.i1 && clearInterval(this.data.dnd.i1), this.data.dnd.i1 = setInterval(b.proxy(function () { this.scrollLeft += b.vakata.dnd.scroll_spd }, c), 100)) : a.pageX - 24 < this.data.dnd.cof.left ? (this.data.dnd.i1 &&
|
|
clearInterval(this.data.dnd.i1), this.data.dnd.i1 = setInterval(b.proxy(function () { this.scrollLeft -= b.vakata.dnd.scroll_spd }, c), 100)) : this.data.dnd.i1 && clearInterval(this.data.dnd.i1); a.pageY + 24 > this.data.dnd.cof.top + this.data.dnd.ch ? (this.data.dnd.i2 && clearInterval(this.data.dnd.i2), this.data.dnd.i2 = setInterval(b.proxy(function () { this.scrollTop += b.vakata.dnd.scroll_spd }, c), 100)) : a.pageY - 24 < this.data.dnd.cof.top ? (this.data.dnd.i2 && clearInterval(this.data.dnd.i2), this.data.dnd.i2 = setInterval(b.proxy(function () {
|
|
this.scrollTop -=
|
|
b.vakata.dnd.scroll_spd
|
|
}, c), 100)) : this.data.dnd.i2 && clearInterval(this.data.dnd.i2)
|
|
}
|
|
}, this)).bind("scroll.jstree", b.proxy(function (a) { b.vakata.dnd.is_drag && b.vakata.dnd.user_data.jstree && d && e && (d.hide(), e.hide()) }, this)).delegate("a", "mousedown.jstree", b.proxy(function (a) { if (1 === a.which) return this.start_drag(a.currentTarget, a), !1 }, this)).delegate("a", "mouseenter.jstree", b.proxy(function (a) { b.vakata.dnd.is_drag && b.vakata.dnd.user_data.jstree && this.dnd_enter(a.currentTarget) }, this)).delegate("a", "mousemove.jstree",
|
|
b.proxy(function (a) { b.vakata.dnd.is_drag && b.vakata.dnd.user_data.jstree && (c && c.length && c.children("a")[0] === a.currentTarget || this.dnd_enter(a.currentTarget), "undefined" === typeof this.data.dnd.off.top && (this.data.dnd.off = b(a.target).offset()), this.data.dnd.w = (a.pageY - (this.data.dnd.off.top || 0)) % this.data.core.li_height, 0 > this.data.dnd.w && (this.data.dnd.w += this.data.core.li_height), this.dnd_show()) }, this)).delegate("a", "mouseleave.jstree", b.proxy(function (a) {
|
|
if (b.vakata.dnd.is_drag && b.vakata.dnd.user_data.jstree) {
|
|
if (a.relatedTarget &&
|
|
a.relatedTarget.id && "jstree-marker-line" === a.relatedTarget.id) return !1; d && d.hide(); e && e.hide(); this.data.dnd.mto = setTimeout(function (b) { return function () { b.dnd_leave(a) } }(this), 0)
|
|
}
|
|
}, this)).delegate("a", "mouseup.jstree", b.proxy(function (a) { b.vakata.dnd.is_drag && b.vakata.dnd.user_data.jstree && this.dnd_finish(a) }, this)); b(document).bind("drag_stop.vakata", b.proxy(function () {
|
|
this.data.dnd.to1 && clearTimeout(this.data.dnd.to1); this.data.dnd.to2 && clearTimeout(this.data.dnd.to2); this.data.dnd.i1 && clearInterval(this.data.dnd.i1);
|
|
this.data.dnd.i2 && clearInterval(this.data.dnd.i2); this.data.dnd.after = !1; this.data.dnd.before = !1; this.data.dnd.inside = !1; this.data.dnd.off = !1; this.data.dnd.prepared = !1; this.data.dnd.w = !1; this.data.dnd.to1 = !1; this.data.dnd.to2 = !1; this.data.dnd.i1 = !1; this.data.dnd.i2 = !1; this.data.dnd.active = !1; this.data.dnd.foreign = !1; d && d.css({ top: "-2000px" }); e && e.css({ top: "-2000px" })
|
|
}, this)).bind("drag_start.vakata", b.proxy(function (a, c) {
|
|
if (c.data.jstree) {
|
|
var d = b(c.event.target); d.closest(".jstree").hasClass("jstree-" +
|
|
this.get_index()) && this.dnd_enter(d)
|
|
}
|
|
}, this)); var f = this._get_settings().dnd; f.drag_target && b(document).delegate(f.drag_target, "mousedown.jstree-" + this.get_index(), b.proxy(function (c) {
|
|
a = c.target; b.vakata.dnd.drag_start(c, { jstree: !0, obj: c.target }, "<ins class='jstree-icon'></ins>" + b(c.target).text()); this.data.themes && (d && d.attr("class", "jstree-" + this.data.themes.theme), e && e.attr("class", "jstree-" + this.data.themes.theme), b.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme));
|
|
b.vakata.dnd.helper.children("ins").attr("class", "jstree-invalid"); var f = this.get_container(); this.data.dnd.cof = f.offset(); this.data.dnd.cw = parseInt(f.width(), 10); this.data.dnd.ch = parseInt(f.height(), 10); this.data.dnd.foreign = !0; c.preventDefault()
|
|
}, this)); f.drop_target && b(document).delegate(f.drop_target, "mouseenter.jstree-" + this.get_index(), b.proxy(function (c) {
|
|
this.data.dnd.active && this._get_settings().dnd.drop_check.call(this, { o: a, r: b(c.target), e: c }) && b.vakata.dnd.helper.children("ins").attr("class",
|
|
"jstree-ok")
|
|
}, this)).delegate(f.drop_target, "mouseleave.jstree-" + this.get_index(), b.proxy(function (a) { this.data.dnd.active && b.vakata.dnd.helper.children("ins").attr("class", "jstree-invalid") }, this)).delegate(f.drop_target, "mouseup.jstree-" + this.get_index(), b.proxy(function (c) { this.data.dnd.active && b.vakata.dnd.helper.children("ins").hasClass("jstree-ok") && this._get_settings().dnd.drop_finish.call(this, { o: a, r: b(c.target), e: c }) }, this))
|
|
}, defaults: {
|
|
copy_modifier: "ctrl", check_timeout: 100, open_timeout: 500,
|
|
drop_target: ".jstree-drop", drop_check: function (a) { return !0 }, drop_finish: b.noop, drag_target: ".jstree-draggable", drag_finish: b.noop, drag_check: function (a) { return { after: !1, before: !1, inside: !0 } }
|
|
}, _fn: {
|
|
dnd_prepare: function () {
|
|
if (c && c.length) {
|
|
this.data.dnd.off = c.offset(); this._get_settings().core.rtl && (this.data.dnd.off.right = this.data.dnd.off.left + c.width()); if (this.data.dnd.foreign) {
|
|
var b = this._get_settings().dnd.drag_check.call(this, { o: a, r: c }); this.data.dnd.after = b.after; this.data.dnd.before = b.before;
|
|
this.data.dnd.inside = b.inside; this.data.dnd.prepared = !0; return this.dnd_show()
|
|
} this.prepare_move(a, c, "before"); this.data.dnd.before = this.check_move(); this.prepare_move(a, c, "after"); this.data.dnd.after = this.check_move(); this._is_loaded(c) ? (this.prepare_move(a, c, "inside"), this.data.dnd.inside = this.check_move()) : this.data.dnd.inside = !1; this.data.dnd.prepared = !0; return this.dnd_show()
|
|
}
|
|
}, dnd_show: function () {
|
|
if (this.data.dnd.prepared) {
|
|
var a = ["before", "inside", "after"], c = !1, f = this._get_settings().core.rtl,
|
|
a = this.data.dnd.w < this.data.core.li_height / 3 ? ["before", "inside", "after"] : this.data.dnd.w <= 2 * this.data.core.li_height / 3 ? this.data.dnd.w < this.data.core.li_height / 2 ? ["inside", "before", "after"] : ["inside", "after", "before"] : ["after", "inside", "before"]; b.each(a, b.proxy(function (a, d) { if (this.data.dnd[d]) return b.vakata.dnd.helper.children("ins").attr("class", "jstree-ok"), c = d, !1 }, this)); !1 === c && b.vakata.dnd.helper.children("ins").attr("class", "jstree-invalid"); a = f ? this.data.dnd.off.right - 18 : this.data.dnd.off.left +
|
|
10; switch (c) {
|
|
case "before": d.css({ left: a + "px", top: this.data.dnd.off.top - 6 + "px" }).show(); e && e.css({ left: a + 8 + "px", top: this.data.dnd.off.top - 1 + "px" }).show(); break; case "after": d.css({ left: a + "px", top: this.data.dnd.off.top + this.data.core.li_height - 6 + "px" }).show(); e && e.css({ left: a + 8 + "px", top: this.data.dnd.off.top + this.data.core.li_height - 1 + "px" }).show(); break; case "inside": d.css({ left: a + (f ? -4 : 4) + "px", top: this.data.dnd.off.top + this.data.core.li_height / 2 - 5 + "px" }).show(); e && e.hide(); break; default: d.hide(),
|
|
e && e.hide()
|
|
} return m = c
|
|
}
|
|
}, dnd_open: function () { this.data.dnd.to2 = !1; this.open_node(c, b.proxy(this.dnd_prepare, this), !0) }, dnd_finish: function (b) { this.data.dnd.foreign ? (this.data.dnd.after || this.data.dnd.before || this.data.dnd.inside) && this._get_settings().dnd.drag_finish.call(this, { o: a, r: c, p: m }) : (this.dnd_prepare(), this.move_node(a, c, m, b[this._get_settings().dnd.copy_modifier + "Key"])); c = a = !1; d.hide(); e && e.hide() }, dnd_enter: function (a) {
|
|
this.data.dnd.mto && (clearTimeout(this.data.dnd.mto), this.data.dnd.mto =
|
|
!1); var d = this._get_settings().dnd; this.data.dnd.prepared = !1; c = this._get_node(a); d.check_timeout ? (this.data.dnd.to1 && clearTimeout(this.data.dnd.to1), this.data.dnd.to1 = setTimeout(b.proxy(this.dnd_prepare, this), d.check_timeout)) : this.dnd_prepare(); d.open_timeout ? (this.data.dnd.to2 && clearTimeout(this.data.dnd.to2), c && c.length && c.hasClass("jstree-closed") && (this.data.dnd.to2 = setTimeout(b.proxy(this.dnd_open, this), d.open_timeout))) : c && c.length && c.hasClass("jstree-closed") && this.dnd_open()
|
|
}, dnd_leave: function (a) {
|
|
this.data.dnd.after =
|
|
!1; this.data.dnd.before = !1; this.data.dnd.inside = !1; b.vakata.dnd.helper.children("ins").attr("class", "jstree-invalid"); d.hide(); e && e.hide(); c && c[0] === a.target.parentNode && (this.data.dnd.to1 && (clearTimeout(this.data.dnd.to1), this.data.dnd.to1 = !1), this.data.dnd.to2 && (clearTimeout(this.data.dnd.to2), this.data.dnd.to2 = !1))
|
|
}, start_drag: function (c, f) {
|
|
a = this._get_node(c); this.data.ui && this.is_selected(a) && (a = this._get_node(null, !0)); var g = 1 < a.length ? this._get_string("multiple_selection") : this.get_text(a),
|
|
h = this.get_container(); this._get_settings().core.html_titles || (g = g.replace(/</ig, "<").replace(/>/ig, ">")); b.vakata.dnd.drag_start(f, { jstree: !0, obj: a }, "<ins class='jstree-icon'></ins>" + g); this.data.themes && (d && d.attr("class", "jstree-" + this.data.themes.theme), e && e.attr("class", "jstree-" + this.data.themes.theme), b.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme)); this.data.dnd.cof = h.offset(); this.data.dnd.cw = parseInt(h.width(), 10); this.data.dnd.ch = parseInt(h.height(),
|
|
10); this.data.dnd.active = !0
|
|
}
|
|
}
|
|
}); b(function () {
|
|
b.vakata.css.add_sheet({
|
|
str: "#vakata-dragged ins { display:block; text-decoration:none; width:16px; height:16px; margin:0 0 0 0; padding:0; position:absolute; top:4px; left:4px; -moz-border-radius:4px; border-radius:4px; -webkit-border-radius:4px; } #vakata-dragged .jstree-ok { background:green; } #vakata-dragged .jstree-invalid { background:red; } #jstree-marker { padding:0; margin:0; font-size:12px; overflow:hidden; height:12px; width:8px; position:absolute; top:-30px; z-index:10001; background-repeat:no-repeat; display:none; background-color:transparent; text-shadow:1px 1px 1px white; color:black; line-height:10px; } #jstree-marker-line { padding:0; margin:0; line-height:0%; font-size:1px; overflow:hidden; height:1px; width:100px; position:absolute; top:-30px; z-index:10000; background-repeat:no-repeat; display:none; background-color:#456c43; cursor:pointer; border:1px solid #eeeeee; border-left:0; -moz-box-shadow: 0px 0px 2px #666; -webkit-box-shadow: 0px 0px 2px #666; box-shadow: 0px 0px 2px #666; -moz-border-radius:1px; border-radius:1px; -webkit-border-radius:1px; }",
|
|
title: "jstree"
|
|
}); d = b("<div />").attr({ id: "jstree-marker" }).hide().html("»").bind("mouseleave mouseenter", function (a) { d.hide(); e.hide(); a.preventDefault(); a.stopImmediatePropagation(); return !1 }).appendTo("body"); e = b("<div />").attr({ id: "jstree-marker-line" }).hide().bind("mouseup", function (a) { if (c && c.length) return c.children("a").trigger(a), a.preventDefault(), a.stopImmediatePropagation(), !1 }).bind("mouseleave", function (a) {
|
|
var f = b(a.relatedTarget); if ((f.is(".jstree") || 0 === f.closest(".jstree").length) &&
|
|
c && c.length) return c.children("a").trigger(a), d.hide(), e.hide(), a.preventDefault(), a.stopImmediatePropagation(), !1
|
|
}).appendTo("body"); b(document).bind("drag_start.vakata", function (a, b) { b.data.jstree && (d.show(), e && e.show()) }); b(document).bind("drag_stop.vakata", function (a, b) { b.data.jstree && (d.hide(), e && e.hide()) })
|
|
})
|
|
})(jQuery); (function (b) {
|
|
b.jstree.plugin("checkbox", {
|
|
__init: function () {
|
|
this.data.checkbox.noui = this._get_settings().checkbox.override_ui; this.data.ui && this.data.checkbox.noui && (this.select_node =
|
|
this.deselect_node = this.deselect_all = b.noop, this.get_selected = this.get_checked); this.get_container().bind("open_node.jstree create_node.jstree clean_node.jstree refresh.jstree", b.proxy(function (a, b) { this._prepare_checkboxes(b.rslt.obj) }, this)).bind("loaded.jstree", b.proxy(function (a) { this._prepare_checkboxes() }, this)).delegate(this.data.ui && this.data.checkbox.noui ? "a" : "ins.jstree-checkbox", "click.jstree", b.proxy(function (a) {
|
|
a.preventDefault(); this._get_node(a.target).hasClass("jstree-checked") ? this.uncheck_node(a.target) :
|
|
this.check_node(a.target); if (this.data.ui && this.data.checkbox.noui) this.save_selected(), this.data.cookies && this.save_cookie("select_node"); else return a.stopImmediatePropagation(), !1
|
|
}, this))
|
|
}, defaults: { override_ui: !1, two_state: !1, real_checkboxes: !1, checked_parent_open: !0, real_checkboxes_names: function (a) { return ["check_" + (a[0].id || Math.ceil(1E4 * Math.random())), 1] } }, __destroy: function () { this.get_container().find("input.jstree-real-checkbox").removeClass("jstree-real-checkbox").end().find("ins.jstree-checkbox").remove() },
|
|
_fn: {
|
|
_checkbox_notify: function (a, b) { b.checked && this.check_node(a, !1) }, _prepare_checkboxes: function (a) {
|
|
a = a && -1 != a ? this._get_node(a) : this.get_container().find("> ul > li"); if (!1 !== a) {
|
|
var c, d = this, e, f = this._get_settings().checkbox.two_state, g = this._get_settings().checkbox.real_checkboxes, l = this._get_settings().checkbox.real_checkboxes_names; a.each(function () {
|
|
e = b(this); c = e.is("li") && (e.hasClass("jstree-checked") || g && e.children(":checked").length) ? "jstree-checked" : "jstree-unchecked"; e.find("li").addBack().each(function () {
|
|
var a =
|
|
b(this), e; a.children("a" + (d.data.languages ? "" : ":eq(0)")).not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'> </ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass(f ? "jstree-unchecked" : c); g && (a.children(":checkbox").length ? a.children(":checkbox").addClass("jstree-real-checkbox") : (e = l.call(d, a), a.prepend("<input type='checkbox' class='jstree-real-checkbox' id='" + e[0] + "' name='" + e[0] + "' value='" + e[1] + "' />"))); f ? (a.hasClass("jstree-checked") || a.children(":checked").length) &&
|
|
a.addClass("jstree-checked").children(":checkbox").prop("checked", !0) : ("jstree-checked" === c || a.hasClass("jstree-checked") || a.children(":checked").length) && a.find("li").addBack().addClass("jstree-checked").children(":checkbox").prop("checked", !0)
|
|
})
|
|
}); f || a.find(".jstree-checked").parent().parent().each(function () { d._repair_state(this) })
|
|
}
|
|
}, change_state: function (a, c) {
|
|
a = this._get_node(a); var d = !1, e = this._get_settings().checkbox.real_checkboxes; if (!a || -1 === a) return !1; c = !1 === c || !0 === c ? c : a.hasClass("jstree-checked");
|
|
if (this._get_settings().checkbox.two_state) c ? (a.removeClass("jstree-checked").addClass("jstree-unchecked"), e && a.children(":checkbox").prop("checked", !1)) : (a.removeClass("jstree-unchecked").addClass("jstree-checked"), e && a.children(":checkbox").prop("checked", !0)); else {
|
|
if (c) { d = a.find("li").addBack(); if (!d.filter(".jstree-checked, .jstree-undetermined").length) return !1; d.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked"); e && d.children(":checkbox").prop("checked", !1) } else {
|
|
d =
|
|
a.find("li").addBack(); if (!d.filter(".jstree-unchecked, .jstree-undetermined").length) return !1; d.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked"); e && d.children(":checkbox").prop("checked", !0); this.data.ui && (this.data.ui.last_selected = a); this.data.checkbox.last_selected = a
|
|
} a.parentsUntil(".jstree", "li").each(function () {
|
|
var a = b(this); if (c) {
|
|
if (a.children("ul").children("li.jstree-checked, li.jstree-undetermined").length) return a.parentsUntil(".jstree", "li").addBack().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined"),
|
|
e && a.parentsUntil(".jstree", "li").addBack().children(":checkbox").prop("checked", !1), !1; a.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked"); e && a.children(":checkbox").prop("checked", !1)
|
|
} else {
|
|
if (a.children("ul").children("li.jstree-unchecked, li.jstree-undetermined").length) return a.parentsUntil(".jstree", "li").addBack().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined"), e && a.parentsUntil(".jstree", "li").addBack().children(":checkbox").prop("checked",
|
|
!1), !1; a.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked"); e && a.children(":checkbox").prop("checked", !0)
|
|
}
|
|
})
|
|
} this.data.ui && this.data.checkbox.noui && (this.data.ui.selected = this.get_checked()); this.__callback(a); return !0
|
|
}, check_node: function (a) { if (this.change_state(a, !1)) { a = this._get_node(a); if (this._get_settings().checkbox.checked_parent_open) { var b = this; a.parents(".jstree-closed").each(function () { b.open_node(this, !1, !0) }) } this.__callback({ obj: a }) } }, uncheck_node: function (a) {
|
|
this.change_state(a,
|
|
!0) && this.__callback({ obj: this._get_node(a) })
|
|
}, check_all: function () { var a = this; (this._get_settings().checkbox.two_state ? this.get_container_ul().find("li") : this.get_container_ul().children("li")).each(function () { a.change_state(this, !1) }); this.__callback() }, uncheck_all: function () { var a = this; (this._get_settings().checkbox.two_state ? this.get_container_ul().find("li") : this.get_container_ul().children("li")).each(function () { a.change_state(this, !0) }); this.__callback() }, is_checked: function (a) {
|
|
a = this._get_node(a);
|
|
return a.length ? a.is(".jstree-checked") : !1
|
|
}, get_checked: function (a, b) { a = a && -1 !== a ? this._get_node(a) : this.get_container(); return b || this._get_settings().checkbox.two_state ? a.find(".jstree-checked") : a.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked") }, get_unchecked: function (a, b) { a = a && -1 !== a ? this._get_node(a) : this.get_container(); return b || this._get_settings().checkbox.two_state ? a.find(".jstree-unchecked") : a.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked") },
|
|
show_checkboxes: function () { this.get_container().children("ul").removeClass("jstree-no-checkboxes") }, hide_checkboxes: function () { this.get_container().children("ul").addClass("jstree-no-checkboxes") }, _repair_state: function (a) {
|
|
a = this._get_node(a); if (a.length) if (this._get_settings().checkbox.two_state) a.find("li").addBack().not(".jstree-checked").removeClass("jstree-undetermined").addClass("jstree-unchecked").children(":checkbox").prop("checked", !0); else {
|
|
var b = this._get_settings().checkbox.real_checkboxes,
|
|
d = a.find("> ul > .jstree-checked").length, e = a.find("> ul > .jstree-undetermined").length, f = a.find("> ul > li").length; 0 === f ? a.hasClass("jstree-undetermined") && this.change_state(a, !1) : 0 === d && 0 === e ? this.change_state(a, !0) : d === f ? this.change_state(a, !1) : (a.parentsUntil(".jstree", "li").addBack().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined"), b && a.parentsUntil(".jstree", "li").addBack().children(":checkbox").prop("checked", !1))
|
|
}
|
|
}, reselect: function () {
|
|
if (this.data.ui && this.data.checkbox.noui) {
|
|
var a =
|
|
this, c = this.data.ui.to_select, c = b.map(b.makeArray(c), function (a) { return "#" + a.toString().replace(/^#/, "").replace(/\\\//g, "/").replace(/\//g, "\\/").replace(/\\\./g, ".").replace(/\./g, "\\.").replace(/\:/g, "\\:") }); this.deselect_all(); b.each(c, function (b, c) { a.check_node(c) }); this.__callback()
|
|
} else this.__call_old()
|
|
}, save_loaded: function () { var a = this; this.data.core.to_load = []; this.get_container_ul().find("li.jstree-closed.jstree-undetermined").each(function () { this.id && a.data.core.to_load.push("#" + this.id) }) }
|
|
}
|
|
});
|
|
b(function () { b.vakata.css.add_sheet({ str: ".jstree .jstree-real-checkbox { display:none; } ", title: "jstree" }) })
|
|
})(jQuery); (function (b) {
|
|
b.vakata.xslt = function (a, c, f) {
|
|
var g = !1, l, h, m; if (!1 === g && window.ActiveXObject) try { g = new ActiveXObject("Msxml2.XSLTemplate"), h = new ActiveXObject("Msxml2.DOMDocument"), h.loadXML(a), m = new ActiveXObject("Msxml2.FreeThreadedDOMDocument"), m.loadXML(c), g.stylesheet = m, l = g.createProcessor(), l.input = h, l.transform(), g = l.output } catch (k) { } a = b.parseXML(a); c = b.parseXML(c); !1 === g &&
|
|
"undefined" !== typeof XSLTProcessor && (l = new XSLTProcessor, l.importStylesheet(c), g = l.transformToFragment(a, document), g = b("<div />").append(g).html()); !1 === g && "undefined" !== typeof a.transformNode && (g = a.transformNode(c)); f.call(null, g)
|
|
}; var a = {
|
|
nest: '<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" /><xsl:template match="/">\t<xsl:call-template name="nodes">\t\t<xsl:with-param name="node" select="/root" />\t</xsl:call-template></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<ul>\t<xsl:for-each select="$node/item">\t\t<xsl:variable name="children" select="count(./item) > 0" />\t\t<li>\t\t\t<xsl:attribute name="class">\t\t\t\t<xsl:if test="position() = last()">jstree-last </xsl:if>\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t\t\t</xsl:choose>\t\t\t\t<xsl:value-of select="@class" />\t\t\t</xsl:attribute>\t\t\t<xsl:for-each select="@*">\t\t\t\t<xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t</xsl:if>\t\t\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text> </xsl:text></ins>\t\t\t<xsl:for-each select="content/name">\t\t\t\t<a>\t\t\t\t<xsl:attribute name="href">\t\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t\t\t</xsl:choose>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t\t\t<xsl:for-each select="@*">\t\t\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t\t</xsl:if>\t\t\t\t</xsl:for-each>\t\t\t\t\t<ins>\t\t\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t\t\t</xsl:attribute>\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t\t\t<xsl:text> </xsl:text>\t\t\t\t\t</ins>\t\t\t\t\t<xsl:copy-of select="./child::node()" />\t\t\t\t</a>\t\t\t</xsl:for-each>\t\t\t<xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>\t\t</li>\t</xsl:for-each>\t</ul></xsl:template></xsl:stylesheet>',
|
|
flat: '<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" /><xsl:template match="/">\t<ul>\t<xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">\t\t<xsl:call-template name="nodes">\t\t\t<xsl:with-param name="node" select="." />\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t</xsl:call-template>\t</xsl:for-each>\t</ul></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<xsl:param name="is_last" />\t<xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) > 0" />\t<li>\t<xsl:attribute name="class">\t\t<xsl:if test="$is_last = true()">jstree-last </xsl:if>\t\t<xsl:choose>\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t</xsl:choose>\t\t<xsl:value-of select="@class" />\t</xsl:attribute>\t<xsl:for-each select="@*">\t\t<xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t</xsl:if>\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text> </xsl:text></ins>\t<xsl:for-each select="content/name">\t\t<a>\t\t<xsl:attribute name="href">\t\t\t<xsl:choose>\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t</xsl:choose>\t\t</xsl:attribute>\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t<xsl:for-each select="@*">\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t</xsl:if>\t\t</xsl:for-each>\t\t\t<ins>\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t<xsl:text> </xsl:text>\t\t\t</ins>\t\t\t<xsl:copy-of select="./child::node()" />\t\t</a>\t</xsl:for-each>\t<xsl:if test="$children">\t\t<ul>\t\t<xsl:for-each select="//item[@parent_id=$node/attribute::id]">\t\t\t<xsl:call-template name="nodes">\t\t\t\t<xsl:with-param name="node" select="." />\t\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t\t</xsl:call-template>\t\t</xsl:for-each>\t\t</ul>\t</xsl:if>\t</li></xsl:template></xsl:stylesheet>'
|
|
},
|
|
c = function (a) { return a.toString().replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'") }; b.jstree.plugin("xml_data", {
|
|
defaults: { data: !1, ajax: !1, xsl: "flat", clean_node: !1, correct_state: !0, get_skip_empty: !1, get_include_preamble: !0 }, _fn: {
|
|
load_node: function (a, b, c) { var g = this; this.load_node_xml(a, function () { g.__callback({ obj: g._get_node(a) }); b.call(this) }, c) }, _is_loaded: function (a) {
|
|
var c = this._get_settings().xml_data; a = this._get_node(a); return -1 == a ||
|
|
!a || !c.ajax && !b.isFunction(c.data) || a.is(".jstree-open, .jstree-leaf") || 0 < a.children("ul").children("li").size()
|
|
}, load_node_xml: function (a, c, f) {
|
|
var g = this.get_settings().xml_data, l = function () { }, h = function () { }; if ((a = this._get_node(a)) && -1 !== a) { if (a.data("jstree_is_loading")) return; a.data("jstree_is_loading", !0) } switch (!0) {
|
|
case !g.data && !g.ajax: throw "Neither data nor ajax settings supplied."; case b.isFunction(g.data): g.data.call(this, a, b.proxy(function (f) {
|
|
this.parse_xml(f, b.proxy(function (f) {
|
|
f && (f =
|
|
f.replace(/ ?xmlns="[^"]*"/ig, ""), 10 < f.length ? (f = b(f), -1 !== a && a ? (a.children("a.jstree-loading").removeClass("jstree-loading"), a.append(f), a.removeData("jstree_is_loading")) : this.get_container().children("ul").empty().append(f.children()), g.clean_node && this.clean_node(a), c && c.call(this)) : a && -1 !== a ? (a.children("a.jstree-loading").removeClass("jstree-loading"), a.removeData("jstree_is_loading"), g.correct_state && (this.correct_state(a), c && c.call(this))) : g.correct_state && (this.get_container().children("ul").empty(),
|
|
c && c.call(this)))
|
|
}, this))
|
|
}, this)); break; case !!g.data && !g.ajax || !!g.data && !!g.ajax && (!a || -1 === a): a && -1 != a || this.parse_xml(g.data, b.proxy(function (f) { f ? (f = f.replace(/ ?xmlns="[^"]*"/ig, ""), 10 < f.length && (f = b(f), this.get_container().children("ul").empty().append(f.children()), g.clean_node && this.clean_node(a), c && c.call(this))) : g.correct_state && (this.get_container().children("ul").empty(), c && c.call(this)) }, this)); break; case !g.data && !!g.ajax || !!g.data && !!g.ajax && a && -1 !== a: l = function (b, c, e) {
|
|
var h = this.get_settings().xml_data.ajax.error;
|
|
h && h.call(this, b, c, e); -1 !== a && a.length ? (a.children("a.jstree-loading").removeClass("jstree-loading"), a.removeData("jstree_is_loading"), "success" === c && g.correct_state && this.correct_state(a)) : "success" === c && g.correct_state && this.get_container().children("ul").empty(); f && f.call(this)
|
|
}, h = function (f, h, p) {
|
|
f = p.responseText; var n = this.get_settings().xml_data.ajax.success; n && (f = n.call(this, f, h, p) || f); if ("" === f || f && f.toString && "" === f.toString().replace(/^[\s\n]+$/, "")) return l.call(this, p, h, ""); this.parse_xml(f,
|
|
b.proxy(function (f) {
|
|
f && (f = f.replace(/ ?xmlns="[^"]*"/ig, ""), 10 < f.length ? (f = b(f), -1 !== a && a ? (a.children("a.jstree-loading").removeClass("jstree-loading"), a.append(f), a.removeData("jstree_is_loading")) : this.get_container().children("ul").empty().append(f.children()), g.clean_node && this.clean_node(a), c && c.call(this)) : a && -1 !== a ? (a.children("a.jstree-loading").removeClass("jstree-loading"), a.removeData("jstree_is_loading"), g.correct_state && (this.correct_state(a), c && c.call(this))) : g.correct_state && (this.get_container().children("ul").empty(),
|
|
c && c.call(this)))
|
|
}, this))
|
|
}, g.ajax.context = this, g.ajax.error = l, g.ajax.success = h, g.ajax.dataType || (g.ajax.dataType = "xml"), b.isFunction(g.ajax.url) && (g.ajax.url = g.ajax.url.call(this, a)), b.isFunction(g.ajax.data) && (g.ajax.data = g.ajax.data.call(this, a)), b.ajax(g.ajax)
|
|
}
|
|
}, parse_xml: function (c, e) { var f = this._get_settings().xml_data; b.vakata.xslt(c, a[f.xsl], e) }, get_xml: function (a, e, f, g, l) {
|
|
var h = "", m = this._get_settings(), k = this, p, n, q, r, s; a || (a = "flat"); l || (l = 0); (e = this._get_node(e)) && -1 !== e || (e = this.get_container().find("> ul > li"));
|
|
f = b.isArray(f) ? f : ["id", "class"]; !l && this.data.types && -1 === b.inArray(m.types.type_attr, f) && f.push(m.types.type_attr); g = b.isArray(g) ? g : []; l || (m.xml_data.get_include_preamble && (h += '<?xml version="1.0" encoding="UTF-8"?>'), h += "<root>"); e.each(function () {
|
|
h += "<item"; q = b(this); b.each(f, function (a, b) { var d = q.attr(b); m.xml_data.get_skip_empty && "undefined" === typeof d || (h += " " + b + '="' + c((" " + (d || "")).replace(/ jstree[^ ]*/ig, "").replace(/\s+$/ig, " ").replace(/^ /, "").replace(/ $/, "")) + '"') }); q.hasClass("jstree-open") &&
|
|
(h += ' state="open"'); q.hasClass("jstree-closed") && (h += ' state="closed"'); "flat" === a && (h += ' parent_id="' + c(l) + '"'); h += ">"; h += "<content>"; r = q.children("a"); r.each(function () {
|
|
p = b(this); s = !1; h += "<name"; -1 !== b.inArray("languages", m.plugins) && b.each(m.languages, function (a, b) { if (p.hasClass(b)) return h += ' lang="' + c(b) + '"', s = b, !1 }); g.length && b.each(g, function (a, b) {
|
|
var d = p.attr(b); m.xml_data.get_skip_empty && "undefined" === typeof d || (h += " " + b + '="' + c((" " + d || "").replace(/ jstree[^ ]*/ig, "").replace(/\s+$/ig, " ").replace(/^ /,
|
|
"").replace(/ $/, "")) + '"')
|
|
}); p.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig, "").replace(/^\s+$/ig, "").length && (h += ' icon="' + c(p.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig, "").replace(/\s+$/ig, " ").replace(/^ /, "").replace(/ $/, "")) + '"'); p.children("ins").get(0).style.backgroundImage.length && (h += ' icon="' + c(p.children("ins").get(0).style.backgroundImage.replace("url(", "").replace(")", "").replace(/'/ig, "").replace(/"/ig, "")) + '"'); h += ">"; h += "<![CDATA[" + k.get_text(p, s) + "]]\x3e";
|
|
h += "</name>"
|
|
}); h += "</content>"; n = q[0].id || !0; q = q.find("> ul > li"); n = q.length ? k.get_xml(a, q, f, g, n) : ""; "nest" == a && (h += n); h += "</item>"; "flat" == a && (h += n)
|
|
}); l || (h += "</root>"); return h
|
|
}
|
|
}
|
|
})
|
|
})(jQuery); (function (b) {
|
|
8 <= b().jquery.split(".")[1] ? (b.expr[":"].jstree_contains = b.expr.createPseudo(function (a) { return function (b) { return 0 <= (b.textContent || b.innerText || "").toLowerCase().indexOf(a.toLowerCase()) } }), b.expr[":"].jstree_title_contains = b.expr.createPseudo(function (a) {
|
|
return function (b) {
|
|
return 0 <= (b.getAttribute("title") ||
|
|
"").toLowerCase().indexOf(a.toLowerCase())
|
|
}
|
|
})) : (b.expr[":"].jstree_contains = function (a, b, d) { return 0 <= (a.textContent || a.innerText || "").toLowerCase().indexOf(d[3].toLowerCase()) }, b.expr[":"].jstree_title_contains = function (a, b, d) { return 0 <= (a.getAttribute("title") || "").toLowerCase().indexOf(d[3].toLowerCase()) }); b.jstree.plugin("search", {
|
|
__init: function () {
|
|
this.data.search.str = ""; this.data.search.result = b(); this._get_settings().search.show_only_matches && this.get_container().bind("search.jstree", function (a,
|
|
c) { b(this).children("ul").find("li").hide().removeClass("jstree-last"); c.rslt.nodes.parentsUntil(".jstree").addBack().show().filter("ul").each(function () { b(this).children("li:visible").eq(-1).addClass("jstree-last") }) }).bind("clear_search.jstree", function () { b(this).children("ul").find("li").css("display", "").end().end().jstree("clean_node", -1) })
|
|
}, defaults: { ajax: !1, search_method: "jstree_contains", show_only_matches: !1 }, _fn: {
|
|
search: function (a, c) {
|
|
if ("" === b.trim(a)) this.clear_search(); else {
|
|
var d = this.get_settings().search,
|
|
e = this, f = function () { }; this.data.search.str = a; if (!c && !1 !== d.ajax && 0 < this.get_container_ul().find("li.jstree-closed:not(:has(ul)):eq(0)").length) {
|
|
this.search.supress_callback = !0; f = function (a, b, c) { var d = this.get_settings().search.ajax.success; d && (a = d.call(this, a, b, c) || a); this.data.search.to_open = a; this._search_open() }; d.ajax.context = this; d.ajax.error = function () { }; d.ajax.success = f; b.isFunction(d.ajax.url) && (d.ajax.url = d.ajax.url.call(this, a)); b.isFunction(d.ajax.data) && (d.ajax.data = d.ajax.data.call(this,
|
|
a)); d.ajax.data || (d.ajax.data = { search_string: a }); if (!d.ajax.dataType || /^json/.exec(d.ajax.dataType)) d.ajax.dataType = "json"; b.ajax(d.ajax)
|
|
} else this.data.search.result.length && this.clear_search(), this.data.search.result = this.get_container().find("a" + (this.data.languages ? "." + this.get_lang() : "") + ":" + d.search_method + "(" + this.data.search.str + ")"), this.data.search.result.addClass("jstree-search").parent().parents(".jstree-closed").each(function () { e.open_node(this, !1, !0) }), this.__callback({
|
|
nodes: this.data.search.result,
|
|
str: a
|
|
})
|
|
}
|
|
}, clear_search: function (a) { this.data.search.result.removeClass("jstree-search"); this.__callback(this.data.search.result); this.data.search.result = b() }, _search_open: function (a) {
|
|
var c = this; a = !0; var d = [], e = []; this.data.search.to_open.length && (b.each(this.data.search.to_open, function (a, c) { if ("#" == c) return !0; b(c).length && b(c).is(".jstree-closed") ? d.push(c) : e.push(c) }), d.length && (this.data.search.to_open = e, b.each(d, function (a, b) { c.open_node(b, function () { c._search_open(!0) }) }), a = !1)); a && this.search(this.data.search.str,
|
|
!0)
|
|
}
|
|
}
|
|
})
|
|
})(jQuery); (function (b) {
|
|
b.vakata.context = {
|
|
hide_on_mouseleave: !1, cnt: b("<div id='vakata-contextmenu' />"), vis: !1, tgt: !1, par: !1, func: !1, data: !1, rtl: !1, show: function (a, c, d, e, f, g, l) {
|
|
b.vakata.context.rtl = !!l; if (a = b.vakata.context.parse(a)) {
|
|
b.vakata.context.vis = !0; b.vakata.context.tgt = c; b.vakata.context.par = g || c || null; b.vakata.context.data = f || null; b.vakata.context.cnt.html(a).css({ visibility: "hidden", display: "block", left: 0, top: 0 }); if (b.vakata.context.hide_on_mouseleave) b.vakata.context.cnt.one("mouseleave",
|
|
function (a) { b.vakata.context.hide() }); f = b.vakata.context.cnt.height(); g = b.vakata.context.cnt.width(); d + g > b(document).width() && (d = b(document).width() - (g + 5), b.vakata.context.cnt.find("li > ul").addClass("right")); e + f > b(document).height() && (e -= f + c[0].offsetHeight, b.vakata.context.cnt.find("li > ul").addClass("bottom")); b.vakata.context.cnt.css({ left: d, top: e }).find("li:has(ul)").bind("mouseenter", function (a) {
|
|
a = b(document).width(); var c = b(document).height(), d = b(this).children("ul").show(); a !== b(document).width() &&
|
|
d.toggleClass("right"); c !== b(document).height() && d.toggleClass("bottom")
|
|
}).bind("mouseleave", function (a) { b(this).children("ul").hide() }).end().css({ visibility: "visible" }).show(); b(document).triggerHandler("context_show.vakata")
|
|
}
|
|
}, hide: function () { b.vakata.context.vis = !1; b.vakata.context.cnt.attr("class", "").css({ visibility: "hidden" }); b(document).triggerHandler("context_hide.vakata") }, parse: function (a, c) {
|
|
if (!a) return !1; var d = "", e = !1, f = !0; c || (b.vakata.context.func = {}); d += "<ul>"; b.each(a, function (a, c) {
|
|
if (!c) return !0;
|
|
b.vakata.context.func[a] = c.action; !f && c.separator_before && (d += "<li class='vakata-separator vakata-separator-before'></li>"); f = !1; d += "<li class='" + (c._class || "") + (c._disabled ? " jstree-contextmenu-disabled " : "") + "'><ins "; c.icon && -1 === c.icon.indexOf("/") && (d += " class='" + c.icon + "' "); c.icon && -1 !== c.icon.indexOf("/") && (d += " style='background:url(" + c.icon + ") center center no-repeat;' "); d += "> </ins><a href='#' rel='" + a + "'>"; c.submenu && (d += "<span style='float:" + (b.vakata.context.rtl ? "left" : "right") +
|
|
";'>»</span>"); d += c.label + "</a>"; c.submenu && (e = b.vakata.context.parse(c.submenu, !0)) && (d += e); d += "</li>"; c.separator_after && (d += "<li class='vakata-separator vakata-separator-after'></li>", f = !0)
|
|
}); d = d.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/, ""); d += "</ul>"; b(document).triggerHandler("context_parse.vakata"); return 10 < d.length ? d : !1
|
|
}, exec: function (a) {
|
|
return b.isFunction(b.vakata.context.func[a]) ? (b.vakata.context.func[a].call(b.vakata.context.data, b.vakata.context.par),
|
|
!0) : !1
|
|
}
|
|
}; b(function () {
|
|
b.vakata.css.add_sheet({
|
|
str: "#vakata-contextmenu { display:block; visibility:hidden; left:0; top:-200px; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } #vakata-contextmenu ul { min-width:180px; *width:180px; } #vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } #vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } #vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } #vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } #vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } #vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } #vakata-contextmenu .right { right:100%; left:auto; } #vakata-contextmenu .bottom { bottom:-1px; top:auto; } #vakata-contextmenu li.vakata-separator { min-height:0; height:1px; line-height:1px; font-size:1px; overflow:hidden; margin:0 2px; background:silver; /* border-top:1px solid #fefefe; */ padding:0; } ",
|
|
title: "vakata"
|
|
}); b.vakata.context.cnt.delegate("a", "click", function (a) { a.preventDefault() }).delegate("a", "mouseup", function (a) { !b(this).parent().hasClass("jstree-contextmenu-disabled") && b.vakata.context.exec(b(this).attr("rel")) ? b.vakata.context.hide() : b(this).blur() }).delegate("a", "mouseover", function () { b.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover") }).appendTo("body"); b(document).bind("mousedown", function (a) {
|
|
b.vakata.context.vis && !b.contains(b.vakata.context.cnt[0], a.target) &&
|
|
b.vakata.context.hide()
|
|
}); "undefined" !== typeof b.hotkeys && b(document).bind("keydown", "up", function (a) { if (b.vakata.context.vis) { var c = b.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first(); c.length || (c = b.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last()); c.addClass("vakata-hover"); a.stopImmediatePropagation(); a.preventDefault() } }).bind("keydown", "down", function (a) {
|
|
if (b.vakata.context.vis) {
|
|
var c =
|
|
b.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first(); c.length || (c = b.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first()); c.addClass("vakata-hover"); a.stopImmediatePropagation(); a.preventDefault()
|
|
}
|
|
}).bind("keydown", "right", function (a) {
|
|
b.vakata.context.vis && (b.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover"),
|
|
a.stopImmediatePropagation(), a.preventDefault())
|
|
}).bind("keydown", "left", function (a) { b.vakata.context.vis && (b.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover"), a.stopImmediatePropagation(), a.preventDefault()) }).bind("keydown", "esc", function (a) { b.vakata.context.hide(); a.preventDefault() }).bind("keydown", "space", function (a) { b.vakata.context.cnt.find(".vakata-hover").last().children("a").click(); a.preventDefault() })
|
|
}); b.jstree.plugin("contextmenu",
|
|
{
|
|
__init: function () {
|
|
this.get_container().delegate("a", "contextmenu.jstree", b.proxy(function (a) { a.preventDefault(); b(a.currentTarget).hasClass("jstree-loading") || this.show_contextmenu(a.currentTarget, a.pageX, a.pageY) }, this)).delegate("a", "click.jstree", b.proxy(function (a) { this.data.contextmenu && b.vakata.context.hide() }, this)).bind("destroy.jstree", b.proxy(function () { this.data.contextmenu && b.vakata.context.hide() }, this)); b(document).bind("context_hide.vakata", b.proxy(function () {
|
|
this.data.contextmenu =
|
|
!1
|
|
}, this))
|
|
}, defaults: {
|
|
select_node: !1, show_at_node: !0, items: {
|
|
create: { separator_before: !1, separator_after: !0, label: "Create", action: function (a) { this.create(a) } }, rename: { separator_before: !1, separator_after: !1, label: "Rename", action: function (a) { this.rename(a) } }, remove: { separator_before: !1, icon: !1, separator_after: !1, label: "Delete", action: function (a) { this.is_selected(a) ? this.remove() : this.remove(a) } }, ccp: {
|
|
separator_before: !0, icon: !1, separator_after: !1, label: "Edit", action: !1, submenu: {
|
|
cut: {
|
|
separator_before: !1,
|
|
separator_after: !1, label: "Cut", action: function (a) { this.cut(a) }
|
|
}, copy: { separator_before: !1, icon: !1, separator_after: !1, label: "Copy", action: function (a) { this.copy(a) } }, paste: { separator_before: !1, icon: !1, separator_after: !1, label: "Paste", action: function (a) { this.paste(a) } }
|
|
}
|
|
}
|
|
}
|
|
}, _fn: {
|
|
show_contextmenu: function (a, c, d) {
|
|
a = this._get_node(a); var e = this.get_settings().contextmenu, f = a.children("a:visible:eq(0)"), g = !1, g = !1; e.select_node && this.data.ui && !this.is_selected(a) && (this.deselect_all(), this.select_node(a, !0));
|
|
if (e.show_at_node || "undefined" === typeof c || "undefined" === typeof d) g = f.offset(), c = g.left, d = g.top + this.data.core.li_height; g = a.data("jstree") && a.data("jstree").contextmenu ? a.data("jstree").contextmenu : e.items; b.isFunction(g) && (g = g.call(this, a)); this.data.contextmenu = !0; b.vakata.context.show(g, f, c, d, this, a, this._get_settings().core.rtl); this.data.themes && b.vakata.context.cnt.attr("class", "jstree-" + this.data.themes.theme + "-context")
|
|
}
|
|
}
|
|
})
|
|
})(jQuery); (function (b) {
|
|
b.jstree.plugin("types", {
|
|
__init: function () {
|
|
var a =
|
|
this._get_settings().types; this.data.types.attach_to = []; this.get_container().bind("init.jstree", b.proxy(function () {
|
|
var c = a.type_attr, d = "", e = this; b.each(a.types, function (a, g) {
|
|
b.each(g, function (a, b) { /^(max_depth|max_children|icon|valid_children)$/.test(a) || e.data.types.attach_to.push(a) }); if (!g.icon) return !0; if (g.icon.image || g.icon.position) d = "default" == a ? d + (".jstree-" + e.get_index() + " a > .jstree-icon { ") : d + (".jstree-" + e.get_index() + " li[" + c + '="' + a + '"] > a > .jstree-icon { '), g.icon.image && (d += " background-image:url(" +
|
|
g.icon.image + "); "), d = g.icon.position ? d + (" background-position:" + g.icon.position + "; ") : d + " background-position:0 0; ", d += "} "
|
|
}); "" !== d && b.vakata.css.add_sheet({ str: d, title: "jstree-types" })
|
|
}, this)).bind("before.jstree", b.proxy(function (a, d) {
|
|
var e, f; if ((e = (e = this._get_settings().types.use_data ? this._get_node(d.args[0]) : !1) && -1 !== e && e.length ? e.data("jstree") : !1) && e.types && !1 === e.types[d.func] || -1 !== b.inArray(d.func, this.data.types.attach_to) && d.args[0] && (d.args[0].tagName || d.args[0].jquery) && (e = this._get_settings().types.types,
|
|
f = this._get_type(d.args[0]), (e[f] && "undefined" !== typeof e[f][d.func] || e["default"] && "undefined" !== typeof e["default"][d.func]) && !1 === this._check(d.func, d.args[0]))) return a.stopImmediatePropagation(), !1
|
|
}, this)); r && this.get_container().bind("load_node.jstree set_type.jstree", b.proxy(function (a, d) {
|
|
var e = d && d.rslt && d.rslt.obj && -1 !== d.rslt.obj ? this._get_node(d.rslt.obj).parent() : this.get_container_ul(), f = !1, g = this._get_settings().types; b.each(g.types, function (a, b) {
|
|
b.icon && (b.icon.image || b.icon.position) &&
|
|
(f = "default" === a ? e.find("li > a > .jstree-icon") : e.find("li[" + g.type_attr + "='" + a + "'] > a > .jstree-icon"), b.icon.image && f.css("backgroundImage", "url(" + b.icon.image + ")"), f.css("backgroundPosition", b.icon.position || "0 0"))
|
|
})
|
|
}, this))
|
|
}, defaults: { max_children: -1, max_depth: -1, valid_children: "all", use_data: !1, type_attr: "rel", types: { "default": { max_children: -1, max_depth: -1, valid_children: "all" } } }, _fn: {
|
|
_types_notify: function (a, b) { b.type && this._get_settings().types.use_data && this.set_type(b.type, a) }, _get_type: function (a) {
|
|
return (a =
|
|
this._get_node(a)) && a.length ? a.attr(this._get_settings().types.type_attr) || "default" : !1
|
|
}, set_type: function (a, b) { b = this._get_node(b); var d = b.length && a ? b.attr(this._get_settings().types.type_attr, a) : !1; d && this.__callback({ obj: b, type: a }); return d }, _check: function (a, c, d) {
|
|
c = this._get_node(c); var e = !1, f = this._get_type(c), g = 0, l = this, h = this._get_settings().types, m = !1; if (-1 === c) if (h[a]) e = h[a]; else return; else {
|
|
if (!1 === f) return; (m = h.use_data ? c.data("jstree") : !1) && m.types && "undefined" !== typeof m.types[a] ? e = m.types[a] :
|
|
h.types[f] && "undefined" !== typeof h.types[f][a] ? e = h.types[f][a] : h.types["default"] && "undefined" !== typeof h.types["default"][a] && (e = h.types["default"][a])
|
|
} b.isFunction(e) && (e = e.call(this, c)); "max_depth" === a && -1 !== c && !1 !== d && -2 !== h.max_depth && 0 !== e && c.children("a:eq(0)").parentsUntil(".jstree", "li").each(function (b) {
|
|
if (-1 !== h.max_depth && 0 >= h.max_depth - (b + 1)) return e = 0, !1; g = 0 === b ? e : l._check(a, this, !1); if (-1 !== g && 0 >= g - (b + 1)) return e = 0, !1; 0 <= g && (g - (b + 1) < e || 0 > e) && (e = g - (b + 1)); 0 <= h.max_depth && (h.max_depth -
|
|
(b + 1) < e || 0 > e) && (e = h.max_depth - (b + 1))
|
|
}); return e
|
|
}, check_move: function () {
|
|
if (!this.__call_old()) return !1; var a = this._get_move(), c = a.rt._get_settings().types, d = a.rt._check("max_children", a.cr), e = a.rt._check("max_depth", a.cr), f = a.rt._check("valid_children", a.cr), g = 0, l = 1; if ("none" === f || b.isArray(f) && a.ot && a.ot._get_type && (a.o.each(function () { if (-1 === b.inArray(a.ot._get_type(this), f)) return l = !1 }), !1 === l) || -2 !== c.max_children && -1 !== d && (g = -1 === a.cr ? this.get_container().find("> ul > li").not(a.o).length : a.cr.find("> ul > li").not(a.o).length,
|
|
g + a.o.length > d)) return !1; if (-2 !== c.max_depth && -1 !== e) { l = 0; if (0 === e) return !1; if ("undefined" === typeof a.o.d) { for (c = a.o; 0 < c.length;) c = c.find("> ul > li"), l++; a.o.d = l } if (0 > e - a.o.d) return !1 } return !0
|
|
}, create_node: function (a, c, d, e, f, g) {
|
|
if (!g && (f || this._is_loaded(a))) {
|
|
var l = "string" == typeof c && c.match(/^before|after$/i) && -1 !== a ? this._get_parent(a) : this._get_node(a), h = this._get_settings().types, m = this._check("max_children", l), k = this._check("max_depth", l), p = this._check("valid_children", l); "string" === typeof d &&
|
|
(d = { data: d }); d || (d = {}); if ("none" === p) return !1; if (b.isArray(p)) if (!d.attr || !d.attr[h.type_attr]) d.attr || (d.attr = {}), d.attr[h.type_attr] = p[0]; else if (-1 === b.inArray(d.attr[h.type_attr], p)) return !1; if (-2 !== h.max_children && -1 !== m && (l = -1 === l ? this.get_container().find("> ul > li").length : l.find("> ul > li").length, l + 1 > m) || -2 !== h.max_depth && -1 !== k && 0 > k - 1) return !1
|
|
} return this.__call_old(!0, a, c, d, e, f, g)
|
|
}
|
|
}
|
|
})
|
|
})(jQuery); (function (b) {
|
|
b.jstree.plugin("html_data", {
|
|
__init: function () {
|
|
this.data.html_data.original_container_html =
|
|
this.get_container().find(" > ul > li").clone(!0); this.data.html_data.original_container_html.find("li").addBack().contents().filter(function () { return 3 == this.nodeType }).remove()
|
|
}, defaults: { data: !1, ajax: !1, correct_state: !0 }, _fn: {
|
|
load_node: function (a, b, d) { var e = this; this.load_node_html(a, function () { e.__callback({ obj: e._get_node(a) }); b.call(this) }, d) }, _is_loaded: function (a) {
|
|
a = this._get_node(a); return -1 == a || !a || !this._get_settings().html_data.ajax && !b.isFunction(this._get_settings().html_data.data) ||
|
|
a.is(".jstree-open, .jstree-leaf") || 0 < a.children("ul").children("li").size()
|
|
}, load_node_html: function (a, c, d) {
|
|
var e, f = this.get_settings().html_data, g = function () { }; e = function () { }; if ((a = this._get_node(a)) && -1 !== a) { if (a.data("jstree_is_loading")) return; a.data("jstree_is_loading", !0) } switch (!0) {
|
|
case b.isFunction(f.data): f.data.call(this, a, b.proxy(function (d) {
|
|
d && "" !== d && d.toString && "" !== d.toString().replace(/^[\s\n]+$/, "") ? (d = b(d), d.is("ul") || (d = b("<ul />").append(d)), -1 != a && a ? (a.children("a.jstree-loading").removeClass("jstree-loading"),
|
|
a.append(d).children("ul").find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || "INS" !== this.firstChild.tagName }).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"), a.removeData("jstree_is_loading")) : this.get_container().children("ul").empty().append(d.children()).find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || "INS" !== this.firstChild.tagName }).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"),
|
|
this.clean_node(a), c && c.call(this)) : a && -1 !== a ? (a.children("a.jstree-loading").removeClass("jstree-loading"), a.removeData("jstree_is_loading"), f.correct_state && (this.correct_state(a), c && c.call(this))) : f.correct_state && (this.get_container().children("ul").empty(), c && c.call(this))
|
|
}, this)); break; case !f.data && !f.ajax: a && -1 != a || (this.get_container().children("ul").empty().append(this.data.html_data.original_container_html).find("li, a").filter(function () {
|
|
return !this.firstChild || !this.firstChild.tagName ||
|
|
"INS" !== this.firstChild.tagName
|
|
}).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"), this.clean_node()); c && c.call(this); break; case !!f.data && !f.ajax || !!f.data && !!f.ajax && (!a || -1 === a): a && -1 != a || (e = b(f.data), e.is("ul") || (e = b("<ul />").append(e)), this.get_container().children("ul").empty().append(e.children()).find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || "INS" !== this.firstChild.tagName }).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"),
|
|
this.clean_node()); c && c.call(this); break; case !f.data && !!f.ajax || !!f.data && !!f.ajax && a && -1 !== a: a = this._get_node(a), g = function (b, c, e) { var g = this.get_settings().html_data.ajax.error; g && g.call(this, b, c, e); -1 != a && a.length ? (a.children("a.jstree-loading").removeClass("jstree-loading"), a.removeData("jstree_is_loading"), "success" === c && f.correct_state && this.correct_state(a)) : "success" === c && f.correct_state && this.get_container().children("ul").empty(); d && d.call(this) }, e = function (d, e, m) {
|
|
var k = this.get_settings().html_data.ajax.success;
|
|
k && (d = k.call(this, d, e, m) || d); if ("" === d || d && d.toString && "" === d.toString().replace(/^[\s\n]+$/, "")) return g.call(this, m, e, ""); d ? (d = b(d), d.is("ul") || (d = b("<ul />").append(d)), -1 != a && a ? (a.children("a.jstree-loading").removeClass("jstree-loading"), a.append(d).children("ul").find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || "INS" !== this.firstChild.tagName }).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"),
|
|
a.removeData("jstree_is_loading")) : this.get_container().children("ul").empty().append(d.children()).find("li, a").filter(function () { return !this.firstChild || !this.firstChild.tagName || "INS" !== this.firstChild.tagName }).prepend("<ins class='jstree-icon'> </ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"), this.clean_node(a), c && c.call(this)) : a && -1 !== a ? (a.children("a.jstree-loading").removeClass("jstree-loading"), a.removeData("jstree_is_loading"), f.correct_state &&
|
|
(this.correct_state(a), c && c.call(this))) : f.correct_state && (this.get_container().children("ul").empty(), c && c.call(this))
|
|
}, f.ajax.context = this, f.ajax.error = g, f.ajax.success = e, f.ajax.dataType || (f.ajax.dataType = "html"), b.isFunction(f.ajax.url) && (f.ajax.url = f.ajax.url.call(this, a)), b.isFunction(f.ajax.data) && (f.ajax.data = f.ajax.data.call(this, a)), b.ajax(f.ajax)
|
|
}
|
|
}
|
|
}
|
|
}); b.jstree.defaults.plugins.push("html_data")
|
|
})(jQuery); (function (b) {
|
|
b.jstree.plugin("themeroller", {
|
|
__init: function () {
|
|
var a = this._get_settings().themeroller;
|
|
this.get_container().addClass("ui-widget-content").addClass("jstree-themeroller").delegate("a", "mouseenter.jstree", function (c) { b(c.currentTarget).hasClass("jstree-loading") || b(this).addClass(a.item_h) }).delegate("a", "mouseleave.jstree", function () { b(this).removeClass(a.item_h) }).bind("init.jstree", b.proxy(function (a, b) { b.inst.get_container().find("> ul > li > .jstree-loading > ins").addClass("ui-icon-refresh"); this._themeroller(b.inst.get_container().find("> ul > li")) }, this)).bind("open_node.jstree create_node.jstree",
|
|
b.proxy(function (a, b) { this._themeroller(b.rslt.obj) }, this)).bind("loaded.jstree refresh.jstree", b.proxy(function (a) { this._themeroller() }, this)).bind("close_node.jstree", b.proxy(function (a, b) { this._themeroller(b.rslt.obj) }, this)).bind("delete_node.jstree", b.proxy(function (a, b) { this._themeroller(b.rslt.parent) }, this)).bind("correct_state.jstree", b.proxy(function (b, d) {
|
|
d.rslt.obj.children("ins.jstree-icon").removeClass(a.opened + " " + a.closed + " ui-icon").end().find("> a > ins.ui-icon").filter(function () {
|
|
return -1 ===
|
|
this.className.toString().replace(a.item_clsd, "").replace(a.item_open, "").replace(a.item_leaf, "").indexOf("ui-icon-")
|
|
}).removeClass(a.item_open + " " + a.item_clsd).addClass(a.item_leaf || "jstree-no-icon")
|
|
}, this)).bind("select_node.jstree", b.proxy(function (b, d) { d.rslt.obj.children("a").addClass(a.item_a) }, this)).bind("deselect_node.jstree deselect_all.jstree", b.proxy(function (b, d) { this.get_container().find("a." + a.item_a).removeClass(a.item_a).end().find("a.jstree-clicked").addClass(a.item_a) }, this)).bind("dehover_node.jstree",
|
|
b.proxy(function (b, d) { d.rslt.obj.children("a").removeClass(a.item_h) }, this)).bind("hover_node.jstree", b.proxy(function (b, d) { this.get_container().find("a." + a.item_h).not(d.rslt.obj).removeClass(a.item_h); d.rslt.obj.children("a").addClass(a.item_h) }, this)).bind("move_node.jstree", b.proxy(function (a, b) { this._themeroller(b.rslt.o); this._themeroller(b.rslt.op) }, this))
|
|
}, __destroy: function () {
|
|
var a = this._get_settings().themeroller, c = ["ui-icon"]; b.each(a, function (a, b) { b = b.split(" "); b.length && (c = c.concat(b)) });
|
|
this.get_container().removeClass("ui-widget-content").find("." + c.join(", .")).removeClass(c.join(" "))
|
|
}, _fn: {
|
|
_themeroller: function (a) {
|
|
var b = this._get_settings().themeroller; a = (a = a && -1 != a ? this._get_node(a) : this.get_container_ul()) && -1 != a ? a.parent() : this.get_container_ul(); a.find("li.jstree-closed").children("ins.jstree-icon").removeClass(b.opened).addClass("ui-icon " + b.closed).end().children("a").addClass(b.item).children("ins.jstree-icon").addClass("ui-icon").filter(function () {
|
|
return -1 === this.className.toString().replace(b.item_clsd,
|
|
"").replace(b.item_open, "").replace(b.item_leaf, "").indexOf("ui-icon-")
|
|
}).removeClass(b.item_leaf + " " + b.item_open).addClass(b.item_clsd || "jstree-no-icon").end().end().end().end().find("li.jstree-open").children("ins.jstree-icon").removeClass(b.closed).addClass("ui-icon " + b.opened).end().children("a").addClass(b.item).children("ins.jstree-icon").addClass("ui-icon").filter(function () { return -1 === this.className.toString().replace(b.item_clsd, "").replace(b.item_open, "").replace(b.item_leaf, "").indexOf("ui-icon-") }).removeClass(b.item_leaf +
|
|
" " + b.item_clsd).addClass(b.item_open || "jstree-no-icon").end().end().end().end().find("li.jstree-leaf").children("ins.jstree-icon").removeClass(b.closed + " ui-icon " + b.opened).end().children("a").addClass(b.item).children("ins.jstree-icon").addClass("ui-icon").filter(function () { return -1 === this.className.toString().replace(b.item_clsd, "").replace(b.item_open, "").replace(b.item_leaf, "").indexOf("ui-icon-") }).removeClass(b.item_clsd + " " + b.item_open).addClass(b.item_leaf || "jstree-no-icon")
|
|
}
|
|
}, defaults: {
|
|
opened: "ui-icon-triangle-1-se",
|
|
closed: "ui-icon-triangle-1-e", item: "ui-state-default", item_h: "ui-state-hover", item_a: "ui-state-active", item_open: "ui-icon-folder-open", item_clsd: "ui-icon-folder-collapsed", item_leaf: "ui-icon-document"
|
|
}
|
|
}); b(function () { b.vakata.css.add_sheet({ str: ".jstree-themeroller .ui-icon { overflow:visible; } .jstree-themeroller a { padding:0 2px; } .jstree-themeroller .jstree-no-icon { display:none; }", title: "jstree" }) })
|
|
})(jQuery); (function (b) {
|
|
b.jstree.plugin("unique", {
|
|
__init: function () {
|
|
this.get_container().bind("before.jstree",
|
|
b.proxy(function (a, c) {
|
|
var d = [], e = !0, f; "move_node" == c.func && !0 === c.args[4] && c.args[0].o && c.args[0].o.length && (c.args[0].o.children("a").each(function () { d.push(b(this).text().replace(/^\s+/g, "")) }), e = this._check_unique(d, c.args[0].np.find("> ul > li").not(c.args[0].o), "move_node")); "create_node" == c.func && (c.args[4] || this._is_loaded(c.args[0])) && (e = this._get_node(c.args[0]), !c.args[1] || "before" !== c.args[1] && "after" !== c.args[1] || (e = this._get_parent(c.args[0])) && -1 !== e || (e = this.get_container()), "string" ===
|
|
typeof c.args[2] ? d.push(c.args[2]) : c.args[2] && c.args[2].data ? d.push(c.args[2].data) : d.push(this._get_string("new_node")), e = this._check_unique(d, e.find("> ul > li"), "create_node")); "rename_node" == c.func && (d.push(c.args[1]), f = this._get_node(c.args[0]), (e = this._get_parent(f)) && -1 !== e || (e = this.get_container()), e = this._check_unique(d, e.find("> ul > li").not(f), "rename_node")); if (!e) return a.stopPropagation(), !1
|
|
}, this))
|
|
}, defaults: { error_callback: b.noop }, _fn: {
|
|
_check_unique: function (a, c, d) {
|
|
var e = [], f = !0;
|
|
c.children("a").each(function () { e.push(b(this).text().replace(/^\s+/g, "")) }); if (!e.length || !a.length) return !0; b.each(a, function (a, c) { if (-1 !== b.inArray(c, e)) return f = !1 }); f || this._get_settings().unique.error_callback.call(null, a, c, d); return f
|
|
}, check_move: function () { if (!this.__call_old()) return !1; var a = this._get_move(), c = []; return a.o && a.o.length ? (a.o.children("a").each(function () { c.push(b(this).text().replace(/^\s+/g, "")) }), this._check_unique(c, a.np.find("> ul > li").not(a.o), "check_move")) : !0 }
|
|
}
|
|
})
|
|
})(jQuery);
|
|
(function (b) {
|
|
b.jstree.plugin("wholerow", {
|
|
__init: function () {
|
|
if (!this.data.ui) throw "jsTree wholerow: jsTree UI plugin not included."; this.data.wholerow.html = !1; this.data.wholerow.to = !1; this.get_container().bind("init.jstree", b.proxy(function (a, b) { this._get_settings().core.animation = 0 }, this)).bind("open_node.jstree create_node.jstree clean_node.jstree loaded.jstree", b.proxy(function (a, b) { this._prepare_wholerow_span(b && b.rslt && b.rslt.obj ? b.rslt.obj : -1) }, this)).bind("search.jstree clear_search.jstree reopen.jstree after_open.jstree after_close.jstree create_node.jstree delete_node.jstree clean_node.jstree",
|
|
b.proxy(function (a, b) { this.data.to && clearTimeout(this.data.to); this.data.to = setTimeout(function (a, b) { return function () { a._prepare_wholerow_ul(b) } }(this, b && b.rslt && b.rslt.obj ? b.rslt.obj : -1), 0) }, this)).bind("deselect_all.jstree", b.proxy(function (a, b) { this.get_container().find(" > .jstree-wholerow .jstree-clicked").removeClass("jstree-clicked " + (this.data.themeroller ? this._get_settings().themeroller.item_a : "")) }, this)).bind("select_node.jstree deselect_node.jstree ", b.proxy(function (a, c) {
|
|
c.rslt.obj.each(function () {
|
|
c.inst.get_container().find(" > .jstree-wholerow li:visible:eq(" +
|
|
parseInt((b(this).offset().top - c.inst.get_container().offset().top + c.inst.get_container()[0].scrollTop) / c.inst.data.core.li_height, 10) + ")").children("a").attr("class", c.rslt.obj.children("a").attr("class"))
|
|
})
|
|
}, this)).bind("hover_node.jstree dehover_node.jstree", b.proxy(function (a, b) {
|
|
this.get_container().find(" > .jstree-wholerow .jstree-hovered").removeClass("jstree-hovered " + (this.data.themeroller ? this._get_settings().themeroller.item_h : "")); "hover_node" === a.type && this.get_container().find(" > .jstree-wholerow li:visible:eq(" +
|
|
parseInt((b.rslt.obj.offset().top - this.get_container().offset().top + this.get_container()[0].scrollTop) / this.data.core.li_height, 10) + ")").children("a").attr("class", b.rslt.obj.children(".jstree-hovered").attr("class"))
|
|
}, this)).delegate(".jstree-wholerow-span, ins.jstree-icon, li", "click.jstree", function (a) { var c = b(a.currentTarget); "A" === a.target.tagName || "INS" === a.target.tagName && c.closest("li").is(".jstree-open, .jstree-closed") || (c.closest("li").children("a:visible:eq(0)").click(), a.stopImmediatePropagation()) }).delegate("li",
|
|
"mouseover.jstree", b.proxy(function (a) { a.stopImmediatePropagation(); if (b(a.currentTarget).children(".jstree-hovered, .jstree-clicked").length) return !1; this.hover_node(a.currentTarget); return !1 }, this)).delegate("li", "mouseleave.jstree", b.proxy(function (a) { b(a.currentTarget).children("a").hasClass("jstree-hovered").length || this.dehover_node(a.currentTarget) }, this)); (s || r) && b.vakata.css.add_sheet({ str: ".jstree-" + this.get_index() + " { position:relative; } ", title: "jstree" })
|
|
}, defaults: {}, __destroy: function () {
|
|
this.get_container().children(".jstree-wholerow").remove();
|
|
this.get_container().find(".jstree-wholerow-span").remove()
|
|
}, _fn: {
|
|
_prepare_wholerow_span: function (a) { a = a && -1 != a ? this._get_node(a) : this.get_container().find("> ul > li"); !1 !== a && a.each(function () { b(this).find("li").addBack().each(function () { var a = b(this); if (a.children(".jstree-wholerow-span").length) return !0; a.prepend("<span class='jstree-wholerow-span' style='width:" + 18 * a.parentsUntil(".jstree", "li").length + "px;'> </span>") }) }) }, _prepare_wholerow_ul: function () {
|
|
var a = this.get_container().children("ul").eq(0),
|
|
b = a.html(); a.addClass("jstree-wholerow-real"); this.data.wholerow.last_html !== b && (this.data.wholerow.last_html = b, this.get_container().children(".jstree-wholerow").remove(), this.get_container().append(a.clone().removeClass("jstree-wholerow-real").wrapAll("<div class='jstree-wholerow' />").parent().width(a.parent()[0].scrollWidth).css("top", -1 * (a.height() + (s ? 5 : 0))).find("li[id]").each(function () { this.removeAttribute("id") }).end()))
|
|
}
|
|
}
|
|
}); b(function () {
|
|
var a = ".jstree .jstree-wholerow-real { position:relative; z-index:1; } .jstree .jstree-wholerow-real li { cursor:pointer; } .jstree .jstree-wholerow-real a { border-left-color:transparent !important; border-right-color:transparent !important; } .jstree .jstree-wholerow { position:relative; z-index:0; height:0; } .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { width:100%; } .jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li, .jstree .jstree-wholerow a { margin:0 !important; padding:0 !important; } .jstree .jstree-wholerow, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow li { background:transparent !important; }.jstree .jstree-wholerow ins, .jstree .jstree-wholerow span, .jstree .jstree-wholerow input { display:none !important; }.jstree .jstree-wholerow a, .jstree .jstree-wholerow a:hover { text-indent:-9999px; !important; width:100%; padding:0 !important; border-right-width:0px !important; border-left-width:0px !important; } .jstree .jstree-wholerow-span { position:absolute; left:0; margin:0px; padding:0; height:18px; border-width:0; padding:0; z-index:0; }";
|
|
t && (a += ".jstree .jstree-wholerow a { display:block; height:18px; margin:0; padding:0; border:0; } .jstree .jstree-wholerow-real a { border-color:transparent !important; } "); if (s || r) a += ".jstree .jstree-wholerow, .jstree .jstree-wholerow li, .jstree .jstree-wholerow ul, .jstree .jstree-wholerow a { margin:0; padding:0; line-height:18px; } .jstree .jstree-wholerow a { display:block; height:18px; line-height:18px; overflow:hidden; } "; b.vakata.css.add_sheet({ str: a, title: "jstree" })
|
|
})
|
|
})(jQuery); (function (b) {
|
|
var a =
|
|
["getChildren", "getChildrenCount", "getAttr", "getName", "getProps"], c = function (a, c) { var f = !0; a = a || {}; c = [].concat(c); b.each(c, function (c, e) { if (!b.isFunction(a[e])) return f = !1 }); return f }; b.jstree.plugin("model", {
|
|
__init: function () {
|
|
if (!this.data.json_data) throw "jsTree model: jsTree json_data plugin not included."; this._get_settings().json_data.data = function (d, e) {
|
|
var f = -1 == d ? this._get_settings().model.object : d.data("jstree_model"); if (!c(f, a)) return e.call(null, !1); this._get_settings().model.async ? f.getChildren(b.proxy(function (a) {
|
|
this.model_done(a,
|
|
e)
|
|
}, this)) : this.model_done(f.getChildren(), e)
|
|
}
|
|
}, defaults: { object: !1, id_prefix: !1, async: !1 }, _fn: {
|
|
model_done: function (a, c) {
|
|
var f = [], g = this._get_settings(), l = this; b.isArray(a) || (a = [a]); b.each(a, function (a, c) {
|
|
var d = c.getProps() || {}; d.attr = c.getAttr() || {}; c.getChildrenCount() && (d.state = "closed"); d.data = c.getName(); b.isArray(d.data) || (d.data = [d.data]); l.data.types && b.isFunction(c.getType) && (d.attr[g.types.type_attr] = c.getType()); d.attr.id && g.model.id_prefix && (d.attr.id = g.model.id_prefix + d.attr.id); d.metadata ||
|
|
(d.metadata = {}); d.metadata.jstree_model = c; f.push(d)
|
|
}); c.call(null, f)
|
|
}
|
|
}
|
|
})
|
|
})(jQuery)
|
|
}
|
|
})(); |