(window.mip = window.mip || []).push({
name: "mip-vd-tabs",
func: function () {
define("mip-vd-tabs/tab", [], function () {
function t(t, n, r, o, a) {
var s = 0;
if (t < n);
else if (t >= o - n) s = r.parent().offset().width;
else s = r.offset().left - r.parent().offset().left - r.width();
if (!i)
if (a) e(r.parent().parent().scrollleft(), s, r.parent().parent());
else r.parent().parent().scrollleft(s);
}
function e(t, e, n) {
var r = (e - t) / 8;
(i = setinterval(function () {
var t = n.scrollleft();
if ((r > 0 && t >= e) || 0 == r) (r = 0), clearinterval(i);
else if (r < 0 && t <= e) (r = 0), clearinterval(i);
n.scrollleft(t + r);
}, 30)),
settimeout(function () {
clearinterval(i), n.scrollleft(e), (i = null);
}, 270);
}
var i,
n = function () {},
r = function (t) {
var e = this,
i = $(e.panel);
(this.toggle = i.find("." + e.toggleclass)),
(this.view = i.find("." + e.viewclass)),
(this.wrapper = i.find("." + e.navwrapperclass)),
(this.navs = this.wrapper.find("." + e.navclass)),
(this.conts = i.find("." + e.contclass)),
(this.sum = this.navs.length),
(this.tabscroll = void 0),
c.call(this),
this.allowscroll && this.view.length && a.call(this),
this.togglemore &&
this.allowscroll &&
this.view.length &&
s.call(this);
},
o = function (t) {
var e = this;
if (
(t
.children()
.eq(0)
.wrap('
",
o = e.from;
o <= e.to;
o++
) {
r =
r +
'" +
o +
"";
}
return (r += "
");
})
.join("")
),
o > 1)
) {
var t = "",
s = 4;
if (o > s) t = '" +
f.replace(e, "" + g) +
"";
t.find("." + w).append(m), d.empty().append(t);
var k = new c(d, {
allowscroll: !!d.get(0).hasattribute(u),
togglemore: !1,
current: h || 1,
currentclass: v,
navwrapperclass: w,
viewclass: x,
navclass: y,
logclass: "mip-vd-tabs-log",
toggleclass: a,
togglelabel: d.attr("toggle-label") || "请选择"
});
!(function (t) {
function e() {
c.empty(),
s.hide(),
l.hide(),
d
.find(".mip-vd-tabs-nav-toggle,.mip-vd-tabs-scroll-touch")
.css({ position: "", top: "" }),
d
.find(".mip-vd-tabs-nav-layer")
.css({ position: "", "border-top": "", top: "" }),
r.toggle.css({
"-webkit-transform": "scaley(1)",
transform: "scaley(1)"
}),
(r.togglestate = 0);
}
function n() {
c.html(i.call(t, o)),
s.append(c),
d.append(l.show()),
r.view.after(s.show()),
d
.find(".mip-vd-tabs-scroll-touch,.mip-vd-tabs-nav-toggle")
.css({ position: "fixed", top: "1px" }),
d
.find(".mip-vd-tabs-nav-layer")
.css({
position: "fixed",
"border-top": "1px solid #ccc",
top: "0"
}),
r.toggle.css({
"-webkit-transform": "scaley(1)",
transform: "scaley(-1)"
}),
(r.togglestate = 1);
}
var r = k,
s = a(
'
"
),
c = a('
'),
l = a('
');
(r.togglestate = 0),
c.on("click", ".mip-vd-tabs-episode-item ", function () {
e();
}),
l
.on("click", function () {
e();
})
.on("touchmove", function (t) {
t.preventdefault();
}),
r.toggle.on("click", function () {
if (0 == r.togglestate) n();
else e();
});
})(this),
d.delegate(
"." + y + ", .mip-vd-tabs-episode-item",
"click",
function (t) {
t.preventdefault();
var e = a(this).attr("href");
if (e) {
var i = a(this).text();
if (!i)
i = a(this)
.find("." + y)
.text();
var n = {
event: "loadiframe",
data: { url: e, title: s || i, click: d.data("click") }
};
if (window.parent !== window)
window.parent.postmessage(n, "*");
else location.href = e;
}
}
);
}
var a = t("zepto"),
s = t("customelement").create(),
c = t("./tab"),
l = 25,
d = 50,
p =
"data:image/png;base64,ivborw0kggoaaaansuheugaaaboaaaaqcamaaaa/d5+aaaaauvbmveuaaabmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmbiinylaaaagnrstlmabkqp+ifs7+fstazasjsugbak3tzgw3gkiaqv3ysaaabmsurbvbjtdde5fomwembqgcy+q1bd/6cp8xir/awarkn3ffjdak2o5020gvp9hjexstcowx4jtor1iqtmrp0wcsxzuzuswdvnsysw9zrnsod7untiyb/uuob4lqtosssqpqp84u9+asciwxpxa/qaaaaasuvork5cyii=",
u = "allow-scroll",
h = "toggle-more",
f = "current",
m = "type",
g = "mip-vd-tabs",
b = "mip-vd-tabs-content",
v = "mip-vd-tabs-nav-selected",
y = "mip-vd-tabs-nav-li",
w = "mip-vd-tabs-nav",
x = "mip-vd-tabs-nav-view",
a = "mip-vd-tabs-nav-toggle",
k = "mip-vd-tabs-nav-bottom",
e = /\{\{\w}}/g;
return (
(s.prototype.build = function () {
var t = this.element;
switch (t.getattribute(m)) {
case "episode":
var i = n.call(this);
if (t.hasattribute(h)) i = r.call(this, i);
o.call(
this,
i,
t.getattribute("total"),
t.getattribute(f),
t.getattribute("text-tpl"),
t.getattribute("link-tpl"),
t.getattribute("head-title")
);
break;
case "bottom":
default:
e.call(this, i);
}
}),
s
);
}
),
define("mip-vd-tabs", ["mip-vd-tabs/mip-vd-tabs"], function (t) {
return t;
}),
(function () {
function t(t, e) {
t.registermipelement(
"mip-vd-tabs",
e,
""
);
}
if (window.mip)
require(["mip-vd-tabs"], function (e) {
t(window.mip, e);
});
else require(["mip", "mip-vd-tabs"], t);
})();
}
});