06-01-2015, 07:12 AM | #1 |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
ePub3: localStorage/JavaScript/RTL support
Since the ePub3 specs neither prohibit nor require localStorage support I created a very simple test epub and the 4 apps that I tested it with (ADE 4.0.3 Azardi 38, Gitden Reader 4.4.9d and iBooks 3.2) all supported it.
However, I'm wondering whether dedicated ebook readers with ePub 3 support generally support localStorage or whether this is an unintentional app-only feature provided by the rendering engine. I'm also interested in finding out whether epub3-enabled ebook readers finally support RTL languages such as Hebrew and Arabic. If you have an ebook reader (or an app other than ADE, Azardi, Gitden or iBooks) that supports epub3 according to the manufacturer, please download the test file, select the first chapter and tap the Off button. This should hide the blue English translations above the German text. Then close the book and reopen it. If the blue text is still hidden, your reader supports localStorage. Then select the last chapter and compare it with the screenshot. |
06-02-2015, 05:02 AM | #2 |
Scripler Project Lead
Posts: 19
Karma: 19304
Join Date: May 2014
Location: Copenhagen, Denmark.
Device: Gameboy Color
|
interesting - what are some of the potential uses of localstorage in ebooks you imagine?
A functionality like your test could be done with simple javascript manipulation of css (display:none /display: block) as well I guess. |
Advert | |
|
06-02-2015, 06:10 AM | #3 | ||
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
For more examples, see this very simple Javascript ebook that I found in a German ebook forum and this over-the-top ebook by the makers of Azardi with all kinds of puzzles. It might even be useful for fancy fiction books, for example the Kadath guide by French ebook publisher Walrus. IIRC, at one point they ask the user a question and if the answer is incorrect the text becomes blurred etc. You could even implement a book password with localStorage. (I'm aware of the fact that it could easily be defeated by tech-savvy users or by simply opening the book with an epub2 reader.) Quote:
Since you seem to have much better JavaScript skills, I've got a question for you: I implemented the show/hide functionality using sheet.deleteRule() followed by sheet.insertRule(). Is there any JavaScript method that would allow me to directly overwrite a CSS rule? |
||
06-02-2015, 06:47 AM | #4 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
A Javascript footnote.
What you need to make it work: 1. - in the html file - head: the script - body: the a link and the div with the text and the id 2. - in the stylesheet - definition of tooltip 3. - in the .opf file, the expression properties="scripted" Last edited by roger64; 06-02-2015 at 11:24 AM. |
06-02-2015, 06:49 AM | #5 | ||
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
I used a Javascript footnote which already works with Calibre viewer. It's not like with the aside footnote, the text remains hidden till you tap on the anchor. Here I used
Quote:
You can either insert it as a block at the end of a paragraph or separate the a link and the div. You also need to add Quote:
Last edited by roger64; 06-02-2015 at 11:14 AM. Reason: div |
||
Advert | |
|
06-02-2015, 06:50 AM | #6 |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
|
06-02-2015, 06:52 AM | #7 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
In the html a script tag
<title>Demo ePub3 Popups</title> <script> function tooltip_open(x) { document.getElementById(x).style.display="block"; } function tooltip_close(y) { document.getElementById(y).style.display="none"; } </script> Last edited by roger64; 06-02-2015 at 09:57 AM. Reason: script |
06-02-2015, 06:55 AM | #8 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
and the CSS
Code:
.tooltip { background: rgb(242, 242, 242); border: 2px solid #a1a1a1; border-radius: 25px; display: block; z-index: 9999; position: relative; padding: 0 10px 0 10px; display:none; } Last edited by roger64; 06-02-2015 at 06:57 AM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is there any android epub reader supporting epub3 with audio/video/javascript? | happycoding | Android Developer's Corner | 10 | 07-29-2014 11:16 AM |
Create a javascript quizz for Epub3 in Sigil | BertrandThibaut | Sigil | 3 | 01-26-2014 09:04 AM |
PRS-T1 prs t1 rtl support | mziaeem | Sony Reader Dev Corner | 22 | 11-16-2013 10:21 PM |
Support for RTL Languages | Gonidae | Calibre | 1 | 10-05-2012 05:13 AM |
JAVASCRIPT support in ePub2/ePub3 | Raja1205 | ePub | 7 | 09-03-2012 06:48 AM |