locus search is not working.

105 views
Skip to first unread message

Jugesh Rai

unread,
Oct 12, 2013, 2:15:14 PM10/12/13
to monoc...@googlegroups.com
Hi,
    I am working on an android epub reader application using monocle js. I have created TOC contents from ncx file through android code. and  clicking on toc icon i m generating this android dialog box to show list of contents(TOC). now i call locus search function (goToXpath) to skip to those pages, but it is rendering to first page only. Any kind of help will be appreciated. please guide me through it.

Robert Schroll

unread,
Oct 12, 2013, 2:39:04 PM10/12/13
to monoc...@googlegroups.com
On Sat, Oct 12, 2013 at 3:15 PM, Jugesh Rai <itsj...@gmail.com> wrote:
> Hi,
> I am working on an android epub reader application using monocle
> js. I have created TOC contents from ncx file through android code.
> and clicking on toc icon i m generating this android dialog box to
> show list of contents(TOC). now i call locus search function
> (goToXpath) to skip to those pages, but it is rendering to first page
> only.
>

I don't know about that specific problem, but I had success with a
different approach in an epub reader I wrote for Ubuntu Touch (Beru, at
https://github.com/rschroll/beru). I use the reader.skipToChapter()
function to move to the beginning of chapters. This function takes a
single argument, the url of the chapter, which you can get from the src
attribute of the <content> tag in each <navPoint> tag in the ncx file.
(In a Epub2 file, at least. It's slightly different for Epub3.) Maybe
that'll work for you.

Robert



Jugesh Rai

unread,
Oct 12, 2013, 3:28:58 PM10/12/13
to monoc...@googlegroups.com
Thanks for your reply... my confusion is that I am creating TOC list dynamically though android code. now on touch of chapter title's from list, it should go to respective page. For that I am using monocle function:
  function goToXPath(cmptId, xpath) {
        window.reader.moveTo(
          { componentId: cmptId, xpath: xpath },
          function () {
            highlight(function (doc) { return nodeForXPath(doc, xpath) });
          }
        );
      }
and passing the cmptId and xpath  dynamically for each title.. but it is not redirecting to the target page

Joseph Pearson

unread,
Oct 12, 2013, 10:01:34 PM10/12/13
to monoc...@googlegroups.com
Depending on the Android version, you may find that the webview does not implement XPath. I believe that's true of Android < 4 — this page will tell you: http://test.monoclejs.com/test/compat/index.html

An alternative is to jump to the chapter and a specific anchor, then in the monocle:componentmodify, assign that id to the relevant element yourself.

— J
--
You received this message because you are subscribed to the Google Groups "Monocle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to monocle-js+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jugesh Rai

unread,
Oct 13, 2013, 3:10:48 AM10/13/13
to monoc...@googlegroups.com
Thanks Joseph I tried with your suggestion but unable to figure out may be some issues from my end. Can you give me some sample code how to call jump and monocle:componentmodify.
To unsubscribe from this group and stop receiving emails from it, send an email to monocle-js+unsubscribe@googlegroups.com.

Jugesh Rai

unread,
Oct 14, 2013, 9:45:40 AM10/14/13
to monoc...@googlegroups.com
Hi Joseph,
 I tried with android version > 4 also but  goToXPath() is not working...


On Sunday, October 13, 2013 7:31:34 AM UTC+5:30, Joseph Pearson wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to monocle-js+unsubscribe@googlegroups.com.

Santhakumar Nagalingam

unread,
Mar 7, 2016, 9:05:49 AM3/7/16
to Monocle
Hi Joseph,
I am facing same issue in my android application.

Please share me fix if you find anything.

Thanks,
Santhakumar.N
Reply all
Reply to author
Forward
0 new messages