87,997
社区成员




thisCps = $(this).attr('cps');//CID
bookHis = thisTitle + "+" + thisUrl+ "+" +thisCps;
if(bookRead != null && bookRead != 'undefined'){
for(i=0;i<readList.length;i++){//serach
ibookInfo = readList[i].split("+");
if(ibookInfo[0] == thisTitle && ibookInfo[1] == thisUrl && ibookInfo[2] == thisCps){//tit id cps
return false;
}else if(ibookInfo[0] == thisTitle && ibookInfo[1] == thisUrl && ibookInfo[2] != thisCps){//tit id
console.log(i,ibookInfo,bookHis,bookRead);
//Cookie.set("bookH5Read", bookHis + "," + bookRead);
}else{
}
}
}else{
Cookie.set("bookH5Read", bookHis);
}
for(i=0;i<readList.length;i++){//serach
ibookInfo = readList[i].split("+");
if(ibookInfo[0] == thisTitle && ibookInfo[1] == thisUrl && ibookInfo[2] == thisCps){//tit id cps
return false;
}else if(readList[i].indexOf(thisTitle + "+" + thisUrl+ "+")==0){//tit id
readList[i] = bookHis;
Cookie.set("bookH5Read", readList);
break;
}
}
if(i==readList.length){
Cookie.set("bookH5Read", bookHis + "," + bookRead);
}
//昨天晚上已经搞定了。
琢磨的好久,才想到这么替换当前I。
readList[i] = bookHis;
var Cookie = {
set: function(name, value, expires, path, domain) {
if (typeof expires == "undefined") {
expires = new Date(new Date().getTime() + 1000 * 3600 * 24 * 365);
}
document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path: "; path=/") + ((domain) ? ";domain=" + domain: "");
},
get: function(name) {
var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
if (arr != null) {
return unescape(arr[2]);
}
return null;
},
clear: function(name, path, domain) {
if (this.get(name)) {
document.cookie = name + "=" + ((path) ? "; path=" + path: "; path=/") + ((domain) ? "; domain=" + domain: "") + ";expires=Fri, 02-Jan-1970 00:00:00 GMT";
}
}
};
//Cookie操作。
thisCps = $(this).attr('cps');//CID
bookHis = thisTitle + "+" + thisUrl+ "+" +thisCps;
if (bookRead != null && bookRead != 'undefined') {
var find = false;
for(i=0;i<readList.length;i++){
ibookInfo = readList[i].split("+");
if (ibookInfo[1] == thisUrl ) {//找到此项更新
readList[i] = bookHis;
find = true;
break;
}
}
if (!find) readList[readList.length] = bookHis;////////////新增
//你应该更新整个cookie吧,cookie存储readList,而不是bookHis。。而且bookHis是什么鬼。。
Cookie.set("bookH5Read", readList);
}else{
//Cookie.set("bookH5Read", bookHis);
}
for(i=0;i<readList.length;i++){//serach
ibookInfo = readList[i].split("+");
if(ibookInfo[0] == thisTitle && ibookInfo[1] == thisUrl && ibookInfo[2] == thisCps){//tit id cps
return false;
//}else if(ibookInfo[0] == thisTitle && ibookInfo[1] == thisUrl && ibookInfo[2] != thisCps){//tit id
}else if(readList[i].indexOf(thisTitle + "+" + thisUrl+ "+")==0){//tit id
Cookie.set("bookH5Read", bookHis);
break;
}
}
if(i==readList.length){
Cookie.set("bookH5Read", bookHis + "," + bookRead);
}
thisCps = $(this).attr('cps');//CID
bookHis = thisTitle + "+" + thisUrl+ "+" +thisCps;
if(bookRead != null && bookRead != 'undefined'){
for(i=0;i<readList.length;i++){//serach
if(readList[i]==bookHis){//tit id cps
return false;
}else if(readList[i].indexOf(thisTitle + "+" + thisUrl+ "+")==0){//tit id
console.log(i,ibookInfo,bookHis,bookRead);
//Cookie.set("bookH5Read", bookHis + "," + bookRead);
}else{
}
}
}else{
Cookie.set("bookH5Read", bookHis);
}
for(i=0;i<readList.length;i++){//serach
ibookInfo = readList[i].split("+");
if(ibookInfo[0] == thisTitle && ibookInfo[1] == thisUrl && ibookInfo[2] == thisCps){//tit id cps
return false;
//}else if(ibookInfo[0] == thisTitle && ibookInfo[1] == thisUrl && ibookInfo[2] != thisCps){//tit id
}else if(readList[i].indexOf(thisTitle + "+" + thisUrl+ "+")==0){//tit id
//console.log(i,readList[i],ibookInfo,bookHis,bookRead);
Cookie.set("bookH5Read", bookHis);
}else{
Cookie.set("bookH5Read", bookHis + "," + bookRead);
}
}