Hacker News new | past | comments | ask | show | jobs | submit login

This already exists on Wikipedia.

Under preferences, select the Gadgets tab and enable "Navigation popups".

When hovering over a link in a Wikipedia article, a small popup will appear, in addition to some metadata about the link, the first paragraph of the article will appear, including links that may appear in that paragraph, which can also be hovered to make another popup appear.




The OP's design for it is much nicer.

Navigation popups have been around since 2005, and while in some ways better than the OP's design (pictures!) this is useful enough to test it as default behavior.

Hover doesn't work on mobile, so perhaps they should appear if you click and hold for a few seconds.


Implementing it in HTML/CSS/JS certainly poses an interesting problem because, as far as I know, one cannot directly access individual, dynamically broken lines of text. One would probably have to wrap each word in a container and keep track of the absolute positions.


Very true. I got a rough POC of this, implemented using the technique in this answer: http://stackoverflow.com/a/22816419/11208

(just with divs instead of images)

It's very brittle though. It relies on knowing the line-height, calculating the line in which the highlighted word sits, accounting for the existence of vertical scroll-bars... not trivial.


Ah, that was surprisingly easy: http://jsfiddle.net/5p92U/

Or am I missing something?

Edit: Yes, I do. It does not work together with images on the right side: http://jsfiddle.net/Nup2F/


You can use getSelection() to do that, but it doesn't work everywhere. [0] [1]

[0] https://stackoverflow.com/questions/7563169/detect-which-wor...

[1] http://jsfiddle.net/Vap7C/15/



Well, Navigation popups seems something a bit different for me and not at all something intended for general consumption like the proposed changes (that I think is great).

First of all you need to have a Wikipedia account to enable them, and second this is something intended as an help for the editors. Wikipedia description of this function is:

"article previews and editing functions popup when hovering over links"


Well, even the Hovercards under Beta features also require a user account. And of course, there is the downside of now only having it enabled on the English Wikipedia.

What about the German or French Wikipedia? What about Wiktionary? Oh man, that is going to be hard.

Indeed, Navigation popups is not perfect and it is intended for editors first. But I mostly use it for speeding up my browsing.

But writing a general tool for all MediaWiki installations is going to be quite the task; a lot of MediaWiki wikis don't even have opening paragraphs like Wikipedia does (see Wiktionary for example). Sure, we can make some compromises and accept that non-encyclopaedia styled wikis don't apply to this tool.

I'd love to see a Firefox extension that did this. But for now; either Hovercards or Navigation popups provides the basics of the requested functionality.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: