Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 06-01-2015, 07:12 AM   #1
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Question 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.
Attached Thumbnails
Click image for larger version

Name:	ADE_RTL.png
Views:	3383
Size:	13.6 KB
ID:	138880   Click image for larger version

Name:	localStorage.png
Views:	302
Size:	14.4 KB
ID:	138881  
Attached Files
File Type: epub epub3Test.epub (84.9 KB, 494 views)
Doitsu is offline   Reply With Quote
Old 06-02-2015, 05:02 AM   #2
Abekonge
Scripler Project Lead
Abekonge has met Morla.Abekonge has met Morla.Abekonge has met Morla.Abekonge has met Morla.Abekonge has met Morla.Abekonge has met Morla.Abekonge has met Morla.Abekonge has met Morla.Abekonge has met Morla.Abekonge has met Morla.Abekonge has met Morla.
 
Abekonge's Avatar
 
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.
Abekonge is offline   Reply With Quote
Advert
Old 06-02-2015, 06:10 AM   #3
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Abekonge View Post
interesting - what are some of the potential uses of localstorage in ebooks you imagine?
IMHO, it might be useful for showing/hiding comments, answers, translations etc.

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:
A functionality like your test could be done with simple javascript manipulation of css (display:none /display: block) as well I guess.
I only have rudimentary JavaScript skills and I'm pretty sure that the functionality could be implemented much more efficiently.
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?
Doitsu is offline   Reply With Quote
Old 06-02-2015, 06:47 AM   #4
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
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.
roger64 is offline   Reply With Quote
Old 06-02-2015, 06:49 AM   #5
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
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:
Note*.
as an anchor but, of course it could be a lot shorter.

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:
properties="scripted"
in the relevant item of the .opf file
Attached Thumbnails
Click image for larger version

Name:	javascript.png
Views:	267
Size:	111.8 KB
ID:	138926  

Last edited by roger64; 06-02-2015 at 11:14 AM. Reason: div
roger64 is offline   Reply With Quote
Advert
Old 06-02-2015, 06:50 AM   #6
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by roger64 View Post
I used a Javascript footnote which already works with Calibre viewer.
Can you please attach a test file or post the JavaScript footnote code?
Doitsu is offline   Reply With Quote
Old 06-02-2015, 06:52 AM   #7
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
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
roger64 is offline   Reply With Quote
Old 06-02-2015, 06:55 AM   #8
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
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;
  }
Attached Thumbnails
Click image for larger version

Name:	click.png
Views:	253
Size:	50.1 KB
ID:	138929  

Last edited by roger64; 06-02-2015 at 06:57 AM.
roger64 is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 05:24 PM.


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