Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.

Conversation

chine
Copy link
Contributor

@chine chine commented Apr 14, 2015

Re: Issue 97

@rkwright
Copy link
Contributor

Defer for now. It targets master and we need a reproducible case.

@rkwright rkwright removed bug labels May 13, 2016
@danielweck
Copy link
Member

This PR indeed targets the master branch instead of develop. Furthermore, the file epub-modules/epub/src/models/package_document.js now resides at js/epub-model/package_document.js (since a significant refactoring).
However, the fix itself is obviously still valid, and should be reviewed appropriately.
Here is a direct link to the new code location:
https://github.com/readium/readium-js/blob/master/js/epub-model/package_document.js#L178

        // Description: Constructs an html representation of NCX navPoints, based on an object of navPoint information
        // Rationale: This is a recursive method, as NCX navPoint elements can nest 0 or more of themselves as children
        function addNavPointElements($navPointDOM, $ol) {

            // Add the current navPoint element to the TOC html
            var navText = $navPointDOM.children("navLabel").text().trim();
            var navHref = $navPointDOM.children("content").attr("src");
            var $navPointLi = $('<li class="nav-elem"></li>').append(
                $('<a></a>', { href: navHref, text: navText })
            );

            // Append nav point info
            $ol.append($navPointLi);

            // Append ordered list of nav points
            if ($navPointDOM.children("navPoint").length > 0 ) {

                var $newLi = $("<li></li>");
                var $newOl = $("<ol></ol>");
                $.each($navPointDOM.children("navPoint"), function (navIndex, navPoint) {
                    $newOl.append(addNavPointElements($(navPoint), $newOl));
                });

                $newLi.append($newOl);
                $ol.append($newLi);
            }
        }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants