Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Viewer

Notices

Reply
 
Thread Tools Search this Thread
Old 09-02-2021, 03:50 PM   #1
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,599
Karma: 7999999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Viewer seems not to load some scripts

The attached epub makes use of javascripts to achieve certain text effects with a minimum of html markup (all the work is made on the css stylesheet). The epub is perfectly displayed by the Calibre Book Editor, as you can see in the image below:

Click image for larger version

Name:	Image1.png
Views:	217
Size:	163.7 KB
ID:	189070

However, the Calibre book viewer only displays text without any formatting:

Click image for larger version

Name:	Image2.png
Views:	201
Size:	45.8 KB
ID:	189071

Obviously the Book Viewer is not loading the javascripts and, I wonder why? I have included the keyword "defer" in the script tags but without result. It also doesn't work to move the scripts to the bottom of the page (above the </body> tag). I would like to know if all this is because I am doing something wrong, or because of a bug in the book viewer.

Regards
Attached Files
File Type: epub nthEverything 2 (epub3).epub (38.9 KB, 136 views)

Last edited by RbnJrg; 09-02-2021 at 06:55 PM.
RbnJrg is offline   Reply With Quote
Old 09-02-2021, 06:53 PM   #2
MicroDrie
Connoisseur
MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.
 
Posts: 58
Karma: 438844
Join Date: Aug 2019
Device: PC, Linux Mint, Tablet, and Telephone
Quote:
Originally Posted by RbnJrg View Post
The attached epub makes use of java scripts to achieve certain text effects with a minimum of html markup (all the work is made on the css stylesheet). The epub is perfectly displayed by the Calibre Book Editor, as you can see in the image below:

Attachment 189070

However, the Calibre book viewer only displays text without any formatting:

Attachment 189071

Obviously the Book Viewer is not loading the java scripts and I wonder why? I have included the keyword "defer" in the script tags but without result. It also doesn't work to move the scripts to the bottom of the page (above the body tag). I would like to know if all this is because I am doing something wrong, or because of a bug in the book viewer.

Regards
When I open your EPUB in Sigil, the formatting works in the preview screen. If I open your EPUB in the external PageEdit program, it doesn't work. If I open the EPUB on my old Galaxy J7 in the GitDen E-reader, it works.

The fact that JavaScript can work on an E-reader does not mean that all (combinations) of HTML, CSS and JavaScript code can also work in all E-readers and EPUB apps. In addition, for example, Google Play Books does not allow JavaScript and Javascript must be allowed on the E-reader.

I don't think the problem is the JavaScript not loading, but the EPUB render software version not being recognized.

To make your EPUB work properly in PageEdit I've put a webkit class over the HTML on both chapters to make it work:

Code:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" class=" -webkit-">
This modified version also works flawlessly in my GitDen app on the Galaxy J7.

Regards MicroDrie
Attached Files
File Type: epub nthEverything 3 (epub3).epub (39.5 KB, 131 views)
MicroDrie is offline   Reply With Quote
Advert
Old 09-02-2021, 08:18 PM   #3
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,599
Karma: 7999999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by MicroDrie View Post
When I open your EPUB in Sigil, the formatting works in the preview screen. If I open your EPUB in the external PageEdit program, it doesn't work. If I open the EPUB on my old Galaxy J7 in the GitDen E-reader, it works.
Hi MicroDrie;

I appreciate your answer. What version of PageEdit are you using? Because I can open the posted epub on PageEdit without adding the "-webkit-" class. In fact, the script prefixfree.min.js is precisely for that; to avoid using any prefix (the script according to the ereader, adds the proper prefix [-moz, -ms, -webkit] to whatever -headers, styles, etc.).

Quote:
The fact that JavaScript can work on an E-reader does not mean that all (combinations) of HTML, CSS and JavaScript code can also work in all E-readers and EPUB apps. In addition, for example, Google Play Books does not allow JavaScript and Javascript must be allowed on the E-reader.
Yes, you are right and I am aware of that. For example, my epub doesn't work on ADE 4.5x (with supports for epub3 and java). The issue here is that Calibre can display the epub flawlessly in its Book Editor. So, in theory, it should run (the epub) also in the Book Viewer. I think there must be something in the way the Viewer processes the function calls. But I'm not sure about that.

Regards to you too.
Rubén
RbnJrg is offline   Reply With Quote
Old 09-03-2021, 12:05 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,371
Karma: 23764838
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
In order to work in web browsers, the viewer virtualizes loading of scripts, so their load order is no longer preserved. If you right click and open the inspector in the console you will see an error about jQuery not being defined. You can fix it by wrapping the entire ntheverything code to run only on the load event.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
window.load event: works in editor but not in viewer jrv Viewer 6 02-15-2021 10:15 PM
Viewer takes ages to load books GertNL01 Viewer 6 01-21-2021 04:07 PM
Collection of runme scripts knc1 Kindle Developer's Corner 23 08-17-2018 01:48 AM
calibre failed to load after 1.12.0 down load junglered Recipes 2 11-27-2013 10:15 PM
E-book viewer takes forever to load flow Iznogood Calibre 7 04-06-2013 11:37 PM


All times are GMT -4. The time now is 09:08 PM.


MobileRead.com is a privately owned, operated and funded community.