diff --git a/public/js/reader.js b/public/js/reader.js index 321f131..c09c340 100644 --- a/public/js/reader.js +++ b/public/js/reader.js @@ -257,9 +257,24 @@ const readerComponent = () => { * @param {string} nextUrl - URL of the next entry */ nextEntry(nextUrl) { - this.saveProgress(items.length, () => { + this.saveProgress(this.items.length, () => { this.redirect(nextUrl); }); + }, + /** + * Exits the reader, and optionally sets the reading progress tp 100% + * + * @param {string} exitUrl - The Exit URL + * @param {boolean} [markCompleted] - Whether we should mark the + * reading progress to 100% + */ + exitReader(exitUrl, markCompleted = false) { + if (!markCompleted) { + return this.redirect(exitUrl); + } + this.saveProgress(this.items.length, () => { + this.redirect(exitUrl); + }); } }; } diff --git a/src/views/reader.html.ecr b/src/views/reader.html.ecr index 91beaf3..afeb510 100644 --- a/src/views/reader.html.ecr +++ b/src/views/reader.html.ecr @@ -36,7 +36,7 @@ <%- if next_entry_url -%> <%- else -%> - + <%- end -%> @@ -91,7 +91,7 @@