readium / readium-js-viewer

👁 ReadiumJS viewer: default web app for Readium.js library
BSD 3-Clause "New" or "Revised" License
550 stars 186 forks source link

Means to define my own word definitions #703

Closed bargri closed 6 years ago

bargri commented 6 years ago

This issue is a Feature Request

I wish to produce an ebook that is written in a not so common language. In turn I would like the person reading this book to be able to click on any word in the book and get the definition of this word in say English. I, as the author of this book, would like to be able to define the definition of each word as part of my epub document.

danielweck commented 6 years ago

I would suggest you look at how "plugins" work, here is a trivial example: https://github.com/readium/readium-shared-js/blob/develop/plugins/example/main.js The CONTENT_DOCUMENT_LOADED event gives you access to the iframe content / publication (X)HTML document ($iframe[0].contentDocument.documentElement), so from there you can do whatever you like.