joseph / Monocle

A silky, tactile browser-based ebook JavaScript library.
http://monocle.inventivelabs.com.au
MIT License
743 stars 200 forks source link

Standard controls within a book #7

Closed MidnightRyder closed 13 years ago

MidnightRyder commented 13 years ago

Since Monocle supports standard HTML content, it would be great to have an easy way to allow for standard HTML controls and events within a book. That way, if the book references a website a standard link within the book pointed at a new window (so it loads in a separate tab / window) would be great for those moments when the book references URL's (rather than the user having to type them in by hand like the print versions of my books ;-) or you want to offer a "Like" link for the book within the book. (For full bore websites it's not quite as important as it might be for stand alone apps on platforms like the iPhone. Current using Monocle + PhoneGap to distribute eBook copies of my print books - works nice, by the way.)

fmundaca commented 13 years ago

hello, i'm having problems with monocle and phonegap. the book doesn't appear and i don't know why.

i put window.reader = Monocle.Reader('book'); inside onDeviceReady function but nothing happens..

can you help me ?

thanks :)

joseph commented 13 years ago

Hi tenzai, I'm afraid I don't have any experience with the PhoneGap framework — you might get in touch with them regarding debugging tools.

joseph commented 13 years ago

Regarding the original issue, I hope the new "panels" feature in the componentry branch takes care of this — allowing interaction with the contents of the book itself.

If you want to open links to other parts of the book in Monocle itself, and external links in a separate iframe, you could take a look at this stuff I wrote for someone a while back:


Yep, for this you want to hook into the componentchange event and modify the DOM of each component slightly, to open in an iframe or whatever.

Here's some example code, which should work -- it's modified from some private code I'm working on:

http://gist.github.com/558293

That snippet doesn't cover the InfoPane class, but it's similar to other Monocle controls: create a div with an internal iframe, expose a "go" method in the API that changes the src attribute of the iframe.