/** layui-v2.5.6 MIT License By https://www.layui.com */
;layui.define("jquery", function(t) {
"use strict";
var a = layui.$, // 获取layui中的$对象,类似jQuery
i = (layui.hint(), layui.device()), // 获取设备信息
e = "element", // 元素模块标识
l = "layui-this", // 激活样式
n = "layui-show", // 显示样式
// 定义一个空的配置对象
s = function() { this.config = {}; };
// 设置配置项的方法
s.prototype.set = function(t) {
var i = this;
return a.extend(!0, i.config, t), i; // 合并配置
};
// 注册事件的方法
s.prototype.on = function(t, a) {
return layui.onevent.call(this, e, t, a); // 调用layui事件机制
};
// 向tab中添加新tab项的方法
s.prototype.tabAdd = function(t, i) {
var e = ".layui-tab-title",
l = a(".layui-tab[lay-filter=" + t + "]"), // 获取指定filter属性的tab容器
n = l.children(e), // 获取tab标题区域
s = n.children(".layui-tab-bar"), // 获取tab栏区域
o = l.children(".layui-tab-content"), // 获取tab内容区域
r = '
" + (i.title || "unnaming") + "";
// 在tab标题区域前添加新的tab项
return s[0] ? s.before(r) : n.append(r),
// 在tab内容区域添加相应的tab内容
o.append('' + (i.content || "") + "
"),
// 隐藏更多tab按钮并重新调整tab宽度
f.hideTabMore(!0),
f.tabAuto(),
this;
};
// 删除指定tab项的方法
s.prototype.tabDelete = function(t, i) {
var e = ".layui-tab-title",
l = a(".layui-tab[lay-filter=" + t + "]"), // 获取tab容器
n = l.children(e), // 获取tab标题区域
s = n.find('>li[lay-id="' + i + '"]'); // 获取指定id的tab项
return f.tabDelete(null, s), this;
};
// 切换指定tab项的方法
s.prototype.tabChange = function(t, i) {
var e = ".layui-tab-title",
l = a(".layui-tab[lay-filter=" + t + "]"), // 获取tab容器
n = l.children(e), // 获取tab标题区域
s = n.find('>li[lay-id="' + i + '"]'); // 获取指定id的tab项
return f.tabClick.call(s[0], null, null, s), this;
};
// 绑定tab点击事件
s.prototype.tab = function(t) {
t = t || {},
b.on("click", t.headerElem, function(i) {
var e = a(this).index();
f.tabClick.call(this, i, e, null, t);
});
};
// 更新进度条的方法
s.prototype.progress = function(t, i) {
var e = "layui-progress",
l = a("." + e + "[lay-filter=" + t + "]"), // 获取进度条元素
n = l.find("." + e + "-bar"), // 获取进度条条形部分
s = n.find("." + e + "-text"); // 获取进度条文本
return n.css("width", i), // 设置进度条宽度
s.text(i), // 更新进度条文本
this;
};
// 导航条相关操作
var o = ".layui-nav", // 导航条容器
r = "layui-nav-item", // 导航条项
c = "layui-nav-bar", // 导航条指示条
u = "layui-nav-tree", // 树形菜单
d = "layui-nav-child", // 子菜单
y = "layui-nav-more", // 更多按钮
h = "layui-anim layui-anim-upbit", // 动画效果
// 处理tab点击、删除、显示、隐藏等操作
f = {
tabClick: function(t, i, s, o) {
o = o || {};
var r = s || a(this),
i = i || r.parent().children("li").index(r), // 获取当前点击tab项的索引
c = o.headerElem ? r.parent() : r.parents(".layui-tab").eq(0), // 获取tab容器
u = o.bodyElem ? a(o.bodyElem) : c.children(".layui-tab-content").children(".layui-tab-item"), // 获取tab内容
d = r.find("a"), // 获取点击的链接
y = c.attr("lay-filter");
// 防止点击跳转
if ("javascript:;" !== d.attr("href") && "_blank" === d.attr("target")) return;
r.addClass(l).siblings().removeClass(l); // 激活当前tab项
u.eq(i).addClass(n).siblings().removeClass(n); // 显示对应内容
layui.event.call(this, e, "tab(" + y + ")", {elem: c, index: i});
},
// 删除tab项的方法
tabDelete: function(t, i) {
var n = i || a(this).parent(), // 获取当前tab项
s = n.index(), // 获取当前tab项的索引
o = n.parents(".layui-tab").eq(0), // 获取tab容器
r = o.children(".layui-tab-content").children(".layui-tab-item"); // 获取tab内容
n.hasClass(l) && (n.next()[0] ? f.tabClick.call(n.next()[0], null, s + 1) : n.prev()[0] && f.tabClick.call(n.prev()[0], null, s - 1)); // 如果删除的是当前激活的tab项,调整激活tab
n.remove(); // 删除tab项
r.eq(s).remove(); // 删除tab内容
setTimeout(function() {
f.tabAuto(); // 调整tab宽度
}, 50);
layui.event.call(this, e, "tabDelete(" + o.attr("lay-filter") + ")", {elem: o, index: s});
},
// 自动调整tab的显示
tabAuto: function() {
var t = "layui-tab-more",
e = "layui-tab-bar",
l = "layui-tab-close",
n = this;
a(".layui-tab").each(function() {
var s = a(this),
o = s.children(".layui-tab-title"), // 获取tab标题区域
r = (s.children(".layui-tab-content").children(".layui-tab-item"), 'lay-stope="tabmore"'),
c = a('');
if (n === window && 8 != i.ie && f.hideTabMore(!0), s.attr("lay-allowClose") && o.find("li").each(function() {
var t = a(this);
if (!t.find("." + l)[0]) {
var i = a('ဆ');
i.on("click", f.tabDelete);
t.append(i);
}
}), "string" != typeof s.attr("lay-unauto")) if (o.prop("scrollWidth") > o.outerWidth() + 1) {
if (o.find("." + e)[0]) return;
o.append(c), s.attr("overflow", ""), c.on("click", function(a) {
o[this.title ? "removeClass" : "addClass"](t), this.title = this.title ? "" : "收缩";
});
} else o.find("." + e).remove(), s.removeAttr("overflow");
});
},
// 隐藏更多tab的按钮
hideTabMore: function(t) {
var i = a(".layui-tab-title");
t !== !0 && "tabmore" === a(t.target).attr("lay-stope") || (i.removeClass("layui-tab-more"), i.find(".layui-tab-bar").attr("title", ""));
},
// 处理导航点击事件
clickThis: function() {
var t = a(this),
i = t.parents(o),
n = i.attr("lay-filter"),
s = t.parent(),
c = t.siblings("." + d),
y = "string" == typeof s.attr("lay-unselect");
if ("javascript:;" !== t.attr("href") && "_blank" === t.attr("target") || y || c[0]) return;
i.find("." + l).removeClass(l), s.addClass(l);
i.hasClass