window/jquery.treeview/tree_user_async.js

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。


;(function($) {
function load(settings, root, child, container) {
	function createNode(parent) {
	    
        var current = $("<li/>");
        current.attr("id",this.id);

        state = this.state==0?"(<font color='green'>在职</font>)":this.state==1?"(<font color='#a9a9a9'>离职</font>)":this.state==2?"(<font color='#0099Cc'>退休</font>)":"";
       current.html("<span><a href='javascript:void(0)' onclick=\"openframe(this,'"+this.url+"')\">"+ this.text+state+"</a></span>");
       //current.html("<span>"+ this.text+"</span>");
        current.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: "&nbsp;",
					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));
}

var proxied = $.fn.treeview;
$.fn.treeview = function(settings) {
	if (!settings.url) {
		return proxied.apply(this, arguments);
	}
	var container = this;
	if (!container.children().size())
		load(settings, "source", this, container);
	var userToggle = settings.toggle;
	return proxied.call(this, $.extend({}, settings, {
		collapsed: true,
		toggle: function() {
			var $this = $(this);
后面还有 12 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。