URL page anchors for bookmarks
Opened this issue · 1 comments
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
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