/*user*/ $(function(){ $("#userinfo").load("https://www.zidonghua.com.cn/index.php?m=member&c=index&a=mini&forward="+encodeURIComponent(location.href)+"&siteid=1"); }); //收藏 function digg() { $.getJSON('https://www.zidonghua.com.cn/index.php?m=digg&c=index&a=post&id=2-13251-1&typeid=1&'+Math.random()+'&callback=?', function(data){ if(data.status==1) { if(data.isup==1){ layer.msg('收藏成功'); $('.btn_digg').addClass('cur'); $('.options-favourite').addClass('cur'); $('.btn_digg').attr('data-islike','true'); $('.article-like .text').html('已收藏'); }else{ layer.msg('取消收藏'); $('.btn_digg').removeClass('cur'); $('.options-favourite').removeClass('cur'); $('.btn_digg').attr('data-islike','false'); $('.article-like .text').html('我要收藏'); } }else { //alert(data.data); layer.msg(data.data,{ time: 2000 }, function(){ window.location.href="https://www.zidonghua.com.cn/index.php?m=member&c=index&a=login&forward=https%3A%2F%2Fwww.zidonghua.com.cn%2Fnews%2Flive%2F13251.html&siteid=1"; }); } }) } $.getJSON('https://www.zidonghua.com.cn/index.php?m=digg&c=index&a=get&id=2-13251-1&typeid=1&'+Math.random()+'&callback=?', function(data){ var userid = '0'; if(userid){ if(data.data!=0){ $('.btn_digg').addClass('cur'); $('.options-favourite').addClass('cur'); $('.btn_digg').attr('data-islike','true'); $('.article-like .text').html('已收藏'); }else { $('.btn_digg').removeClass('cur'); $('.options-favourite').removeClass('cur'); $('.btn_digg').attr('data-islike','false'); $('.article-like .text').html('我要收藏'); } }else{ $('.btn_digg').removeClass('cur'); $('.options-favourite').removeClass('cur'); $('.btn_digg').attr('data-islike','false'); $('.article-like .text').html('我要收藏'); } }) //赞 function digg_up() { $.getJSON('https://www.zidonghua.com.cn/index.php?m=digg&c=index&a=post&id=2-13251-1&typeid=2&'+Math.random()+'&callback=?', function(data){ if(data.status==1) { if(data.isup==1){ layer.msg('赞一个'); $('.btn_digg_up').addClass('cur'); $('.options-like').addClass('cur'); $('.btn_digg_up').attr('data-isup','true'); $('.article-up .text').children('em').html(data.data); $('.options-like').children('p').html(data.data); $('.article-up .text').children('span').html('个赞'); }else{ layer.msg('取消赞'); $('.btn_digg_up').removeClass('cur'); $('.options-like').removeClass('cur'); $('.btn_digg_up').attr('data-isup','false'); $('.article-up .text').children('em').html(data.data); $('.options-like').children('p').html(data.data); $('.article-up .text').children('span').html('个赞'); } }else { //alert(data.data); layer.msg(data.data,{ time: 2000 }, function(){ window.location.href="https://www.zidonghua.com.cn/index.php?m=member&c=index&a=login&forward=https%3A%2F%2Fwww.zidonghua.com.cn%2Fnews%2Flive%2F13251.html&siteid=1"; }); } }) } $.getJSON('https://www.zidonghua.com.cn/index.php?m=digg&c=index&a=get&id=2-13251-1&typeid=2&'+Math.random()+'&callback=?', function(data){ var userid = '0'; if(userid){ //alert(data.num); if(data.data!=0){ $('.btn_digg_up').addClass('cur'); $('.options-like').addClass('cur'); $('.btn_digg_up').attr('data-isup','true'); $('.article-up .text').children('em').html(data.num); $('.article-up .text').children('span').html('个赞'); $('.options-like').children('p').html(data.num); }else { $('.btn_digg_up').removeClass('cur'); $('.options-like').removeClass('cur'); $('.btn_digg_up').attr('data-isup','false'); $('.article-up .text').children('em').html(data.num); $('.article-up .text').children('span').html('个赞'); $('.options-like').children('p').html(data.num); } }else { $('.btn_digg_up').removeClass('cur'); $('.btn_digg_up').attr('data-isup','false'); if(data.num==0){ $('.article-up .text').children('em').html(''); $('.options-like').children('p').html('0'); $('.article-up .text').children('span').html('点个赞吧'); }else{ $('.article-up .text').children('em').html(data.num); $('.options-like').children('p').html(data.num); $('.article-up .text').children('span').html('个赞'); } } })