ionic-epubjs icon indicating copy to clipboard operation
ionic-epubjs copied to clipboard

Links are not working

Open lgme opened this issue 6 years ago • 14 comments

From the screenshot below if I click the "Genesis 1" it should open the next page. The link is valid and it works in epub readers on desktop (I use Microsoft Edge 42.17134). However, it doesn't do anything in testing mode (ionic serve) or after publishing the app, on mobile.

I've sent you the epub file in the zip archive.

image

The full epub file can be downloaded from crossway.org

esv_bible.zip

lgme avatar Sep 30 '18 17:09 lgme

Interesting. Do you get any errors in the console or doesn't just anything happen?

janpio avatar Sep 30 '18 17:09 janpio

Silly me, I'm doing it wrong. Ionic has its own navigation system and I need it to navigate one page to another, similar to the chapter navigation in the _subscribeToEvents() method

image

The problem is how do I convert <a>...</a> tags in <ion-item> elements? Any ideas please?

lgme avatar Sep 30 '18 17:09 lgme

I would try to hook into the existing onclick handlers for those links. Maybe just overwrite h1? Any idea what nav.wait() does?

janpio avatar Sep 30 '18 18:09 janpio

The js code is is the OEBPS/Text/js/tooltip.js file. Below is a screenshot of the code. I sent you the unpacked epub archive.

image

esv_genesis_unpacked.zip

lgme avatar Sep 30 '18 18:09 lgme

Whoah.

Any idea where h1() comes from and what it does? Seems to me that this then should switch the location?

janpio avatar Sep 30 '18 18:09 janpio

All the js functions are available in the tooltip.js file. tooltip.zip

Each paragraph in the page is uniquely identified by an id (ie 01001001). "01" - book number, "001" - chapter number, "001" - verse number. If you look at my first comment, when I click the "Genesis 1" link it should send me to the "b01.00.Genesis.text.xhtml" page, at the header element wit the id=v01001001

image

lgme avatar Sep 30 '18 18:09 lgme

I couldn't find a h1 method in that file.

janpio avatar Sep 30 '18 18:09 janpio

I couldn't find a h1 method in that file.

It's not h1, its hl

lgme avatar Sep 30 '18 18:09 lgme

Ahhh, it's hl, not h1 ;)

janpio avatar Sep 30 '18 18:09 janpio

Hmmm, I have no idea how one could handle those "internal" navigation functions, especially if the params and target have no relation to what epubjs knows as navigation targets etc. Maybe epubjs has some logic to handle those that I never saw and touched?

janpio avatar Sep 30 '18 18:09 janpio

Would it be possible to include ionic elements in epub files? After all, ionic elements are xml elements.

lgme avatar Sep 30 '18 18:09 lgme

No idea if those would be included in the rendering process of Ionic.

But if you control the content of the epub, you could just replace the function calls with the appropriate ones (see the TOC).

janpio avatar Sep 30 '18 19:09 janpio

I'm not sure I'm quite following you. What TOC are you referring to?

lgme avatar Sep 30 '18 19:09 lgme

How the TOC of the ebook handles navigation to pages. You posted a screenshot of it above.

janpio avatar Sep 30 '18 19:09 janpio