var ng = navigator;
if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(ng.userAgent)){
var htmltest=document.getElementsByTagName('head')[0].innerHTML;
if(htmltest.match(RegExp(/format=html5/))){
var wapurl=htmltest.match(/format=html5; url=(.+?)"/)[1];
location.href = wapurl;
}
}//donetop
function setCookie(c_name,value,expiredays)
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+365)
document.cookie=c_name+ "=" +escape(value)+";expires="+exdate.toGMTString()+";path=/";
}
function getCookie(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 "";
}
function delCookie(name) {
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null)
document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}
var bookUserName=getCookie("username");
function tj(){
var head = "
";
if(bookUserName != '' && bookUserName != undefined){
head += "
";
}else{
head += "
";
}
$(".header_top").html(head+'
');
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?9c5f07b6ce20e3782eac91ed47d1421c";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
$(".search").html('');
}
function lists(id){
$(".listmain .more").click(function(){$(".listmain .dd_hide").show();$(".listmain .more").hide();});
$(".noshow").hide();$(".allshow").click(function(){$(".noshow").show();$(".allshow").hide();});
$(".comment_hide").hide();$(".comment_more").click(function(){$(".comment_hide").show();$(".comment_more").hide();});
var looklist = window.localStorage.getItem("bookList").split('#');
var lookid = looklist.indexOf(id);if(lookid<0){return false;}
var lastbook = window.localStorage.getItem(looklist[lookid]).split('#');
$(".readlink .rl").attr('href', '/kan/' + id + '/' + lastbook[1] + '.html');
$(".readlink .rl").attr('title', '上次阅读到:' + lastbook[3]);
$(".readlink .rl").text('继续阅读');
var hm = Math.ceil(Math.random()*10);
if(hm==1){new Image().src = '/'+id+'/hm.gif';}
}
function listtj(id){
//var hm = Math.ceil(Math.random()*10);
//if(hm==1){new Image().src = 'https://tj.bqgso.cc/hm.gif?id='+id+'&rnd=';}
// + new Date().getTime()
}
function reads(){
}
function read2(){
}
function read3(){
$(".noshow").hide();
}
function list2(){
//document.writeln("");
//read2();
//document.writeln("
");
}
function get_bookpage(id,num){
if(num=="n"){page++;}else if(num=="p"){if(page<=1){alert('已经是第一页了!');return false;}page--;}else{page=num;}
$.getJSON("/json_book?id="+id+"&page="+page,function(data){
var strHtml = "";
$.each(data,function(index,val){
strHtml += ''+val+' ';
})
if(strHtml==""){alert('没有了!');return false;}
$(".allup").html(strHtml);$("select option[value="+page+"]").attr("selected", true);
});
}
function get_booklist(id){
$.getJSON("/json_book?id="+id+"&page=0",function(data){
var strHtml = "";
$.each(data,function(index,val){
strHtml += ''+val+' ';
})
if(strHtml==""){alert('没有了!');return false;}
$(".allup").html(strHtml);$(".listpage").hide();
});
}
function topCase(){
var sURL = "http://"+location.hostname;
var sTitle = "书趣阁";
try{
window.external.addFavorite(sURL, document.title);
}catch (e){
try{
window.sidebar.addPanel(sTitle, sURL, "");
}catch (e){
alert("加入收藏失败,请使用Ctrl+D进行添加");
}
}
}
function setHome(){
var url = "http://"+location.hostname;
if (document.all){
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage(url);
}else{
alert("操作被浏览器拒绝,请手动在浏览器里设置该页面为首页!");
}
}
function logout(){
setCookie("userid",'',1);setCookie("username",'',1);location.reload();
}
function doParse(url) {
var params = {};
if (! url ) return params;
var paramPart = url.substring(url.indexOf("?") + 1);
var parts = paramPart.split("&");
for(var i = 0; i < parts.length; i++) {
var index = parts[i].indexOf("=");
if (index == -1) continue;
params[parts[i].substring(0, index)] = parts[i].substring(index + 1);
}
return params;
}
function user_href(){
if(getCookie('username')){
var params = doParse(location.href);
if (!params.jumpurl || params.jumpurl == "undefined") {location.href = "/user/bookcase.html";} else{location.href = decodeURIComponent(params.jumpurl);}
}
}
function addBookCase(bookid){
$.post("/user/action.html",
{ action: "addbook", bookid: bookid },
function(data){
if(data==-1)
{
location.href = "/login.html?jumpurl="+location.href;
}
else if(data==0)
{
alert("书架已满,加入书架出错!");
}
else if(data==1)
{
alert("加入书架成功!");
}
else if(data==2)
{
alert("该书已在书架中!");
}else{alert("加入书架出错!");}
}
);
}
function addBookMark(bookId,chapterId,articleName,chapterName){
$.post("/user/action.html",
{ action: "addbook",bookid: bookId, chapterid:chapterId, articlename: articleName, chaptername: chapterName },
function(data){
if(data==-1)
{
alert("您还没有登录,请登录后再加入书签!");
location.href = "/login.html?jumpurl="+location.href+"#footer";
}
else if(data==0)
{
alert("书架已满,加入书架出错!");
}
else if(data==1)
{
alert("加入书签成功!");
}else{alert("加入书签出错!");}
}
);
}
function chapter_error(bookId,chapterId,articleName,chapterName,Time){
//if (confirm('你确定这章节有错吗?')) {
$.post("/user/action.html",
{ action: "chapter_error", bookid: bookId, chapterid:chapterId, articlename: articleName, chaptername: chapterName, time: Time},
function(data){
if(data==1)
{
alert("举报错误章节成功,请耐心等待维护人员处理~");
}
else if(data>10)
{
window.location.href=window.location.href+'?'+data;
}
else{
alert("请不要频繁提交~");
}
}
);
//}
}
function book_error(bookId,articleName,Time){
if (confirm('你确定本书更新出错吗?')) {
$.post("/user/action.html",
{ action: "book_error", bookid: bookId, articlename: articleName, time: Time},
function(data){
if(data==1)
{
alert("举报错误成功,请耐心等待维护人员处理~");
}
else if(data>10)
{
window.location.href=window.location.href+'?'+data;
}
else{
alert("请不要频繁提交~");
}
}
);
}
}
$(function(){
document.body.insertAdjacentHTML("afterBegin", '' +
'
' +
'home ' +
'arrow-up-circle ' +
'chevron-left-circle ' +
'user ' +
' ')
});