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

When text selected, include index number if needed #3

Merged
merged 1 commit into from Dec 15, 2016

Conversation

Projects
None yet
2 participants
@dracos
Copy link
Contributor

commented Dec 15, 2016

This means that if the “mess” in the last paragraph of Chapter 4 is selected, the hash becomes #mess++2 not just #mess which goes to the first mention. Hope that’s helpful.

(I assume the now-shared function might want to be wrapped in a IIFE but thought I’d leave that in case not.)

@adactio

This comment has been minimized.

Copy link
Owner

commented Dec 15, 2016

Brilliant! Thanks, Matthew.

@adactio adactio merged commit af0e929 into adactio:master Dec 15, 2016

adactio added a commit that referenced this pull request Dec 15, 2016

Revert "Merge pull request #3 from dracos/the-nth-degree"
This reverts commit af0e929, reversing
changes made to 9c09f2e.
@adactio

This comment has been minimized.

Copy link
Owner

commented Dec 15, 2016

Ah, I'm afraid there's an issue with this. I'm getting a JS error when I highlight text:

scripts.js:31 Uncaught TypeError: elements.indexOf is not a function(…)updateURL @ scripts.js:31

@dracos

This comment has been minimized.

Copy link
Contributor Author

commented Dec 15, 2016

Ah, sorry, I did test it :) Which browser? I though indexOf was widely supported, so perhaps it’s something else, but I can’t think what. Is it any text that causes it, or just specific instance?

@dracos

This comment has been minimized.

Copy link
Contributor Author

commented Dec 15, 2016

Aha, tracked it down - selecting text across multiple nodes, new PR incoming...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.