From c7cde9a9b71a4550a46a352c408d33c9303da85d Mon Sep 17 00:00:00 2001
From: QuintBrit <>
Date: Tue, 17 Jan 2023 16:56:22 +0000
Subject: [PATCH] added chapter links
---
chapter.js | 24 ++++++++++++------------
manifest.json | 2 +-
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/chapter.js b/chapter.js
index 69ac47d..921c6e2 100644
--- a/chapter.js
+++ b/chapter.js
@@ -1,4 +1,4 @@
-function cleanHTML(html, i) {
+function cleanHTML(html, i, link) {
var parser = new DOMParser();
console.log("got chapter, parsing");
var doc = parser.parseFromString(html, "text/html");
@@ -28,24 +28,24 @@ function cleanHTML(html, i) {
if (i != 1) {
// only add the existing notes
if (note1 != null && note2 != null) {
- var chapter = "
" + `${title}
` + "
" + note1.outerHTML + chapterText.outerHTML + note2.outerHTML;
+ var chapter = "
" + `` + "
" + note1.outerHTML + chapterText.outerHTML + note2.outerHTML;
} else if (note1 != null) {
- var chapter = "
" + `${title}
` + "
" + note1.outerHTML + chapterText.outerHTML;
+ var chapter = "
" + `` + "
" + note1.outerHTML + chapterText.outerHTML;
} else if (note2 != null) {
- var chapter = "
" + `${title}
` + "
" + chapterText.outerHTML + note2.outerHTML;
+ var chapter = "
" + `` + "
" + chapterText.outerHTML + note2.outerHTML;
} else {
- var chapter = "
" + `${title}
` + "
" + chapterText.outerHTML;
+ var chapter = "
" + `` + "
" + chapterText.outerHTML;
}
} else {
// only add the existing notes
if (note1 != null && note2 != null) {
- var chapter = `${title}
` + "
" + note1.outerHTML + chapterText.outerHTML + note2.outerHTML;
+ var chapter = `` + "
" + note1.outerHTML + chapterText.outerHTML + note2.outerHTML;
} else if (note1 != null) {
- var chapter = `${title}
` + "
" + note1.outerHTML + chapterText.outerHTML;
+ var chapter = `` + "
" + note1.outerHTML + chapterText.outerHTML;
} else if (note2 != null) {
- var chapter = `${title}
` + "
" + chapterText.outerHTML + note2.outerHTML;
+ var chapter = `` + "
" + chapterText.outerHTML + note2.outerHTML;
} else {
- var chapter = `${title}
` + "
" + chapterText.outerHTML;
+ var chapter = `` + "
" + chapterText.outerHTML;
}
}
@@ -99,8 +99,8 @@ function prepPage() {
console.log("not signed in");
}
- var newTitle = document.title.split(" - ")[1];
- console.log("new title: " + newTitle);
+ var newTitle = document.title.split(" - ");
+ newTitle = newTitle[newTitle.length - 1];
document.title = newTitle;
var bod = document.querySelector(".portlet-body");
var buttons = bod.querySelector(".nav-buttons");
@@ -162,7 +162,7 @@ async function insertNewChapter(link, i, isStartingChapter) {
console.log("getting chapter");
const response = await fetch(link);
var html = await response.text();
- var contents = cleanHTML(html, i);
+ var contents = cleanHTML(html, i, link);
var chapterContents = contents[0];
var nextLink = contents[1];
diff --git a/manifest.json b/manifest.json
index 7458c58..a3bdf73 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
"description": "An addon that adds an option for reading the full text of a RoyalRoad story.",
"manifest_version": 2,
"name": "RoyalRoad Full Story",
- "version": "1.4.0",
+ "version": "1.5.1",
"homepage_url": "https://github.com/QuintBrit/RoyalRoad-Addon",
"icons": {
"16": "icons/favicon-16x16.png",