var ey_jquery_1624608277 = false;
if (!window.jQuery) {
ey_jquery_1624608277 = true;
} else {
var ey_jq_ver_1624608277 = jQuery.fn.jquery;
if (ey_jq_ver_1624608277 < '1.8.0') {
ey_jquery_1624608277 = true;
}
}
if (ey_jquery_1624608277) {
document.write(unescape("%3Cscript src='"+root_dir_1606379494+"/public/static/common/js/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
document.write(unescape("%3Cscript type='text/javascript'%3E try{jQuery.noConflict();}catch(e){} %3C/script%3E"));
}
if (!window.layer || !layer.v) {
document.write(unescape("%3Cscript src='"+root_dir_1606379494+"/public/plugins/layer-v3.1.0/layer.js' type='text/javascript'%3E%3C/script%3E"));
}
/**
* 收藏、取?
* @return {[type]} [description]
*/
function ey_1606378141(aid,cla,obj)
{
var cancel_1606379494 = window['cancel_1606379494_'+aid];
var collected_1606379494 = window['collected_1606379494_'+aid];
var users_id = getCookie_1606378141('users_id');
if (!users_id) {
if (document.getElementById('ey_login_id_1609665117')) {
$('#ey_login_id_1609665117').trigger('click');
} else {
if (!window.layer) {
alert('请先d');
} else {
var layerindex = layer.alert('请先d', {id: 'layer_collection_1606378141' , icon: 5, title: false}, function(){
window.location.href = loginurl_1606379494;
});
//重新l指定层讑֮top{?
var top = 150;
var top2 = document.getElementById("layer_collection_1606378141").parentNode.style.top;
top2 = top2.replace('px', '');
if (top2 > 150 && top2 < 500) {
top = top2;
}
layer.style(layerindex, {
top: top
});
}
return false;
}
}
//步骤一:创徏异步对象
var ajax = new XMLHttpRequest();
//步骤?讄h的url参数,参数一是请求的cd,参数二是h的url,可以带参?动态的传递参数starName到服务端
ajax.open("post", root_dir_1606379494+"/index.php?m=api&c=Ajax&a=collect_save", true);
// l头部添加ajax信息
ajax.setRequestHeader("X-Requested-With","XMLHttpRequest");
// 如果需要像 HTML 表单那样 POST 数据Q请使用 setRequestHeader() 来添?HTTP 头。然后在 send() Ҏ中规定您希望发送的数据Q?
ajax.setRequestHeader("Content-type","application/x-www-form-urlencoded");
//步骤?发送请?数据
ajax.send('aid='+aid+'&_ajax=1');
//步骤?注册事g onreadystatechange 状态改变就会调?
ajax.onreadystatechange = function () {
//步骤?如果能够q到q个判断 说明 数据 完美的回来了,q且h的页面是存在?
if (ajax.readyState==4 && ajax.status==200) {
var json = ajax.responseText;
var res = JSON.parse(json);
if (1 == res.code) {
if ('on' == cla){
if (res.data.opt == 'add') {
if (cancel_1606379494) {
obj.classList.remove(cancel_1606379494);
}
if (collected_1606379494) {
obj.classList.add(collected_1606379494);
}
if (document.getElementById("ey_cnum_1606379494_"+aid)) {
var collection_num = document.getElementById("ey_cnum_1606379494_"+aid).innerHTML;
collection_num = parseInt(collection_num) + 1;
document.getElementById("ey_cnum_1606379494_"+aid).innerHTML = collection_num;
}
} else {
if (collected_1606379494) {
obj.classList.remove(collected_1606379494);
}
if (cancel_1606379494) {
obj.classList.add(cancel_1606379494);
}
if (document.getElementById("ey_cnum_1606379494_"+aid)) {
var collection_num = document.getElementById("ey_cnum_1606379494_"+aid).innerHTML;
collection_num = parseInt(collection_num) - 1;
if (collection_num < 0) {
collection_num = 0;
}
document.getElementById("ey_cnum_1606379494_"+aid).innerHTML = collection_num;
}
}
}else{
var afterHtml = '';
if (res.data.opt == 'add') {
afterHtml = collected_1606379494;
if (document.getElementById("ey_cnum_1606379494_"+aid)) {
var collection_num = document.getElementById("ey_cnum_1606379494_"+aid).innerHTML;
collection_num = parseInt(collection_num) + 1;
document.getElementById("ey_cnum_1606379494_"+aid).innerHTML = collection_num;
}
} else {
afterHtml = cancel_1606379494;//加入收藏
if (document.getElementById("ey_cnum_1606379494_"+aid)) {
var collection_num = document.getElementById("ey_cnum_1606379494_"+aid).innerHTML;
collection_num = parseInt(collection_num) - 1;
if (collection_num < 0) {
collection_num = 0;
}
document.getElementById("ey_cnum_1606379494_"+aid).innerHTML = collection_num;
}
}
obj.innerHTML = afterHtml;
}
if (!window.layer) {
alert(res.msg);
} else {
layer.msg(res.msg, {time: 1000});
}
}
}
}
}
/**
* 异步判断是否收藏
* @return {[type]} [description]
*/
function ey_1609377550(aid,cla)
{
var cancel_1606379494 = window['cancel_1606379494_'+aid];
var collected_1606379494 = window['collected_1606379494_'+aid];
var users_id = getCookie_1606378141('users_id');
if ((document.getElementById("ey_1606378141_"+aid) || document.getElementById("ey_cnum_1606379494_"+aid)) && 0 < aid) {
var obj = '';
if (document.getElementById("ey_1606378141_"+aid)) {
obj = document.getElementById("ey_1606378141_"+aid);
// 收藏之前的html文案
beforeHtml1595661966 = obj.innerHTML;
// console.log(beforeHtml1595661966);return false;
}
if (0 < users_id) {
// 正在加蝲
var loading = '
';
if (!obj) {
obj.innerHTML = loading;
}
}
//步骤一:创徏异步对象
var ajax = new XMLHttpRequest();
//步骤?讄h的url参数,参数一是请求的cd,参数二是h的url,可以带参?动态的传递参数starName到服务端
ajax.open("get", root_dir_1606379494+"/index.php?m=api&c=Ajax&a=get_collection&aid="+aid, true);
// l头部添加ajax信息
ajax.setRequestHeader("X-Requested-With","XMLHttpRequest");
// 如果需要像 HTML 表单那样 POST 数据Q请使用 setRequestHeader() 来添?HTTP 头。然后在 send() Ҏ中规定您希望发送的数据Q?
ajax.setRequestHeader("Content-type","application/x-www-form-urlencoded");
//步骤?发送请?数据
ajax.send();
//步骤?注册事g onreadystatechange 状态改变就会调?
ajax.onreadystatechange = function () {
//步骤?如果能够q到q个判断 说明 数据 完美的回来了,q且h的页面是存在?
if (ajax.readyState==4 && ajax.status==200) {
var json = ajax.responseText;
var res = JSON.parse(json);
if (1 == res.code) {
if (0 < users_id) {
if ('on' == cla){
if (cancel_1606379494) {
obj.classList.remove(cancel_1606379494);
}
if (collected_1606379494) {
obj.classList.add(collected_1606379494);
}
} else{
// 收藏之后的html文案
if (obj) obj.innerHTML = collected_1606379494;
}
}
if (document.getElementById("ey_cnum_1606379494_"+aid)) {
document.getElementById("ey_cnum_1606379494_"+aid).innerHTML = res.data.total;
}
} else {
if (0 < users_id) {
if ('on' == cla){
if (collected_1606379494) {
obj.classList.remove(collected_1606379494);
}
if (cancel_1606379494) {
obj.classList.add(cancel_1606379494);
}
} else{
// 收藏之后的html文案
if (obj) obj.innerHTML = cancel_1606379494;
}
}
if (document.getElementById("ey_cnum_1606379494_"+aid)) {
document.getElementById("ey_cnum_1606379494_"+aid).innerHTML = res.data.total;
}
}
}
}
}
}
// d cookie
function getCookie_1606378141(c_name)
{
if (document.cookie.length>0)
{
c_start = document.cookie.indexOf(c_name + "=")
if (c_start!=-1)
{
c_start=c_start + c_name.length+1
c_end=document.cookie.indexOf(";",c_start)
if (c_end==-1) c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end))
}
}
return "";
} ձ91