Last modified: 2014-09-24 13:25:25 UTC
The content of a footnote (or the beginning of it, until XX characters) could
appear in a tooltip when the mouse pointer is over the reference link : this
way, short notes are visible while reading, which is better for the reader.
I might have a look at this one, I'm busy revamping cite.php anyway (see
When assigning bugs, please *do it right*. Thanks.
Created attachment 3013 [details]
Reference in tooltip
Created attachment 3018 [details]
This patch puts the text of the reference into the title-field of the tooltip.
In this way people will be able to see the text of the reference by hovering
over the reference, and they do not need to scroll all the way down (which is
distracting when reading the document).
A demo is running on chemistry.poolspares.com, though it is there combined with
the patch on bug 423.
Created attachment 3019 [details]
reference in tooltip
cleaner references, for comments see previous patch
Created attachment 3028 [details]
updated patch, remove an error
Created attachment 3032 [details]
(previous patch was broken)
Commited as r19202
Reverted; this needs work. A few notes:
* Raw HTML code in messages seems rather... icky. Fragile and likely to fail due
to mistakes or customization gone awry. :)
Xml::escapeJsString rather than trying to roll your own escape function; this
keeps things consistent and is probably safer (eg newlines and escapes are
already handled in a common place)
* Don't forget to run the parser tests, and update them if necessary. This patch
breaks 10 test cases.
all? It harms compatibility and is probably more fragile than simply putting the
title attribute where it belongs in the first place.
I'll quick-reply to this.
* Understood, they have to move to the main code. Don't need customisation, anyway.
* I'll look into the documentation for that.
* Ke, asked for testing, but will try to run them myself as well.
* Nope, doesn't work, references are not by definition known at the moment the HTML of the inline
reference mark is generated, so have to be supplied later anyway. Another problem there is that it
is wikitext, which does not have the possibility to add a custom title.
Created attachment 3071 [details]
refs in tooltip
Added tooltips and adapted citeparsertests.txt
Re previous comments:
* Changed rendering of javatext title parameter
* Parsertests.php does not give more errors than before.
* internationalisation removed (these parameters do not require
* Added comment in code on why Java and why there
Created attachment 3918 [details]
refs in tooltip updated
I updated the patch to make it working on the latest revision.
There's a big problem with this implementation : tooltip content is displayed in raw HTML. If there's a link, bold or anything in the ref tag, HTML tags are included in the tooltip.
I see two ways to avoid that :
* Remove HTML tags and only display content (probably error prone).
Hmmmm, it might be cleaner to do a ful display in client-side JS. Since the reference's contents get rendered later on the page, they can be fairly straightforwardly retrieved at display time by JS and copied into a floating box which is shown on mouseover.
Using a trimmed and HTML-stripped text for a 'title' attribute might also be a little extra helper suitable for browsers with JS disabled or unavailable.
*** Bug 11515 has been marked as a duplicate of this bug. ***
I am not quite sure "tooltip" is the right wording. I would rather call it a "pop up". They have it on an internet site I know, for example on that page : http://www.nonfiction.fr/article-171-hobsbawm_et_le_bicentenaire_de_la_revolution.htm
I find it convenient and, well... "cool".
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
Mike, thanks for the patch.
(In reply to comment #13)
> Hmmmm, it might be cleaner to do a ful display in client-side JS. Since the
> reference's contents get rendered later on the page, they can be fairly
> straightforwardly retrieved at display time by JS and copied into a floating
> box which is shown on mouseover.
> Using a trimmed and HTML-stripped text for a 'title' attribute might also be a
> little extra helper suitable for browsers with JS disabled or unavailable.
Per this review by Brion, I'm marking this patch as reviewed. Do you have time and/or interest in revising your patch? Thanks again!
For the record, this was implemented as a default gadget on English Wikipedia.
There is discussion here:
Should this become the new default or just an option?
Would making it the default save parsing time?
If default, does having the notes render in HTML in the same point where they are in wikitext save parsing time? From hearsay: the parser doesn't enjoy fetching the last chunk of the HTML from all over the wikitext of the page, right?
I like the idea of having the ReferenceTooltips as default. Maybe it should be integrated with Extension:Cite.
However, I'd like the title attribute of the <sup>'d reference links to be generated in HTML, for maximum compatibility and accessibility. These could then be removed by JS as it dynamically adds the rich tooltip (the progressive enhancement pattern). Interestingly, pure-html toolstips can even be slighly formatted with control characters such as line breaks and tabs (see http://stackoverflow.com/a/12486358/266309)
It looks like some experimental tooltip code was added to cite.php but recently removed.
We now have the experimental HoverCards which works pretty well for reference tooltips.