Skins should add their name as a class in <body>
Closed, ResolvedPublic

Assigned To
None
Priority
Normal
Author
jhsoby
Subscribers
Chad, ashley, jhsoby and 2 others
Projects
Reference
bz15052
Description

Each skin should add its name (or ID or whatever) as a class in <body>. The reason I request this is that it would enable gadgets to change the CSS of a page in different ways depending on what skin is used.

For an example, turn on the "Dynamic menus" gadget on Meta; it is only intended for Modern, and will look awful in other skins like Monobook or Standard. With a CSS identifier for each skin, it could be adapted (or disabled) for other skins than Modern, and avoid making a mess.


Version: unspecified
Severity: enhancement

bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz15052.
jhsoby created this task.Via LegacyAug 5 2008, 10:53 PM
Chad added a comment.Via ConduitAug 6 2008, 12:57 AM

Any particular reason the skin name provided with the javascript vars can't be used?

ashley added a comment.Via ConduitAug 6 2008, 1:09 AM

Fixed in r38675.

DanielFriesen added a comment.Via ConduitAug 6 2008, 2:29 AM

Reverted in r38677:
The commit was clearly not thought through and is poorly implemented.

It simply tacked the skin name onto the end of the body's class attribute. The idea of a skin className inside of the body tag has been discussed many times before. But one common agreement is that the class should be prefixed with 'skin-' as we prefix all the other stuff.

Additionally this code likely was not tested. It made use of "get_class( $this );" to find the 'skin name', this is a poor and unreliable method of doing this. Not only should the case of the skin name to output (lowercase id like 'monobook', or normal form 'MonoBook'), it's highly likely for the class to NOT be the name of the skin.


Discussion on this 'feature' is something that should be continued. Though, before WONTFIX'ing it as has been done in the past Splarka does note that this will be useful when [[MediaWiki:Print.css]] and [[Special:MyPage/print.css]] are implemented. That'll allow skin-specific print rules without a separate file for each one.

Personally, I'd also note that it would allow for minor skin-specific tweaks in Common.css
ie: A large body of code such as Titleicons code is inside of Common.css, and some minor location tweaks can be made for different skins, without resorting to separating the Titleicons code into multiple css files. (Actually, it would also allow for customizing something to work in multiple similar skins at the same time without duplicating the code)

bzimport added a comment.Via ConduitAug 6 2008, 3:00 PM

ayg wrote:

I'd like to see some more concrete use-cases for this before spamming another class onto the body element.

brion added a comment.Via ConduitAug 6 2008, 7:34 PM

Use cases include user common CSS, site common CSS, browser user stylesheet / greasemonkey CSS, extension CSS, gadget CSS, etc which might want to tweak for specific skins.

I would recommend the classname being skin-{$skinname}. SkinTemplate provides a 'skinname' thingy already... though it should probably be whatever name is used in the prefs, $wgValidSkins, $wgDefaultSkin bla bla that we grabbed globally.

bzimport added a comment.Via ConduitAug 10 2008, 9:22 AM

sxwiki wrote:

Fixed again in r39058 .

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.