Jump to content

Talk:Snippets/Style pages based on categories

Add topic
From mediawiki.org
Latest comment: 8 years ago by Stefahn in topic Load JavaScript before CSS

Load JavaScript before CSS

[edit]

The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.


Thanks for your snippet. It's very handy.

How can I add the snippet to a wiki page? If I try to do that, I get ReferenceError: jQuery is not defined

I can add the snippet to my Common.js. However the Common.js seems to be loaded only after the CSS files. So there is a short moment where you can see all the elements I want to disable in a certain category. I don't want the user to see these elements.

Thanks, Stefan Stefahn (talk) 14:13, 21 October 2017 (UTC)Reply

There's no other way to load it before the page is rendered than output the category classes directly by PHP, by implementing an extension or directly a hook in LocalSettings.php Ciencia Al Poder (talk) 14:56, 21 October 2017 (UTC)Reply
Okay, thanks.
I (re)found the extension AddBodyClass which does exactly what I need. Stefahn (talk) 15:59, 21 October 2017 (UTC)Reply
The discussion above is closed. Please do not modify it. No further edits should be made to this discussion.