reset
This commit is contained in:
@@ -1,391 +0,0 @@
|
||||
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('newcase');
|
||||
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></div>';
|
||||
} else {
|
||||
jxyd = '<a href="' + read_page_url + '" class="a3"><span class="iconfont icon-yuedu1"></span>继续阅读</a></div></div>';
|
||||
}
|
||||
var jxyd;
|
||||
bookhtml += '<div class="hot_sale' + ' ' + c + '"><div class="tl"><a href="' + info_url + '" class="title">' + articlename + '</a></div><p>小说作者:<span>' + author + '</span></p><p class="p2">上次阅读:' + lastchapter + page_word + '</p><div class="anbtn"><a href="javascript:removebook(' + tmpbook_del + ')" class="xsdel"><span class="iconfont icon-105"></span></a><a href="' + info_url + '" class="a4"><span class="iconfont icon-shujia1"></span>目录</a><a onclick=\'shuqian(' + mybook_aid + ',' + mybook_cid + ',"' + tmpbook_rewrite + '")\' class="a2"><span class="iconfont icon-gengxin"></span>云书签</a>' + jxyd;
|
||||
|
||||
// '<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 = '<div class="xs_phb"><span class="iconfont icon-liulanliang fs22 btn_cl_1"></span><h2 class="btn_cl_1">阅读历史(浏览器储存记录)</h2>' + 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 = "#f7ecef";
|
||||
//内容页用户设置
|
||||
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("chapterbody");//页面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 = "开灯";
|
||||
lightdiv.style.backgroundColor = "#ccc9c0";
|
||||
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 = "关灯";
|
||||
lightdiv.style.backgroundColor = checkbg;
|
||||
nr_body.style.backgroundColor = "#f7ecef";
|
||||
txt.style.color = "#423838";
|
||||
nr_title.style.color = "#333";
|
||||
huyandiv.style.backgroundColor = "";
|
||||
//shuqian_2.style.color = "#000";
|
||||
}
|
||||
else if (p == "huyan") {
|
||||
//护眼
|
||||
lightdiv.innerHTML = "关灯";
|
||||
huyandiv.style.backgroundColor = "#ded4b2";
|
||||
nr_body.style.backgroundColor = "#dfdbcd";
|
||||
txt.style.color = "#333";
|
||||
//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 = "#ded4b2";
|
||||
txt.style.fontSize = "30px";
|
||||
txt.style.lineHeight = "45px"
|
||||
}
|
||||
if (p == "middle") {
|
||||
fontmiddle.style.backgroundColor = "#ded4b2";
|
||||
txt.style.fontSize = "24px";
|
||||
txt.style.lineHeight = "36px"
|
||||
}
|
||||
if (p == "small") {
|
||||
fontsmall.style.backgroundColor = "#ded4b2";
|
||||
txt.style.fontSize = "18px";
|
||||
txt.style.lineHeight = "30px"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user