Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL page anchors for bookmarks #16

Open
mrlnc opened this issue Feb 25, 2021 · 1 comment
Open

URL page anchors for bookmarks #16

mrlnc opened this issue Feb 25, 2021 · 1 comment

Comments

@mrlnc
Copy link
Contributor

mrlnc commented Feb 25, 2021

in the HTML-converted spec, clicking on a page yields an URL with some page anchor encoded at the very end: /specs/24/24_010/v15_0_0.html#[10,%22FitH%22,501]

It seems the pdf2html JS only appends the data to the URL, but never evaluates the data when you click on a link. In this example, the browser should jump to page 10. That'd be great for bookmarks and sharing links to some specific (TS+version+section).

Would be great to

  • fix the JS and enable bookmarks
  • introduce another anchor format that includes the Section
@mrlnc
Copy link
Contributor Author

mrlnc commented Feb 25, 2021

navigate_to_dest does the URL handling (both updating URL and reading URL and jumping to the location). It takes two arguments:

/**
   * @param{string} detail_str may come from user provided hashtag, need sanitizing
   * @param{Page=} src_page page containing the source event (e.g. link)
   */
            navigate_to_dest: function(detail_str, src_page) {

Some calls to the function are missing the second argument:

if (this.config['hashchange_handler']) {
    window.addEventListener('hashchange', function(e) {
          self.navigate_to_dest(document.location.hash.substring(1));
    }, false);
}

if (this.config['view_history_handler']) {
     window.addEventListener('popstate', function(e) {
          if (e.state) self.navigate_to_dest(e.state);
    }, false);
}

To fix the URL handling, src_page must be set to document.location.

Maybe this patch will do: mrlnc@9788c33 untested because build seems currently broken #17

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

No branches or pull requests

1 participant