debug
This commit is contained in:
110
code/public/template/default/h5/js/common.js
Normal file
110
code/public/template/default/h5/js/common.js
Normal file
@@ -0,0 +1,110 @@
|
||||
function qsskel(o){function w(b,a){return(b<<a)|(b>>>(32-a))}function E(k,b){var U,a,d,x,c;d=(k&2147483648);x=(b&2147483648);U=(k&1073741824);a=(b&1073741824);c=(k&1073741823)+(b&1073741823);if(U&a){return(c^2147483648^d^x)}if(U|a){if(c&1073741824){return(c^3221225472^d^x)}else{return(c^1073741824^d^x)}}else{return(c^d^x)}}function s(a,c,b){return(a&c)|((~a)&b)}function r(a,c,b){return(a&b)|(c&(~b))}function q(a,c,b){return(a^c^b)}function p(a,c,b){return(c^(a|(~b)))}function f(V,U,Z,Y,k,W,X){V=E(V,E(E(s(U,Z,Y),k),X));return E(w(V,W),U)}function C(V,U,Z,Y,k,W,X){V=E(V,E(E(r(U,Z,Y),k),X));return E(w(V,W),U)}function t(V,U,Z,Y,k,W,X){V=E(V,E(E(q(U,Z,Y),k),X));return E(w(V,W),U)}function e(V,U,Z,Y,k,W,X){V=E(V,E(E(p(U,Z,Y),k),X));return E(w(V,W),U)}function g(k){var V;var d=k.length;var c=d+8;var b=(c-(c%64))/64;var U=(b+1)*16;var W=Array(U-1);var a=0;var x=0;while(x<d){V=(x-(x%4))/4;a=(x%4)*8;W[V]=(W[V]|(k.charCodeAt(x)<<a));x++}V=(x-(x%4))/4;a=(x%4)*8;W[V]=W[V]|(128<<a);W[U-2]=d<<3;W[U-1]=d>>>29;return W}function G(c){var b="",d="",k,a;for(a=0;a<=3;a++){k=(c>>>(a*8))&255;d="0"+k.toString(16);b=b+d.substr(d.length-2,2)}return b}function u(b){b=b.replace(/\r\n/g,"\n");var a="";for(var k=0;k<b.length;k++){var d=b.charCodeAt(k);if(d<128){a+=String.fromCharCode(d)}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}return a}var D=Array();var K,i,F,v,h,T,S,R,Q;var N=7,L=12,I=17,H=22;var B=5,A=9,z=14,y=20;var n=4,m=11,l=16,j=23;var P=6,O=10,M=15,J=21;o=u(o);D=g(o);T=1732584193;S=4023233417;R=2562383102;Q=271733878;for(K=0;K<D.length;K+=16){i=T;F=S;v=R;h=Q;T=f(T,S,R,Q,D[K+0],N,3614090360);Q=f(Q,T,S,R,D[K+1],L,3905402710);R=f(R,Q,T,S,D[K+2],I,606105819);S=f(S,R,Q,T,D[K+3],H,3250441966);T=f(T,S,R,Q,D[K+4],N,4118548399);Q=f(Q,T,S,R,D[K+5],L,1200080426);R=f(R,Q,T,S,D[K+6],I,2821735955);S=f(S,R,Q,T,D[K+7],H,4249261313);T=f(T,S,R,Q,D[K+8],N,1770035416);Q=f(Q,T,S,R,D[K+9],L,2336552879);R=f(R,Q,T,S,D[K+10],I,4294925233);S=f(S,R,Q,T,D[K+11],H,2304563134);T=f(T,S,R,Q,D[K+12],N,1804603682);Q=f(Q,T,S,R,D[K+13],L,4254626195);R=f(R,Q,T,S,D[K+14],I,2792965006);S=f(S,R,Q,T,D[K+15],H,1236535329);T=C(T,S,R,Q,D[K+1],B,4129170786);Q=C(Q,T,S,R,D[K+6],A,3225465664);R=C(R,Q,T,S,D[K+11],z,643717713);S=C(S,R,Q,T,D[K+0],y,3921069994);T=C(T,S,R,Q,D[K+5],B,3593408605);Q=C(Q,T,S,R,D[K+10],A,38016083);R=C(R,Q,T,S,D[K+15],z,3634488961);S=C(S,R,Q,T,D[K+4],y,3889429448);T=C(T,S,R,Q,D[K+9],B,568446438);Q=C(Q,T,S,R,D[K+14],A,3275163606);R=C(R,Q,T,S,D[K+3],z,4107603335);S=C(S,R,Q,T,D[K+8],y,1163531501);T=C(T,S,R,Q,D[K+13],B,2850285829);Q=C(Q,T,S,R,D[K+2],A,4243563512);R=C(R,Q,T,S,D[K+7],z,1735328473);S=C(S,R,Q,T,D[K+12],y,2368359562);T=t(T,S,R,Q,D[K+5],n,4294588738);Q=t(Q,T,S,R,D[K+8],m,2272392833);R=t(R,Q,T,S,D[K+11],l,1839030562);S=t(S,R,Q,T,D[K+14],j,4259657740);T=t(T,S,R,Q,D[K+1],n,2763975236);Q=t(Q,T,S,R,D[K+4],m,1272893353);R=t(R,Q,T,S,D[K+7],l,4139469664);S=t(S,R,Q,T,D[K+10],j,3200236656);T=t(T,S,R,Q,D[K+13],n,681279174);Q=t(Q,T,S,R,D[K+0],m,3936430074);R=t(R,Q,T,S,D[K+3],l,3572445317);S=t(S,R,Q,T,D[K+6],j,76029189);T=t(T,S,R,Q,D[K+9],n,3654602809);Q=t(Q,T,S,R,D[K+12],m,3873151461);R=t(R,Q,T,S,D[K+15],l,530742520);S=t(S,R,Q,T,D[K+2],j,3299628645);T=e(T,S,R,Q,D[K+0],P,4096336452);Q=e(Q,T,S,R,D[K+7],O,1126891415);R=e(R,Q,T,S,D[K+14],M,2878612391);S=e(S,R,Q,T,D[K+5],J,4237533241);T=e(T,S,R,Q,D[K+12],P,1700485571);Q=e(Q,T,S,R,D[K+3],O,2399980690);R=e(R,Q,T,S,D[K+10],M,4293915773);S=e(S,R,Q,T,D[K+1],J,2240044497);T=e(T,S,R,Q,D[K+8],P,1873313359);Q=e(Q,T,S,R,D[K+15],O,4264355552);R=e(R,Q,T,S,D[K+6],M,2734768916);S=e(S,R,Q,T,D[K+13],J,1309151649);T=e(T,S,R,Q,D[K+4],P,4149444226);Q=e(Q,T,S,R,D[K+11],O,3174756917);R=e(R,Q,T,S,D[K+2],M,718787259);S=e(S,R,Q,T,D[K+9],J,3951481745);T=E(T,i);S=E(S,F);R=E(R,v);Q=E(Q,h)}return(G(T)+G(S)+G(R)+G(Q)).toLowerCase()};
|
||||
|
||||
jq = jQuery.noConflict();//重定义JQ
|
||||
// var varslehj3 = qsskel(jq.cookie('user_id') + jq.cookie('user_name') + kdeh2);
|
||||
// if(jq.cookie('user_name')){//登录判断
|
||||
// var user_name = jq.cookie('user_name');
|
||||
// jq('#qs_login').html('<a href=\"/mybook.html\" title=\"访问会员书架\">书架</a>');
|
||||
// jq('#register').html('<a href=\"javascript:qs_logout();\">退出</a>');
|
||||
// }else{
|
||||
// jq('#qs_login').html('<a href=\"/login.html?url='+lg_url+'\">登录</a>');
|
||||
// jq('#register').html('<a href=\"/register.html?url='+lg_url+'\">注册</a>');
|
||||
// }
|
||||
|
||||
// function qs_logout(){//退出登录
|
||||
// jq.removeCookie(varslehj3,{ path: '/'});
|
||||
// jq.removeCookie('user_id',{ path: '/'});
|
||||
// jq.removeCookie('user_name',{ path: '/'});
|
||||
// window.location.reload();
|
||||
// }
|
||||
|
||||
// function login(lg_url){//用户登录
|
||||
// user_name = document.getElementById("user_name").value;
|
||||
// user_pass = qsskel(document.getElementById("user_pass").value);
|
||||
// user_code = document.getElementById("user_code").value;
|
||||
// jq.post('/qs_login_go.php',{'user_name':user_name,'user_pass':user_pass,'user_code':user_code},
|
||||
// function(data){
|
||||
// data=data.replace(/\s/g,'');data=data.split("|");
|
||||
// erword=data[1];
|
||||
// if(data[0]==1){
|
||||
// window.location.href = lg_url;
|
||||
// }
|
||||
// else{
|
||||
// reloadcode();
|
||||
// jq('#shuqian').html('<div class=\"dvfd\"><span class=red>'+erword+'</span><a href=\"javascript:shanchusc();\" class=\"qdbtn\">确 定</a></div>');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// function register(lg_url){//用户注册
|
||||
// name = document.getElementById("name").value;
|
||||
// mobile = document.getElementById("mobile").value;
|
||||
// pass = qsskel(document.getElementById("pass").value);
|
||||
// pass2 = qsskel(document.getElementById("pass2").value);
|
||||
// code = document.getElementById("code").value;
|
||||
// if(pass == pass2){
|
||||
// jq.post('/qs_register_go.php',{'name':name,'mobile':mobile,'pass':pass,'pass2':pass2,'code':code},
|
||||
// function(data){
|
||||
// data=data.replace(/\s/g,'');data=data.split('|');
|
||||
// erword=data[1];
|
||||
// if(data[0]==1){
|
||||
// window.location.href = lg_url;
|
||||
// }
|
||||
// else{
|
||||
// reloadcode();
|
||||
// jq('#shuqian').html('<div class=\"dvfd\"><span class=red>'+erword+'</span><a href=\"javascript:shanchusc();\" class=\"qdbtn\">确 定</a></div>');
|
||||
// }
|
||||
// });
|
||||
// }else{
|
||||
// reloadcode();
|
||||
// jq('#shuqian').html('<div class=\"dvfd\"><span class=red>两次密码不一致</span><a href=\"javascript:shanchusc();\" class=\"qdbtn\">确 定</a></div>');
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
function case_del(aid,xstitle){//从书架删除小说
|
||||
jq.post("/ajax.php",{"aid":aid,"case_del":"1"},function(data){
|
||||
jq("#"+aid).html("<span class=\"s5\">删除中</span>");if(data != ""){
|
||||
jq("#"+aid).html("<span class=\"s5\">已删除</span>");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function shanchusc(){document.getElementById('shuqian').innerHTML = '';}//清空shuqian DIV
|
||||
function addbookcase(url,aid){//添加小说到书架
|
||||
jq.get('/ajax.php',{'addbookcase':'1','url':url,'aid':aid},
|
||||
function(data){
|
||||
data=data.replace(/\s/g,'');data=data.split("|");
|
||||
if(data[0]==1){
|
||||
jq('#shuqian').animate({left:"-5px"},20).animate({left:"10px"},20).animate({left:"-10px"},20).animate({left:"0px"},20).html('<div class=\"dvfd\"><span class=red>添加成功</span><a href=\"javascript:shanchusc();\" class=\"qdbtn\">确 定</a></div>');
|
||||
}
|
||||
else{
|
||||
window.location.href = "/login.html?url="+data[1];
|
||||
}
|
||||
});
|
||||
}
|
||||
function shuqian(aid,cid,url){//存书签
|
||||
//alert("shuqian");
|
||||
jq.get('/ajax.php',{'addmark':'1','url':url,'aid':aid,'cid':cid},
|
||||
function(data){
|
||||
data=data.replace(/\s/g,'');data=data.split("|");
|
||||
if(data[0]==1){
|
||||
jq('#shuqian').animate({left:"-5px"},20).animate({left:"10px"},20).animate({left:"-10px"},20).animate({left:"0px"},20).html('<div class=\"dvfd\"><span class=red>书签已保存</span><a href=\"javascript:shanchusc();\" class=\"qdbtn\">确 定</a></div>');
|
||||
}
|
||||
else{
|
||||
window.location.href = "/login.html?url="+data[1];
|
||||
}
|
||||
});
|
||||
}
|
||||
function shuqian2(t){
|
||||
var t = t.replace(/\s/g,'');
|
||||
//alert(t);
|
||||
var a = t.split("|");
|
||||
if(a[0]==1){
|
||||
jq("#shuqian").html("<div class=\"dvfd\"><span class=red>收藏成功</span><a href=\"javascript:shanchusc();\" class=\"qdbtn\">确 定</a></div>");
|
||||
}
|
||||
if(a[0]==0){
|
||||
window.location.href = "/login.php?url="+a[1];
|
||||
}
|
||||
}
|
||||
4413
code/public/template/default/h5/js/jquery.min.js
vendored
Normal file
4413
code/public/template/default/h5/js/jquery.min.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
554
code/public/template/default/h5/js/yueduqsbs.js
Normal file
554
code/public/template/default/h5/js/yueduqsbs.js
Normal file
@@ -0,0 +1,554 @@
|
||||
//var qsbs = { _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", aa: function (input) { var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; input = qsbs._utf8_encode(input); while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64 } else if (isNaN(chr3)) { enc4 = 64 } output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4) } return output }, bb: function (input) { var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) { enc1 = this._keyStr.indexOf(input.charAt(i++)); enc2 = this._keyStr.indexOf(input.charAt(i++)); enc3 = this._keyStr.indexOf(input.charAt(i++)); enc4 = this._keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) { output = output + String.fromCharCode(chr2) } if (enc4 != 64) { output = output + String.fromCharCode(chr3) } } output = qsbs._utf8_decode(output); return output }, _utf8_encode: function (string) { string = string.replace(/\r\n/g, "\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c) } else if ((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128) } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128) } } return utftext }, _utf8_decode: function (utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while (i < utftext.length) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++ } else if ((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i + 1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2 } else { c2 = utftext.charCodeAt(i + 1); c3 = utftext.charCodeAt(i + 2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3 } } return string } }
|
||||
function cleanMaliciousCode(decodedStr) {
|
||||
// 定义一系列的恶意代码和关键字
|
||||
const maliciousPatterns = [
|
||||
/eval\s*\(/gi, // 检测 eval
|
||||
/document\.location/gi, // 页面跳转
|
||||
/window\.location/gi, // 页面跳转
|
||||
/window\.location\.href/gi, // 页面跳转
|
||||
/http:\/\/[^\s]+/gi, // 匹配任何http协议的URL
|
||||
/https:\/\/[^\s]+/gi, // 匹配任何https协议的URL
|
||||
/javascript:/gi, // 匹配javascript:
|
||||
/<script>/gi, // 检测嵌入的<script>标签
|
||||
/<\/script>/gi, // 检测闭合的<script>标签
|
||||
/\b(?:[a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,}\b/gi ,// 匹配任何域名,如 example.com
|
||||
/m.23wx.com/gi, // 检测闭合的<script>标签
|
||||
/23wx.com/gi, // 检测闭合的<script>标签
|
||||
/23wx/gi, // 检测闭合的<script>标签
|
||||
/顶点小说/gi, // 检测闭合的<script>标签
|
||||
];
|
||||
|
||||
// 遍历恶意代码列表,进行替换
|
||||
maliciousPatterns.forEach(pattern => {
|
||||
decodedStr = decodedStr.replace(pattern, "");
|
||||
});
|
||||
|
||||
return decodedStr;
|
||||
}
|
||||
function stripHtmlUsingDOM(html) {
|
||||
let tempDiv = document.createElement("div");
|
||||
tempDiv.innerHTML = html;
|
||||
return tempDiv.innerText || tempDiv.textContent;
|
||||
}
|
||||
var qsbs = {
|
||||
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
||||
|
||||
aa: function (input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
input = qsbs._utf8_encode(input);
|
||||
|
||||
while (i < input.length) {
|
||||
chr1 = input.charCodeAt(i++);
|
||||
chr2 = input.charCodeAt(i++);
|
||||
chr3 = input.charCodeAt(i++);
|
||||
enc1 = chr1 >> 2;
|
||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||
enc4 = chr3 & 63;
|
||||
|
||||
if (isNaN(chr2)) {
|
||||
enc3 = enc4 = 64;
|
||||
} else if (isNaN(chr3)) {
|
||||
enc4 = 64;
|
||||
}
|
||||
|
||||
output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
|
||||
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
bb: function (input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3;
|
||||
var enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||
|
||||
while (i < input.length) {
|
||||
enc1 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc2 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc3 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc4 = this._keyStr.indexOf(input.charAt(i++));
|
||||
|
||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||
|
||||
output = output + String.fromCharCode(chr1);
|
||||
if (enc3 != 64) {
|
||||
output = output + String.fromCharCode(chr2);
|
||||
}
|
||||
if (enc4 != 64) {
|
||||
output = output + String.fromCharCode(chr3);
|
||||
}
|
||||
}
|
||||
|
||||
output = qsbs._utf8_decode(output);
|
||||
return output;
|
||||
},
|
||||
|
||||
bbb: function (input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3;
|
||||
var enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||
|
||||
while (i < input.length) {
|
||||
enc1 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc2 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc3 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc4 = this._keyStr.indexOf(input.charAt(i++));
|
||||
|
||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||
|
||||
output = output + String.fromCharCode(chr1);
|
||||
if (enc3 != 64) {
|
||||
output = output + String.fromCharCode(chr2);
|
||||
}
|
||||
if (enc4 != 64) {
|
||||
output = output + String.fromCharCode(chr3);
|
||||
}
|
||||
}
|
||||
|
||||
output = qsbs._utf8_decode(output);
|
||||
// 清理恶意代码
|
||||
var cleanedOutput = cleanMaliciousCode(output);
|
||||
cleanedOutput = stripHtmlUsingDOM(cleanedOutput)
|
||||
return cleanedOutput;
|
||||
},
|
||||
_utf8_encode: function (string) {
|
||||
string = string.replace(/\r\n/g, "\n");
|
||||
var utftext = "";
|
||||
for (var n = 0; n < string.length; n++) {
|
||||
var c = string.charCodeAt(n);
|
||||
if (c < 128) {
|
||||
utftext += String.fromCharCode(c);
|
||||
} else if ((c > 127) && (c < 2048)) {
|
||||
utftext += String.fromCharCode((c >> 6) | 192);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
} else {
|
||||
utftext += String.fromCharCode((c >> 12) | 224);
|
||||
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
}
|
||||
return utftext;
|
||||
},
|
||||
|
||||
_utf8_decode: function (utftext) {
|
||||
var string = "";
|
||||
var i = 0;
|
||||
var c = c1 = c2 = 0;
|
||||
|
||||
while (i < utftext.length) {
|
||||
c = utftext.charCodeAt(i);
|
||||
if (c < 128) {
|
||||
string += String.fromCharCode(c);
|
||||
i++;
|
||||
} else if ((c > 191) && (c < 224)) {
|
||||
c2 = utftext.charCodeAt(i + 1);
|
||||
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
||||
i += 2;
|
||||
} else {
|
||||
c2 = utftext.charCodeAt(i + 1);
|
||||
c3 = utftext.charCodeAt(i + 2);
|
||||
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
return string;
|
||||
}
|
||||
};
|
||||
var _num = 100;
|
||||
|
||||
function LastRead(){
|
||||
this.bookList="bookList"
|
||||
}
|
||||
LastRead.prototype={
|
||||
set:function(bid,tid,title,texttitle,read_page,author,tmpbook){
|
||||
if(!(bid&&tid&&title&&texttitle,read_page))return;
|
||||
var v=bid+'#'+tid+'#'+title+'#'+texttitle+'#'+read_page+'#'+author+'#'+tmpbook;
|
||||
this.setItem(bid,v);
|
||||
this.setBook(bid)
|
||||
},
|
||||
|
||||
get:function(k){
|
||||
return this.getItem(k)?this.getItem(k).split("#"):"";
|
||||
},
|
||||
|
||||
remove:function(k){
|
||||
this.removeItem(k);
|
||||
this.removeBook(k)
|
||||
},
|
||||
|
||||
setBook:function(v){
|
||||
var reg=new RegExp("(^|#)"+v);
|
||||
var books = this.getItem(this.bookList);
|
||||
if(books==""){
|
||||
books=v
|
||||
}
|
||||
else{
|
||||
if(books.search(reg)==-1){
|
||||
books+="#"+v
|
||||
}
|
||||
else{
|
||||
books.replace(reg,"#"+v)
|
||||
}
|
||||
}
|
||||
this.setItem(this.bookList,books)
|
||||
|
||||
},
|
||||
|
||||
getBook:function(){
|
||||
var v=this.getItem(this.bookList)?this.getItem(this.bookList).split("#"):Array();
|
||||
var books=Array();
|
||||
if(v.length){
|
||||
|
||||
for(var i=0;i<v.length;i++){
|
||||
var tem=this.getItem(v[i]).split('#');
|
||||
if(i>v.length-(_num+1)){
|
||||
if (tem.length>3) books.push(tem);
|
||||
}
|
||||
else{
|
||||
lastread.remove(tem[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return books
|
||||
},
|
||||
|
||||
removeBook:function(v){
|
||||
var reg=new RegExp("(^|#)"+v);
|
||||
var books = this.getItem(this.bookList);
|
||||
if(!books){
|
||||
books=""
|
||||
}
|
||||
else{
|
||||
if(books.search(reg)!=-1){
|
||||
books=books.replace(reg,"")
|
||||
}
|
||||
|
||||
}
|
||||
this.setItem(this.bookList,books)
|
||||
|
||||
},
|
||||
|
||||
setItem:function(k,v){
|
||||
if(!!window.localStorage){
|
||||
localStorage.setItem(k,v);
|
||||
}
|
||||
else{
|
||||
var expireDate=new Date();
|
||||
var EXPIR_MONTH=30*24*3600*1000;
|
||||
expireDate.setTime(expireDate.getTime()+12*EXPIR_MONTH)
|
||||
document.cookie=k+"="+encodeURIComponent(v)+";expires="+expireDate.toGMTString()+"; path=/";
|
||||
}
|
||||
},
|
||||
|
||||
getItem:function(k){
|
||||
var value=""
|
||||
var result=""
|
||||
if(!!window.localStorage){
|
||||
result=window.localStorage.getItem(k);
|
||||
value=result||"";
|
||||
}
|
||||
else{
|
||||
var reg=new RegExp("(^| )"+k+"=([^;]*)(;|\x24)");
|
||||
var result=reg.exec(document.cookie);
|
||||
if(result){
|
||||
value=decodeURIComponent(result[2])||""}
|
||||
}
|
||||
return value
|
||||
|
||||
},
|
||||
|
||||
removeItem:function(k){
|
||||
if(!!window.localStorage){
|
||||
window.localStorage.removeItem(k);
|
||||
}
|
||||
else{
|
||||
var expireDate=new Date();
|
||||
expireDate.setTime(expireDate.getTime()-1000)
|
||||
document.cookie=k+"= "+";expires="+expireDate.toGMTString()
|
||||
}
|
||||
},
|
||||
removeAll:function(){
|
||||
if(!!window.localStorage){
|
||||
window.localStorage.clear();
|
||||
}
|
||||
else{
|
||||
var v=this.getItem(this.bookList)?this.getItem(this.bookList).split("#"):Array();
|
||||
var books=Array();
|
||||
if(v.length){
|
||||
for( i in v ){
|
||||
var tem=this.removeItem(v[k])
|
||||
}
|
||||
}
|
||||
this.removeItem(this.bookList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showbook(){
|
||||
var showbook=document.getElementById('tmpbook');
|
||||
var books=lastread.getBook();
|
||||
var bookhtml = '';
|
||||
if(books.length){
|
||||
var k = 1;
|
||||
for(var i=books.length-1;i>-1;i--){
|
||||
var articlename = books[i][2];
|
||||
var lastchapter = books[i][3];
|
||||
var lastchapterid = books[i][1];
|
||||
var read_page = parseInt(books[i][4]);
|
||||
var tmpbook_del = books[i][0];
|
||||
var author = books[i][5];
|
||||
var read_ym = parseInt(read_page+1);
|
||||
if(books[i][6]>0){
|
||||
var articleid = parseInt(books[i][0].replace('t',''));
|
||||
var shortid = parseInt(articleid/1000);
|
||||
var mybook_aid = parseInt(books[i][6]);
|
||||
var mybook_cid = parseInt(books[i][1] - articleid);
|
||||
info_url = tag_info_rewrite.replace(/{aid}/, articleid);
|
||||
info_url = info_url.replace(/{bid}/, shortid);
|
||||
read_url = tag_read_rewrite.replace(/{aid}/, articleid);
|
||||
read_url = read_url.replace(/{bid}/,shortid);
|
||||
read_url = read_url.replace(/{cid}/,lastchapterid);
|
||||
read_page_url = tag_read_page_rewrite.replace(/{aid}/, articleid);
|
||||
read_page_url = read_page_url.replace(/{bid}/,shortid);
|
||||
read_page_url = read_page_url.replace(/{cid}/,lastchapterid);
|
||||
read_page_url = read_page_url.replace(/{pid}/,read_page);
|
||||
}else{
|
||||
var articleid = parseInt(books[i][0]);
|
||||
var shortid = parseInt(articleid/1000);
|
||||
var mybook_aid = articleid;
|
||||
var mybook_cid = books[i][1];
|
||||
info_url = info_rewrite.replace(/{aid}/, articleid);
|
||||
info_url = info_url.replace(/{bid}/, shortid);
|
||||
read_url = read_rewrite.replace(/{aid}/, articleid);
|
||||
read_url = read_url.replace(/{bid}/,shortid);
|
||||
read_url = read_url.replace(/{cid}/,lastchapterid);
|
||||
read_page_url = read_page_rewrite.replace(/{aid}/, articleid);
|
||||
read_page_url = read_page_url.replace(/{bid}/,shortid);
|
||||
read_page_url = read_page_url.replace(/{cid}/,lastchapterid);
|
||||
read_page_url = read_page_url.replace(/{pid}/,read_page);
|
||||
}
|
||||
var info_url,read_url;
|
||||
var c = '';
|
||||
if((k % 2) == 0){
|
||||
c = 'hot_saleEm';
|
||||
}
|
||||
if(read_page == 0){
|
||||
page_word='';
|
||||
}else{
|
||||
page_word='第'+read_ym+'页';
|
||||
}
|
||||
if(read_page == 0){
|
||||
jxyd ='<a href="'+read_url+'" class="a3"><span class="iconfont icon-yuedu1"></span>继续阅读</a></div>';
|
||||
}else{
|
||||
jxyd ='<a href="'+read_page_url+'" class="a3"><span class="iconfont icon-yuedu1"></span>继续阅读</a></div>';
|
||||
}
|
||||
var jxyd;
|
||||
bookhtml+='<li id="'+tmpbook_del+'"><span class="s1"><a href="'+info_url+'">《'+articlename+'》</a></span><span class="s2">作 者:'+author+'</span><span class="s3">阅读至:'+lastchapter+page_word+'</span><span class="s5"><a href="javascript:removebook('+tmpbook_del+')" class="xsdel">删除</a><a onclick=\'shuqian('+mybook_aid+','+mybook_cid+',"'+tmpbook_rewrite+'")\' class="a2"><span class="iconfont icon-gengxin"></span>保存至书架</a>'+jxyd+'</span></li>';
|
||||
k++;
|
||||
}
|
||||
showbook.innerHTML = bookhtml;
|
||||
}
|
||||
else{
|
||||
showbook.innerHTML = '<li>您还木有阅读本站小说,未产生阅读记录。</li>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function removebook(k){
|
||||
lastread.remove(k);
|
||||
showbook()
|
||||
}
|
||||
|
||||
|
||||
|
||||
function yuedu(){
|
||||
//document.write("<a href='javascript:showbook();' target='_self'>点击查看阅读记录</a>");
|
||||
showbook();
|
||||
}
|
||||
|
||||
window.lastread = new LastRead();
|
||||
|
||||
|
||||
function removebook(k){
|
||||
lastread.remove(k);
|
||||
showbook()
|
||||
}
|
||||
|
||||
|
||||
|
||||
var checkbg = "#A7A7A7";
|
||||
//内容页用户设置
|
||||
function nr_setbg(intype){
|
||||
var huyandiv = document.getElementById("huyandiv");
|
||||
var light = document.getElementById("lightdiv");
|
||||
if(intype == "huyan"){
|
||||
if(huyandiv.style.backgroundColor == ""){
|
||||
set("light","huyan");
|
||||
document.cookie="light=huyan;path=/";
|
||||
}
|
||||
else{
|
||||
set("light","no");
|
||||
document.cookie="light=no;path=/";
|
||||
}
|
||||
}
|
||||
if(intype == "light"){
|
||||
|
||||
if(light.innerHTML == "关灯"){
|
||||
set("light","yes");
|
||||
document.cookie="light=yes;path=/";
|
||||
}
|
||||
else{
|
||||
set("light","no");
|
||||
document.cookie="light=no;path=/";
|
||||
}
|
||||
}
|
||||
if(intype == "big"){
|
||||
set("font","big");
|
||||
document.cookie="font=big;path=/";
|
||||
}
|
||||
if(intype == "middle"){
|
||||
set("font","middle");
|
||||
document.cookie="font=middle;path=/";
|
||||
}
|
||||
if(intype == "small"){
|
||||
set("font","small");
|
||||
document.cookie="font=small;path=/";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//内容页读取设置
|
||||
function getset(){
|
||||
var strCookie=document.cookie;
|
||||
var arrCookie=strCookie.split("; ");
|
||||
var light;
|
||||
var font;
|
||||
|
||||
for(var i=0;i<arrCookie.length;i++){
|
||||
var arr=arrCookie[i].split("=");
|
||||
if("light"==arr[0]){
|
||||
light=arr[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(var i=0;i<arrCookie.length;i++){
|
||||
var arr=arrCookie[i].split("=");
|
||||
if("font"==arr[0]){
|
||||
font=arr[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//light
|
||||
if(light == "yes"){
|
||||
set("light","yes");
|
||||
}
|
||||
else if(light == "no"){
|
||||
set("light","no");
|
||||
}
|
||||
else if(light == "huyan"){
|
||||
set("light","huyan");
|
||||
}
|
||||
//font
|
||||
if(font == "big"){
|
||||
set("font","big");
|
||||
}
|
||||
else if(font == "middle"){
|
||||
set("font","middle");
|
||||
}
|
||||
else if(font == "small"){
|
||||
set("font","small");
|
||||
}
|
||||
else{
|
||||
set("","");
|
||||
}
|
||||
}
|
||||
|
||||
//内容页应用设置
|
||||
function set(intype,p){
|
||||
var nr_body = document.getElementById("kkasdfei");//页面body
|
||||
var huyandiv = document.getElementById("huyandiv");//护眼div
|
||||
var lightdiv = document.getElementById("lightdiv");//灯光div
|
||||
var fontfont = document.getElementById("fontfont");//字体div
|
||||
var fontbig = document.getElementById("fontbig");//大字体div
|
||||
var fontmiddle = document.getElementById("fontmiddle");//中字体div
|
||||
var fontsmall = document.getElementById("fontsmall");//小字体div
|
||||
var txt = document.getElementById("txt");//内容div
|
||||
var nr_title = document.getElementById("chaptername");//文章标题
|
||||
//var shuqian_2 = document.getElementById("shuqian_2");//书签链接
|
||||
|
||||
var pt_mulu = document.getElementById("pt_mulu");
|
||||
var pt_next = document.getElementById("pt_next");
|
||||
var pb_prev = document.getElementById("pb_prev");
|
||||
var pb_mulu = document.getElementById("pb_mulu");
|
||||
var pb_next = document.getElementById("pb_next");
|
||||
|
||||
//初始化
|
||||
//document.getElementsByName("page_nr")[1].style.color = "#000";
|
||||
|
||||
//灯光
|
||||
if(intype == "light"){
|
||||
if(p == "yes"){
|
||||
//关灯
|
||||
lightdiv.innerHTML = "开灯";
|
||||
nr_body.style.backgroundColor = "#32373B";
|
||||
huyandiv.style.backgroundColor = "";
|
||||
nr_title.style.color = "#ccc";
|
||||
txt.style.color = "#999";
|
||||
//shuqian_2.style.color = "#999";
|
||||
}
|
||||
else if(p == "no"){
|
||||
//开灯
|
||||
lightdiv.innerHTML = "关灯";
|
||||
nr_body.style.backgroundColor = "#fff";
|
||||
txt.style.color = "#000";
|
||||
nr_title.style.color = "#000";
|
||||
huyandiv.style.backgroundColor = "";
|
||||
//shuqian_2.style.color = "#000";
|
||||
}
|
||||
else if(p == "huyan"){
|
||||
//护眼
|
||||
lightdiv.innerHTML = "关灯";
|
||||
huyandiv.style.backgroundColor = checkbg;
|
||||
nr_body.style.backgroundColor = "#dcecd2";
|
||||
txt.style.color = "#000";
|
||||
//shuqian_2.style.color = "#000";
|
||||
}
|
||||
}
|
||||
//字体
|
||||
if(intype == "font"){
|
||||
//alert(p);
|
||||
fontbig.style.backgroundColor = "";
|
||||
fontmiddle.style.backgroundColor = "";
|
||||
fontsmall.style.backgroundColor = "";
|
||||
if(p == "big"){
|
||||
fontbig.style.backgroundColor = checkbg;
|
||||
txt.style.fontSize = "30px";
|
||||
txt.style.lineHeight = "45px"
|
||||
}
|
||||
if(p == "middle"){
|
||||
fontmiddle.style.backgroundColor = checkbg;
|
||||
txt.style.fontSize = "24px";
|
||||
txt.style.lineHeight = "36px"
|
||||
}
|
||||
if(p == "small"){
|
||||
fontsmall.style.backgroundColor = checkbg;
|
||||
txt.style.fontSize = "18px";
|
||||
txt.style.lineHeight = "30px"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user