Topic on Project:Support desk

Javascript is not activated?!

14
91.96.131.188 (talkcontribs)

Hey there guys, for some unkwon reasons the JS defined class mw-collapsible (mw-collapsed) is currently not working in our wiki. The "hide" and "show" wont show up. I tryed a few things, but it wont work either! And the special page "maintenence shell" is not working too! A message is always popping up saying "JavaScript must be activated" in order to use this special page. I am really confused right now. In other wiki, like this wiki, mw-collapsible (mw-collapsed) is working but not in my wiki.

I am not using any css/js rules in my wiki to define these two classes. I updated /resources and all the files to the latest version and still nothing happend.I even read the manuals and copy&pasted the css&js rules. Nothing happend. A few days ago I noticed that mw-collapsible (mw-collapsed) was not always working. Sometimes the toogle button was shown and sometimes not. But now it's entirely not working.

Currently using: MediaWiki: 1.26.2; https://php.net/ PHP 7.0.10 (cgi-fcgi); MySQL 5.5.50-0+deb7u2-log; ICU 4.8.1.1

I'd be really grateful and happy if someone could help me.

121.220.53.76 (talkcontribs)

Press F12, reload the page and see the errors which come up in the console; these are preventing JS from working. Probably caused by some custom script in MediaWiki:Common.js or MediaWiki:Vector.js.

91.96.131.188 (talkcontribs)

I made two screenshots, please take a look.

http://i1250.photobucket.com/albums/hh535/lodestar/fzwscreenshot01_zps4ezxjzsc.png

http://i1250.photobucket.com/albums/hh535/lodestar/fzwscreenshot02_zpsjnt9lffk.png

I also copied these codes (mypage.example/example/Benutzer:xxx:26 - take a look at the second screenshot)

<code><nowiki>

<link rel="stylesheet" href="data:text/css;charset=UTF-8;base64,I2Nzcy1leHRlbnNpb24tY2FuYXJ5LWM0NzFmMXtiYWNrZ3JvdW5kOiNjNDcxZjEgIWltcG9ydGFudH1kaXYuY2VudGVyIHsKICAgIHRleHQtYWxpZ246IGNlbnRlcjsKfQoKQG1lZGlhIHNjcmVlbiBhbmQgKG1heC13aWR0aDogMTAwMHB4KSB7Ci5kaXNhcHBlYXIgaW1nIHsKICAgIGRpc3BsYXk6IG5vbmU7Cn0KfQ==" /><script>jQuery( function( $ ) {

$( 'link[href^="data:text/css;charset=UTF-8;base64,I2Nzcy1leHRlbnNpb24tY2FuYXJ5LWM0NzFmMXti"]' )

.cssExtensionDataURIFallback( 'css-extension-canary-c471f1', 'c471f1' );

} );</script></nowiki></code>

<code><nowiki>

Exception encountered, of type &quot;Error&quot;<br />

[b283ccc6] /load.php?debug=false&amp;lang=de&amp;modules=startup&amp;only=scripts&amp;skin=timeless   Error from line 563 of /var/www/web130/html/mediawiki-1.23.4/mediawiki-1.23.4/includes/resourceloader/ResourceLoader.php: Class 'ResourceLoaderSiteStylesModule' not found<br />

Backtrace:<br />

#0 /var/www/web130/html/mediawiki-1.23.4/mediawiki-1.23.4/includes/resourceloader/ResourceLoader.php(132): ResourceLoader-&gt;getModule(string)<br />

#1 /var/www/web130/html/mediawiki-1.23.4/mediawiki-1.23.4/includes/resourceloader/ResourceLoaderStartUpModule.php(406): ResourceLoader-&gt;preloadModuleInfo(array, DerivativeResourceLoaderContext)<br />

#2 /var/www/web130/html/mediawiki-1.23.4/mediawiki-1.23.4/includes/resourceloader/ResourceLoaderStartUpModule.php(388): ResourceLoaderStartUpModule-&gt;getAllModuleHashes(DerivativeResourceLoaderContext)<br />

#3 /var/www/web130/html/mediawiki-1.23.4/mediawiki-1.23.4/includes/resourceloader/ResourceLoaderModule.php(624): ResourceLoaderStartUpModule-&gt;getDefinitionSummary(DerivativeResourceLoaderContext)<br />

#4 /var/www/web130/html/mediawiki-1.23.4/mediawiki-1.23.4/includes/resourceloader/ResourceLoader.php(643): ResourceLoaderModule-&gt;getVersionHash(DerivativeResourceLoaderContext)<br />

#5 [internal function]: ResourceLoader-&gt;{closure}(string)<br />

#6 /var/www/web130/html/mediawiki-1.23.4/mediawiki-1.23.4/includes/resourceloader/ResourceLoader.php(644): array_map(Closure, array)<br />

#7 /var/www/web130/html/mediawiki-1.23.4/mediawiki-1.23.4/includes/resourceloader/ResourceLoader.php(696): ResourceLoader-&gt;getCombinedVersion(ResourceLoaderContext, array)<br />

#8 /var/www/web130/h

</nowiki></code>

(when clicking on "Refused to execute script from 'http://fzerowiki.net/load.php?debug=false&lang=de&modules=startup&only=scripts&skin=timeless' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.")

I am assuming somethings wrong with the [[Skin:Timeless|Timeless]] skin.

85.16.33.149 (talkcontribs)

now what?

87.123.41.228 (talkcontribs)

The relevant part of the error is

Class 'ResourceLoaderSiteStylesModule' not found

You should check, where (= in which file) this class should be. And why it is not there.

87.123.41.228 (talkcontribs)

I think this is not a problem with that one skin. You are getting the same error message also, if you use that URL, but with "vector" or "monobook" instead of "timeless" in it.

Class ResourceLoaderSiteStylesModule should be defined in includes/resourceloader/ResourceLoaderSiteStylesModule.php and it is referenced in autoload.php.

Make sure that all files of the MediaWiki package got extracted and that no old files remained.

Afterwards, make sure to empty all caches, e.g. the PHP cache, a class loader cache, APC or whatever you might have running on the server!

85.16.38.51 (talkcontribs)

Done. JavaScript is now activated. Thanks.

87.123.2.94 (talkcontribs)

JavaScript had been activated all the time. How have you fixed the issue?

85.16.47.223 (talkcontribs)

I realized something was wrong with the Common.js page and the extension "CSS". I just updated MediaWiki to the current version. I also realized that the skins have nothing to do with the issue because the console menu is always reporting the same message even If I switch to vector or monobook. To be honest (and I realized that a few hours ago) the issue is not really fixed. I am sorry and I really don't understand how to handle with PHP and/or JS. I am just a CSS & HTML guy with a wiki on a shared host server. As you may realized I really can't do anything because I've some problems to understand where the problem is how to fix it. But I am really motivated and have interest to learn more about the current situation and how to fix it.

I am thinking about deleting the Common.js page since these codes are useless for us. I just wanted the "click on image to toogle" thingy and I need that in the future. So, let us restart so I can think about the whole problem.

When this visiting this page these message can be seen in the console menu of Firefox and/or Google Chrome:

(Google Chrome)

Uncaught ReferenceError: jQuery is not defined

load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=monobook&version=Lw3Ssrp0:178 Exception in module-execute in module site:

load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=monobook&version=Lw3Ssrp0:178 ReferenceError: addOnloadHook is not defined ReferenceError: addOnloadHook is not defined(…)log @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=monobook&version=Lw3Ssrp0:178

(Firefox)

Exception in module-execute in module site:load.php:178:411

ReferenceError: addOnloadHook is not defined ReferenceError: addOnloadHook is not defined [...]

What I get is that jQuery and addOnloadHook is not defined. I clicked on "Warnings" (in the console/debug menu of Firefox while reading the "Captain Falcon page") and got several warning messages like "Use of "$j" is deprecated. Use $ or jQuery instead." or "Use of "wgAction" is deprecated. Use mw.config instead."

Ciencia Al Poder (talkcontribs)

The "Uncaught ReferenceError: jQuery is not defined" is because Extension:CSS is injecting a script referencing jQuery at the head of the document, but jQuery is loaded asynchronously, so when the Extension:CSS script is loaded, jQuery still is not defined. I can say for sure that Extension:CSS is broken. I'd recommend uninstalling it. You can achieve similar effects by editing MediaWiki:Common.css and target your rules to the specific CSS class that every page has in the body element.

addOnloadHook was deprecated long ago and is now no longer supported. See ResourceLoader/Legacy JavaScript. You can fix that simply by replacing "addOnloadHook" with "jQuery". But knowing that your scripts are relying on that obsolete method, it may throw other errors for similar obsolete methods when this code executes.

Yässinzeldafan (talkcontribs)

I know it's been five months and our wiki is a ghost town (but thats not important anyway). Erm... okay... I'm a noobie, so dont expect I understand everything. What I know is that these <idontknowhowtocallthem> are deprecated, I got it. Now I need to replace them... with newer ones, right? And how am I supposed to do that? Which file(s) should I edit and where is it (/are they)?

Warning messages (if someones wants to take a look...)
load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:178 ReferenceError: addOnloadHook is not defined ReferenceError: addOnloadHook is not defined
    at eval (eval at <anonymous> (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:4), <anonymous>:6:91)
    at eval (<anonymous>)
    at load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:4
    at Function.globalEval (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:4)
    at Object.<anonymous> (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:163)
    at fire (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:45)
    at Object.add [as done] (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:45)
    at Object.always (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:46)
    at runScript (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:162)
    at checkCssHandles (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:163)

log @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:178 handler @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:155 fire @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:45 fireWith @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:46 fire @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:46 track @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:155 runScript @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:163 checkCssHandles @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:163 (anonymous) @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:163 fire @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:45 fireWith @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:46 fire @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:46 fireCallbacks @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:157 addEmbeddedCSS @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:158 (anonymous) @ load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=timeless&version=Lw3Ssrp0:157

Ciencia Al Poder (talkcontribs)

A link to the wiki would help. Instances of "addOnloadHook" may be on those pages: "MediaWiki:Common.js" and "MediaWiki:Timeless.js", your personal scripts, or even outdated extensions/skins

Yässinzeldafan (talkcontribs)
Ciencia Al Poder (talkcontribs)
Reply to "Javascript is not activated?!"