Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 09-26-2024, 06:01 PM   #31
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,101
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by RbnJrg View Post
What I wanted to mean is that the epub would be opened even for those ereaders with the old ADE 2.x engine (and ignoring all the code for epub3 included in the ebook).
I do like your idea of different CSS for ePub2 or ePub3.
JSWolf is online now   Reply With Quote
Old 09-26-2024, 11:39 PM   #32
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,606
Karma: 8291219
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by JSWolf View Post
I do like your idea of different CSS for ePub2 or ePub3.
The best thing is that works If the ereader device can't read the javascript that links the css3 stylesheet to the xhtml files, then it means that is only an epub2 ereader and the css3 code never is loaded; in that case you have a perfect epub2 ebook On the other hand, if the javascript can be executed, then it means that we have an epub3 ereader, the css3 stylesheet is linked and the css2 classes are overwritten; you have a perfect epub3 ebook. Two epubs in only one ebook; the best of both worlds.
RbnJrg is offline   Reply With Quote
Old 09-28-2024, 11:17 AM   #33
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,606
Karma: 8291219
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
For those who want to play with the idea of ​​changing styles from css2 to css3 via javascript, I attach a simple epub that only contains a title page.

The epub is initially only linked to the epub2.css stylesheet and therefore the layout is pure epub2/css2. When the epub is loaded, if the e-reader is one that supports epub3, the script will be executed and link the epub3.css stylesheet. Since the styles in this stylesheet have the same name as the styles in the epub2.css and is linked later, the epub3 styles overwrite the epub2 ones and of this way the epub gives the best reading experience.

In the example you can see how the title page improves when a flex-box is used. All texts are perfectly centered, both horizontally and vertically, and the layout is maintained regardless of the change in font size. This does not happen when the epub is opened in an e-reader that only supports epub2, since here, changes in font size strongly affect the layout. Try opening the epub first in ADE 2.x/3.x (or KOReader, that is a nice epub2 ereader) and then open this same epub for example in Calibre Viewer/Thorium/Readium. When you open it in ADE 2.x/3.x/KOReader only the code for epub2 is active and consequently the vertical centering is affected by the change in font size. On the other hand, when the epub is opened in Calibre Viewer/Thorium/Readium the code for epub3 is activated and the centering, both vertical and horizontal, is maintained regardless of the font size.

In conclusion, the attached epub can be opened by an epub2 and epub3 e-reader. If it is opened by an epub2 device, only de epub2 code is enabled and the reader has a nice and old epub to read ; if it is opened by an epub3 device, then the epub3 code is enabled and overwrites the epub2, giving the best reading experience.

In the epub you can also see the simple script that allows the linking of the code for epub3 when the book is opened.
Attached Files
File Type: epub Two epubs, one ebook.epub (3.5 KB, 17 views)
RbnJrg is offline   Reply With Quote
Old 09-28-2024, 03:30 PM   #34
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 76,101
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by RbnJrg View Post
For those who want to play with the idea of ​​changing styles from css2 to css3 via javascript, I attach a simple epub that only contains a title page.
What happens if this ePub is read initially with an ePub3 reader and the Javascript is executed. Then the ePub is read on an ePub2 reader. How does CSS2 get used since the CSS is now CSS3 from the previous view? Does the Javascript run when either the ePub is closed and/or the program is exited to put the CSS2 back in place?

Last edited by JSWolf; 09-28-2024 at 03:37 PM.
JSWolf is online now   Reply With Quote
Old 09-28-2024, 03:40 PM   #35
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,215
Karma: 19000635
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Jon, the JavaScript doesn’t CHANGE the css… it simply attaches the new file when the epub is loaded on a device that runs js. If it doesn’t run js it doesn’t link the new css file.

The epub file doesn’t change at all between devices.
Turtle91 is online now   Reply With Quote
Old 09-28-2024, 03:52 PM   #36
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,215
Karma: 19000635
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Also, this js technique is not strictly necessary on a compliant device. Simply linking the ePub3 css file AFTER the ePub2 css file would work the same way. RbnJrg’s js technique protects against non-compliant devices/apps by only linking the ePub3 css if it can run js. Thus you wouldn’t have decrepit devices ignoring all the css if it didn’t like one. A compliant device would do this automatically by ignoring css it doesn’t support. This js technique can be used in multiple ways, however, and is a great step in learning “fall-back” coding theories.

Thanks RbnJrg
Turtle91 is online now   Reply With Quote
Old 09-28-2024, 06:08 PM   #37
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,606
Karma: 8291219
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by JSWolf View Post
What happens if this ePub is read initially with an ePub3 reader and the Javascript is executed. Then the ePub is read on an ePub2 reader. How does CSS2 get used since the CSS is now CSS3 from the previous view? Does the Javascript run when either the ePub is closed and/or the program is exited to put the CSS2 back in place?
Turtle91 answered you very well; nothing happens! Because the linking of the css3 stylesheet is temporal; once the epub is closed, the linking is broken and again you only have an epub with the css2 sheet "physically" linked. Do the try and you'll see how the things work.

Last edited by RbnJrg; 09-28-2024 at 06:21 PM.
RbnJrg is offline   Reply With Quote
Old 09-28-2024, 06:20 PM   #38
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,606
Karma: 8291219
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by Turtle91 View Post
Also, this js technique is not strictly necessary on a compliant device. Simply linking the ePub3 css file AFTER the ePub2 css file would work the same way. RbnJrg’s js technique protects against non-compliant devices/apps by only linking the ePub3 css if it can run js. Thus you wouldn’t have decrepit devices ignoring all the css if it didn’t like one.
Exactly! I developed this hack as a workaround for epub ereaders based on ADE 2.x (RMSDK).

Quote:
A compliant device would do this automatically by ignoring css it doesn’t support.
That's right.

Quote:
This js technique can be used in multiple ways, however, and is a great step in learning “fall-back” coding theories.
With this technique is easy to convert an epub2 into an epub3. It's not necessary to erase nothing; just to add a new css stylesheet with the new properties for existing styles. And one doesn't have to worry about compatibility with old epub ereaders because the new styles, they only will be loaded (and will overwrite the existing ones) by epub3 ereaders. The issues with ADE 2.x are gone!

Quote:
Thanks RbnJrg
You are welcome
RbnJrg is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen shady bottom emreceng Onyx Boox 3 02-09-2020 01:15 PM
Aura HD Lines on bottom of screen hf.tan Kobo Reader 4 08-28-2014 08:02 PM
Page numbers at bottom of screen Waylander Sony Reader 1 10-18-2013 02:21 PM
Circled M or S at the bottom of the screen Larken Sony Reader 4 12-18-2009 03:15 PM
Black line 3½ cm from bottom of screen Moonraker iRex 6 08-20-2006 11:19 AM


All times are GMT -4. The time now is 07:53 PM.


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