diff options
author | Claire Revillet <grenoya@mageia.org> | 2013-05-18 16:18:30 +0000 |
---|---|---|
committer | Claire Revillet <grenoya@mageia.org> | 2013-05-18 16:18:30 +0000 |
commit | 635b81d3a608ebf7d2f55fe2b8b54f3d7fddafad (patch) | |
tree | fcb011f4731932d4632ede00716db519cdd0ed0c /installer/3/el/common/jquery/treeview/jquery.treeview.async.js | |
parent | 33e4ce923d60d3bd13f4c3d5d807d753ca76ba8f (diff) | |
download | doc-635b81d3a608ebf7d2f55fe2b8b54f3d7fddafad.tar doc-635b81d3a608ebf7d2f55fe2b8b54f3d7fddafad.tar.gz doc-635b81d3a608ebf7d2f55fe2b8b54f3d7fddafad.tar.bz2 doc-635b81d3a608ebf7d2f55fe2b8b54f3d7fddafad.tar.xz doc-635b81d3a608ebf7d2f55fe2b8b54f3d7fddafad.zip |
- add new languages for installer/3
- new versions of mcc/3
Diffstat (limited to 'installer/3/el/common/jquery/treeview/jquery.treeview.async.js')
-rw-r--r-- | installer/3/el/common/jquery/treeview/jquery.treeview.async.js | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/installer/3/el/common/jquery/treeview/jquery.treeview.async.js b/installer/3/el/common/jquery/treeview/jquery.treeview.async.js new file mode 100644 index 00000000..2597dde1 --- /dev/null +++ b/installer/3/el/common/jquery/treeview/jquery.treeview.async.js @@ -0,0 +1,72 @@ +/*
+ * Async Treeview 0.1 - Lazy-loading extension for Treeview
+ *
+ * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
+ *
+ * Copyright (c) 2007 Jörn Zaefferer
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Revision: $Id$
+ *
+ */
+
+;(function($) {
+
+function load(settings, root, child, container) {
+ $.getJSON(settings.url, {root: root}, function(response) {
+ function createNode(parent) {
+ var current = $("<li/>").attr("id", this.id || "").html("<span>" + this.text + "</span>").appendTo(parent);
+ if (this.classes) {
+ current.children("span").addClass(this.classes);
+ }
+ if (this.expanded) {
+ current.addClass("open");
+ }
+ if (this.hasChildren || this.children && this.children.length) {
+ var branch = $("<ul/>").appendTo(current);
+ if (this.hasChildren) {
+ current.addClass("hasChildren");
+ createNode.call({
+ text:"placeholder",
+ id:"placeholder",
+ children:[]
+ }, branch);
+ }
+ if (this.children && this.children.length) {
+ $.each(this.children, createNode, [branch])
+ }
+ }
+ }
+ $.each(response, createNode, [child]);
+ $(container).treeview({add: child});
+ });
+}
+
+var proxied = $.fn.treeview;
+$.fn.treeview = function(settings) {
+ if (!settings.url) {
+ return proxied.apply(this, arguments);
+ }
+ var container = this;
+ load(settings, "source", this, container);
+ var userToggle = settings.toggle;
+ return proxied.call(this, $.extend({}, settings, {
+ collapsed: true,
+ toggle: function() {
+ var $this = $(this);
+ if ($this.hasClass("hasChildren")) {
+ var childList = $this.removeClass("hasChildren").find("ul");
+ childList.empty();
+ load(settings, this.id, childList, container);
+ }
+ if (userToggle) {
+ userToggle.apply(this, arguments);
+ }
+ }
+ }));
+};
+
+})(jQuery);
\ No newline at end of file |