//查询售电文章是否过期 $.getJSON('http://www.sgcio.com/index.php?m=content&c=index&a=get_sell&catid=2&id=26722&modelid=1&'+Math.random()+'&callback=?', function(data){ //alert(data.fettle); if(data.timearr==2){ $('#fettle').html('已失效'); }else { if(data.fettle==1){ $('#fettle').html('热销中'); }else if(data.fettle==2){ $('#fettle').html('已售完'); }else if(data.fettle==3){ $('#fettle').html('已失效'); }else{ $('#fettle').html(''); } } }) //查询购电文章是否过期 $.getJSON('http://www.sgcio.com/index.php?m=content&c=index&a=get_buy&catid=2&id=26722&modelid=1&'+Math.random()+'&callback=?', function(data){ //alert(data.fettle); if(data.timearr==2){ $('#fettle_buy').html('已失效'); }else { if(data.fettle==1){ $('#fettle_buy').html('求购中'); }else if(data.fettle==2){ $('#fettle_buy').html('已购买'); }else if(data.fettle==3){ $('#fettle_buy').html('已失效'); }else{ $('#fettle_buy').html(''); } } }) //收藏 function digg() { $.getJSON('http://www.sgcio.com/index.php?m=digg&c=index&a=post&id=2-26722-1&typeid=1&'+Math.random()+'&callback=?', function(data){ if(data.status==1) { if(data.isup==1){ layer.msg('收藏成功'); $('.btn_digg').addClass('cur'); $('.btn_digg').attr('data-islike','true'); $('.article-like .text').html('已收藏'); }else{ layer.msg('取消收藏'); $('.btn_digg').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="http://www.sgcio.com/index.php?m=member&c=index&a=login&forward=http%3A%2F%2Fwww.sgcio.com%2Fnews%2Fzh%2F26722.html&siteid=1"; }); } }) } $.getJSON('http://www.sgcio.com/index.php?m=digg&c=index&a=get&id=2-26722-1&typeid=1&'+Math.random()+'&callback=?', function(data){ var userid = ''; if(userid){ if(data.data!=0){ $('.btn_digg').addClass('cur'); $('.btn_digg').attr('data-islike','true'); $('.article-like .text').html('已收藏'); }else { $('.btn_digg').removeClass('cur'); $('.btn_digg').attr('data-islike','false'); $('.article-like .text').html('我要收藏'); } }else{ $('.btn_digg').removeClass('cur'); $('.btn_digg').attr('data-islike','false'); $('.article-like .text').html('我要收藏'); } }) //赞 function digg_up() { $.getJSON('http://www.sgcio.com/index.php?m=digg&c=index&a=post&id=2-26722-1&typeid=2&'+Math.random()+'&callback=?', function(data){ if(data.status==1) { if(data.isup==1){ layer.msg('赞一个'); $('.btn_digg_up').addClass('cur'); $('.btn_digg_up').attr('data-isup','true'); $('.article-up .text').children('em').html(data.data); $('.article-up .text').children('span').html('个赞'); }else{ layer.msg('取消赞'); $('.btn_digg_up').removeClass('cur'); $('.btn_digg_up').attr('data-isup','false'); $('.article-up .text').children('em').html(data.data); $('.article-up .text').children('span').html('个赞'); } }else { //alert(data.data); layer.msg(data.data,{ time: 2000 }, function(){ window.location.href="http://www.sgcio.com/index.php?m=member&c=index&a=login&forward=http%3A%2F%2Fwww.sgcio.com%2Fnews%2Fzh%2F26722.html&siteid=1"; }); } }) } $.getJSON('http://www.sgcio.com/index.php?m=digg&c=index&a=get&id=2-26722-1&typeid=2&'+Math.random()+'&callback=?', function(data){ var userid = ''; if(userid){ if(data.data!=0){ $('.btn_digg_up').addClass('cur'); $('.btn_digg_up').attr('data-isup','true'); $('.article-up .text').children('em').html(data.data); $('.article-up .text').children('span').html('个赞'); }else { $('.btn_digg_up').removeClass('cur'); $('.btn_digg_up').attr('data-isup','false'); $('.article-up .text').children('em').html(''); $('.article-up .text').children('span').html('点个赞吧'); } }else { $('.btn_digg_up').removeClass('cur'); $('.btn_digg_up').attr('data-isup','false'); if(data.data==0){ $('.article-up .text').children('em').html(''); $('.article-up .text').children('span').html('点个赞吧'); }else{ $('.article-up .text').children('em').html(data.data); $('.article-up .text').children('span').html('个赞'); } } }) //踩 function digg_down() { $.getJSON('http://www.sgcio.com/index.php?m=digg&c=index&a=post&id=2-26722-1&typeid=3&'+Math.random()+'&callback=?', function(data){ if(data.status==1) { if(data.isup==1){ layer.msg('踩了一下'); $('.btn_digg_down').addClass('cur'); $('.btn_digg_down').attr('data-isdown','true'); $('.article-down .text').children('em').html(data.data); $('.article-down .text').children('span').html('被踩'); $('.article-down .text').children('font').html('下'); }else{ layer.msg('取消踩'); $('.btn_digg_down').removeClass('cur'); $('.btn_digg_down').attr('data-isdown','false'); $('.article-down .text').children('em').html(data.data); $('.article-down .text').children('span').html('被踩'); $('.article-down .text').children('font').html('下'); } }else { //alert(data.data); layer.msg(data.data,{ time: 2000 }, function(){ window.location.href="http://www.sgcio.com/index.php?m=member&c=index&a=login&forward=http%3A%2F%2Fwww.sgcio.com%2Fnews%2Fzh%2F26722.html&siteid=1"; }); } }) } $.getJSON('http://www.sgcio.com/index.php?m=digg&c=index&a=get&id=2-26722-1&typeid=3&'+Math.random()+'&callback=?', function(data){ var userid = ''; if(userid){ if(data.data!=0){ $('.btn_digg_down').addClass('cur'); $('.btn_digg_down').attr('data-isdown','true'); $('.article-down .text').children('em').html(data.data); $('.article-down .text').children('span').html('被踩'); $('.article-down .text').children('font').html('下'); }else { $('.btn_digg_down').removeClass('cur'); $('.btn_digg_down').attr('data-isdown','false'); $('.article-down .text').children('em').html(''); $('.article-down .text').children('font').html(''); $('.article-down .text').children('span').html('踩一下'); } }else { $('.btn_digg_down').removeClass('cur'); $('.btn_digg_down').attr('data-isdown','false'); if(data.data==0){ $('.article-down .text').children('em').html(''); $('.article-down .text').children('font').html(''); $('.article-down .text').children('span').html('踩一下'); }else{ $('.article-down .text').children('em').html(data.data); $('.article-down .text').children('span').html('被踩'); $('.article-down .text').children('font').html('下'); } } }) //分享 $('.article-share').hover(function(){ $('#share-popover').show(); },function(){ $('#share-popover').hide(); }) //关注 function follow(followid) { $.getJSON('http://www.sgcio.com/index.php?m=digg&c=index&a=follow&id=2-26722-1&typeid=4&follow='+followid+'&'+Math.random()+'&callback=?', function(data){ if(data.status==1) { if(data.isup==1){ layer.msg('关注成功'); $('.btn_follow').attr('data-like','true'); $('.btn_follow').addClass('followed'); $('.btn_follow').html('已关注'); $('.icon_fan').html(data.data); }else{ layer.msg('取消关注'); $('.btn_follow').attr('data-like','false'); $('.btn_follow').removeClass('followed'); $('.btn_follow').html('关注'); $('.icon_fan').html(data.data); } }else { layer.msg(data.data,{ time: 2000 }, function(){ window.location.href="http://www.sgcio.com/index.php?m=member&c=index&a=login&forward=http%3A%2F%2Fwww.sgcio.com%2Fnews%2Fzh%2F26722.html&siteid=1"; }); } }) } var followid = $('.btn_follow').attr('data-id'); $.getJSON('http://www.sgcio.com/index.php?m=digg&c=index&a=getfollow&id=2-26722-1&typeid=4&follow='+followid+'&'+Math.random()+'&callback=?', function(data){ var userid = ''; if(userid){ if(data.status==1){ $('.btn_follow').attr('data-like','true'); $('.btn_follow').addClass('followed'); $('.btn_follow').html('已关注'); }else { $('.btn_follow').attr('data-like','false'); $('.btn_follow').removeClass('followed'); $('.btn_follow').html('关注'); } }else{ $('.btn_follow').attr('data-like','false'); $('.btn_follow').removeClass('followed'); $('.btn_follow').html('关注'); } if(data.data){ $('.icon_fan').html(data.data); } }) //getpostnum $.getJSON('http://www.sgcio.com/index.php?m=digg&c=index&a=getpostnum&id=2-26722-1&userid='+followid+'&'+Math.random()+'&callback=?', function(data){ if(data.status==1){ $('.icon_art').html(data.data); }else { $('.icon_art').hide(); } }) $(document).on("click", "#btn_loading", function() { var cookiepage = getcookie('loadpage') ? getcookie('loadpage') : '0'; var loadednum = $('#clist').children('li').length; var newpage = Math.ceil(loadednum/10) + 1; var thepage = $('#clist').attr('data-page') ? $('#clist').attr('data-page') : newpage; if(parseInt(cookiepage) < parseInt(thepage)){ ajaxRead(thepage); setcookie('loadpage',thepage,'1'); }else{ ajaxRead(newpage); } }) //页面加载完成 默认显示 $(function(){ var cookiepage = getcookie('loadpage') ? getcookie('loadpage') : '0'; var loadednum = $('#clist').children('li').length; var newpage = Math.ceil(loadednum/10) + 1; var thepage = $('#clist').attr('data-page') ? $('#clist').attr('data-page') : newpage; if(parseInt(cookiepage) < parseInt(thepage)){ ajaxRead(thepage); setcookie('loadpage',thepage,'1'); }else{ ajaxRead(newpage); } }); setcookie('loadpage','0','1'); function show(){ if($(window).scrollTop()+$(window).height()>=$(document).height()){ var cookiepage = getcookie('loadpage') ? getcookie('loadpage') : '0'; var loadednum = $('#clist').children('li').length; var newpage = Math.ceil(loadednum/10) + 1; var thepage = $('#clist').attr('data-page') ? $('#clist').attr('data-page') : newpage; if(parseInt(cookiepage) < parseInt(thepage)){ ajaxRead(thepage); setcookie('loadpage',thepage,'1'); }else{ } } } function ajaxRead(page){ var html=""; var loadednum = $('#clist').children('li').length; var newpage = Math.ceil(loadednum/10) + 1; var thepage = $('#clist').attr('data-page') ? $('#clist').attr('data-page') : newpage; var page = arguments[0] ? arguments[0] : thepage; var thenum = $('#clist').attr('data-num') ? $('#clist').attr('data-num') : '0'; thenum = parseInt(thenum); page = parseInt(page); $.ajax({ type:'get', dataType:'json', url:'http://www.sgcio.com/index.php?m=comment&c=index&a=init&commentid=content_2-26722-1&type=1&page='+page, beforeSend:function(){}, success:function(data){ var theload = $('#clist').attr('data-load') ? $('#clist').attr('data-load') : 'true'; //alert(obj2string(data)); //$('.section-hotchannel').next('.section-show').html(obj2string(data)).css('height','200px').css('overfllow','hidden'); if(obj2string(data) != '[]'){ $('#clist').attr('data-load','ture'); $.each(data,function(i,item){ html+='