-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ExperimentalTabMode' into MagicWizards
- Loading branch information
Showing
10 changed files
with
167 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
Parses files on www.book18.org | ||
*/ | ||
"use strict"; | ||
|
||
parserFactory.register("book18.org", () => new Book18Parser()); | ||
|
||
class Book18Parser extends Parser{ | ||
constructor() { | ||
super(); | ||
} | ||
|
||
async getChapterUrls(dom) { | ||
let menu = dom.querySelector(".list-group"); | ||
return util.hyperlinksToChapterList(menu); | ||
} | ||
|
||
findContent(dom) { | ||
return dom.querySelector("div#content"); | ||
} | ||
|
||
extractTitleImpl(dom) { | ||
return dom.querySelector("title"); | ||
} | ||
|
||
removeUnwantedElementsFromContentElement(element) { | ||
util.removeChildElementsMatchingCss(element, "span.d-none"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
"use strict"; | ||
|
||
module("NovelfullParser"); | ||
|
||
QUnit.test("findWatermark", function (assert) { | ||
let dom = new DOMParser().parseFromString(NovelfullSample, "text/html"); | ||
let parser = new NovelfullParser(); | ||
let watermark = parser.findWatermark(dom); | ||
assert.equal(watermark, "n/ô/vel/b//jn dot c//om"); | ||
}); | ||
|
||
QUnit.test("tagWatermark", function (assert) { | ||
let dom = new DOMParser().parseFromString(NovelfullSample, "text/html"); | ||
let parser = new NovelfullParser(); | ||
parser.tagWatermark(dom); | ||
let paragraph = dom.querySelector("#watermarked"); | ||
let span = paragraph.querySelector("span"); | ||
assert.equal(span.innerHTML, "n/ô/vel/b//jn dot c//om"); | ||
assert.equal(paragraph.childNodes[0].nodeValue, " Yuan found their wording quite weird, but who was he to judge their world? "); | ||
}); | ||
|
||
let NovelfullSample = | ||
`<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>Cultivation Online #Chapter 1596 Primal Expanse - Read Cultivation Online Chapter 1596 Primal Expanse Online - All Page - Novel Bin</title> | ||
</head> | ||
<body> | ||
<div id="chr-content"> | ||
<div id="pf-10311-1"> | ||
<script>window.pubfuturetag = window.pubfuturetag || [];window.pubfuturetag.push({unit: "66b4e3c40939a022784366eb", id: "pf-10311-1"})</script></div> | ||
<div></div> | ||
<h3>Chapter 1596 Primal Expanse</h3> <p> </p><p> After taking a moment to digest the possibility that they had been transported to another world outside the Nine Heavens, Yuan turned to look at the mysterious naked little girl and asked, "Do you mind telling us a little about the Primal Expanse?" </p><div id="pf-10364-1"> | ||
<script>window.pubfuturetag = window.pubfuturetag || [];window.pubfuturetag.push({unit: "66b9b2575d6f5a59dab6ff6d", id: "pf-10364-1"})</script></div><p id="watermarked"> Yuan found their wording quite weird, but who was he to judge their world? n/ô/vel/b//jn dot c//om</p><p> "Primal and Predators, right? I will remember that." </p> | ||
<div id="pf-10366-1"> | ||
<script>window.pubfuturetag = window.pubfuturetag || [];window.pubfuturetag.push({unit: "66b9b27899ef0d23774745cd", id: "pf-10366-1"})</script></div> | ||
</div> | ||
<script> | ||
setTimeout(function () { | ||
const paragraphss = $("p"); | ||
paragraphss.each(function () { | ||
const original11Content = $(this).html(); | ||
const updated11Content = original11Content.replace("n/ô/vel/b//jn dot c//om", \`<span id="span">n/ô/vel/b//jn dot c//om</span>\`); | ||
$(this).html(updated11Content); | ||
}); | ||
}, 600000); | ||
</script> | ||
</body> | ||
</html>` |