第67章 这就是战争
第67章 这就是战争 (第3/3页)
w();
});
$('#xiaoxi').mouseout(function (){
$("#xiaoxi").attr('class', 'sp_more');
$("#nav_s2").hide();
});
//头部消息end
var options = {
beforeSubmit:showRequest,
success:showResponse // post-submit
};
$('#form1').ajaxForm(options);
//返回顶部
$('#span_top').mouseover(function (){
$("#span_top").attr('class', 'span_top2');
});
$('#span_top').mouseout(function (){
$("#span_top").attr('class', 'span_top');
});
$('#span_bottom').mouseover(function (){
$("#span_bottom").attr('class', 'span_bottom2');
});
$('#span_bottom').mouseout(function (){
$("#span_bottom").attr('class', 'span_bottom');
});
$('#span_top').click(function (){
$("html, body").animate({ scrollTop: 0 }, 120);
});
$('#span_bottom').click(function (){
browser = $(document).height() ;
$("html, body").animate({ scrollTop: browser }, 120);
});
//返回顶部 end
});
function setTabLogin(m,n){
var tli=document.getElementById("menu"+m).getElementsByTagName("li"); /*获取选项卡的LI对象*/
var mli=document.getElementById("main"+m).getElementsByTagName("dl"); /*获取主显示区域对象*/
for(i=0;i
tli[i].className=i==n?"hover":""; /*更改选项卡的LI对象的样式,如果是选定的项则使用.hover样式*/
mli[i].style.display=i==n?"block":"none"; /*确定主区域显示哪一个对象*/
}
//changeValid($('#captchaImg_reg')) ;
if(n==0){
changeValid($('#captchaImg_login')) ;//加验证码
}else{
changeValid($('#captchaImg_reg')) ;
}
}
//购买本书的所有章节
function buyAllBook(book_id,now_chapter_id){
$('#but_book_all').attr('disabled' , 'disabled') ;
$('#but_book_all').attr('class' , 'but_all_disable') ;
$.ajax({
type: "post",
timeout : 30000,
url: '/new/ks_user/subscription/buyAllBook',
data: 'book_id='+book_id+"&now_chapter_id="+now_chapter_id,
dataType: "json",
complete : function(XMLHttpRequest,status){ //请求完成后最终执行参数
if(status=='timeout'){//超时,status还有success,error等值的情况
window.location.reload();
alert("请求超时");
}
},
success: function(msg){
if(msg.result.status.code != 0){
alert(msg.result.status.msg);
return false;
}else{
showResponseALL(msg) ;
}
}
});
}
//未订阅章节列表伸缩功能
$(function(){
var page = 1 ;
var uid = '' ;
var book_id = '' ;
$("span.subs_expand").live("click",function(){
book_id = $(this).attr('data-book_id');
uid = $(this).attr('data-uid');
$.ajax({
type: "get",
url: '/new/ks_user/subscription/getChapterMore',
data: 'book_id='+book_id+'&page='+page,
dataType: "json",
success: function(msg){
chapter_count = parseInt($('#chapterSum').html()) ;
goldsum = parseInt($('#goldsum').html()) ;
if(msg.result.status.code != 0)
{
alert(msg.result.status.msg);
return false;
}else{
var html = '',
data_len = msg.result.data.length;
if(data_len==0){
$('#subs_expand_all').html('收起章节列表') ;
//$('span.subs_expand').css('color','#CCC');
$('span.subs_expand').css('color','#CCC');
$("#subs_expand_all").die("click");
$("span.subs_expand").die("click");
$('#subs_expand_all').live('click',function(){
hiddenChapterAll() ;
}) ;
}
// $.each(data.items, function(i,item){
var count = 0 ;
$.each(msg.result.data ,function(i, n){
count++ ;
if((page==1&&i<=3)){
i = i ;
}else{
html = '
if(n.is_subscription!=1){
html +='
goldsum = goldsum+parseInt(n.sale_price);
chapter_count++ ;
}else{
html +='
}
html +='
subhtml ='' ;
if(n.chapternum!=''){
subhtml= '第'+n.chapternum+'章 ';
}
html +='
html +='
html +='
subhtml ='' ;
if(n.is_subscription==1){
subhtml= '已订阅';
}else{
subhtml= '未订阅';
}
html +='
html +='
$("#chapter_more_table tr:last").after(html);
}
});
if(count<10){
$('#subs_expand_all').html('收起章节列表') ;
//$('span.subs_expand').css('color','#CCC');
$('span.subs_expand').css('color','#CCC');
$("span.subs_expand").die("click");
$("#subs_expand_all").die("click");
$('#subs_expand_all').live('click',function(){
hiddenChapterAll() ;
}) ;
}
page++ ;
$('#chapterSum').html(chapter_count) ;
$('#goldsum').html(goldsum) ;
$('#sumEgold').html(goldsum) ;
if(parseInt(goldsum)>parseInt($('#nowEgold').html())){
showRequest();
}
}
}
});
$("div.subs_list").css({height:"auto"}) ;
});
$("#subs_expand_all").live("click",function(){
loading();
$("#subs_expand_all").die("click");
book_id = $(this).attr('data-book_id');
uid = $(this).attr('data-uid');
$.ajax({
type: "get",
url: '/new/ks_user/subscription/getChapterListAll',
data: 'book_id='+book_id,
dataType: "json",
success: function(msg){
chapter_count = 0;
goldsum = 0;
ymPrompt.close();
if(msg.result.status.code != 0)
{
alert(msg.result.status.msg);
return false;
}else{
var html = '',
data_len = msg.result.data.length;
// $.each(data.items, function(i,item){
$("#chapter_more_table tr:gt(0)").remove();
$.each(msg.result.data ,function(i, n){
//$("#chapter_more_table").html('
html = '
if(n.is_subscription!=1){
html +='
goldsum = goldsum+parseInt(n.sale_price);
chapter_count++ ;
}else{
html +='
}
html +='
subhtml ='' ;
if(n.chapternum!=''){
subhtml= '第'+n.chapternum+'章 ';
}
html +='
html +='
html +='
subhtml ='' ;
if(n.is_subscription==1){
subhtml= '已订阅';
}else{
subhtml= '未订阅';
}
html +='
html +='
$("#chapter_more_table tr:last").after(html);
});
$('#chapterSum').html(chapter_count) ;
$('#goldsum').html(goldsum) ;
$('#sumEgold').html(goldsum) ;
if(parseInt($('#goldsum').html())>parseInt($('#nowEgold').html())){
showRequest();
}
$('#subs_expand_all').html('收起章节列表') ;
//$('span.subs_expand').css('color','#CCC');
$('span.subs_expand').css('color','#CCC');
$("span.subs_expand").die("click");
$("#subs_expand_all").die("click");
$('#subs_expand_all').live('click',function(){
hiddenChapterAll() ;
}) ;
//$('#subs_expand_all').css('color','#CCC');
//去掉展开更多章节的提示
page=9999;
}
}
});
$("div.subs_list").css({height:"auto"}) ;
});
})
//隐藏章节
function hiddenChapterAll(){
loading();
setTimeout('hiddenChapterAllTimeOut()' , 1000) ;
//hiddenChapterAllTimeOut() ;
}
function hiddenChapterAllTimeOut(){
$("#chapter_more_table tr:gt(4)").hide() ;
$("#chapter_more_table tr:gt(4) :checkbox").attr('checked',false) ;
/*
$("#chapter_more_table tr:gt(0)").each(function(i, n){
if(i>3){
$(this).hide();
}
});
*/
goldsum = 0 ;
chapter_count = 0 ;
$("#chapter_more_table tr:visible").each(function(i, n){
if($(this).children().children(":checkbox").attr('disabled')==false&&$(this).children().children(":checkbox").attr('checked')&&i!=0){
goldsum = goldsum+parseInt($(this).children('td:eq(4)').children().html());
chapter_count++ ;
}
});
$('#chapterSum').html(chapter_count) ;
$('#goldsum').html(goldsum) ;
$('#sumEgold').html(goldsum) ;
$("#subs_expand_all").die("click");
$('#subs_expand_all').html('展开全部章节') ;
$('#subs_expand_all').live('click',function(){
showChapterAll() ;
}) ;
$("span.subs_expand").die("click");
$('span.subs_expand').css('color','#0099FF');
$('span.subs_expand').live('click',function(){
showChapterMore() ;
}) ;
if(parseInt($('#goldsum').html())<=parseInt($('#nowEgold').html())){
$('#subSubmit').attr('disabled' , false) ;
$('#subSubmit').attr('class' , 'but_dingyue') ;
}
ymPrompt.close();
}
var clickMpre = 5 ;
var count_num = 0 ;
function showChapterMore(){
k = 0 ;
goldsum = 0 ;
chapter_count = 0;
$("#chapter_more_table tr:gt(0)").each(function(i, n){
if(i>3){
if(k>clickMpre){
clickMpre = 9 ;
count_num++ ;
return false;
}
if($(this).is(":hidden")){
$(this).show();
k++ ;
}
}
if($(this).children().children(":checkbox").attr('disabled')==false){
goldsum = goldsum+parseInt($(this).children('td:eq(4)').children().html());
$(this).children().children(":checkbox").attr('checked',true) ;
chapter_count++;
}
});
$('#chapterSum').html(chapter_count) ;
$('#goldsum').html(goldsum) ;
$('#sumEgold').html(goldsum) ;
if(parseInt($('#goldsum').html())>parseInt($('#nowEgold').html())){
showRequest();
}
if((count_num==1&&k>6)||(count_num>1&&k<10)){
$('#subs_expand_all').html('收起章节列表') ;
//$('span.subs_expand').css('color','#CCC');
$('span.subs_expand').css('color','#CCC');
$("span.subs_expand").die("click");
$("#subs_expand_all").die("click");
$('#subs_expand_all').live('click',function(){
hiddenChapterAll() ;
}) ;
}
/*
$("#chapter_more_table tr:gt(0)").each(function(i, n){
if(i>3){
$(this).hide();
}
});
*/
}
//显示章节
function showChapterAll(){
loading();
setTimeout('showChapterAllTimeOut()' , 1000) ;
}
function showChapterAllTimeOut(){
$("#chapter_more_table tr:gt(4)").show() ;
chapter_count = parseInt($('#chapterSum').html()) ;
goldsum = parseInt($('#goldsum').html()) ;
$("#chapter_more_table tr:visible").each(function(i, n){
if($(this).children().children(":checkbox").attr('disabled')==false&&$(this).children().children(":checkbox").attr('checked')==false){
$(this).children().children(":checkbox").attr('checked',true) ;
goldsum = goldsum+parseInt($(this).children('td:eq(4)').children().html());
chapter_count++ ;
}
});
/*
$("#chapter_more_table tr:gt(0)").each(function(i, n){
if(i>3){
$(this).show();
}
});
*/
$('#chapterSum').html(chapter_count) ;
$('#goldsum').html(goldsum) ;
$('#sumEgold').html(goldsum) ;
$("#subs_expand_all").die("click");
$('#subs_expand_all').html('收起章节列表') ;
$('#subs_expand_all').live('click',function(){
hiddenChapterAll() ;
}) ;
$('span.subs_expand').css('color','#CCC');
$("span.subs_expand").die("click");
if(parseInt($('#goldsum').html())>parseInt($('#nowEgold').html())){
showRequest();
}
ymPrompt.close();
}
function loading(){
var msg = '
msg += '
msg+= '
请稍等...
msg+= '
msg+= '
msg+= '
msg+= '
msg+= '
ymPrompt.confirmInfo({btn:'',icoCls:'',msgCls:'confirm',message:msg,titleBar:false,useSlide:true,autoClose:false,width:340,height:160});
}