! function(a) { "function" == typeof define ? define(a) : a(window) }(function(require, exports, module) {
var a = {
data: { len: 0 },
getData: function(b) {
function c(b) {
var c = "vip.koo.cn" == location.hostname ? "//www.koo.cn/" : "";
window.PAGE_URL.loginInfo && $.ajax({ type: "POST", url: c + window.PAGE_URL.loginInfo, dataType: "JSON", data: { version: (new Date).getTime() }, success: function(c) { a.data = $.extend(a.data, c, !0), window.islogin = c.len + "" == "1", $.isFunction(b) && b(a.data) }, error: function(a) { console.dir(a) } })
}
b({ len: "0" }), c(b)
},
isVIP: function(a) { return a.isVIP ? "vip" : a.isSVIP ? "svip" : "notVip" },
vipStr: function(b) { return "vip" == a.isVIP(b) ? '' : "svip" == a.isVIP(b) ? '' : "" },
isLogin: function(a) { return a.len + "" == "1" },
saveKeyWord: function(a) {
var b = $(a).find('[name="sort"]').val(),
c = $.trim($(a).find('[name="keyword"]').val());
if (c) { try { $.post("/findClass/saveKeyWord", { keyWord: c, type: b }, function(a) { console.log(a) }) } catch (d) { console.log(d) } }
return !0
},
_setNavHtml: function(a, b) { var c = []; return $.each(a, function(a, d) { c.push("
' + d.name + "") }), c.join("") },
setHeaderHtml: function(b) {
this.isLogin(b);
window.koo_saveKeyWord = function(b) { return a.saveKeyWord(b) }, "vip.koo.cn" == window.location.hostname && (window.location.hostname = "www.koo.cn");
var c = "",
d = "";
return d = window.headerType && "mykoo" == window.headerType ? a._setNavHtml([{ href: "/mykoo/mykoo", name: "我的酷学" }, { href: "/userProduct", name: "我的课程" }, { href: "/findClass/0-0-1/", name: "全部课程" }, { href: "//vip.koo.cn/", name: "酷学会员" }, { href: "/app", name: "App下载" }]) : window.headerType && "svip" == window.headerType ? a._setNavHtml([{ href: "/vipChosen/vipchosen", name: "免单直播" }, { href: "/vipChosen/vipchosen#share", name: "精英分享" }, { href: "/coupon/myCouponList", name: "我的优惠券" }, { href: "/userProduct", name: "我的课程" }, { href: "/vipCenter/vipCenter", name: "我的会员" }, { href: "/app", name: "App下载" }], "svip") : a._setNavHtml([{ href: "/findClass/0-0-1/", name: "全部课程" }, { href: "http://www.koo.cn/zhuanti/2018reading/", name: "酷学计划" }, { href: "//vip.koo.cn/", name: "酷学会员" }, { href: "/app", name: "App下载" }]), c = '"
},
getLoginHTML: function(b) {
var c = this.isLogin(b),
d = a.vipStr(b);
return c ? ' ' + d + '
' : ''
},
setHeaderScrollHtml: function(a, b) {
$(b).find(".g-header-2018").append(' ');
var c = $(b).find(".g-scroll-header-2018"),
d = "fixed";
$(window).on("scroll", function() { $(window).scrollTop() >= 80 && !c.eq(1).hasClass(d) ? c.eq(0).show().end().eq(1).addClass(d) : $(window).scrollTop() < 80 && c.eq(1).hasClass(d) && c.eq(0).hide().end().eq(1).removeClass(d) })
},
main: function(b, c, d) {
if (0 == $(b).size()) { return !1 }
// var e = function(d) { "/" == location.pathname ? ($(b).html(a.setHeaderHtml(d)), a.setHeaderScrollHtml(d, b)) : $(b).html(a.setHeaderHtml(d)), $.isFunction(c) && c(d) };
console.log(location.pathname)
var e = function(d) { "/" == location.pathname || "/index.html" == location.pathname ? ($(b).html(a.setHeaderHtml(d)), a.setHeaderScrollHtml(d, b)) : $(b).html(a.setHeaderHtml(d)), $.isFunction(c) && c(d) };
// var e = ($(b).html(a.setHeaderHtml(d)), a.setHeaderScrollHtml(d, b))
a.getData(e)
}
};
return a
});