forked from Wavyzz/dolibarr
Fix: crlf to lf
This commit is contained in:
@@ -1,108 +1,108 @@
|
||||
/*
|
||||
* Async Treeview 0.1 - Lazy-loading extension for Treeview
|
||||
*
|
||||
* http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
|
||||
*
|
||||
* Copyright 2010 Jörn Zaefferer
|
||||
* Released under the MIT license:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
;(function($) {
|
||||
|
||||
function load(settings, root, child, container) {
|
||||
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({
|
||||
classes: "placeholder",
|
||||
text: " ",
|
||||
children:[]
|
||||
}, branch);
|
||||
}
|
||||
if (this.children && this.children.length) {
|
||||
$.each(this.children, createNode, [branch])
|
||||
}
|
||||
}
|
||||
}
|
||||
$.ajax($.extend(true, {
|
||||
url: settings.url,
|
||||
dataType: "json",
|
||||
data: {
|
||||
root: root
|
||||
},
|
||||
success: function(response) {
|
||||
child.empty();
|
||||
$.each(response, createNode, [child]);
|
||||
$(container).treeview({add: child});
|
||||
}
|
||||
}, settings.ajax));
|
||||
/*
|
||||
$.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({
|
||||
classes: "placeholder",
|
||||
text: " ",
|
||||
children:[]
|
||||
}, branch);
|
||||
}
|
||||
if (this.children && this.children.length) {
|
||||
$.each(this.children, createNode, [branch])
|
||||
}
|
||||
}
|
||||
}
|
||||
child.empty();
|
||||
$.each(response, createNode, [child]);
|
||||
$(container).treeview({add: child});
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
var proxied = $.fn.treeview;
|
||||
$.fn.treeview = function(settings) {
|
||||
if (!settings.url) {
|
||||
return proxied.apply(this, arguments);
|
||||
}
|
||||
if (!settings.root) {
|
||||
settings.root = "source";
|
||||
}
|
||||
var container = this;
|
||||
if (!container.children().size())
|
||||
load(settings, settings.root, 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");
|
||||
load(settings, this.id, childList, container);
|
||||
}
|
||||
if (userToggle) {
|
||||
userToggle.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
}));
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
/*
|
||||
* Async Treeview 0.1 - Lazy-loading extension for Treeview
|
||||
*
|
||||
* http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
|
||||
*
|
||||
* Copyright 2010 Jörn Zaefferer
|
||||
* Released under the MIT license:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
;(function($) {
|
||||
|
||||
function load(settings, root, child, container) {
|
||||
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({
|
||||
classes: "placeholder",
|
||||
text: " ",
|
||||
children:[]
|
||||
}, branch);
|
||||
}
|
||||
if (this.children && this.children.length) {
|
||||
$.each(this.children, createNode, [branch])
|
||||
}
|
||||
}
|
||||
}
|
||||
$.ajax($.extend(true, {
|
||||
url: settings.url,
|
||||
dataType: "json",
|
||||
data: {
|
||||
root: root
|
||||
},
|
||||
success: function(response) {
|
||||
child.empty();
|
||||
$.each(response, createNode, [child]);
|
||||
$(container).treeview({add: child});
|
||||
}
|
||||
}, settings.ajax));
|
||||
/*
|
||||
$.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({
|
||||
classes: "placeholder",
|
||||
text: " ",
|
||||
children:[]
|
||||
}, branch);
|
||||
}
|
||||
if (this.children && this.children.length) {
|
||||
$.each(this.children, createNode, [branch])
|
||||
}
|
||||
}
|
||||
}
|
||||
child.empty();
|
||||
$.each(response, createNode, [child]);
|
||||
$(container).treeview({add: child});
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
var proxied = $.fn.treeview;
|
||||
$.fn.treeview = function(settings) {
|
||||
if (!settings.url) {
|
||||
return proxied.apply(this, arguments);
|
||||
}
|
||||
if (!settings.root) {
|
||||
settings.root = "source";
|
||||
}
|
||||
var container = this;
|
||||
if (!container.children().size())
|
||||
load(settings, settings.root, 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");
|
||||
load(settings, this.id, childList, container);
|
||||
}
|
||||
if (userToggle) {
|
||||
userToggle.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
}));
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
Reference in New Issue
Block a user