diff --git a/Epub.js b/Epub.js index 3636687..96223f8 100644 --- a/Epub.js +++ b/Epub.js @@ -738,6 +738,14 @@ class Epub { return sequence; } + updateDate(dateString) { + let dateEl = this.opf.dom.querySelector("dc\\:date:not([opf\\:event])"); + if (dateEl !== null) { + dateEl.textContent = dateString; + } + return Promise.resolve(this.replaceZipObject(this.opf.zipObjectName, this.opf.dom, true)); + } + checkForInvalidXhtml() { let sequence = Promise.resolve(); let bad = []; diff --git a/index.html b/index.html index baf8c29..3f85f80 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ - + @@ -98,6 +98,10 @@

Epub Editor

+ + + +

diff --git a/main.js b/main.js index d104fcc..e3fa513 100644 --- a/main.js +++ b/main.js @@ -156,6 +156,13 @@ class Main { .then(() => epub.save(this.fileName, "application/epub+zip")); } + updateDate() { + let dateString = document.getElementById("updateDateInput").value; + let epub = this.epub; + return epub.updateDate(dateString) + .then(() => epub.save(this.fileName, "application/epub+zip")); + } + removeZeroSizeImages() { return this.removeImages(this.epub.findZeroSizeImages()); } @@ -229,6 +236,7 @@ class Main { document.getElementById("convertTableToDivButton").onclick = this.convertTableToDiv.bind(this); document.getElementById("appendSourceLinkInEachChapterButton").onclick = this.appendSourceLinkInEachChapter.bind(this); document.getElementById("linkExtraFontsButton").onclick = this.linkExtraFonts.bind(this); + document.getElementById("updateDateButton").onclick = this.updateDate.bind(this); document.getElementById("runScriptButton").onclick = this.runScript.bind(this); document.getElementById("runScriptAsyncButton").onclick = this.runScriptAsync.bind(this);