function gosearch()
{
if ($("#weixin_name").val() == "搜索微信号/微信名" || $("#weixin_name").val() == "")
{
alert("请输入搜索微信号/微信名");
return false;
}
return true;
}
function view(id)
{
if (getcookie("v" + id) == "1")
return;
setcookie("v" + id, "1");
$.ajax(
{type: 'POST',
url: '/ajax.php',
data: {'cmd': 'tj', 'id': id},
success: function(msg) {
}});
}
function downpic(id)
{
$.ajax(
{type: 'POST',
url: '/ajax.php',
data: {'cmd': 'downpic', 'id': id},
success: function(msg) {
}});
}
function good(id)
{
if (getcookie("good" + id) == "1")
return;
$.ajax(
{type: 'POST',
url: '/ajax.php',
data: {'cmd': 'good', 'id': id},
success: function(msg) {
$("#goodnum").html(parseInt($("#goodnum").html()) + 1);
setcookie("good" + id, "1");
}});
}
function getcookie(name) {
var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
if (arr != null) {
return (arr[2]);
} else {
return "";
}
}
function setcookie(name, value) {
var Days = 5;
var exp = new Date();
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
}
function setcookie1d(name, value) {
var Days = 1;
var exp = new Date();
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
}
function loadcontent()
{
try {
t = relatekey;
}
catch (e) {
relatekey = "";
}
try {
t = xid;
}
catch (e) {
xid = "";
}
try {
t = orderby;
}
catch (e) {
orderby = "";
}
try {
t = goodacc;
}
catch (e) {
goodacc = "";
}
try {
t = title;
}
catch (e) {
title = "";
}
try {
t = rel_master_contentid;
}
catch (e) {
rel_master_contentid = "";
}
$("#loading").show();
$.ajax(
{
type: 'POST',
url: '/ajax.php',
data: {
'cmd': 'loadcontent',
'pagesize': pagesize,
'page': page,
'category': category,
'account': account,
'relatekey': relatekey,
'xid': xid,
'orderby': orderby,
'goodacc': goodacc,
'title': title,
'rel_master_contentid': rel_master_contentid
},
dataType: "json",
success: function(msg) {
$("#loading").hide();
if (msg.error_code == 0 && msg.content != "")
{
if (msg.page == page)
{
$(".news_list > .news_content > ul").append(msg.content);
page++;
}
}
else
rqmore = false;
}}
);
}
function delcomment(id)
{
$.ajax(
{
type: 'POST',
url: '/ajax.php',
data: {
'cmd': 'delcomment',
'id': id,
},
dataType: "json",
success: function(msg) {
if (msg.error_code == 0)
{
alert("删除成功");
loadcomment(1, false);
} else if (msg.error_code == 8685)
{
alert("请先登录");
window.location = '/login';
}
else
{
alert(msg.error_message);
}
}}
);
}
function initfollowbutton1(btn)
{
$(btn).html('订阅');
$(btn).unbind("click");
$(btn).removeClass("subscribe_off");
$(btn).addClass("subscribe_on");
$(btn).click(function()
{
$.ajax(
{
type: 'POST',
url: '/ajax.php',
data: {
'cmd': 'gz',
'followid': $(btn).attr("account"),
},
dataType: "json",
success: function(msg) {
if (msg.error_code == 0)
{
initfollowbutton2(btn)
} else if (msg.error_code == 8685)
{
alert("请先登录");
window.location = '/login';
}
else
{
alert(msg.error_message);
}
}}
);
});
}
function initfollowbutton2(btn)
{
$(btn).html("取消订阅");
$(btn).unbind("click");
$(btn).removeClass("subscribe_on");
$(btn).addClass("subscribe_off");
$(btn).click(function()
{
$.ajax(
{
type: 'POST',
url: '/ajax.php',
data: {
'cmd': 'qxgz',
'followid': $(btn).attr("account"),
},
dataType: "json",
success: function(msg) {
if (msg.error_code == 0)
{
initfollowbutton1(btn)
} else if (msg.error_code == 8685)
{
alert("请先登录");
window.location = '/login';
}
else
{
alert(msg.error_message);
}
}}
);
});
}
function initbtn(btn)
{
$.ajax(
{
type: 'POST',
url: '/ajax.php',
data: {
'cmd': 'isgz',
'followid': $(btn).attr("account"),
},
dataType: "json",
success: function(msg) {
try {
if (msg.error_code == 0)//已经关注
{
initfollowbutton2($(btn))
}
else
{
initfollowbutton1($(btn))
}
} catch (e) {
}
}}
);
}
function initfollowbutton()
{
$(".followaccount").each(
function() {
initbtn($(this));
}
);
}
function reg1()
{
if (!$("#agreement").attr("checked"))
{
alert("请阅读并同意注册协议");
return false;
}
if (check_register_tel() && check_register_password1() && check_register_password2())
return true;
else
return false;
}
function resendtelcode()
{
$.ajax(
{
type: 'POST',
url: '/ajax.php',
data: {
'cmd': 'sendsmsregcode',
'register_tel': $("#register_tel").val(),
},
dataType: "json",
success: function(msg) {
try {
if (msg.error_code == 0)//已经关注
{
alert("发送成功");
}
else
{
alert(msg.error_message);
}
} catch (e) {
}
}}
);
}
function resendtelcode2()
{
$.ajax(
{
type: 'POST',
url: '/ajax.php',
data: {
'cmd': 'sendsmsrecoverycode',
'register_tel': $("#back_tel").val(),
},
dataType: "json",
success: function(msg) {
try {
if (msg.error_code == 0)//已经关注
{
alert("发送成功");
}
else
{
alert(msg.error_message);
}
} catch (e) {
}
}}
);
}
function dologin()
{
if (check_login_password() && check_user_name())
return true;
else
return false;
}
function ckrecovery1()
{
if (check_back_code() && check_back_code())
return true;
else
return false;
}
function ckrecovery2()
{
if (check_password1() && check_password2())
return true;
else
return false;
}
var getReferrer = function() {
var referrer = '';
try {
referrer = window.top.document.referrer;
} catch (e) {
if (window.parent) {
try {
referrer = window.parent.document.referrer;
} catch (e2) {
referrer = '';
}
}
}
if (referrer === '') {
referrer = document.referrer;
}
return referrer;
};
function tjgc()
{
var refer = getReferrer();
var regx = /^http:\/\/m\.weixinyidu\.com\/api\/gc\/iframe\.php/i;
if (regx.test(refer))
{
_czc.push(["_trackEvent", "来路", "iframe"]);
return;
}
var regx = /^http:\/\/q\.8684\.com\//i;
if (regx.test(refer))
{
_czc.push(["_trackEvent", "来路", "q.8684.com"]);
return;
}
var regx = /^http:\/\/qu\.8684\.com\//i;
if (regx.test(refer))
{
_czc.push(["_trackEvent", "来路", "qu.8684.com"]);
return;
}
var regx = /^http:\/\/[^\/]+\.8684\.cn\//i;
if (regx.test(refer))
{
_czc.push(["_trackEvent", "来路", "8684.cn"]);
return;
}
var regx = /^http:\/\/[^\/]+\.8684\.com\//i;
if (regx.test(refer))
{
_czc.push(["_trackEvent", "来路", "其他8684.com"]);
return;
}
}
function initfavbutton()
{
$(".collectionbtn").click(
function(){
if($(".collectionbtn").html()=="已收藏")
{
$.ajax({
type: 'POST',
url: '/ajax.php',
data: {
'cmd': 'qxsc',
'favid': favid,
},
dataType: "json",
success: function(msg) {
try {
if (msg.error_code == 0)//已经关注
{
$(".collectionbtn").html('收藏');
$(".collectionbtn").removeClass('subscribe_off');
$(".collectionbtn").addClass('subscribe_on');
//$(".collectionbtn").hide();
//initfollowbutton2($(btn))
}
if (msg.error_code == 8684)
{
alert(msg.error_message);
}
if (msg.error_code == 8685)
{
window.location='/login';
}
} catch (e) {
}
}});
}
else
{
$.ajax({
type: 'POST',
url: '/ajax.php',
data: {
'cmd': 'sc',
'favid': favid,
},
dataType: "json",
success: function(msg) {
try {
if (msg.error_code == 0)//已经关注
{
$(".collectionbtn").html("已收藏");
$(".collectionbtn").removeClass('subscribe_on');
$(".collectionbtn").addClass('subscribe_off');
//$(".collectionbtn").hide();
//initfollowbutton2($(btn))
}
if (msg.error_code == 8684)
{
alert(msg.error_message);
}
if (msg.error_code == 8685)
{
window.location='/login';
}
} catch (e) {
}
}});
}
}
);
try{x=favid;}catch(e){favid=0;}
$.ajax(
{
type: 'POST',
url: '/ajax.php',
data: {
'cmd': 'issc',
'favid': favid,
},
dataType: "json",
success: function(msg) {
try {
if (msg.error_code == 0)//已经关注
{
$(".collectionbtn").html("已收藏");
$(".collectionbtn").removeClass('subscribe_on');
$(".collectionbtn").addClass('subscribe_off');
//$(".collectionbtn").hide();
//initfollowbutton2($(btn))
}
else
{
$(".collectionbtn").html('收藏');
$(".collectionbtn").show();
}
} catch (e) {
}
}}
);
}
$(document).ready(function(e) {
initfollowbutton();
initfavbutton();
tjgc();
$('.news_list .newsLoadMore').on('click',function(){
if($(this).html() == '没有更多内容了'){return false;}
try{
if(rqmore){
loadcontent();
}else{
$(this).html('没有更多内容了');
}
}catch(e){}
});
});