Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Epub.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
Expand Down Expand Up @@ -98,6 +98,10 @@ <h1>Epub Editor</h1>
<td></td>
<td><button id="linkExtraFontsButton">Link extra fonts (ChrysanthemumGarden, requiemtls etc.)</button></td>
</tr>
<tr>
<td></td>
<td><button id="updateDateButton">Update Date</button><input id="updateDateInput" type="text" value="2026-03-10"></td>
</tr>
</table>
<div id="outputTarget">
<h4 id="listHeader"></h4>
Expand Down
8 changes: 8 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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);

Expand Down