Skip to content

Commit f50fd42

Browse files
committed
Add an option to allow script in EPUB
1 parent 9ec4d1f commit f50fd42

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

epub.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ export class EPUB {
953953
${doc.querySelector('parsererror').innerText}`)
954954
return doc
955955
}
956-
async init() {
956+
async init({ allowScript = false } = {}) {
957957
const $container = await this.#loadXML('META-INF/container.xml')
958958
if (!$container) throw new Error('Failed to load container file')
959959

@@ -980,6 +980,7 @@ ${doc.querySelector('parsererror').innerText}`)
980980
.then(this.#encryption.getDecoder(uri)),
981981
resources: this.resources,
982982
})
983+
this.#loader.allowScript = allowScript
983984
this.transformTarget = this.#loader.eventTarget
984985
this.sections = this.resources.spine.map((spineItem, index) => {
985986
const { idref, linear, properties = [] } = spineItem

0 commit comments

Comments
 (0)