Jump to content

Manual:User group CSS and JavaScript

From mediawiki.org

User group CSS and JavaScript is possible since MediaWiki 1.18 (specifically r82285). This means that CSS and JavaScript can be loaded per user group. CSS and JavaScript pages take the following form, where example is the user group:

  • [[MediaWiki:Group-example.css]]
  • [[MediaWiki:Group-example.js]]

The special group "*" does not load MediaWiki:Group-*.js or MediaWiki:Group-*.css. To address all users, use MediaWiki:Common.js and MediaWiki:Common.css instead. Note that if $wgMFCustomSiteModules is set (such as WMF production), you may also need to duplicate the styles in MediaWiki:Minerva.css for it to effect mobile users. The special group "user" (for logged-in users) does load MediaWiki:Group-user.js and MediaWiki:Group-user.css (though this was only introduced in MediaWiki 1.23 , Gerrit #I0ef967). See UserModule.php for reference.

Examples: