-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathPerlegoContent.js
29 lines (29 loc) · 905 Bytes
/
PerlegoContent.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function printPages(start, end) {
document.querySelector("style").remove();
let printContents = "";
let i = start;
function downloadPage() {
setTimeout(()=>{
let content = document.querySelector(`div[data-chapterid='${i}']`);
content.scrollIntoView();
if (content.querySelector(".pdfplaceholder") == null) {
printContents += content.innerHTML + "<br>";
i++;
}
if (i <= end) {
downloadPage();
}
if (i == end + 1) {
document.body.innerHTML = printContents;
console.log("Reading...");
setTimeout(()=>{
window.print();
location.reload();
}
, (end - start) * 100);
}
}
, 1000);
}
downloadPage();
}