Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 02-27-2013, 03:40 PM   #1
tincanbot
Junior Member
tincanbot began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2013
Device: none
Including jQuery in an ePUB3.0 eBook

Because ePUB3.0 supports JavaScript, I'm wondering if it's also possible to embed the jQuery source in eBooks so it's possible to include jQuery scripting. I haven't the faintest idea of how to go about this. Is it even possible?

Thank you!
tincanbot is offline   Reply With Quote
Old 02-27-2013, 04:18 PM   #2
AlPe
Digital Amanuensis
AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.
 
AlPe's Avatar
 
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
Technicly, it is possible, but the problem, as always with EPUB 3, is the support in reading applications/devices.

Specifically, iBooks has some problems with jQuery (I did some testing a couple of months ago, I do not rember exactly what went wrong). Readium should be ok. But other readers (say, Blio) completely ignore the JS embedded.

EDIT: for the "how", have a look at the IDPF samples. Basically, include your JS script, add it to the manifest, and add "scripted" property to the page(s) using it.
AlPe is offline   Reply With Quote
Advert
Old 02-27-2013, 05:09 PM   #3
tincanbot
Junior Member
tincanbot began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2013
Device: none
Thank you for your response, AlPe. I can embed normal javascript into an eBook without any issues and it'll display just fine on the iPad. I'm wondering if the iPad can natively understand and display jQuery code or if I would have to embed the jQuery source code in the eBook or use some sort of namespace reference in the header, etc., and if so how that's done. Thus far all of my attempts have been for naught. I'm beginning to think it's not possible, unfortunately.
tincanbot is offline   Reply With Quote
Old 02-27-2013, 05:19 PM   #4
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: 73,645
Karma: 127837858
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 tincanbot View Post
Thank you for your response, AlPe. I can embed normal javascript into an eBook without any issues and it'll display just fine on the iPad. I'm wondering if the iPad can natively understand and display jQuery code or if I would have to embed the jQuery source code in the eBook or use some sort of namespace reference in the header, etc., and if so how that's done. Thus far all of my attempts have been for naught. I'm beginning to think it's not possible, unfortunately.
You are totally messing your terminology up here. Please do not use iPad when you should be using iBooks. What the iPad can do with eBooks is up to the app, not the iPad itself. iPad is the device. iBooks is the app. Don't use ipad in place of iBooks. It just makes you look bad.
JSWolf is offline   Reply With Quote
Old 02-27-2013, 05:26 PM   #5
tincanbot
Junior Member
tincanbot began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2013
Device: none
I think most anyone can safely assume that when I said "on the iPad" I was referring to its native eBook display program, iBooks. Thanks for contributing to the discussion, though.
tincanbot is offline   Reply With Quote
Advert
Old 02-27-2013, 05:26 PM   #6
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: 73,645
Karma: 127837858
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 tincanbot View Post
I think most anyone can safely assume that when I said "on the iPad" I was referring to its native eBook display program, iBooks. Thanks for contributing to the discussion, though.
It's not native. It's an add-on app. Why should we have to assume? Why can't iBooks just be specified when that's what you mean?
JSWolf is offline   Reply With Quote
Old 02-28-2013, 01:23 AM   #7
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
For the most part, I would expect jQuery to work the same way that it does in Safari. This is not to say that you won't find interesting bugs and edge cases where jQuery does the wrong thing, of course. If you find such problems, file bugs with jQuery, and if they conclude it's a bug in iBooks, then file bugs against iBooks.

But yes, you almost certainly will have to embed the jQuery library code in the book. To the best of my knowledge, EPUB books are not allowed to use resources outside the book bundle; they must be self-contained.
dgatwood is offline   Reply With Quote
Old 02-28-2013, 07:47 AM   #8
AlPe
Digital Amanuensis
AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.
 
AlPe's Avatar
 
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
Quote:
Originally Posted by tincanbot View Post
Thank you for your response, AlPe. I can embed normal javascript into an eBook without any issues and it'll display just fine on the iPad. I'm wondering if the iPad can natively understand and display jQuery code or if I would have to embed the jQuery source code in the eBook or use some sort of namespace reference in the header, etc., and if so how that's done. Thus far all of my attempts have been for naught. I'm beginning to think it's not possible, unfortunately.
Add in the XHTML page (say) p001.xhtml:
Code:
<script src="path/to/your/script.js" type="text/javascript"></script>
In the OPF file:
Code:
<item id="p001" href="path/to/your/p001.xhtml" media-type="application/xhtml+xml" properties="scripted"/>
<item id="s001" href="path/to/your/script.js" media-type="text/javascript"/>
If you are going to try this in iBooks, you might want/need to include META-INF/com.apple.ibooks.display-options.xml declaring:
Code:
<option name="interactive">true</option>
AlPe is offline   Reply With Quote
Old 02-28-2013, 07:51 AM   #9
AlPe
Digital Amanuensis
AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.AlPe ought to be getting tired of karma fortunes by now.
 
AlPe's Avatar
 
Posts: 727
Karma: 1446357
Join Date: Dec 2011
Location: Turin, Italy
Device: Several eReaders and tablets
Quote:
Originally Posted by dgatwood View Post
But yes, you almost certainly will have to embed the jQuery library code in the book. To the best of my knowledge, EPUB books are not allowed to use resources outside the book bundle; they must be self-contained.
Yes, yes, you need to embed the JS script into your book, either in the XHTML page or embedding the JS file.

(FYI, audio/video resource might be outside the EPUB 3 container: http://idpf.org/epub/30/spec/epub30-...urce-locations )
AlPe is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
App Syncs "copied" text (including eBook clips) between iOS and OSX 1611mac Apple Devices 6 01-25-2013 08:23 AM
Free ~ Dante Alighieri - Audio eBook EPUB3 of the Divine Comedy, read by Lino Pertile AlPe Self-Promotions by Authors and Publishers 2 12-13-2012 04:13 PM
epub3 pbs_ebook Writer2ePub 1 05-06-2011 11:47 AM
including RSS item pubDate in ebook text alison87 Recipes 2 02-05-2011 04:40 PM


All times are GMT -4. The time now is 04:14 AM.


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