Topic on Talk:Reference Tooltips

Jump to navigation Jump to search

Not able to get script functioning

Coyote897 (talkcontribs)

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:

In total I now have relevant script on all the following pages:

[On the above page have tried: importStylesheet('User:Yair rand/ReferenceTooltips.css');


/* Reference Tooltips. Version for testing before adding to gadget */

/* See */

/* Discussion: */

importScript('User:Yair rand/ReferenceTooltips.js'); importStylesheet('User:Yair rand/ReferenceTooltips.css');


contains: importScript('User:Yair rand/ReferenceTooltips.js'); (just in case required)

[The following two urls contain the same code as their matching pages above.]

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.

Yair rand (talkcontribs)

@Coyote897 Is the site publicly visible? If so, could you provide a link?

Also, does the javascript console show any errors?

Yair rand (talkcontribs)

@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.

Coyote897 (talkcontribs)

@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.

Yair rand (talkcontribs)

@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 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).

Coyote897 (talkcontribs)

@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.

Reply to "Not able to get script functioning"