"use strict";
var qs_c_obj, qs_need_ref = !0;
!function(e, n) {
var t = null
, i = {
shareImg: "http://img.qiaobooks.com/sys/shareRect.jpg",
mhost: "/",
host: "/",
cdnhost: "http://img.qiaobooks.com/",
readUrl: "/read/",
isRef: !1,
needOpen: null,
inTimer: null,
callback: !1,
tellObj: !1,
clickEvent: "click",
sessTime: null,
userInfo: null,
isLogin: !1,
isDebug: !1,
isTest: !1,
wxJs: !1,
showMsg: !1,
msgPage: 1,
msgAble: !1,
alertTimer: null,
_tempInfo: window.login_user && 1 == login_user.status ? login_user : null,
get platformInfo() {
var e = ""
, n = ""
, t = ""
, i = ""
, o = /\bchrome.*\s/
, s = /\bfirefox.*(\s|$)/
, a = /\bedge.*(\s|$)/
, r = /\bopr.*(\s|$)/
, c = /\bsafari.*(\s|$)/
, d = /\blbbrowser.*(\s|$)/
, u = window.navigator.userAgent.toLowerCase()
, l = window.navigator.vendor.toLowerCase();
u.indexOf("window") >= 0 ? e = "window" : u.indexOf("mac") >= 0 ? e = "mac" : u.indexOf("unix") >= 0 && (e = "unix"),
(u.indexOf("msie") >= 0 || u.indexOf("trident") >= 0) && (n = "IE",
t = "",
i = "Trident");
var p = o.exec(u)
, h = s.exec(u)
, f = a.exec(u)
, m = r.exec(u)
, g = c.exec(u)
, b = d.exec(u);
return p && l.indexOf("google") >= 0 && (p[0].indexOf("/") && (t = p[0].split("/")[1]),
n = "Chrome",
i = "webkit"),
g && l.indexOf("apple") >= 0 && (g[0].indexOf("/") && (t = g[0].split("/")[1]),
n = "Safari",
i = "webkit"),
f && (f[0].indexOf("/") && (t = f[0].split("/")[1]),
n = "Edge",
i = "webkit"),
m && (m[0].indexOf("/") && (t = m[0].split("/")[1]),
n = "Opera",
i = "webkit"),
b && (b[0].indexOf("/") && (t = b[0].split("/")[1]),
n = "Liebao",
i = "webkit"),
h && (h[0].indexOf("/") && (t = h[0].split("/")[1]),
n = "Firefox",
i = "gecko"),
{
os: e,
browser: n,
version: t,
kernel: i
}
}
}
, o = {
stopCP: function(e) {
if (!e || !e.stopPropagation)
return n.event.cancelBubble = !0,
!1;
e.stopPropagation()
},
stopPD: function(e) {
if (!e || !e.preventDefault)
return n.event.returnValue = !0,
!1;
e.preventDefault()
},
eventList: {
"click|#alertExit": function(n) {
e("#userWin").hide(),
e("#userWin div.form ul li").removeError(),
e("#userWin div.form ul li input").val("")
},
"click|.alert a.hide-r": function(n) {
e(this).parents(".alertbox").hide(),
e(this).parents(".alertbox").children("div.form ul li").removeError(),
e(this).parents(".alertbox").children("div.form ul li input").val("")
},
"click|#remmeButton": function(n) {
e("#remc").is(":checked") ? e("i", this).css("background-position", "-16px top") : e("i", this).css("background-position", "left top")
},
"click|#userOpinion": function() {
e("#opinion").show()
},
"click|#opinion button": function() {
var n = e("#opinion textarea").val();
if (n && n.length > 0) {
var t = {
content: n
};
qs_c_obj.feedBackRequest(t)
} else
e("#opinion form").addError("请输入您的意见和建议!")
},
"click|#opinion a.hide-r": function() {
e("#opinion").hide().children("textarea").val("")
},
"click|#forgetPassButton": function(n) {
e("#userWin").hide(),
e("#forgetPassWin").show()
},
"click|#forgetPassWin dt.outbox a": function() {
e("#forgetPassWin").hide(),
e("#forgetPassWin input").parent().removeError(),
e("#forgetPassWin input[name='phone']").val(""),
e("#forgetPassWin input[name='code']").val("")
},
'focusout|#forgetPassWin input[name="phone"]': function() {
qs_c_obj.checkPhone(this) ? (e(this).parent().removeError(),
"点击获取" == e("#forgetPassWin div.tell a").text() && e("#forgetPassWin div.tell a").removeClass("disable")) : e(this).parent().addError("请填写正确的手机号!")
},
"click|#forgetPassWin div.tell a": function() {
if (!e(this).hasClass("disable")) {
qs_c_obj.smsbuttonTime(e("#forgetPassWin input[name='phone']"), this);
var n = {
phone: e("#forgetPassWin").find("input[name='phone']").val()
};
qs_c_obj.sendForgetSmsRequest(n, function(n) {
1 == n.status ? e("body").toast("验证码已发送!") : e("body").toast("验证码发送失败!")
})
}
},
"click|#forgetPassWin button.btnCener": function() {
var n = e("#forgetPassWin").find("input[name='phone']").val()
, t = e("#forgetPassWin").find("input[name='code']").val();
if (t.length > 0 && qs_c_obj.checkPhone(e("#forgetPassWin").find("input[name='phone']"))) {
var i = {
phone: n,
code: t,
rest: 1
};
qs_c_obj.forgetCheckRequest(i, function(n) {
1 == n.status ? (e("#forgetPassWin").hide(),
e("#restpassWin").show()) : 0 == n.status ? e("#forgetPassWin").find("input[name='code']").parent().addError("验证码错误!") : 2 == n.status && e("#forgetPassWin").find("input[name='phone']").parent().addError("账号不存在!")
})
}
},
"focusout|#restpassWin input": function() {
var n = e(this).attr("name");
qs_c_obj.checkRegPass(this),
"pass2" == n && (e("#restpassWin").find("input[name='pass1']").val() != e(this).val() ? e(this).parent().addError("两次输入的密码不一致!") : e(this).parent().removeError())
},
"click|#restpassWin button.btnCener": function() {
var n = e("#restpassWin").find("input[name='pass1']").val()
, t = e("#restpassWin").find("input[name='pass2']").val();
if (qs_c_obj.checkRegPass(e("#restpassWin").find("input[name='pass1']")) && n == t) {
var i = {
pass1: n,
pass2: t
};
qs_c_obj.resetQuest(i, function(n) {
1 == n.status ? (e("body").toast("重置密码成功!"),
e("#restpassWin").hide(),
e("#restpassWin").find("input[name='pass1']").val(""),
e("#restpassWin").find("input[name='pass2']").val(""),
qs_c_obj.showLoginWin()) : e("body").toast("重置密码失败!")
})
}
},
"click|.otherButton": function(n) {
e(this).hide(),
e(this).next().show()
},
"click|#newregbutton": function(e) {
qs_c_obj.showRegisterWin()
},
"click|#newloginbutton": function(e) {
qs_c_obj.showLoginWin()
},
"focusout|#userWin input": function(n) {
switch (e(this).attr("name")) {
case "phone":
qs_c_obj.checkPhone(this);
break;
case "regphone":
qs_c_obj.checkRegPhone(this, function() {
"点击获取" == e("#getVirCode").text() && e("#getVirCode").removeClass("disable")
});
break;
case "passwd":
qs_c_obj.checkLoginPass(this);
break;
case "nickname":
qs_c_obj.checkNickname(this);
break;
case "pass1":
qs_c_obj.checkRegPass(this);
break;
case "ycode":
qs_c_obj.checkRegCaptcha(this);
break;
case "vircode":
qs_c_obj.checkRegCode(this)
}
},
"click|#getVirCode": function(n) {
if (!e(this).hasClass("disable")) {
"" != e("#alertReg").find("input[name='ycode']").val() ? qs_c_obj.sendRegSms(this) : e("#alertReg").find("input[name='ycode']").blur()
}
},
"keyup|#alertLogin input": function(e) {
13 == e.keyCode && qs_c_obj.doLogin()
},
"keyup|#alertReg input": function(e) {
13 == e.keyCode && qs_c_obj.doRegister()
},
"click|#goLoginButton": function(e) {
qs_c_obj.doLogin()
},
"click|#goRegButton": function(e) {
qs_c_obj.doRegister()
},
"click|#userBlock .eliminate": function(e) {
qs_c_obj.logoutRequest()
},
"click|#wrbutton": function(t) {
if (qs_c_obj.isLogin) {
var i = e(this).data("qing");
n.open(1 == i ? "/newQxs.html" : "/newBook.html")
} else
qs_c_obj.showLoginWin()
},
"click|#fllow": function(n) {
e("#elastic").show()
},
"click|#elastic .sout": function(n) {
e("#elastic").hide()
},
"click|#reqbox dd.in .btn-r": function(e) {
qs_c_obj.showGetReqWin()
},
"click|#reqbox dd.in .btn-l": function(t) {
var i = e("#reqbox").find("input[name='ivcode']").val();
if (i && i.length > 0) {
e("#reqbox").find("input[name='ivcode']").parent().removeError();
var o = {
code: i
};
qs_c_obj.checkIvdRequest(o, function(t) {
1 == t.status ? n.location.reload() : e("body").toast("无效的邀请码!")
})
} else
e("#reqbox").find("input[name='ivcode']").parent().addError("请填写邀请码!")
},
"click|#reqbox dd.out button.btnCener": function() {
var n = e("#reqbox").find("dd.out input[name='name']").val()
, t = e("#reqbox").find("dd.out input[name='phone']").val()
, i = e("#reqbox").find("dd.out textarea[name='indu']").val();
if (n.length < 1)
e("#reqbox").find("dd.out input[name='name']").parent().addError("请输入姓名!");
else if (t.length < 6)
e("#reqbox").find("dd.out input[name='phone']").parent().addError("请输入正确的联系方式!");
else if (i.length < 100)
e("#reqbox").find("dd.out textarea[name='indu']").parent().addError("请填写不少于100字的申请短文"),
e("#reqbox").find("dd.out textarea[name='indu']").next().css("color", "red");
else {
e("#reqbox").find(".open_txt").remove();
var o = {
name: n,
phone: t,
content: i
};
qs_c_obj.applyIvdCodeRequest(o, function(n) {
1 == n.status ? e("body").toast("申请成功,请等待工作人员与您联系!") : e("body").toast("申请失败!")
})
}
},
"click|#nameSure": function() {
var n = e("#weiboName input[name='content']").val();
if ("" == n.length)
e("#weiboName input[name='content']").parent().addError("请输入用户名!");
else if (n.length < 3)
e("#weiboName input[name='content']").parent().addError("用户名不能小于3位!");
else {
var t = {
name: n
};
qs_c_obj.changeNameRequest(t)
}
},
"click|#wxregbutton": function(e) {
qs_c_obj.showRegisterWin()
},
"click|#wxloginbutton": function(e) {
qs_c_obj.showLoginWin()
},
"click|.wxLogin": function(e) {
qs_c_obj.showWxWin()
},
"click|#mob_search_li": function(n) {
n.preventDefault(),
e("#mob_search_form").slideDown(300),
e("#mob_search_form input").focus()
},
"blur|#mob_search_form input": function() {
e("#mob_search_form").slideUp(300)
},
"click|#message a": function(n) {
if (n.stopPropagation(),
e("#nav_my_menu").is(":visible") && e("#nav_my_menu").animate({
top: "53px",
opacity: "hide"
}, 200),
qs_c_obj.isLogin) {
if (!qs_c_obj.showMsg) {
e("#message").append('
'),
qs_c_obj.showMsg = !0,
qs_c_obj.msgRequest(),
e(".message_list ul").scroll(function() {
if (qs_c_obj.msgAble) {
var n = e(this).scrollTop()
, t = e(this).height()
, i = 0;
e(this).find("li").each(function() {
i += e(this).outerHeight()
}),
n + t + 50 >= i && n > 50 && qs_c_obj.msgAble && qs_c_obj.msgRequest()
}
}),
e(".message_list").click(function(e) {
e.stopPropagation()
})
}
e(".message_list").is(":visible") ? e(".message_list").animate({
top: "53px",
opacity: "hide"
}, 200) : e(".message_list").css("top", "53px").animate({
top: "63px",
opacity: "show"
}, 200)
} else
qs_c_obj.showLoginWin();
return !1
},
"click|#nav_my_link": function(n) {
return n.stopPropagation(),
e(".message_list").is(":visible") && e(".message_list").animate({
top: "53px",
opacity: "hide"
}, 200),
qs_c_obj.isLogin ? qs_c_obj.isMobile() || e(window).width() <= 660 ? void 0 : (e("#nav_my_menu").is(":visible") ? e("#nav_my_menu").animate({
top: "53px",
opacity: "hide"
}, 200) : e("#nav_my_menu").css("top", "53px").animate({
top: "63px",
opacity: "show"
}, 200),
!1) : (qs_c_obj.showLoginWin(),
!1)
},
"click|#loginBlock": function() {
qs_c_obj.showLoginWin(function() {
qs_need_ref && window.location.reload()
})
},
"click|#regBlock": function() {
qs_c_obj.showRegisterWin()
},
"click|.search": function() {
e(".search").find("input").animate({
width: "112px",
marginLeft: "37px"
}, 300),
setTimeout(function() {
e(".search input").focus()
}, 301),
e(".search form").addClass("current")
},
"click|#yimg": function() {
qs_c_obj.showRegisterCaptcha()
},
"blur|.search input": function() {
e(".search input").animate({
width: "0",
marginLeft: "21px"
}, 300),
setTimeout(function() {
e(".search form").removeClass("current")
}, 300)
},
"click|body": function() {
e(".message_list").is(":visible") && e(".message_list").animate({
top: "53px",
opacity: "hide"
}, 200),
e("#nav_my_menu").is(":visible") && e("#nav_my_menu").animate({
top: "53px",
opacity: "hide"
}, 200)
},
"resize|window": function() {
e(".message_list").is(":visible") && e(".message_list").animate({
top: "53px",
opacity: "hide"
}, 200),
e("#nav_my_menu").is(":visible") && e("#nav_my_menu").animate({
top: "53px",
opacity: "hide"
}, 200)
}
}
}
, s = {
inzitRequest: function(n) {
var t = this;
e.ajax({
type: "post",
url: "/User/online",
data: {},
dataType: "JSON",
success: function(e) {
t._tempInfo = e,
"function" == typeof n && n(e)
}
})
},
loginRequest: function(n, t) {
e.ajax({
type: "post",
url: "/User/doLogin",
data: n,
dataType: "JSON",
success: function(e) {
"function" == typeof t && t(e)
},
error: function() {
e("body").toast("登录失败!")
}
})
},
registerRequest: function(n, t) {
e.ajax({
type: "post",
url: "/User/doReg",
data: n,
dataType: "JSON",
success: function(e) {
"function" == typeof t && t(e)
},
error: function() {
e("body").toast("网络错误,注册失败!", 2)
}
})
},
checkPhoneRequest: function(n, t) {
e.ajax({
type: "post",
url: "/User/checkRegPhone",
data: n,
dataType: "JSON",
success: function(e) {
"function" == typeof t && t(e)
}
})
},
sendRegSmsRequest: function(n, t) {
e.ajax({
type: "post",
url: "/User/sendCodeSms",
data: n,
dataType: "JSON",
success: function(e) {
"function" == typeof t && t(e)
}
})
},
sendForgetSmsRequest: function(n, t) {
e.ajax({
type: "post",
url: "/User/sendforgetPassSms",
data: n,
dataType: "JSON",
success: function(e) {
"function" == typeof t && t(e)
},
error: function() {
e("body").toast("验证码发送失败!")
}
})
},
forgetCheckRequest: function(n, t) {
e.ajax({
type: "post",
url: "/User/virCode",
data: n,
dataType: "JSON",
success: function(e) {
"function" == typeof t && t(e)
},
error: function() {
e("body").toast("验证失败!")
}
})
},
resetQuest: function(n, t) {
e.ajax({
type: "post",
url: "/User/restPassword",
data: n,
dataType: "JSON",
success: function(e) {
"function" == typeof t && t(e)
},
error: function() {
e("body").toast("重置密码失败!")
}
})
},
logoutRequest: function() {
e.ajax({
type: "post",
url: "/User/logout",
data: {},
dataType: "JSON",
success: function(e) {
1 == e.status && n.location.reload()
}
})
},
checkIvdRequest: function(n, t) {
e.ajax({
type: "post",
url: "/User/inIvdCode",
data: n,
dataType: "JSON",
success: function(e) {
"function" == typeof t && t(e)
},
error: function() {
e("body").toast("出错了,请稍后再试!")
}
})
},
applyIvdCodeRequest: function(n, t) {
e.ajax({
type: "post",
url: "/User/reqIvdCode",
data: n,
dataType: "JSON",
success: function(e) {
"function" == typeof t && t(e)
},
error: function() {
e("body").toast("申请失败!")
}
})
},
feedBackRequest: function(n) {
e.ajax({
type: "post",
url: "/Intf/newAc",
data: n,
dataType: "JSON",
success: function(n) {
1 == n.status ? (e("#opinion").hide().children("textarea").val(""),
e("body").toast("感谢你的意见和建议")) : (e("#opinion").hide().children("textarea").val(""),
e("body").toast("提交失败!"))
},
error: function() {
e("body").toast("提交失败!")
}
})
},
changeNameRequest: function(n) {
e.ajax({
type: "post",
url: "/User/changeName",
data: n,
dataType: "JSON",
success: function(n) {
1 == n.status ? (e("body").toast("添加用户名成功"),
e("#weiboName input[name='content']").parent().removeError(),
e("#weiboName").hide(),
e("#weiboName input[name='content']").val(""),
qs_c_obj.inzit()) : e("body").toast("添加用户名失败!")
},
error: function() {
e("body").toast("添加用户名失败!")
}
})
},
msgRequest: function() {
qs_c_obj.msgAble = !1;
var n = qs_c_obj.msgPage
, t = e(".tmessage li").clone();
t.addClass("msg_loading"),
t.appendTo(e("#message ul")),
e.ajax({
url: "/Person/myMessage/",
type: "POST",
data: {
page: n
},
success: function(t) {
e("#message ul").find(".msg_loading").remove(),
e(t.data).length > 0 ? (e(t.data).each(function(n, t) {
var i = e(".tmessage li").clone();
if ("" == t.head_img) {
i.find(".user_img img").hide().siblings().show();
var o = t.nick_name.substring(0, 1);
i.find(".ne").html(o),
0 != t.cid && i.find("a").attr("href", "/" + t.cid + "/book.html")
} else {
i.find(".user_img .ne").hide().siblings().show();
var s = t.head_img;
i.find(".user_img img").attr("src", s)
}
i.find(".p1").html(t.msg),
i.find(".time").html(t.time),
i.appendTo(e("#message ul"))
}),
t.totalPage > n && (qs_c_obj.msgAble = !0,
qs_c_obj.msgPage = n + 1)) : 1 == n && e("#message ul").html("没有消息…")
}
})
},
markBookRequest: function(n) {
e.ajax({
type: "post",
url: "/Person/doMarkBook",
data: {
bookid: n
},
dataType: "JSON",
success: function(t) {
1 == t.status && e(".mark_book_" + n).fadeOut(500)
}
})
},
zanBookRequest: function(n) {
e.ajax({
type: "post",
url: "/Person/doZanBook",
data: {
bookid: n
},
dataType: "JSON",
success: function(t) {
var i = e(".like_" + n);
1 == t.status ? (i.removeClass("liked"),
i.find("span").html("-1").removeClass("zan-fadeOut-up").show(0).addClass("zan-fadeOut-up").delay(800).hide(0)) : (i.addClass("liked"),
i.find("span").html("+1").removeClass("zan-fadeOut-up").show(0).addClass("zan-fadeOut-up").delay(800).hide(0)),
t.zan_cnt && i.find("em").text(t.zan_cnt)
}
})
}
}
, a = {
init: function() {
var n = this
, t = this._tempInfo;
t && (this.isLogin = !0,
this.userInfo = t.info),
e(function() {
n.clickEvent = n.isMobile() ? "touchend" : "click",
n.bindEvent(n.eventList)
// n.inzit()
})
},
inzit: function() {
function i(i) {
if (e("body").removeLoader(),
1 == i.status) {
if (o.userInfo = i.info,
o.isLogin = !0,
t = i.info,
o.sessTime = setTimeout(function() {
o.inzit()
}, 6e4),
e(".only_not_login").hide(),
(!i.info.nick_name || i.info.nick_name.indexOf("测试名字") >= 0) && e("#weiboName").show(),
s.find("samp").text(i.info.nick_name),
"" == i.info.head_img || null == i.info.head_img)
o.createHeadimg(i.info.nick_name),
s.find(".user_img img").hide();
else {
/(http:\/\/|https:\/\/)((\w|=|\?|\.|\/|&|-)+)/g.test(i.info.head_img) || (i.info.head_img = o.cdnhost + i.info.head_img),
s.find(".user_img img").attr("src", i.info.head_img),
s.find(".user_img p").hide()
}
if (1 == i.newmsg ? (e("#titlemsgflg").addClass("icon_red"),
e("#titlemmsgflg").addClass("icon_red")) : (e("#titlemsgflg").removeClass("icon_red"),
e("#titlemmsgflg").removeClass("icon_red")),
0 !== i.info.is_qiandao && 0 !== i.info.is_7day || e(".nav_lab").append(e("")),
1 == i.newpay ? (e("#titlepayflg").addClass("icon_red"),
e("#mypayflg").append("")) : (e("#titlepayflg").removeClass("icon_red"),
e("#mypayflg").find("i").remove()),
e(".nav_my_link").attr("href", "/" + i.info.id + "/book.html"),
e(".nav_draft_link").attr("href", "/" + i.info.id + "/draft.html"),
e(".only_login").show(),
o.isRef)
o.isRef = !1,
n.location.reload();
else if (o.needOpen) {
var a = o.needOpen;
o.needOpen = null,
n.location.href = a
} else
o.callback && (o.callback(),
o.callback = !1)
} else
clearTimeout(o.sessTime),
o.isLogin = !1,
o.clearCookie("qs_ssid"),
e(".only_login").hide(),
e(".only_not_login").show();
var r = [];
"undefined" != typeof gid && gid && (r = gid.split(",")),
"undefined" != typeof ngid && "" != ngid && (0 == o.isLogin ? (o.showLoginWin(),
e("#alertExit").off("click").on("click", function() {
n.location.href = o.host + "index.html"
}),
o.isRef = !0) : r.indexOf(ngid))
}
var o = this
, s = e("#userBlock");
this.isLogin ? i(this._tempInfo) : this.inzitRequest(i)
},
doLogin: function() {
var n = this
, i = e("#alertLogin")
, o = i.find("input[name='phone']")
, s = i.find("input[name='passwd']")
, a = this.checkPhone(o)
, r = this.checkLoginPass(s);
if (a && r) {
var c = e("#remc").is(":checked") ? 700 : 1
, d = {
phone: e.trim(o.val()),
pass: e.trim(s.val()),
isrmc: c
};
this.loginRequest(d, function(i) {
1 == i.status ? (n._tempInfo = {
status: 1,
info: i.profile
},
e("body").toast("登录成功!"),
e("#userWin").hide(),
n.isLogin = !0,
t = i.profile,
n.inzit()) : o.parent().addError(i.msg)
})
}
},
doRegister: function() {
var n = this
, t = e("#alertReg").find("input[name='nickname']")
, i = e("#alertReg").find("input[name='regphone']")
, o = e("#alertReg").find("input[name='pass1']")
, s = e("#alertReg").find("input[name='vircode']")
, a = this.checkNickname(t)
, r = this.checkPhone(i)
, c = this.checkRegPass(o)
, d = this.checkRegCode(s);
if (1 == this.tellObj) {
if (a && r && c && d) {
this.tellObj = !1,
e("body").loader();
var u = {
name: encodeURIComponent(e.trim(e("#alertReg").find("input[name='nickname']").val())),
phone: e.trim(i.val()),
mcode: e.trim(s.val()),
pass: e.trim(o.val())
};
n.registerRequest(u, function(a) {
e("body").removeLoader(),
1 == a.status ? (e("#userWin").hide(),
e("body").toast("注册成功!", 2),
n.inzit()) : (a.name && a.name.length > 0 && t.parent().addError(a.name),
a.phone && a.phone.length > 0 && i.parent().addError(a.phone),
a.code && a.code.length > 0 && s.parent().addError(a.code),
a.pass && a.pass.length > 0 && o.parent().addError(a.pass))
})
}
} else
i.parent().addError("请输入手机号码!")
},
isMobile: function() {
var e = navigator.userAgent.match(/(pad|iPad)/i)
, n = navigator.userAgent.match(/(phone|pod|iPhone|iPod|ios|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
return !(e || !n)
},
isWeichat: function() {
return "micromessenger" == navigator.userAgent.toLowerCase().match(/MicroMessenger/i)
},
thirdLogin: function() {
if (this.isMobile()) {
var e = window.location.href;
n.location.href = e.replace(this.host, this.mhost)
}
},
setCookie: function(e, n) {
var t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : .1
, i = new Date;
i.setTime(i.getTime() + 24 * t * 60 * 60 * 1e3);
var o = "expires=" + i.toUTCString();
document.cookie = e + "=" + n + ";" + o + "; path=/; domain=" + location.host
},
getCookie: function(e) {
var n, t = new RegExp("(^| )" + e + "=([^;]*)(;|$)");
return (n = document.cookie.match(t)) ? unescape(n[2]) : null
},
fixWinHeight: function(n) {
n || (n = 0);
var t = e(window).height()
, i = e("body").height();
if (i < t) {
var o = e("#content");
o.css("min-height", t - (i - o.height() + n) + "px")
}
},
showWeixinShareBox: function(n, t) {
var i = e("#wxShareBox");
0 == n ? i.show() : (t || (t = this.cdnhost + "ewm/b_" + n + ".png"),
i.find("img").attr("src", t).end().show())
},
showWxWin: function() {
if (e("#userWin").show().find("dd").hide(),
this.isWeichat() || this.isMobile())
n.location.href = this.mhost + "User/tlogin/t/Wechat";
else if (e("#alertWx").show(),
this.wxJs) {
new WxLogin(wx_login_obj)
} else
this.wxJs = !0,
e.getScript("//res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js", function() {
new WxLogin(wx_login_obj)
})
},
hoverCirButtonEvent: function(n, t, i) {
var o;
e(n).on("mouseover", function(s) {
t && clearInterval(t),
o = e(this).width(),
i || (i = -1),
e(n).css("background-position", -1 * o + "px"),
t = setInterval(function() {
i--,
e(n).css("background-position", o * i + "px"),
-13 == i && clearInterval(t)
}, 50)
}).on("mouseout", function(s) {
t && clearInterval(t),
o = e(this).width(),
i || (i = -13),
e(this).css("background-position", i * o + "px"),
t = setInterval(function() {
i++,
e(n).css("background-position", o * i + "px"),
0 == i && clearInterval(t)
}, 30)
})
},
showLoginWin: function(t) {
t && (this.callback = t),
e("#userWin").find("dd").hide();
var i;
if (this.isMobile()) {
i = n.location.href;
var o = i.replace(this.mhost, "");
"login.html" != o && "register.html" != o && this.setCookie("qs_backUrl", i, .1),
n.location.href = this.mhost + "login"
} else
i = n.location.href,
this.setCookie("qs_backUrl", i, .1),
e("#alertLogin").show(),
e("#userWin").show()
},
showRegisterWin: function() {
e("#userWin").show().find("dd").hide(),
this.isMobile() ? n.location.href = this.mhost + "register" : (this.showRegisterCaptcha(),
e("#alertReg").show())
},
showRegisterCaptcha: function() {
var n = "/user/captcha/?" + Math.random();
e("#yimg").attr("src", n)
},
showReqWin: function(n) {
e("#reqbox").find("dd.out").hide(),
e("#reqbox").find("dd.in").show(),
e("#reqbox").find(".alert_title span").text("邀请码"),
e("#reqbox").show()
},
showGetReqWin: function() {
var n = e("#reqbox");
n.find("dd.out").show(),
n.find("dd.in").hide(),
n.find(".alert_title span").text("申请邀请码"),
n.show()
},
checkTel: function(e) {
return /^0?1[3|4|5|6|7|8|9][0-9]\d{8}$/.test(e)
},
checkPassWord: function(e) {
return /^(?=.{6,16}$)[0-9a-zA-Z_]+$/.test(e)
},
checkName: function(e) {
return !!/^[\w\u4e00-\u9fa5]+$/gi.test(e)
},
getQueryString: function(e) {
var t = new RegExp("(^|&)" + e + "=([^&]*)(&|$)","i")
, i = n.location.search.substr(1).match(t);
return null != i ? decodeURI(i[2]) : null
},
clearCookie: function(e) {
this.setCookie(e, "", -1)
},
checkPhone: function(n) {
var t = e(n).val();
return t.length > 0 ? this.checkTel(t) ? (e(n).parent().removeError(),
!0) : (e(n).parent().addError("请输入正确的手机号!"),
!1) : (e(n).parent().addError("请输入手机号!"),
!1)
},
checkRegPhone: function(n, t) {
var i = e(n).val()
, o = this;
if (!(i.length > 0))
return this.tellObj = !1,
e(n).parent().addError("请输入手机号!"),
!1;
if (!this.checkTel(i))
return e(n).parent().addError("请输入正确的手机号!"),
this.tellObj = !1,
!1;
var s = {
phone: e.trim(e(n).val())
};
o.checkPhoneRequest(s, function(i) {
1 == i.status ? (e(n).parent().removeError(),
o.tellObj = !0,
t()) : (1 == i.code ? e(n).parent().addError("该手机已被注册!") : e(n).parent().addError("请输入正确的手机号!"),
o.tellObj = !1,
e("#getVirCode").addClass("disable"))
})
},
checkLoginPass: function(n) {
return 0 == e(n).val().length ? (e(n).parent().addError("请输入密码!"),
!1) : (e(n).parent().removeError(),
!0)
},
checkNickname: function(n) {
var t = e(n).val();
return t.length > 0 ? t.length < 3 ? (e(n).parent().addError("昵称不少于3位!"),
!1) : this.checkName(t) ? (e(n).parent().removeError(),
!0) : (e(n).parent().addError("昵称不能有特殊字符!"),
!1) : (e(n).parent().addError("请输入昵称!"),
!1)
},
checkRegPass: function(n) {
var t = e(n).val();
if (0 == t.length)
return e(n).parent().addError("请输入密码!"),
!1;
if (t.length < 6)
e(n).parent().addError("密码不能小于6位!");
else if (t.length > 16)
e(n).parent().addError("密码不能大于16位!");
else {
if (this.checkPassWord(t))
return e(n).parent().removeError(),
!0;
e(n).parent().addError("密码不能有特殊字符!")
}
return !1
},
checkRegCaptcha: function(n) {
return 0 == e(n).val().length ? (e(n).parent().addError("请输入图形验证码!"),
!1) : (e(n).parent().removeError(),
!0)
},
checkRegCode: function(n) {
return 0 == e(n).val().length ? (e(n).parent().addError("请输入验证码!"),
!1) : (e(n).parent().removeError(),
!0)
},
smsbuttonTime: function(n, t) {
var i = this
, o = e(t).text()
, s = 60;
e(t).text(s),
e(t).addClass("disable"),
this.inTimer = setInterval(function() {
s--,
e(t).text(s),
0 == s && (clearInterval(i.inTimer),
e(t).text(o),
i.checkPhone(e(n)) || e(dom).addClass("disable"))
}, 1e3)
},
sendRegSms: function(n) {
var t = this
, i = e("#alertReg").find("input[name='regphone']")
, o = i.val()
, s = e("#alertReg").find("input[name='ycode']").val()
, a = {
phone: o,
ycode: s
};
this.sendRegSmsRequest(a, function(o) {
o.ycode_error && 1 == o.ycode_error ? e("body").toast("图形验证码错误!") : o.result.success && "true" == o.result.success ? (e("body").toast("验证码发送成功!"),
e(n).addClass("disable"),
t.smsbuttonTime(i, n)) : e("body").toast("验证码发送失败!")
})
},
createHeadimg: function(n) {
n && e("#userBlock .user_img p").text(n.substring(0, 1))
},
bindEvent: function(n) {
for (var t in n) {
var i = t.split("|")
, o = "window" == i[1] ? window : i[1]
, s = i[0]
, a = !!i[2] && i[2];
"scroll" == s || "mouseleave" == s || "focusout" == s || "keyup" == s ? e(o)[s](n[t]) : a ? function(t, i) {
var o;
e(t).on("touchmove.mb", function() {
o = !0
}).on("touchend.mb", function(e) {
if (o)
return o = !1,
!1;
o = !1,
n[i].call(this, e)
})
}(o, t) : e(o).on(s, n[t])
}
},
markBook: function(e) {
var n = this;
0 == n.isLogin ? n.showLoginWin() : this.markBookRequest(e)
},
zanBook: function(e) {
var n = this;
0 == n.isLogin ? n.showLoginWin() : this.zanBookRequest(e)
},
rendTime: function(e, n) {
var t = new Date
, i = Math.floor(t.getTime() / 1e3)
, o = i - e;
if (o < 86400)
return o > 3600 ? Math.floor(o / 3600) + " 小时前" : o > 60 ? Math.floor(o / 60) + " 分前" : o > 5 ? o + " 秒前" : "刚刚";
var s = (t.getYear(),
new Date(t.getTime() - 864e5))
, a = s.getFullYear()
, r = s.getMonth() + 1
, c = s.getDate()
, d = new Date(1e3 * parseInt(e))
, u = d.getFullYear()
, l = d.getMonth() + 1
, p = d.getDate();
if (u == a && l == r && p == c) {
var h = "昨天";
if (n && 1 == n) {
var f = d.getHours()
, m = d.getMinutes();
f < 10 && (f = "0" + f),
m < 10 && (m = "0" + m),
h += " " + f + ":" + m
}
return h
}
if (u != a) {
l < 10 && (l = "0" + l),
p < 10 && (p = "0" + p);
var h = u + "." + l + "." + p;
if (n && 1 == n) {
var f = d.getHours()
, m = d.getMinutes();
f < 10 && (f = "0" + f),
m < 10 && (m = "0" + m),
h += " " + f + ":" + m
}
return h
}
l < 10 && (l = "0" + l),
p < 10 && (p = "0" + p);
var h = l + "." + p;
if (n && 1 == n) {
var f = d.getHours()
, m = d.getMinutes();
f < 10 && (f = "0" + f),
m < 10 && (m = "0" + m),
h += " " + f + ":" + m
}
return h
}
};
qs_c_obj = e.extend({}, o, s, a, i),
qs_c_obj.init(),
function() {
e.fn.login = function() {
e(this).on("click", function(e) {
qs_c_obj.stopCP(e),
qs_c_obj.showLoginWin()
})
}
,
e.fn.register = function(n) {
e(this).on("click", function() {
qs_c_obj.stopCP(n),
qs_c_obj.showRegisterWin()
})
}
,
e.fn.toast = function(n, t, i) {
e("#toastBox").remove();
var o = e('');
i && o.css(i),
n = n || "忙碌中!",
t = t || 2,
e("p", o).html(n),
e(this).append(o),
e(o).fadeIn(500),
t > 0 && setTimeout(function() {
e(o).fadeOut(500)
}, 1e3 * t)
}
,
e.fn.newToast = function(n, t) {
if (0 == e(".top-tip").length) {
e(this).append('')
}
e(".top-tip").html("").append(e('' + n + "
")),
e(".top-tip").show(),
qs_c_obj.alertTimer && clearTimeout(qs_c_obj.alertTimer),
qs_c_obj.alertTimer = setTimeout(function() {
e(".top-tip").remove()
}, 2e3)
}
,
e.fn.loader = function() {
var n = e(this).find("#box");
if (n.size() <= 0) {
var t = e("").css({
position: "fixed",
top: 0,
left: 0,
height: "100%",
width: "100%",
zIndex: "300"
}).prop("id", "mask")
, i = e('
');
i.attr("data-size", "1"),
e(this).append(i).append(t)
} else {
var o = Number(n.attr("data-size"));
n.attr("data-size", o + 1)
}
return e(this)
}
,
e.fn.removeLoader = function(n) {
var t = e(this).find("#box");
if (n)
return t.remove(),
e("#mask").remove(),
e(this);
if (t.size() > 0) {
var i = Number(t.attr("data-size"));
i > 1 ? t.attr("data-size", --i) : (t.remove(),
e("#mask").remove())
}
return e(this)
}
,
e.fn.rwHover1 = function() {
qs_c_obj.hoverCirButtonEvent(this)
}
,
e.fn.rwHover2 = function() {
qs_c_obj.hoverCirButtonEvent(this)
}
,
e.fn.addError = function(n) {
var t = e(".open_txt", this);
0 == e(t).length && (t = e('
'),
e(this).append(t)),
e("span", t).text(n)
}
,
e.fn.removeError = function(n) {
var t = e(".open_txt", this);
e(t).length > 0 && e(t).remove()
}
,
e.fn.shareQs = function(n, t, i) {
function o(e, n) {
var t;
e.on("touchmove.mb", function() {
t = !0
}).on("touchend.mb", function(e) {
if (t)
return t = !1,
!1;
t = !1,
n.call(this, e)
})
}
var s, a, r, c = "", d = "", u = "click";
if (a += "&url=" + encodeURIComponent(n.url),
a += "&desc=" + encodeURIComponent(n.desc),
a += "&title=" + encodeURIComponent(n.title),
a += "&summery=&pics=" + encodeURIComponent(n.img),
a += "&pic=" + encodeURIComponent(n.img),
r += "&url=" + encodeURIComponent(n.url),
r += "&desc=" + encodeURIComponent(n.title),
r += "&title=" + encodeURIComponent(n.desc),
r += "&summery=&pics=" + encodeURIComponent(n.img),
r += "&pic=" + encodeURIComponent(n.img),
c += '
',
d += '
',
d += "
将该作品分享至
",
d += "
',
t)
if (qs_c_obj.isMobile()) {
u = "touchend";
var l = e("
").css({
position: "fixed",
left: "0",
top: "0",
width: "100%",
height: "100%",
display: "none",
zIndex: "300",
background: "rgba(0, 0, 0, 0.64)"
}).on("touchend", function() {
return e(this).hide(),
!1
});
s = e(d).appendTo(l),
e("body").append(l),
o(this, function() {
return qs_c_obj.isWeichat() && (s.append("
点击此处分享到朋友圈 "),
e("li", s).eq(0).hide(),
e("li", s).eq(1).hide(),
e("ul", s).addClass("weChat")),
l.show(),
!1
})
} else
s = e(c).hide().appendTo(this),
i && s.css(i),
this.on("mouseleave", function() {
s.hide()
}).on(t, function() {
s.show()
});
else
s = e(c).hide().appendTo(this),
this.on("click", function() {
s.toggle()
});
return qs_c_obj.isMobile() ? (o(e(".sWeibo", s), function() {
window.open("http://service.weibo.com/share/share.php?appkey=197649834&language=zh_cn" + r)
}),
o(e(".sQQsp", s), function() {
window.open("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?style=203&width=98&height=22&otype=share" + a)
})) : (e(".sWeibo", s).on(u, function() {
window.open("http://service.weibo.com/share/share.php?appkey=197649834&language=zh_cn" + r)
}),
e(".sWeixin", s).on(u, function() {
qs_c_obj.showWeixinShareBox(n.id, n.ewmUrl)
}),
e(".sQQsp", s).on(u, function() {
window.open("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?style=203&width=98&height=22&otype=share" + a)
})),
this
}
,
e.fn.loader2 = function(n) {
var t, i, o, s, a, r = n ? "prependTo" : "appendTo", c = e("
加载中
").attr("class", "loadText"), d = e('
'), u = {
position: "fixed",
top: 0,
left: 0,
height: "100%",
width: "100%",
zIndex: "1000"
};
e("
").css(u).prop("id", "mask").appendTo(this);
return qs_c_obj.isMobile() ? (t = n ? "52px" : "48px",
o = n ? "28px 0 8px 0" : "24px 0 8px 0",
i = "68px",
a = {
padding: o,
lineHeight: "1.6rem",
fontSize: "1.2rem"
},
d.css({
top: t,
margin: "0",
height: "6px",
lineHeight: "6px",
bottom: "auto"
}).find("span").css({
width: "6px",
height: "6px",
margin: "0 3px"
}),
s = {
height: i,
background: "inherit",
color: "#ccc",
position: "relative"
}) : (t = n ? "100px" : "90px",
o = n ? "57px 0 16px 0" : "48px 0 16px 0",
i = "130px",
a = {
padding: o,
lineHeight: "2.1rem",
fontSize: "1.6rem"
},
d.css({
top: t,
lineHeight: "12px",
height: "12px",
margin: "0",
bottom: "auto"
}).find("span").css({
width: "12px",
height: "12px",
margin: "0 6px"
}),
s = {
height: i,
background: "inherit",
position: "relative"
}),
e("
").css(s).attr("id", "loader2").append(c.css(a))[r](this).append(d).animate({
height: i
}, 120),
e(this)
}
,
e.fn.removeLoader2 = function() {
return e("#loader2").remove(),
e("#mask").remove(),
e("#box").remove(),
e(this)
}
}()
}(jQuery, window);