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

HTML: Paragraphs to use unique numbered id #12

Closed
taophp opened this issue Mar 20, 2016 · 5 comments
Closed

HTML: Paragraphs to use unique numbered id #12

taophp opened this issue Mar 20, 2016 · 5 comments

Comments

@taophp
Copy link
Contributor

taophp commented Mar 20, 2016

I was thinking about what I should need to make the HTML output of Crowbook to remember the last vertical position when the user leaves the page and restore it when he comes back, even if the window has another size. It can be done purely with JavaScript, but there a part that would be better done when Crowbook output the HTML, and that's my request.

I would like you to add a unique id to each paragraph. Numbering is not required, but it should be easier for you. I suggest something like cXXpYY where XX is the chapter number, and YY the paragraph number.
So we'll have something like:

<p id="c1p1">blabla</p>
<p id="c1p2">blabla</p>
<p id="c1p3">and so on...</p>

Currently, I do not know when I will have enough time to write the JavaScript part, so I made this request first, in the hope to make this feature implementation progress faster.

crowdagger added a commit that referenced this issue Mar 22, 2016
@crowdagger
Copy link
Owner

It's not exactly the scheme your suggested (global index instead of chapter-paragraph), is that ok?

@taophp
Copy link
Contributor Author

taophp commented Mar 22, 2016

Well, it should be a little trickier to display the correct chapter in the "one chapter at once" view, as the I will have to decide the chapter number from the paragraph number (I'll have to climb in the DOM!) but I think I could deal with. Just do know when...

@crowdagger
Copy link
Owner

Actually I already modified the javascript (maybe not in a very clean way) to do that so that book.html#internal-ref displays the correct chapter: https://github.com/lise-henry/crowbook/blob/master/templates/script.js#L29

@taophp
Copy link
Contributor Author

taophp commented Mar 23, 2016

At first glance, it seems fine. We may bind the function to an event so we will not have to manage this later. Currently, I do know if there is an event for url hash change only.

@taophp
Copy link
Contributor Author

taophp commented Mar 23, 2016

I do know if there is an event for url hash change only.

Well, there is one in HTML5: http://stackoverflow.com/questions/680785/on-window-location-hash-change#answer-681030

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

2 participants