/** PTNovelSearch-v4.1.2 LPPL License By http://www.ptcms.com/ */
 ;$(".select-all").click(function(){var e=$(".subscribe .chapter-list input[type=checkbox]").attr("checked",!0),t=0;$(".subscribe .bottom .selected_num").text(e.length),e.each(function(e,c){t+=parseFloat($(c).data("price"))?parseFloat($(c).data("price")):0}),$(".subscribe .bottom .selected_money").text(t)}),$(".subscribe .chapter-list input[type=checkbox]").click(function(){var e=$(".subscribe .chapter-list input[type=checkbox]:checked"),t=0;$(".subscribe .bottom .selected_num").text(e.length),e.each(function(e,c){t+=parseFloat($(c).data("price"))?parseFloat($(c).data("price")):0}),$(".subscribe .bottom .selected_money").text(t)}),$(".subscribe .bottom button").click(function(){var e=null,t=parseFloat($(this).siblings("div").find(".total").text()),c=parseFloat($(this).siblings("div").find(".selected_money").text()),n=[];return c?t<c?layer.open({content:"余额不足，请先充值后再试。",btn:["去充值","取消"],yes:function(e){window.location.href=__RECHARGE_URL}}):($(".chapter-list input[type=checkbox]:checked").each(function(e,t){n.push(t.value)}),void $.ajax(__SUBSCRIBE_URL,{data:{novelid:__NOVEL_ID,chapters:n},type:"post",dataType:"json",beforeSend:function(){null==e&&(e=layer.open({type:2}))},complete:function(){null!=e&&(layer.close(e),e=null)},success:function(e){e.code?layer.open({content:e.msg,skin:"msg",time:3,end:function(){e.data.redirect&&(window.location.href=e.data.redirect)}}):window.location.reload()},error:function(){layer.open({content:"订阅失败，请稍后再试！",btn:"我知道了"})}})):layer.open({content:"请先选择章节。",skin:"msg",time:2})});