{"size": 2346, "ext": "js", "max_stars_repo_path": "src/main/webapp/js/jquery.balert.js", "max_stars_repo_name": "sunnytu/dockerweb", "max_stars_repo_stars_event_min_datetime": "2015-02-18T15:57:56.000Z", "max_stars_repo_stars_event_max_datetime": "2018-11-22T10:44:35.000Z", "max_issues_repo_path": "src/main/webapp/js/jquery.balert.js", "max_issues_repo_name": "southwolf/dockerweb", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/main/webapp/js/jquery.balert.js", "max_forks_repo_name": "southwolf/dockerweb", "max_forks_repo_forks_event_min_datetime": "2015-01-08T08:25:26.000Z", "max_forks_repo_forks_event_max_datetime": "2018-09-14T20:31:22.000Z"}
{"max_stars_count": 24, "max_issues_count": null, "max_forks_count": 28, "avg_line_length": 30.8684210526, "max_line_length": 108, "alphanum_fraction": 0.468456948}
/*******************************************************************************
 * **** 警告提示框插件*****<br>
 * 原js来自ZDocker Sunny(tufeiping@gmail.com)修改原有（ZDocker）版本<br>
 * 将确认后动作的地址加入函数处理方式，并增加了事件支持 如果使用cb回调事件，最好不要设置url参数<br>
 ******************************************************************************/

(function($) {
	$.fn.balert = function(options) {
		var defaults = {
			url : null,
			title : '',
			close : false,
			id : 0,
			div : '.table',
			msgid : 'balertid-you-can-replace-it',
			cb : null,
			type : 'warning' // [warning, alert]
		};
		var opts = $.extend(defaults, options);
		$(this)
				.click(
						function() {
							var warning = opts.type == 'warning';
							var msghtml = '<div id="' + opts.msgid;
							if (warning)
								msghtml += '" class="alert alert-warning alert-dismissable">';
							else
								msghtml += '" class="alert alert-success alert-dismissable">';
							msghtml += '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">关闭</button>';
							if (warning)
								msghtml += '<strong>警告!</strong> ' + opts.title;
							else
								msghtml += '<strong>提示!</strong> ' + opts.title;
							if (warning) {
								if (opts.cb != null) {
									msghtml += '<a id="'
											+ opts.msgid
											+ '_ok" class="btn btn_xs btn_primary">确定</a>';
								} else {
									if (opts.url != null) {
										if (opts.url instanceof Function) {
											var target = opts.url($(this));
											msghtml += '<a href="'
													+ target
													+ '" class="btn btn_xs btn_primary">确定</a>';
										} else
											msghtml += '<a href="'
													+ opts.url
													+ '" class="btn btn_xs btn_primary">确定</a>';
									} else
										msghtml += '<a href="#" class="btn btn_xs btn_primary">确定</a>';
								}
							}
							msghtml += '</div>';
							var msgidobj = $('#' + opts.msgid);
							if (msgidobj)
								msgidobj.remove();
							var msg = $(msghtml).hide();
							$(opts.div).before(msg);
							var self = $(this);
							if (opts.cb != null) {
								$('#' + opts.msgid + '_ok').click(function() {
									opts.cb(self);
								});
							}
							msg.show("slow");
						});
	};
})(jQuery);

jQuery.balert = function(opts) {
	var tmpDiv = $("<div>&nbsp;</div>");
	tmpDiv.balert(opts);
	tmpDiv.click();
	tmpDiv.remove();
};