kiwix-js icon indicating copy to clipboard operation
kiwix-js copied to clipboard

Support "page preview" feature of Wikipedia and Wikivoyage

Open Jaifroid opened this issue 3 years ago • 9 comments

This is a feature that is default for signed-out users of Wikipedia, though signed-in users may need to switch it on. It consists in showing a small preview of the lede, together with an image (if the article has one) when a user hovers over (or long-presses on mobile) an intenal link. It looks like in the screenshot below (the Île-de-France pop-up). It seems to me that this would be quite easy to support in Kiwix JS, especially now that block caching gives us quick lookup capabilities. The equivalent of hovering over a link in mobile is long-press.

Would this be of interest? An issue might be how to get the target of a hover in SW mode without interfering with the DOM. I think it can be done with a mouseover event listener on the iframe window (i.e. above the DOM), from which the target of the event can be retrieved and tested. It would need to run with a suitable timeout delay, so that it is not triggered excessively with each mouse movement, but this is precisely what is required for a hover event. This method would avoid having to attach listeners to each link in the DOM.

image

Jaifroid avatar Apr 10 '21 14:04 Jaifroid

Jaifroid, I want to work on this issue. Can you please assign this issue to me

Maneet-k avatar Dec 08 '21 17:12 Maneet-k

@Maneet-k Thank you for the offer. However, this issue is a tentative suggestion, and has not been agreed by the active developers on this app. No work should be undertaken until a discussion has been had about the usefulness of the feature and the balance of utility vs the risk of complicating the codebase. This feature, if agreed, is not at all straightforward, and if you are not highly experienced with JavaScript and UI development, then I would suggest you look for a different issue.

Jaifroid avatar Dec 09 '21 08:12 Jaifroid

Ohkayy...... not a problem at all :) But that would be little better if you could give me some suggestion on other issues, if they're open

Maneet-k avatar Dec 09 '21 08:12 Maneet-k

Well I don't know your level of experience. If you're prepared to study the source code and look for ways of putting repeated code into a separate function, then #78 might be suitable. But it depends on your interests, knowledge and experience.

Jaifroid avatar Dec 09 '21 08:12 Jaifroid

#729 might also be easier than #78 ?

mossroy avatar Dec 09 '21 09:12 mossroy

That's true. I had assigned that to someone else, but that person has not come back to us and doesn't appear to be working on it.

Jaifroid avatar Dec 09 '21 09:12 Jaifroid

Thanks alot @jaifroid and @mossroy for your help. I'll be working on that issue^^

Maneet-k avatar Dec 09 '21 09:12 Maneet-k

Same as https://github.com/kiwix/kiwix-desktop/issues/611 on kiwix-desktop. Really hard ticket, if the "preview" is not already pre-computed.

kelson42 avatar Dec 09 '21 09:12 kelson42

This issue has been solved in the PWA, and I have nearly finished backporting the code. Here's what it looks like in KJS browser extension:

image

Jaifroid avatar May 19 '24 21:05 Jaifroid