MediaWiki talk:Gadget-ReferenceTooltips.js: Difference between revisions

Content deleted Content added
request sync
Preferences: new section
 
(127 intermediate revisions by 34 users not shown)
Line 4:
{{editprotected|answered=yes}}
Could an admin please re-copy [[User:Yair rand/ReferenceTooltips.js]] to this page to add the recent bug fix? Thanks. --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 19:19, 4 April 2012 (UTC)
:Done. <small><span style="border:1px solid black;padding:1px;">[[User:Sandstein|<fontspan style="color:white;background:blue;font-family:sans-serif;">'''&nbsp;Sandstein&nbsp;'''</fontspan>]]</span></small> 17:27, 11 April 2012 (UTC)
{{editprotected|answered=yes}}
Could someone synchronize the pages again, please? --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 21:35, 19 April 2012 (UTC)
:{{EP[[File:Yes check.svg|d}}20px|link=|alt=]] '''Done'''<!-- Template:EP --> --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 22:15, 19 April 2012 (UTC)
:::Thank you. --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 22:25, 19 April 2012 (UTC)
{{editprotected|ans=yes}}
Line 18:
{{editprotected|ans=yes}}
:<code>#footer-places</code> is at the bottom of the page, holding the "Privacy policy", "About Wikipedia", and "Disclaimers" links, but only in Vector skin. I had forgotten to also include the equivalent elements for other skins. There was also another bug in working with other skins that I had missed. Now that both bugs, as well as the problem in Firefox, are fixed, could an admin please copy [[User:Yair rand/ReferenceTooltips.js]] and [[User:Yair rand/ReferenceTooltips.css]] over [[MediaWiki:Gadget-ReferenceTooltips.js]] and [[MediaWiki:Gadget-ReferenceTooltips.css]] again? (Sorry for having to ask so frequently.) --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 19:52, 17 June 2012 (UTC)
::{{EP[[File:Yes check.svg|d}}20px|link=|alt=]] '''Done'''<!-- Template:EP --> --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 20:08, 17 June 2012 (UTC)
:::Thanks. --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 20:13, 17 June 2012 (UTC)
{{editprotected|ans=yes}}
:[[MediaWiki:Gadget-ReferenceTooltips.js]] and [[MediaWiki:Gadget-ReferenceTooltips.css]] need yet another sync, to fix [[User_talk:Yair_rand/ReferenceTooltips#Reference_box_needs_to_show_below_the_number_sometimes|this bug]]. Thanks. --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 21:06, 2 July 2012 (UTC)
::[[File:Yes check.svg|20px|link=|alt=]] '''Done'''<!-- Template:EP --> --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 22:33, 2 July 2012 (UTC)
{{editprotected|ans=yes}}
:::Sorry, I made a mistake in the edit to [[User:Yair rand/ReferenceTooltips.js]]. Could someone please re-sync the pages to fix this? Sorry about that. --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 00:03, 3 July 2012 (UTC)
::::[https://en.wikipedia.org/w/index.php?title=MediaWiki%3AGadget-ReferenceTooltips.js&diff=500423794&oldid=500394995 Done]. Thank you. [[User:Rjd0060|Rjd0060]] ([[User talk:Rjd0060|talk]]) 02:29, 3 July 2012 (UTC)
{{editprotected|ans=yes}}
:There was a bug with the script working with iPads, hopefully the recent change to [[User:Yair rand/ReferenceTooltips.js]] fixes it. Could an admin sync the gadget page again, please? --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 04:56, 5 July 2012 (UTC)
::[[File:Yes check.svg|20px|link=|alt=]] '''Done'''<!-- Template:EP --> --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 10:26, 5 July 2012 (UTC)
{{editprotected|ans=yes}}
:Could someone please sync this with [[User:Yair rand/ReferenceTooltips.js]] again? Thanks. --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 23:40, 21 August 2012 (UTC)
::[[File:Yes check.svg|20px|link=|alt=]] '''Done'''<!-- Template:EP --> --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 16:13, 22 August 2012 (UTC)
 
== Protected edit request on 11 July 2014 ==
 
{{edit protected|MediaWiki:Gadget-ReferenceTooltips.js|answered=yes}}
<!-- Begin request -->
{{See also|WP:Village pump (technical)#No more "wg..." globals in JavaScript}}
Hello!
 
Could someone apply [[Special:Diff/508635914/616577212|these changes]] to the script?
<!-- End request -->
[[User:Helder.wiki|Helder.wiki]] 21:22, 11 July 2014 (UTC)
:{{done}} [[User:Ruslik0|Ruslik]]_[[User Talk:Ruslik0|<span style="color:red">Zero</span>]] 19:43, 18 July 2014 (UTC)
 
== NotFoundError ==
 
This gadget causes the error: <span class="error">NotFoundError: Node was not found</span>. See [[phab:T109486]]. [[User:He7d3r|Helder]] 17:54, 18 August 2015 (UTC)
:{{Replyto|He7d3r}} Checked Chrome/FF/IE on Window 7, could not reproduce. What browser were you using? --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 18:09, 18 August 2015 (UTC)
I was using Iceweasel 38.2.0. On Google Chrome it is a little more verbose:
<blockquote>
<syntaxhighlight lang="javascript">
{
"errorMessage": "Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.",
"url": "https://en.wikipedia.org/wiki/%28%CE%B5,_%CE%B4%29-definition_of_limit",
"lineNumber": 102,
"columnNumber": 812,
"errorObject": {
"stack": "Error: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.\n at Error (native)\n at HTMLUListElement.eval (eval at <anonymous> (https://en.wikipedia.org/w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=3hR%2F0Nym:4:681), <anonymous>:102:812)\n at HTMLUListElement.opt.complete (https://en.wikipedia.org/w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=3hR%2F0Nym:110:60)\n at fire (https://en.wikipedia.org/w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=3hR%2F0Nym:45:124)\n at Object.self.fireWith [as resolveWith] (https://en.wikipedia.org/w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=3hR%2F0Nym:46:431)\n at Animation.tick (https://en.wikipedia.org/w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=3hR%2F0Nym:107:719)\n at jQuery.fx.tick (https://en.wikipedia.org/w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=3hR%2F0Nym:112:760)"
}
}
</syntaxhighlight>
</blockquote>[[User:He7d3r|Helder]] 18:55, 18 August 2015 (UTC)
:PS: it also happens when I'm not logged in. [[User:He7d3r|Helder]] 18:56, 18 August 2015 (UTC)
 
== Formatting by stylesheet ==
 
{{edit fully-protected|answered=yes}}
To allow users to use custom styling of the highlighted reference, please replace:
# <code>h.style.border = ""</code> → <code>$( h ).removeClass("RTTarget")</code>
# <code>h.style.border = "#080086 2px solid"</code> → <code>$( h ).addClass("RTTarget")</code>
Note that this class is already defined in [[MediaWiki:Gadget-ReferenceTooltips.css]].
<span style="font-family:Segoe Script">[[User:Petr Matas|Petr Matas]]</span> 14:44, 9 January 2016 (UTC)
:Hm, this was actually in the changes that I made to the [[User:Yair rand/ReferenceTooltips.js|version in my userspace]], but I never ended up requesting a merge, and I can't remember why... Eh. --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 04:08, 11 January 2016 (UTC)
:[[File:Yes check.svg|20px|link=]] '''Done'''<!-- Template:EP --> — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr.&nbsp;Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪&nbsp;talk&nbsp;♪]]</sup> 07:25, 13 January 2016 (UTC)
 
== Tooltip is not shown if the reference is above the visible area ==
 
{{edit fully-protected|ans=y}}
 
'''Problem description:''' Open [//en.wikipedia.org/w/index.php?title=Quantum_state&oldid=699514891#cite_note-18 Quantum state#Ref-14]. Reference 14 contains a link to reference 1. If you hover on the link to reference 1, no tooltip is shown, although reference 1 is off-screen (''above'' the visible area). This is because the check for the reference being ''below'' the visible area is implemented, but ''above'' is not.
 
'''Fix:''' Please replace
if( !isTouchscreen && <span style="background-color:orange">( window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0 )</span> + $(window).height() > $( h ).offset().top + h.offsetHeight ) {
with
<span style="background-color:cyan">var windowTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;</span>
if( !isTouchscreen && <span style="background-color:cyan">windowTop < $( h ).offset().top && windowTop</span> + $(window).height() > $( h ).offset().top + h.offsetHeight ) {
<span style="font-family:Segoe Script">[[User:Petr Matas|Petr Matas]]</span> 13:20, 13 January 2016 (UTC)
:Probably easier if you dump the whole code in a sandbox next time, so I can just copy/paste. But {{done}} &mdash;&nbsp;Martin <small>([[User:MSGJ|MSGJ]]&nbsp;·&nbsp;[[User talk:MSGJ|talk]])</small> 09:25, 14 January 2016 (UTC)
::Ok, thanks :) <span style="font-family:Segoe Script">[[User:Petr Matas|Petr Matas]]</span> 12:00, 14 January 2016 (UTC)
 
== Sync request ==
 
{{editprotected|ans=y}}
Could an admin please merge [[User:Yair rand/ReferenceTooltips.js|these changes]]? Changes include:
* Nested references can have tooltips.
* Links inside reference tooltips are compatible with hovercards, for those who have the beta feature enabled.
* Messages are grouped at the top and use mw.msg, for easier localization when imported to other language projects.
* Reference Tooltips now runs in the [[WP:Drafts|Draft namespace]].
* Minor general cleanup.
--[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 23:04, 14 January 2016 (UTC)
:{{done}} &mdash;&nbsp;Martin <small>([[User:MSGJ|MSGJ]]&nbsp;·&nbsp;[[User talk:MSGJ|talk]])</small> 09:24, 15 January 2016 (UTC)
 
== jQuery 3 ==
 
{{edit fully-protected|answered=yes}}
This script contains the lines
<blockquote><syntaxhighlight lang="javascript" inline>$(this)[ isTouchscreen ? 'click' : 'hover' ](function( e ){</syntaxhighlight></blockquote>
and
<blockquote><syntaxhighlight lang="javascript" inline>isTouchscreen || $(tooltipNode).hover(show, hide);</syntaxhighlight></blockquote>
which cause the following warning in the console: <blockquote class="error">JQMIGRATE: jQuery.fn.hover() is deprecated</blockquote>
[[User:He7d3r|Helder]] 22:54, 7 October 2017 (UTC)
:[[File:Red question icon with gradient background.svg|20px|link=|alt=]] '''Not done:''' it's not clear what changes you want to be made. Please mention the specific changes in a "change X to Y" format.<!-- Template:EP --> &mdash;&nbsp;Martin <small>([[User:MSGJ|MSGJ]]&nbsp;·&nbsp;[[User talk:MSGJ|talk]])</small> 07:13, 27 October 2017 (UTC)
::This was resolved by [https://en.wikipedia.org/w/index.php?title=MediaWiki%3AGadget-ReferenceTooltips.js&type=revision&diff=807945391&oldid=800563927 Krinkle] —[[User:TheDJ|Th<span style="color: green">e</span>DJ]] ([[User talk:TheDJ|talk]] • [[Special:Contributions/TheDJ|contribs]]) 12:38, 1 November 2017 (UTC)
 
== Update suggestion ==
 
{{edit interface-protected|answered=yes}}
[[File:Reference Tooltips reworked.png|right]]
Hello! I would like to suggest to update to the new version of this gadget I've presented at [[mw:Topic:Ueqlcc482l9yw8gv]]. There are numerous bugfixes and added features like Harvard-style citations support. Tooltip style & animations are also updated to be consistent with Page Previews' style & animations. It has been tested thoroughly and used in Russian Wikipedia for several months with no complaints.
 
* JS: [[User:Jack who built the house/Gadget-referenceTooltips.js]]
* CSS: [[:ru:MediaWiki:Gadget-referenceTooltips.css]]
* All in one for testing purposes: [[User:Jack who built the house/referenceTooltips.js]]
[[User:Jack who built the house|Jack who built the house]] ([[User talk:Jack who built the house|talk]]) 11:18, 29 December 2018 (UTC)
* '''Support'''. --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 19:44, 6 January 2019 (UTC)
* {{re|p=|TheDJ|Xaosflux}}? [[User:Jack who built the house|Jack who built the house]] ([[User talk:Jack who built the house|talk]]) 09:54, 9 January 2019 (UTC)
* Sorry extremely busy IRL, no time to wiki. —[[User:TheDJ|Th<span style="color: green">e</span>DJ]] ([[User talk:TheDJ|talk]] • [[Special:Contributions/TheDJ|contribs]]) 10:43, 9 January 2019 (UTC)
*:These are significantly more changes than I had anticipated when looking at this again today.. This is gonna take me more than 15 minutes to review, so please be patient as I try to take another look later this week. —[[User:TheDJ|Th<span style="color: green">e</span>DJ]] ([[User talk:TheDJ|talk]] • [[Special:Contributions/TheDJ|contribs]]) 16:12, 29 January 2019 (UTC)
*::Thanks in advance! [[User:Jack who built the house|Jack who built the house]] ([[User talk:Jack who built the house|talk]]) 23:45, 30 January 2019 (UTC)
:[[File:Yes check.svg|20px|link=|alt=]] '''Done'''<!-- Template:EIp --> —[[User:TheDJ|Th<span style="color: green">e</span>DJ]] ([[User talk:TheDJ|talk]] • [[Special:Contributions/TheDJ|contribs]]) 16:40, 2 February 2019 (UTC)
::P.S. you might want to get rid of the cookies in favor of LocalStorage. That helps reduce request size and we won't be bothering the WMF servers with that info any longer. —[[User:TheDJ|Th<span style="color: green">e</span>DJ]] ([[User talk:TheDJ|talk]] • [[Special:Contributions/TheDJ|contribs]]) 16:43, 2 February 2019 (UTC)
:::Per [[phab:T179415]] for logged in users it should really be replaced with toggling the gadget in preferences. [[User:Galobtter|Galobtter]] ([[User talk:Galobtter|pingó mió]]) 07:35, 8 February 2019 (UTC)
::{{re|TheDJ}} Thanks! I forgot: {{code|jquery.client}} and {{code|mediawiki.notify}} dependencies are needed too. [[User:Jack who built the house|Jack who built the house]] ([[User talk:Jack who built the house|talk]]) 19:52, 2 February 2019 (UTC)
* Hello [[user:Jack who built the house|Jack]], nice to see you here. My two cents: since I'm sill using Opera 12.18, I was afraid that your new version would not work for me, as for some unknown reason on ruwiki it didn't, but oddly enough that's not the case now, it does work. (Except for the absence of icon in the upper right corner, but that's bearable.) So take my congrats on the success. — [[user:Mike Novikoff|Mike Novikoff]] 02:33, 3 February 2019 (UTC)
 
=== Mechanics ===
:{{ping|Jack who built the house}} to be clear, is this ready to go and you would like us to replace:
*[[MediaWiki:Gadget-ReferenceTooltips.js]] with [[User:Jack who built the house/Gadget-referenceTooltips.js]] and
*[[MediaWiki:Gadget-ReferenceTooltips.css]] with [[:ru:MediaWiki:Gadget-referenceTooltips.css]]
:? — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 13:52, 9 January 2019 (UTC)
::Yes, that's correct. Right now I have both of these files in [[:en:User:Jack who built the house/common.js|my common.js]], and it's working properly. [[User:Jack who built the house|Jack who built the house]] ([[User talk:Jack who built the house|talk]]) 14:18, 9 January 2019 (UTC)
::<small>{{re|p=|Xaosflux}}. [[User:Jack who built the house|Jack who built the house]] ([[User talk:Jack who built the house|talk]]) 14:20, 9 January 2019 (UTC)</small>
::{{re|Xaosflux}} Hello! Any updates? [[User:Jack who built the house|Jack who built the house]] ([[User talk:Jack who built the house|talk]]) 14:58, 11 January 2019 (UTC)
*Seems like a good idea....&nbsp;<b style="font-family:monospace;"><< [[User:FR30799386|FR]]</b> 10:09, 12 January 2019 (UTC)
* Pinging [[User:MSGJ|MSGJ]], who helped with several prior change requests. Would you be able to merge the above changes? --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 06:12, 15 January 2019 (UTC)
 
== Interference with links on touchscreen ==
 
As reported [[WP:Village pump (technical)/Archive 173#V • T • E (Navbar) template links not working on a phone|here]], this gadget's feature to show tooltips seems to make links with tooltips unclickable on touchscreen devices:
*[[Knockout#Technical knockout|{{abbr|TKO|technical knockout}}]] <small>(from [[Template:Abbr#Linking must be done a particular way]])</small>
This is particularly inconvenient on navboxes, which uses {{tlx|navbar||mini{{=}}y}} to show the links on top left. Can this be fixed with a change to this JS? [[User:Nardog|Nardog]] ([[User talk:Nardog|talk]]) 09:50, 4 April 2019 (UTC)
: We also have this problem in Ukrainian Wiki after we updated Gadget:Reference Tooltips to the last version. I think it would be the best solution if the words “view this template”, “discuss…” and “edit…” became pressable after you click on vte. If anyone can fix the bug in this way, please do this! --[[User:Gzhegozh|Gzhegozh]] ([[User talk:Gzhegozh|talk]]) 12:35, 5 April 2019 (UTC)
: {{ping|TheDJ}} I am sorry to bother you, but maybe you can help fix the problem? --[[User:Gzhegozh|Gzhegozh]] ([[User talk:Gzhegozh|talk]]) 15:45, 7 April 2019 (UTC)
 
{{editprotected|answered=yes}}
 
I [https://en.wikipedia.org/w/index.php?title=User:Jack_who_built_the_house/Gadget-referenceTooltips.js&type=revision&diff=896438422&oldid=882854186 fixed] the issue together with another one, reported at [[:en:Template talk:Harvard citation#Cosmetic issue: nested quotes.]]
 
Please update the gadget by moving the code from [[:en:User:Jack who built the house/Gadget-referenceTooltips.js]] to here.
 
{{re|Gzhegozh}} you can update in your wiki too. [[User:Jack who built the house|Jack who built the house]] ([[User talk:Jack who built the house|talk]]) 14:00, 10 May 2019 (UTC)
:{{re|Jack who built the house}} just want to make sure that this is the change you are asking for: [https://en.wikipedia.org/wiki/Special:ComparePages?page1=&rev1=881441476&page2=&rev2=896438422&action=&diffonly=&unhide= DIFF]. — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 19:25, 10 May 2019 (UTC)
::Yes, I only forgot the comment on top: <code>// Source https://en.wikipedia.org/wiki/MediaWiki:Gadget-ReferenceTooltips.js</code>. Updated my code, now it's correct. [[User:Jack who built the house|Jack who built the house]] ([[User talk:Jack who built the house|talk]]) 19:32, 10 May 2019 (UTC)
::<small>{{u|Xaosflux}} [[User:Jack who built the house|Jack who built the house]] ([[User talk:Jack who built the house|talk]]) 19:33, 10 May 2019 (UTC)</small>
:::{{done}}. [[User:Oshwah|<b><span style="color:#C00000">~Oshwah~</span></b>]]<sup><small><b>[[User_talk:Oshwah|<span style="color:blue">(talk)</span>]] [[Special:Contributions/Oshwah|<span style="color:green">(contribs)</span>]]</b></small></sup> 10:21, 11 May 2019 (UTC)
 
== Add support for directionality of ref tags ==
 
{{editprotected|answered=yes}}
[https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Cite/+/7738/ Since May 2018] we have the ability to use the <code>dir</code> attribute in the <code>&lt;ref&gt;</code> tags to specify the directionality of ref tags as right-to-left (RTL) or left-to-right (LTR). This is widely used in pages that cite both RTL and LTR sources, for example on Persian Wikipedia (fawiki, see [[:fa:مقام (موسیقی)|example]]). Since the ReferenceTooltips code is used on many wikis, it is ideal to add support for directionality in its enwiki version so that all others who copy it would also benefit from it.
 
I have already implemented the solution into our copy on fawiki. Please incorporate it here too.
 
* [https://fa.wikipedia.org/w/index.php?title=%D9%85%D8%AF%DB%8C%D8%A7%D9%88%DB%8C%DA%A9%DB%8C:Gadget-ReferenceTooltips.js&diff=26531591&oldid=25714387 This diff] shows how the JS code on this page should be changed.
* [https://fa.wikipedia.org/w/index.php?title=%D9%85%D8%AF%DB%8C%D8%A7%D9%88%DB%8C%DA%A9%DB%8C%3AGadget-ReferenceTooltips.css&type=revision&diff=26531007&oldid=25714426 This diff] shows how the CSS code on [[MediaWiki talk:Gadget-ReferenceTooltips.css]] should be modified.
 
Happy to answer any questions (but please {{tl|ping}} me). [[User:Huji|huji]]—[[User_talk:Huji|<small>TALK</small>]] 14:47, 1 July 2019 (UTC)
:{{Ping|Huji}} (Presumably you did not mean to leave in the <code>console.log</code> there.) --[[User:Yair rand|Yair rand]] ([[User talk:Yair rand|talk]]) 16:40, 1 July 2019 (UTC)
::{{ping|Yair rand}} correct; I updated the diff link above [[User:Huji|huji]]—[[User_talk:Huji|<small>TALK</small>]] 16:46, 1 July 2019 (UTC)
:The structure of the surrounding code context appears to be substantially different in enwiki's version of this script; I'm not sure it would be a straightforward cut-and-paste. [[User:Writ Keeper|Writ&nbsp;Keeper]]&nbsp;[[User Talk: Writ Keeper|&#9863;]][[Special:Contributions/Writ_Keeper|&#9812;]] 14:54, 2 July 2019 (UTC)
::{{not done}} this would need to be thoroughly tested here first, feel free to mock it up as a user script here on wiki and gain some testers. — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 19:50, 15 July 2019 (UTC)
 
== Feature suggestion: support for book references ==
 
The Cite extension has an experimental feature called [[mw:Help:Cite#book referencing|book referencing]]. This feature allows editors to cite multiple parts of an already-cited source using the <code>extends</code> attribute. For instance, an editor could cite a book with the citation <code><nowiki><ref name="Miller">E. Miller, ''The Sun'', (New York: Academic Press, 2005)</ref></nowiki></code>, and then they could cite page 42 in that book with a second citation <code><nowiki><ref extends="Miller">p. 42</ref></nowiki></code>.
 
Continuing with the earlier example, currently when a user hovers over the "p. 42" sub-citation, the tooltip will just contain "p. 42" without the book name. That tooltip is not especially useful. It would be nice if this gadget could handle "book references" more naturally. That is, if a user hovers over a citation of the form <code><nowiki><ref name="child" extends="parent">text</ref></nowiki></code> attribute, it would be nice if the tooltip displayed the contents of both the <code>parent</code> and <code>child</code> citations. Note that book citations can only go one level deep (you cannot extend a citation that extends another citation), which should make the implementation more straightforward. Thank you for considering this suggestion! [[User:MtMNC|MtMNC]] ([[User talk:MtMNC|talk]]) 06:51, 2 November 2020 (UTC)
:The feature in Cite extension was experimental. The project was eventually abandoned unfortunately, see [[m:WMDE Technical Wishes/Book referencing]]. – [[User:SD0001|<span style="font-weight: bold; color: #C30">SD0001</span>]] ([[User talk:SD0001|talk]]) 07:23, 14 December 2021 (UTC)
 
== Change 2 strings ==
 
{{edit fully-protected|answered=yes}}
As it [[Wikipedia:Village pump (technical)#citation tooltips no longer working when logged in?|turned out]], it can be unclear to users what they are disabling/enabling. So please replace
<syntaxhighlight lang="js">
'rt-enable': 'Enable',
'rt-disable': 'Disable',
</syntaxhighlight>
with
<syntaxhighlight lang="js">
'rt-enable': 'Enable Reference Tooltips',
'rt-disable': 'Disable Reference Tooltips',
</syntaxhighlight> [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 20:43, 4 February 2024 (UTC)
: {{done}} [[User:Pppery|* Pppery *]] [[User talk:Pppery|<sub style="color:#800000">it has begun...</sub>]] 21:34, 4 February 2024 (UTC)
 
== Update request 9 July 2024 ==
{{editprotected|answered=yes}}
Please update the JS and CSS parts of the gadget:
* Update [[MediaWiki:Gadget-ReferenceTooltips.js]] from [[User:JWBTH/Gadget-ReferenceTooltips.js]] ([https://en.wikipedia.org/wiki/Special:ComparePages?page1=MediaWiki%3AGadget-ReferenceTooltips.js&rev1=&page2=User%3AJWBTH%2FGadget-ReferenceTooltips.js&rev2=&action=&unhide= diff])
* Update [[MediaWiki:Gadget-ReferenceTooltips.css]] from [[User:JWBTH/Gadget-ReferenceTooltips.css]] ([https://en.wikipedia.org/wiki/Special:ComparePages?page1=MediaWiki%3AGadget-ReferenceTooltips.css&rev1=&page2=User%3AJWBTH%2FGadget-ReferenceTooltips.css&rev2=&action=&unhide= diff])
 
Changes:
* Respect the text size the user has in the "Appearance" section ({{myprefs|Beta|check=Accessibility for Reading (Vector 2022)}}) by using the <code>--font-size-medium</code> CSS variable and making the font size and several related properties relative (in <code>em</code>) instead of absolute (in <code>px</code>).
* Encode several constants to calculate distances based on them instead of relying on [[magic number (programming)|magic number]]s.
* Use <code><nowiki><a></nowiki></code> element for the settings link instead of <code><nowiki><div></nowiki></code> as more semantically appropriate.
* Use [https://doc.wikimedia.org/codex/latest/design-tokens/overview.html Codex design tokens] in several places (<code>box-shadow</code>, icon size).
* Fix the appearance of the tooltip tail (anchor) in Blink browsers in Windows on bigger system font sizes.
 
Ping me if there are any problems. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 08:40, 9 July 2024 (UTC)
: {{done}} [[User:Pppery|* Pppery *]] [[User talk:Pppery|<sub style="color:#800000">it has begun...</sub>]] 16:15, 9 July 2024 (UTC)
:This change breaks font size on Vector 2010. Now my reference tooltip font is larger than the article size. [[User:Traumnovelle|Traumnovelle]] ([[User talk:Traumnovelle|talk]]) 04:41, 10 July 2024 (UTC)
::cc {{u|JWBTH}} –[[User:Novem Linguae|<span style="color:blue">'''Novem Linguae'''</span>]] <small>([[User talk:Novem Linguae|talk]])</small> 04:47, 10 July 2024 (UTC)
::Thanks for the report. I guess we'll have to hardcode the font size for Vector 2010 and Monobook as well. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 05:53, 10 July 2024 (UTC)
:This is extremely broken for me (using Monobook). Font size is now significantly larger than body copy. (I think it was previously smaller? Or at least the same size.) Footnote boxes are the same width as before but now much less text fits on each line, so the footnote ends up taking 1.5x or more vertical space, which both makes it less legible per se and also covers an excessive amount of the page below. Long footnotes are much less likely to fit on screen. Some footnotes with wider content get cut off horizontally. –[[user:jacobolus|jacobolus]] [[User_talk:jacobolus|(t)]] 06:50, 10 July 2024 (UTC)
::{{tq|I think it was previously smaller?}}<br>It was 13px – a bit bigger than the font size in Monobook.{{pb}}{{tq|1=Some footnotes with wider content get cut off horizontally.}}<br>Can you give an example? [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 06:54, 10 July 2024 (UTC)
:::Here's an example, [[Lemniscate elliptic functions#cite note-73]]. Arguably this is an absurdly big formula to have in a footnote (without any breakpoints), and it's possible it spilled out of the width of a popup box even before. But there are at least some number of similar examples in other pages across the wiki. –[[user:jacobolus|jacobolus]] [[User_talk:jacobolus|(t)]] 14:10, 10 July 2024 (UTC)
::::That's very helpful, thanks. I'll make the tooltip scroll horizontally instead of having the formula spill out. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 14:31, 10 July 2024 (UTC)
:::::The width of footnote boxes should also probably be specified relative to the font size, to some consistent number of ems (25 or so? not sure). Then there can be somewhat consistent expectation for authors that readers' view of a popup note will be relatively close to an author's own view. –[[user:jacobolus|jacobolus]] [[User_talk:jacobolus|(t)]] 15:01, 10 July 2024 (UTC)
::::::That too, yeah. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 15:02, 10 July 2024 (UTC)
:::::Like this: [[File:English Wikipedia Lemniscate elliptic functions 2024-07-12 11-26-19.png|frameless|none]] [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 11:27, 12 July 2024 (UTC)
::I assume this is to be fixed by appending the WindowManager to <code>OO.ui.getTeleportTarget()</code> instead of {{tag|body|o}}? (See [[phab:T348286]].) [[User:Nardog|Nardog]] ([[User talk:Nardog|talk]]) 06:55, 10 July 2024 (UTC)
:::Oh right, using <code>#mw-teleport-target</code> could actually be a better idea than hardcoding anything (note that reference tooltips are not OOUI-based).{{pb}}Let's see. Before the change the tooltip was 13px across all skins against 14px body size. We want to make it bigger where the body font size is bigger. <code>#mw-teleport-target</code> is:
:::* strictly the body size (14px, 16px, or 20px) in Vector, Vector 2022, and Minerva
:::* 14.44px against 15.2px body size in Timeless
:::* 12.8px against 12.7px body size in Monobook
:::{{pb}}Here, I'm only afraid that making the tooltip smaller than the body text in Monobook wouldn't be a good idea as this would be hard to read. So, we may still hardcode the size for Monobook as a special case. An alternative would be to have the tooltip font size just equal to the body font size, like in Page Previews and Reference Previews:
:::[[File:English Wikipedia DeLancey W. Gill 2024-07-10 07-21-45.png|frameless|none]] [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 07:25, 10 July 2024 (UTC)
::::Couldn't you just wrap it in {{tag|ol|o|attribs=class="references"}}? [[User:Nardog|Nardog]] ([[User talk:Nardog|talk]]) 07:33, 10 July 2024 (UTC)
:::::It would just give <code>font-size: 90%;</code> to the root font size and bring side effects with it. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 07:40, 10 July 2024 (UTC)
::::::What side effects? Aren't we trying to restore the previous font size (except relative) here? [[User:Nardog|Nardog]] ([[User talk:Nardog|talk]]) 08:13, 10 July 2024 (UTC)
:::::::Side effects of the {{tag|ol|o}} element as well as any styles applied to <code>ol.references</code>. By "root font size" I mean 1rem, so it's not relative to the body font size. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 08:20, 10 July 2024 (UTC)
::::::::How about applying <code>font-size: 90%;</code> (or <code>calc(... * 0.9)</code> or whatever) then? [[User:Nardog|Nardog]] ([[User talk:Nardog|talk]]) 08:26, 10 July 2024 (UTC)
:::::::::There is no problem with that (currently the coefficient is 13/14 to match the usual font size in Vector, 13px); the question is, relative to what. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 08:33, 10 July 2024 (UTC)
::::::::::The teleport target. [[User:Nardog|Nardog]] ([[User talk:Nardog|talk]]) 17:21, 10 July 2024 (UTC)
:::::{{outdent|5}} Hm. There is a problem with <code>#mw-teleport-target</code>, and I can't yet figure out how to solve it. <code>#mw-teleport-target</code> is located at the end of the DOM and only has<syntaxhighlight lang="css">
position: absolute;
z-index: 450;
</syntaxhighlight>as styles. Which means its descendants will be positioned relative to the bottom of the screen, even if they have <code>position: absolute</code>. If I use <code>position: fixed</code> for a descendant, then ''its'' descendants will have fixed positioning relative to the page (which we don't need), even if they have <code>position: absolute</code>.{{pb}}If <code>#mw-teleport-target</code> had<syntaxhighlight lang="css">
top: 0;
width: 100%;
</syntaxhighlight>that would probably work, but it doesn't. <code>#mw-teleport-target</code> seems to be intended for fixed-positioned elements like dialogs only. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 12:51, 11 July 2024 (UTC)
::::::{{ping|Matma Rex}} Do you have a recommendation on where a script can insert tooltips so the font size etc. are the same as in the content body? [[User:Nardog|Nardog]] ([[User talk:Nardog|talk]]) 15:46, 11 July 2024 (UTC)
:::::::I believe that <code>#mw-teleport-target</code> was intended exactly for this use case. (As noted below, access it using <code>require( 'mediawiki.page.ready' ).teleportTarget</code>.) It's used by both Codex and OOUI and is meant to be usable by anything else.
:::::::I haven't looked at how it's used in Codex, but at least OOUI manages to use it to position not just dialogs, but also e.g. dropdown menus (like those on [[Special:Log]]).
:::::::You're right though that the position has to be calculated relative to the bottom of the screen… (I see things like <code>top: -2447.62px</code> on those OOUI dropdowns, which is a bit silly). I would guess nobody noticed because those libraries have generic methods to position anything relative to anything else, and they coped with the weirdness automatically. You might want to file a Phab task (and CC people who worked on the feature: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/945825), or you'll have to make your code cope with it too. [[User:Matma Rex|Matma Rex]] <small>[[User talk:Matma Rex|talk]]</small> 16:57, 11 July 2024 (UTC)
::::::::Thanks for explaining. Apart from requiring negative offsets, it also has zero width which makes descendants shrink if they don't have explicitly set width, e.g. try <syntaxhighlight lang="js">
const topOffset = -$('#mw-teleport-target').offset().top + $(window).scrollTop();
$('#mw-teleport-target').append(`<div style="position: absolute; top: ${topOffset}px; background-color:yellow;">test test test</div>`);
</syntaxhighlight>So I'm afraid, unless you set <code>width: max-content</code> (which [https://developer.mozilla.org/en-US/docs/Web/CSS/max-content#browser_compatibility is] a bit newer than Grade C browsers) together with <code>max-width</code>, you can't have descendants with variable width also. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 17:49, 11 July 2024 (UTC)
::::::::{{tq|1=You might want to file a Phab task (and CC people who worked on the feature: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/945825)}}<br>https://phabricator.wikimedia.org/T369880 [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 00:56, 12 July 2024 (UTC)
::::<code>#mw-teleport-target</code> isn't served by HTML, so I assume you can't just expect it to be there but have to await something. [[User:Nardog|Nardog]] ([[User talk:Nardog|talk]]) 07:36, 10 July 2024 (UTC)
:::::https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki.page.ready/ready.js<syntaxhighlight lang="js">
mw.loader.using('mediawiki.page.ready').then(function (require) {
console.log(require('mediawiki.page.ready').teleportTarget);
});
</syntaxhighlight>works. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 07:44, 10 July 2024 (UTC)
::::Also, two questions to @[[User:Jon (WMF)|Jon (WMF)]]: Is there a chance that CSS variables like <code>--font-size-medium</code> will land in skins other than Vector 2022 and Minerva? Is <code>#mw-teleport-target</code> reliable to be used by gadgets like this one (that seek the font size more or less equal to the body font size)? [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 08:56, 10 July 2024 (UTC)
:::::https://doc.wikimedia.org/mediawiki-core/master/js/module-mediawiki.page.ready.html#.teleportTarget is in the documentation so is therefore stable.
:::::The font size variables are not stable as they are not part of https://doc.wikimedia.org/codex/latest/design-tokens/overview.html yet. (FWIW officially CSS variables are currently not covered under the stable policy but that conversation is underway). [[User:Jon (WMF)|Jon (WMF)]] ([[User talk:Jon (WMF)|talk]]) 23:04, 10 July 2024 (UTC)
::::::Got it.{{pb}}{{tq|1=The font size variables are not stable as they are not part of https://doc.wikimedia.org/codex/latest/design-tokens/overview.html yet}}<br>Well, they ''are'' on https://doc.wikimedia.org/codex/latest/design-tokens/font.html#font-size. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 04:10, 11 July 2024 (UTC)
:::::::Yes you are correct. They are part of Codex now. My bad! Thanks for correcting me. [[User:Jon (WMF)|Jon (WMF)]] ([[User talk:Jon (WMF)|talk]]) 16:03, 11 July 2024 (UTC)
::::I think it would be fine to have the reference preview font size match the body font size if it's less work to compute. [[User:SWinxy|SWinxy]] ([[User talk:SWinxy|talk]]) 22:38, 10 July 2024 (UTC)
:::::I agree. Having footnote popups match body copy size would be totally fine. (With the proviso that the popup box width should be set using relative units so the width is about the same number of characters, as discussed a bit above.) –[[user:jacobolus|jacobolus]] [[User_talk:jacobolus|(t)]] 00:01, 11 July 2024 (UTC)
::::::I think it would look awkward. At least harder to tell apart from body text. Why should it be made bigger? We who stayed on Vector didn't complain. [[Special:Contributions/78.3.197.2|78.3.197.2]] ([[User talk:78.3.197.2|talk]]) 19:40, 12 July 2024 (UTC)
:::::::(Plus I don't want to sound like an old person but footnotes are smaller in physical books. [[Special:Contributions/78.3.197.2|78.3.197.2]] ([[User talk:78.3.197.2|talk]]) 19:45, 12 July 2024 (UTC))
:::::Disagree per what IP wrote. The old style was fine and I would like it restored. [[User:Traumnovelle|Traumnovelle]] ([[User talk:Traumnovelle|talk]]) 09:25, 13 July 2024 (UTC)
:::::Several thoughts:
:::::* Work to compute is secondary here, but there should be a rationale for smaller font from a design perspective.
:::::* Technically we don't have the current font size of Reference Tooltips in [https://doc.wikimedia.org/codex/latest/design-tokens/font.html#font-size design tokens] that we are recommended to use. Page Previews also use the default font size, 14px.
:::::* ''"I think it would look awkward. At least harder to tell apart from body text"'' – in theory, yes, but in practice, I think, the tooltip content is already well-isolated by border + paddings + shadow. My hypothesis is that you'll quickly get used to the body font size once you enable it. To test this hypothesis, you can add this<syntaxhighlight lang="css">
.rt-overlay.rt-overlay {
font-size: var(--font-size-medium, 14px);
}
</syntaxhighlight>to [[special:mypage/common.css|your common.css]] and, after some time, say how it goes. I added it to mine.
:::::* ''"footnotes are smaller in physical books"'' – obviously [[WP:NOTPAPER]], but if the argument goes "Footnotes are smaller in the reference section itself", the counterargument is "The reference in a tooltip is isolated and doesn't compete for space or attention with anything, so there is no reason to downsize it".
::::: [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 09:52, 14 July 2024 (UTC)
::::::{{tq|1=in theory, yes, but in practice, I think, the tooltip content is already well-isolated by border + paddings + shadow}}<br>If the tooltip content is not enough isolated, we might add a bit more side padding to that end:
::::::{| border=1 cellpadding=4 style="border-collapse: collapse; border-color: var(--border-color-base, #a2a9b1)"
| Increased font size + increased padding
| Current look
|-
| [[File:English Wikipedia Lemniscate elliptic functions 2024-07-14 10-33-47.png|frameless|none]]
| [[File:English Wikipedia Lemniscate elliptic functions 2024-07-14 11-54-45.png|frameless|none]]
|}
::::::More examples with the default text size set to "Small" in the "Appearance" section: [[:File:English Wikipedia Lemniscate elliptic functions 2024-07-14 10-43-32.png|current look]], [[:File:English Wikipedia Lemniscate elliptic functions 2024-07-14 10-48-59.png|increased font size]], [[:File:English Wikipedia Lemniscate elliptic functions 2024-07-14 10-50-25.png|increased font size + increased padding]]. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 12:07, 14 July 2024 (UTC)
::::::The main reason to make the text in the popup slightly smaller would be to better fit in a narrow text column, since the popup box is narrower than typical skins have for paragraphs of body copy. If the popup used the same font size as the article body that would also be fine though, in my opinion. It shouldn't be larger though. –[[user:jacobolus|jacobolus]] [[User_talk:jacobolus|(t)]] 14:33, 14 July 2024 (UTC)
:::::::As I promised, the popup width in my [[#Update request 14 July 2024|updated version]] is relative to the font size anyway. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 14:45, 14 July 2024 (UTC)
::{{tq|1=Footnote boxes are the same width as before but now much less text fits on each line}}<br>This actually made me think that probably we should also made the tooltip wider when the user opted for the large font size in ''Vector''. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 06:57, 10 July 2024 (UTC)
:::Do your updates fix the gadget on Vector 2010? [[User:Traumnovelle|Traumnovelle]] ([[User talk:Traumnovelle|talk]]) 09:26, 14 July 2024 (UTC)
::::Yes, see [[#Update request 14 July 2024]]. [[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 09:34, 14 July 2024 (UTC)
 
== Update request 14 July 2024 ==
 
{{editprotected|answered=yes}}
This update addresses user complaints voiced in [[MediaWiki talk:Gadget-ReferenceTooltips.js#Update request 9 July 2024]] and includes other changes.
 
Please update the JS and CSS parts of the gadget:
* Update [[MediaWiki:Gadget-ReferenceTooltips.js]] from [[User:JWBTH/Gadget-ReferenceTooltips.js]] ([https://en.wikipedia.org/wiki/Special:ComparePages?page1=MediaWiki%3AGadget-ReferenceTooltips.js&rev1=&page2=User%3AJWBTH%2FGadget-ReferenceTooltips.js&rev2=&action=&unhide= diff])
* Update [[MediaWiki:Gadget-ReferenceTooltips.css]] from [[User:JWBTH/Gadget-ReferenceTooltips.css]] ([https://en.wikipedia.org/wiki/Special:ComparePages?page1=MediaWiki%3AGadget-ReferenceTooltips.css&rev1=&page2=User%3AJWBTH%2FGadget-ReferenceTooltips.css&rev2=&action=&unhide= diff])
 
Changes:
* Make the font size in Vector 2010 and MonoBook the same as before the changes. (In the future, Vector 2010 font size should be fixed by placing the overlay inside <code>#mw-teleport-target</code>; see [[phab:T369880]].)
* Make the tooltip width relative to the font size.
* Increase the height of the tooltip tail (anchor) by 1px (it's hard to resize it proportionately as with other values).
* Make a horizontal scrollbar appear when the contents of the tooltip exceed the maximum width and can't be wrapped to the next line ([[Lemniscate elliptic functions#cite note-73|example]]).
* Make the script reusable by other wikis (and synchronizable across wikis). They can now load it from enwiki while setting their own settings and messages.
* Rework the settings dialog: turn the enable/disable radio input into a checkbox, turn the "Cancel" button into a close button, reword the labels.
* Replace a 404 image illustrating the footer link from an extension with a [[:File:MediaWiki footer link ltr.svg|Commons file]]. It appears when the gadget is disabled from its settings.
* Fix the page footer when the gadget is disabled from its settings. A new footer link to reenable the gadget was added each time <code>wikipage.content</code> hook fired on a page.
* Remove old IE fix (IE is [[mw:Compatibility#Browser support matrix|no longer supported]] by MediaWiki).
* Do minor chores and code style fixes.
[[User:JWBTH|Jack who built the house]] ([[User:JWBTH|talk]]) 09:33, 14 July 2024 (UTC)
: {{done}} [[User:Pppery|* Pppery *]] [[User talk:Pppery|<sub style="color:#800000">it has begun...</sub>]] 23:22, 15 July 2024 (UTC)
 
== Preferences ==
 
There is a [[phab:T179415|task]] regarding this gadget about setting preferences. [[User:Wargo|Wargo]] ([[User talk:Wargo|talk]]) 13:10, 16 February 2025 (UTC)