(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('
'), t.children().eq(1).hasclass(e.toggleclass)) ) t.find("." + e.navwrapperclass).append( '
' ); return t; }, a = function () { var e = this; if ( ((e.tabscroll = o.call(e, e.view)), e.current > 0 && e.current < e.sum) ) { t( math.min(e.current + 1, e.sum - 1), 1, e.navs.eq(e.current), e.navs.length, !1 ); } if ("function" == typeof e.ontabscrollend) e.tabscroll.on("scrollend", function () { if (!this.customflag || !this.customflag.autoscroll) e.ontabscrollend.call(e, this); }); }, s = function () { function t() { r.empty(), n.hide(), i.toggle.css({ "-webkit-transform": "scaley(1)", transform: "scaley(1)" }), (i.togglestate = 0); } function e() { r.html(i.navs.clone()), n.append(r), i.view.after(n.show()), i.toggle.css({ "-webkit-transform": "scaley(1)", transform: "scaley(-1)" }), (i.togglestate = 1); } var i = this, n = $( '

' + i.togglelabel + "

" ), r = $(''); (i.togglestate = 0), r.on("click", "." + i.navclass, function () { var e = $(this); i.navs.eq(e.attr("data-tid")).trigger("click"), t(); }), i.toggle.on("click", function () { if (0 == i.togglestate) e(); else t(); }); }, c = function () { var e = this; $.each(e.navs, function (i, r) { var o = $(r); if (o.hasclass(e.currentclass)) e.current = i; o.addclass(e.logclass), o.attr("data-tid", i), o.on("click", function () { var i = parseint($(this).attr("data-tid")); if (i !== e.current) { if ( ((e.last = e.current), (e.current = i), e.hidetab(e.last), e.showtab(e.current), e.onresetchange == n) ) e.hidecontent(e.last), e.showcontent(e.current), e.onchange.call(e, e.current, e.conts[e.current]); else e.onresetchange.call(e, e.current); if (e.tabscroll) t(e.current + 1, 1, o, e.navs.length, !0); } }); }), $.each(e.conts, function (t, i) { if (t == e.current) e.showtab(t), e.showcontent(t); else e.hidetab(t), e.hidecontent(t); }); }, l = function (t, e) { (e = e || {}), (this.panel = t), (this.current = e.current || 0), (this.currentclass = e.currentclass || "c-tabs-nav-selected"), (this.navwrapperclass = e.navwrapperclass || "c-tabs-nav"), (this.navclass = e.navclass || "c-tabs-nav-li"), (this.contclass = e.contclass || "c-tabs-content"), (this.viewclass = e.viewclass || "c-tabs-nav-view"), (this.toggleclass = e.toggleclass || "c-tabs-nav-toggle"), (this.layerclass = e.layerclass || "c-tabs-nav-layer"), (this.layerulclass = e.layerulclass || "c-tabs-nav-layer-ul"), (this.allowscroll = e.allowscroll || !1), (this.togglemore = e.togglemore || !1), (this.togglelabel = e.togglelabel || "请选择"), (this.logclass = e.logclass || "wa_log_tab"), (this.scrollsize = e.scrollsize || "-40"), (this.navs = []), (this.seps = []), (this.conts = []), (this.sum = 0), (this.last = null), (this.onchange = e.onchange || n), (this.onresetchange = e.onresetchange || n), (this.ontabscrollend = e.ontabscrollend), t && r.call(this, e); }; return ( $.extend(l.prototype, { showcontent: function (t) { if (this.conts[t]) $(this.conts[t]).show(); }, hidecontent: function (t) { var e = this.conts[t]; if (e) $(e).hide(); }, showtab: function (t) { var e = this, i = e.navs; e.seps; $(i[t]).addclass(e.currentclass); }, hidetab: function (t) { var e = this, i = e.navs; e.seps; $(i[t]).removeclass(e.currentclass); } }), l ); }), define( "mip-vd-tabs/mip-vd-tabs", ["require", "zepto", "customelement", "./tab"], function (t) { function e() { var t = this.element, e = a(t), i = t.getattribute(m), n = !!t.hasattribute(u), r = !!t.hasattribute(h), o = parseint(t.getattribute(f), 0) || 0, s = null; if ((e.addclass(g), "bottom" === i)) s = a(t.children.item(t.children.length - 1)); else s = a(t.children.item(0)); if ( (s.detach(), s.children().each(function (t, e) { var i = a(e); if (o === t) i.addclass(v); i.addclass(y); }), n) ) { if ( (s .addclass(x) .append( a('
').append(s.children()) ), r) ) s.append( '
').append(s.children()) ); if ( (e .children() .addclass(b) .css("display", "none") .eq(o) .css("display", "block"), "bottom" === i) ) e.append(s); else e.prepend(s); new c(e, { allowscroll: n, current: parseint(e.attr(f), 10) || 1, togglemore: r, togglelabel: e.attr("toggle-label") || "请选择", currentclass: v, navwrapperclass: w, viewclass: x, contclass: b, navclass: y, logclass: "mip-vd-tabs-log", toggleclass: a, layerclass: "mip-vd-tabs-nav-layer", layerulclass: "mip-vd-tabs-nav-layer-ul" }); } function i(t) { for ( var e = a(this.element), i = parseint(e.attr("page-size"), 10) || d, n = parseint(e.attr(f), 10) || 1, r = parseint(e.attr("total"), 10) || 1, o = math.ceil(r / i), s = math.floor((n - 1) / i), l = [], p = 0; p < o; p++ ) { var u = i * p + 1, h = math.min(r, i * (p + 1)); l.push({ from: u, to: h, text: u + (u < h ? " - " + h : "") }); } var m = a('
'); if ( (m.append( l .map(function (e, i) { for ( var r = '
", o = e.from; o <= e.to; o++ ) { r = r + '" + o + ""; } return (r += "
"); }) .join("") ), o > 1) ) { var t = "", s = 4; if (o > s) t = '
'; if ( ((t += '"), o > s) ) t += "
"; m.append(t), new c(m, { allowscroll: o > s, current: math.floor((n - 1) / i) || 1, currentclass: v, navwrapperclass: w, viewclass: x, contclass: b, navclass: y, logclass: "mip-vd-tabs-log", toggleclass: a }); } return m; } function n() { var t = a(this.element), e = null; if ((t.addclass(g), (parseint(t.attr("total"), 10) || 1) > 4)) e = a('
'); else e = a( '
' ); return e; } function r(t) { var e = a(this.element); if ((parseint(e.attr("total"), 10) || 1) <= 4) return t; else return ( t.append('
" + 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( '

' + r.togglelabel + "

" ), 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); })(); } });