Topic on Project:Support desk

Javascript is sketchy

12
Bttfvgo (talkcontribs)

I was testing a Gadget I used to use (jCarousel) and I noticed it only works half the time. (I'm on Vector). Chrome debug console gives me the following errors:

This page is using the deprecated ResourceLoader module "jquery.ui.core". Please use "mediawiki.ui.button" or "oojs-ui" instead. This page is using the deprecated ResourceLoader module "jquery.ui.widget". This page is using the deprecated ResourceLoader module "jquery.ui.position".

In that vein, I've noticed that all of my Javascript is acting funny. My drop down menus don't work, search suggestions don't work, basically anything involving Javascript only works half the time now. Is there something I can change to get them to start working? These errors are being shown on every page. Thank you!

Malyacko (talkcontribs)
Bawolff (talkcontribs)

While you should upgrade your dependencies, its likely the js "half-working" is caused by something else.

Bttfvgo (talkcontribs)

How can I go about that? I've ran update.php and composer update. Is there another place I can run composer update and do I have to do it on each extension? Thanks!

Bttfvgo (talkcontribs)

I've been looking though various files and haven't found anything useful. I do see that those modules aren't in my Resources director (like other jquery modules) so I know that's the problem. But I'm unsure of how to remove those references to them. I checked Wikivoyage (where they also use jCarousel) and they have the same problem - yet their carousel still works. So I'm sure the problem is somewhere else, I just don't know where. I do really really love this software and I'm willing to learn!

UPDATE: Found them all in /public_html/resources/lib/jquery.ui/ but don't know what to do with them.

Bttfvgo (talkcontribs)

Could it be a java problem? When I type "java -version" I get the following: Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object

Malyacko (talkcontribs)

Please explain why you think of random languages not used in MediaWiki (like Java) when asking if this could be a Java problem. There must have been a thought process that you have not shared.

Bttfvgo (talkcontribs)

I figured Java - Javascript. You know.

Bttfvgo (talkcontribs)

I also receive the following (additional) error on the Main Page: Uncaught TypeError: $.debounce is not a function

Bawolff (talkcontribs)

I don't mean those types of dependencies, I mean the dependencies written into the script.

Uncaught TypeError: $.debounce is not a function

is highly likely related to the issues you are seeing (Likely caused by dependency jquery.throttle-debounce not being declared correctly, with it sometimes being loaded in wrong order).

Bttfvgo (talkcontribs)

I finally just moved my hosting from shared hosting to VPS. It has been a chore to get right but everything seems to be running great again. I was able to install JDK so I don't have to worry about that anymore. I did need to update Java on my device. It had been reminding me for awhile. It hasn't given me a problem since. It still displays the errors but only if you go into Chrome's Developer Tools. Everything works good now, though, so I'm not going to complain! @Bawolff, you mention dependencies being declared in the wrong order. Do they load in the order in which the extension calling for them is listed in LocalSettings.php? I only ask because I decided to organize my settings file by alphabetizing all of the extensions. I did make notes throughout as certain extensions (like Scribunto, Syntax Highlighter, and Visual Editor) do say that items needed to be listed in a certain order. In that case I changed the order of the extension attribute declarations (like $wgScribuntoUseGeSHi = true; and $wgScribuntoUseCodeEditor = true;). For some reason I feel I'm doing it wrong but I'm not complaining! It works again! Yea!

Bawolff (talkcontribs)

Java and Javascript are entirely separate things (Calling it javascript was a marketing ploy by Netscape back in the 90's because they thought java had a lot of positive buzz), so upgrading the jdk should have no affect.

For dependencies, I don't mean LocalSettings.php. In the code of the gadget javascript (that is what the programmer made), having things in wrong order could cause problems. Order should mostly not matter in LocalSettings.php, and anywhere it does matter your site will probably totally not work at all so it will be really noticable

Reply to "Javascript is sketchy"