In Wikipedia preferences it says: "does not work if 'Navigation popups' is enabled above".
They both work for me. I am using Firefox on a desktop PC.
In Wikipedia preferences it says: "does not work if 'Navigation popups' is enabled above".
They both work for me. I am using Firefox on a desktop PC.
Initially the gadget used Page Preview's classes to show tooltip and later changed to its own copies of them. However, after that, there were some visual changes to Page Preview's classes including changing border colors which didn't reflect on reference tooltips.
I hope these changes will be applyed to reference tooltips. Thanks!
Where are ReferenceTooltips.js and ReferenceTooltips.css meant to go?
I have a Debian package installation and there are a whole load of file links between /etc/www/mywiki/w and /usr/share/mediawiki/extensions-core/Gadgets and /var/lib/mediawiki. Unfortunately the document writer's assumption that I should know is just overoptimistic.
Does it matter if I called the JS and CSS files something different? The only place they are referenced is in MediaWiki:Gadgets-definition, is that right?
I've just got this in my LocalSettings.php:
$wgGadgetsRepoClass = "MediaWikiGadgetsDefinitionRepo"
wfLoadExtension( 'Gadgets' );
And is this good:
ReferenceTooltips[ResourceLoader|default|type=general|dependencies=mediawiki.cookie,jquery.client]|Gadget-ReferenceTooltips.js|Gadget-ReferenceTooltips.css
or will those dependencies foobar It? I took that off wikipedia.org. Being a noob, I don't even know how to confirm if those 2 dependencies are present.
They are not kept as files on a server, instead you only need to add some pages to your wiki. So you have to create a page in your wiki named "MediaWiki:Gadget-ReferenceTooltips.js" and so on for all of the steps.
Hit the next issue - not sure if this is a foobar that I sneaked in with my fat fingers or a real problem:
Fatal error: Uncaught Exception: /usr/share/mediawiki/extensions/Gadgets/extension.json does not exist!
It's obviously having a problem because that file is at /usr/share/mediawiki/extensions-core/Gadgets
I put:
wfLoadExtension( 'Gadgets' );
in my LocalSettings.php - is that wrong?
Can you move the extension to the "extensions" folder instead of "extensions-core"?
Ah, I see. Yes. Even simpler, I just created a link like many of the other packages had. Obviously the Debian Gadgets package is way behind. However, now mediawiki is happy, but although I see the Gadgets entry on Special:Version, Gadgets isn't loading somehow:
- it doesn't have any entries in Special:Gadgets
- it doesn't show up as a tab in my Preferences
- the ReferencesTooltip functionality isn't present.
OK - panic over. I hadn't called the two files "MediaWiki:Gadget-ReferenceTooltips.js/css" - stupidly confused. It's probably worth making a small edit to the setup doc to clarify this point. In my first attempt, I put them on the file system - doh!
On my second attempt, I called them "MediaWiki:ReferenceTooltips.js" and in my Gadgets-definition page, I referred to them as "ReferenceTooltips.js".
On my third attempt I renamed them to "MediaWiki:Gadget-ReferenceTooltips.js" but I haven't changed the names in Gadgets-definition so that is in contrast to the instructions here, yet it works.
there's a beta feature called "Reference Previews". didn't see it here, but ATM, it exists in beta preferences on enwiki and hewiki, and probably most wikimedia wikis.
presumably not a "gadget", but part of core.
these two features "collide" - both show the cite note in two separate popups.
one of them should check if the other is on and disable itself. i think this one already self-disable when the old "popup" enwiki gadget is on, and something similar should be done WRT the beta feature too.
peace.
Copied from WP:VPT on en.WP: The tooltip for reference [a] in en:Clearing_the_neighbourhood#Margot's_Π is too narrow to accommodate the equations.
.rt-tooltip
has a max-width: 350px;
. Would require some additional code to check what the overflow is and then overwrite the max-width value. How about just adding word breaks inside the math equations?
.rt-tooltip img { max-width: 100%; }
would also solve this (for when people are using the default image renderer and not MathML)
Go to MediaWiki:Gadget-ReferenceTooltips on your wiki
When I navigate to Special:Preferences#mw-prefsection-gadgets, I can't see where to disable Reference Tooltips. Thank you for looking into this!
What wiki are you on? If you go to MediaWiki:Gadget-ReferenceTooltips on your wiki you will see what label this option has and you should be able to look for that label in your Preferences.
You might also be looking for "Reference Previews", which is a different thing. That can be found under the "Preferences -> Beta Features" tab.
I understand this does not work together with Navigation popups.
But before, if you enabled both, Navigation popups will simply override Reference Tooltips. But currently, if you leave Reference Tooltips on (with default setting, "Click") and then enable Navigation popup, it causes a bug that, if you want to jump to the reference by clicking the reference number, you have to CLICK TWICE.
This doesn't happen a few months ago. So I mark it as a regression bug.
Both of my sites are active. But on one of my sites, only one opens. Normal. On my other site, they both open at once. This is certainly bad (Google Chrome). What should I do to be normal on the second site? I don't want to give up the Navigation popups.
I solved the problem. I replaced "Popups 1_33" with "Popups 1_32". Now everything is exactly what I want. The latest version does not have "Popups.php" and "package-lock.json" files. It is possible that this was the cause of the problem.
Hi, I'm a developer active in Russian Wikipedia. We've reworked ReferenceTooltips significantly in our wiki, and I would like to suggest other wikis to update to our version. (Maybe a global gadget would be a better solution, I would welcome such an initiative if the community agrees.) It was developed by me; Facenapalm, Serhio Magpie, IKhitron, Iniquity, Saint Johann helped in testing.
Here it is: w:en:User:Jack who built the house/Gadget-referenceTooltips.js (English translation) / w:ru:MediaWiki:Gadget-referenceTooltips.css.
Changes list:
Some details about installation:
.mwe-popups-fade-in-down
and such. The code is not so short, so they weren't incorporated into the gadgets. If the classes would be renamed/removed some time, you would have to add them manually.Looks good. I notice a few bugs that were introduced:
Note that the gadget still works, but without the animation, when Page Previews is disabled via preferences.
@Yair rand: thank you for the original version of the gadget and thank you for the notes. The first one seems legit, although it is the case for Page Previews also. I fixed it. The demo tooltip bug is fixed too. As to the animation, I checked it some time ago and found that the classes work no matter Page Previews is enabled or disabled. Now it changed apparently, so I added the classes to the gadget's CSS.
One question: in your version there is a namespace check. Is it there because in some namespaces the gadget is undesirable, or is it there because in most namespaces there is just no need for it? If it is the second, I don't see good reasons for that restriction as references appear from time to time in much more namespaces than the main namespace, "Project", "Help" and "Draft". I removed the namespace check for now.
@Jack who built the house: The namespace check was added in 2011 by @Kaldari, with the intention of "trying to cut down js bloat for other pages", which seems reasonable. It might be preferable to add some more namespaces to the list, but the gadget certainly doesn't need to run in the Special namespace or Module namespace, for example. Or maybe it should be changed from a whitelist to a blacklist?
In the Module namespace, refs may appear in docs, and they do. As for the Special namespace, you are probably right. A check for the wgIsArticle
wgAction
config value could also be useful. Nevertheless I don't really see much gain here as it will only save us a time needed for running 2 selectors (by default).
On my old notebook in the watchlist with 500 last changes the script runs with no effect for 8ms. On modern machines it's even quicker. So I guess the gain of the script not running where it has no effect is comparable to the price of loading additional lines of code (and for most users who only read Wikipedia, which means they don't visit special pages or page history, it has no effect). So I don't see any clear benifits and will leave the code unchanged for now.
It looks great, thanks for the update and the support of Harvard-style citations!
While translating it, I noticed an orphan bracket at the end of 'rt-tooltipsForComments'.
If possible, it would make the translation easier to keep the translation text at the beginning of the code, like in the original Reference Tooltips code.
Could it be made so that it shows on the bottom of the ref like Page Previews (see meta:WMDE Technical Wishes/ReferencePreviews) (an advantage is that it doesn't hide the text of the sentence) and with the same exact animation?
@The RedBurn: > While translating it, I noticed an orphan bracket at the end of 'rt-tooltipsForComments'.
That's a Google Translate bug.
> If possible, it would make the translation easier to keep the translation text at the beginning of the code, like in the original Reference Tooltips code.
Done.
> Could it be made so that it shows on the bottom of the ref like Page Previews (see meta:WMDE Technical Wishes/ReferencePreviews) (an advantage is that it doesn't hide the text of the sentence) and with the same exact animation?
I'm afraid I can't understand what you mean here.
> That's a Google Translate bug.
Indeed, my bad.
> Done.
Thanks!
> I'm afraid I can't understand what you mean here.
Yes, I should have said "below": the Page Previews pop-up shows up below the link, as you can see here. Could the same thing be achieved with Reference Tooltips, since it's mentioned on meta:WMDE_Technical_Wishes/ReferencePreviews#Requirements_for_a_solution?
Page Previews are shown above the link by default as well. They are shown below only when there isn't enough space above. To make them appear below you could change the following condition: teOffset.top < this.$element.outerHeight() + $window.scrollTop() + 6
.
Could you make an English version? I don't think translating with Google Translate is enough.
If it's any help to you, Jack who built the house or anyone, here's the French translation I made: Utilisateur:The_RedBurn/ReferenceTooltips-fr.js
English translation: en:User:Jack who built the house/Gadget-referenceTooltips.js. Feel free to improve by posting better translations here.
It looks great! Is it possible to put mw.util.addCSS below the translation text to make translations easier?
You're right: I changed the link to only-JS version. CSS needs no changes.
Hello,
I'd like to add this extension to Wikiversity. What are the steps to add it?
A local administrator can copy the pages w:MediaWiki:Gadget-ReferenceTooltips, w:MediaWiki:Gadget-ReferenceTooltips.js, and w:MediaWiki:Gadget-ReferenceTooltips.css over to Wikiversity, and then add the line "ReferenceTooltips[ResourceLoader|default|type=general]|ReferenceTooltips.js|ReferenceTooltips.css" to MediaWiki:Gadgets-definition. The gadget will then be loaded by default on the wiki.
Hi, on a 3rd party mediawiki site I have installed the script as per the instructions (as far as I can tell) but I am not able to get the pop-up functionality working. I would really appreciate some assistance please.
I have installed both manually (according to the instructions) and via export and special page import from here: https://en.wikipedia.org/wiki/Special:Gadgets/export/ReferenceTooltips
In total I now have relevant script on all the following pages:
https://www.domain.com/x/User:Yair_rand/ReferenceTooltips.js
https://www.domain.com/x/User:Yair_rand/ReferenceTooltips.css
https://www.domain.com/x/User:Louisa/common.js
[On the above page have tried: importStylesheet('User:Yair rand/ReferenceTooltips.css');
and:
/* Reference Tooltips. Version for testing before adding to gadget */
/* See en.wikipedia.org/wiki/User:Yair_rand/ReferenceTooltips */
/* Discussion: en.wikipedia.org/wiki/User_talk:Yair_rand/ReferenceTooltips */
importScript('User:Yair rand/ReferenceTooltips.js'); importStylesheet('User:Yair rand/ReferenceTooltips.css');
]
https://www.domain.com/x/User:Louisa/monobook.js
contains: importScript('User:Yair rand/ReferenceTooltips.js');
https://www.domain.com/x/MediaWiki:Common.js (just in case required)
[The following two urls contain the same code as their matching pages above.]
https://www.domain.com/x/MediaWiki:Gadget-ReferenceTooltips.js
https://www.domain.com/x/MediaWiki:Gadget-ReferenceTooltips.css
https://www.domain.com/x/MediaWiki:Gadgets-definition
The script appears as a gadget in preferences > gadgets.
I have cleared the browser cache by various methods.
The "Navigation popups" script is not installed on the server.
@Coyote897 Is the site publicly visible? If so, could you provide a link?
Also, does the javascript console show any errors?
@Coyote897 The JS console is showing "ReferenceError: importScript is not defined". Seems as though "importScript" is no longer always available at the start, so that line is breaking things. You could wrap it in mw.loader.using( 'mediawiki.legacy.wikibits', function () {} );
, but since this is a gadget anyway, I think it would just work if you removed the importScript/importStylesheet lines from Common.js and the user js pages.
@Yair rand Thankyou. Though do not seem to be getting a console error (at least with FF 52.0.2) I am still not able to get the script working. Please see here for a screenshot of the console while cursor is over a reference number.
I have tried the following:
a) Removing the importscript lines
b) Enclosing the importscript lines with the following:
mw.loader.using( 'mediawiki.legacy.wikibits', function () {
/* importscript line here */
} );
and the following variant (using the format of the line from the main wiki common.js)
mw.loader.using( ['mediawiki.legacy.wikibits'] ).done( function () {
/* Begin of mw.loader.using callback */
/* importscript line here */
/* End of mw.loader.using callback */
} );
c) And I have removed the full url in the importscript lines - so that it is back to the format in the instructions.
Is there anything I can set access wise, for the account I listed above - which would help you ascertain more. If so, please if you could copy the credentials so that I can delete them from the above post.
@Coyote897 Ah, the issue is that that page is in the userspace. By default, the script only runs in the main namespace, and the project, help, and draft namespaces. You can change this by modifying the line containing the text [ "", "Project", "Help", "Draft" ]
in the JS code. The gadget seems to be working as expected in the main namespace of the site.
I've removed the credentials from your post and "deleted" the old revision, making it only visible to mediawiki.org administrators (which includes myself). If you want to further remove the content, the only people with the ability to do that here are Wikimedia Stewards (see m:Stewards).
@Yair randThankyou so much for your generous attention in identifying what the issue was. I am so pleased to get the script working :) :) :)
As you wrote, I just needed to add "User" to the relevant line so as to add that namespace.
The script is working perfectly now.