var _num = 100; function LastRead(){ this.bookList="bookList" } LastRead.prototype={ set:function(bid,tid,title,texttitle,read_page,author){ if(!(bid&&tid&&title&&texttitle,read_page))return; var v=bid+'#'+tid+'#'+title+'#'+texttitle+'#'+read_page+'#'+author; 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;iv.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 articleid = parseInt(books[i][0]); var shortid = parseInt(articleid/1000); var articlename = books[i][2]; var lastchapter = books[i][3]; var lastchapterid = books[i][1]; var read_page = parseInt(books[i][4]); var author = books[i][5]; var read_ym = parseInt(read_page+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 ='继续阅读'; }else{ jxyd ='继续阅读'; } */ if(read_page == 0){ jxyd ='继续阅读'; }else{ jxyd ='继续阅读'; } var jxyd; //bookhtml+='
  • 《'+articlename+'》作 者:'+author+'阅读至:'+lastchapter+page_word+'删除保存至书架'+jxyd+'
  • '; bookhtml+='
  • '+jxyd+'

    '+articlename+'

    '+author+'

    读到:'+lastchapter+page_word+'

    删除收藏

  • '; k++; } showbook.innerHTML = bookhtml; } else{ showbook.innerHTML = '
  • 您还木有阅读本站小说,未产生阅读记录。
  • '; } } function removebook(k){ lastread.remove(k); showbook() } function yuedu(){ //document.write("点击查看阅读记录"); showbook(); } window.lastread = new LastRead(); function removebook(k){ lastread.remove(k); showbook() }