//loading //收藏 function digg(catid,id) { $.getJSON('http://www.sgcio.com/index.php?m=digg&c=index&a=post&id='+catid+'-'+id+'-1&typeid=1&'+Math.random()+'&callback=?', function(data){ if(data.status==1) { if(data.isup==1){ layer.msg('收藏成功'); $('#digg_'+catid+'-'+id).addClass('cur'); }else{ layer.msg('取消收藏'); $('#digg_'+catid+'-'+id).removeClass('cur'); } }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%2Finformatization%2Fnyhlw%2F&siteid=1"; }); } }) } var userid = ''; if(userid){ $(function(){ $(".joke_list ul li").each(function(){ var id = $(this).find('.btn_digg').attr('id'); id = id.substring(6,id.length); $.getJSON('http://www.sgcio.com/index.php?m=digg&c=index&a=get&id='+id+'-1&typeid=1&'+Math.random()+'&callback=?', function(data){ var userid = ''; if(userid){ if(data.data!=0){ layer.msg('收藏成功'); $('#digg_'+id).addClass('cur'); }else { //layer.msg('取消收藏'); $('#digg_'+id).removeClass('cur'); } }else{ } }) }); }); } //nav $(function(){ $(".cat-668").addClass("cur"); $(".cat-36").addClass("cur"); $(".cat-0").addClass("cur"); }); //search // $(document).on("click", ".btn-search", function() { if($('#q').val() == ''){ var typeid = $('#typeid').attr('data'); if(typeid!=''){ $('#typeid-'+typeid).addClass('on'); }else{ $('#typeid-0').addClass('on'); } layer.msg('请输入关键词'); $('#q').focus(); return false; }else{ var keyword = $('#q').val(); var typeid = $('#typeid').attr('data'); if(typeid && typeid != '0'){ window.location.href = 'http://www.sgcio.com/'+typeid+'/search/'+encodeURIComponent(keyword); }else{ window.location.href = 'http://www.sgcio.com/search/'+encodeURIComponent(keyword); } } }) if($.isFunction(keyDownSearch)){ }else{ document.onkeydown=keyDownSearch; function keyDownSearch(e) { var theEvent = e || window.event; var code = theEvent.keyCode || theEvent.which || theEvent.charCode; if (code == 13 && $('#q').val() != '') { if($('#q').val() == ''){ layer.msg('请输入关键词'); $('#q').focus(); return false; }else{ var keyword = $('#q').val(); var typeid = $('#typeid').attr('data'); if(typeid && typeid != '0'){ window.location.href = 'http://www.sgcio.com/'+typeid+'/search/'+encodeURIComponent(keyword); }else{ window.location.href = 'http://www.sgcio.com/search/'+encodeURIComponent(keyword); } } return false; } return true; } } //if (document.location.host != "www.sgcio.com") { //location.href = location.href.replace(document.location.host,'www.sgcio.com'); //} //feedback function suggest(e) { var userid = ''; layer.open({ type: 2, title: '建议反馈', closeBtn: 1, area: ['500px', '350px'], skin: 'layui-layer-nobg', //没有背景色 shadeClose: true, content: ['http://www.sgcio.com/index.php?m=formguide&c=index&a=show&formid=46&siteid=1&&userid='+userid+'&url='+encodeURIComponent(location.href)+'&pop=1', 'no'] }); }