|
|
@ -7,6 +7,7 @@ |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
var now_chapter = -1; |
|
|
|
var now_chapter = -1; |
|
|
|
|
|
|
|
var sum_chapter = 0; |
|
|
|
|
|
|
|
|
|
|
|
var formatTime = value => { |
|
|
|
var formatTime = value => { |
|
|
|
return new Date(value).toLocaleString('zh-CN', { |
|
|
|
return new Date(value).toLocaleString('zh-CN', { |
|
|
@ -64,7 +65,8 @@ var init = () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
$$('#books img').forEach(bookImg => |
|
|
|
$$('#books img').forEach(bookImg => |
|
|
|
bookImg.addEventListener("click", () => { |
|
|
|
bookImg.addEventListener("click", () => { |
|
|
|
now_chapter = -1 |
|
|
|
now_chapter = -1; |
|
|
|
|
|
|
|
sum_chapter = 0; |
|
|
|
$('#allcontent').classList.add("read"); |
|
|
|
$('#allcontent').classList.add("read"); |
|
|
|
var book = books[bookImg.getAttribute("data-series-num")]; |
|
|
|
var book = books[bookImg.getAttribute("data-series-num")]; |
|
|
|
$("#info").innerHTML = `<img src="${bookImg.src}">
|
|
|
|
$("#info").innerHTML = `<img src="${bookImg.src}">
|
|
|
@ -97,6 +99,7 @@ var init = () => { |
|
|
|
ch.innerHTML = chapter.title.length > 15 ? chapter.title.substring(0, 14) + "..." : chapter.title; |
|
|
|
ch.innerHTML = chapter.title.length > 15 ? chapter.title.substring(0, 14) + "..." : chapter.title; |
|
|
|
$("#chapter").appendChild(ch); |
|
|
|
$("#chapter").appendChild(ch); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
sum_chapter = data.data.length; |
|
|
|
$('#chapter').scrollTop = 0; |
|
|
|
$('#chapter').scrollTop = 0; |
|
|
|
$("#content").innerHTML = "章节列表加载完成!"; |
|
|
|
$("#content").innerHTML = "章节列表加载完成!"; |
|
|
|
}); |
|
|
|
}); |
|
|
@ -139,15 +142,24 @@ $('#up').addEventListener('click', e => { |
|
|
|
let clickEvent = document.createEvent('MouseEvents'); |
|
|
|
let clickEvent = document.createEvent('MouseEvents'); |
|
|
|
clickEvent.initEvent("click", true, false); |
|
|
|
clickEvent.initEvent("click", true, false); |
|
|
|
$('[data-index="' + now_chapter + '"]').dispatchEvent(clickEvent); |
|
|
|
$('[data-index="' + now_chapter + '"]').dispatchEvent(clickEvent); |
|
|
|
|
|
|
|
} else if (now_chapter == 0) { |
|
|
|
|
|
|
|
alert("已经是第一章了^_^!") |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$('#down').addEventListener('click', e => { |
|
|
|
$('#down').addEventListener('click', e => { |
|
|
|
if (now_chapter > -1) { |
|
|
|
if (now_chapter > -1) { |
|
|
|
now_chapter++; |
|
|
|
if (now_chapter < sum_chapter - 1) { |
|
|
|
let clickEvent = document.createEvent('MouseEvents'); |
|
|
|
now_chapter++; |
|
|
|
clickEvent.initEvent("click", true, false); |
|
|
|
let clickEvent = document.createEvent('MouseEvents'); |
|
|
|
$('[data-index="' + now_chapter + '"]').dispatchEvent(clickEvent); |
|
|
|
clickEvent.initEvent("click", true, false); |
|
|
|
|
|
|
|
$('[data-index="' + now_chapter + '"]').dispatchEvent(clickEvent); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
alert("已经是最后一章了^_^!") |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|