Mediawiki access/SkinSelection

From Bjoern Hassler's website
Jump to: navigation, search


1 Can anonymous users choose a mediawiki skin?[edit]

The translatewiki allows anonymous users to set their language via the Extension:LanguageSelector.

Is it possible to do the same for mediawiki skins?

The idea behind this question is to offer a low bandwidth skin (for use in developing countries, as well as over mobile), that should be user selectable (without logging in). This has two parts:

  • The skin selection itself (manual, based on browser, or css media=handheld), but also having
  • a suitable low bandwidth skin (see Mediawiki access/Monobmo).

There doesn't seem to be an extension or skin available, so let's experiment a little.

2 What's available?[edit]

2.1 Ad-hoc skin selection[edit]

http://www.mediawiki.org/wiki/Manual:Parameters_to_index.php

http://www.sciencemedianetwork.org/w/index.php?title=Main_Page&useskin=cologneblue

2.2 Extensions to select skins per page, namespace, or browser[edit]

There are some extensions that allow page or namespace specific selection of skins:

(Note that there is some interaction between these extensions if they are all installed. You need to double check that you get the desired results. For instance, the MobileSkin overrides SkinPerPage. If the MobileSkin.php is included, SkinPerNamespace no longer works on desktop browsers, but it does still work for mobile browsers. It would be a useful project to make those compatible with each other in a sensible way.)

2.3 Links to other skin related projects[edit]

The following two projects refer to skin selection, but there doesn't seem to be code downloadable:

http://www.mediawiki.org/wiki/Category:Skin_extensions

2.4 Mediawiki 1.14.0: $wgHandheldStyle[edit]

Also note the $wgHandheldStyle variable http://www.mediawiki.org/wiki/Manual:$wgHandheldStyle, introduce in 1.1.4.0. This can be set to a string (the skin) or to false. It provides a style for media="handheld".

Optionally, we can specify a stylesheet to use for media="handheld". This is recognized by some, but not all, handheld/mobile/PDA browsers. If left empty, compliant handheld browsers won't pick up the skin stylesheet, which is specified for 'screen' media.

Can be a complete URL, base-relative path, or $wgStylePath-relative path. Try 'chick/main.css' to apply the Chick styles to the MonoBook HTML.

Will also be switched in when 'handheld=yes' is added to the URL, like the 'printable=yes' mode for print media.

Example: The current page with handheld=yes.

This is quite useful, as it allows the user to momentarily change the skin, by adding 'handheld=yes'. However, the setting isn't remembered, so only the current page is show in handheld style.

Also, we need to use this with a lightweight skin.

3 Thoughts on Skin Selection[edit]

It should be possible to tweak the skin through parameters, perhaps even without modification of mediawiki core.

3.1 Remembering the setting[edit]

To remember the setting, we can use a $_SESSION variable.

3.2 Example[edit]

We can combine the nocss skin (Mediawiki access/Monobmo/nocss), with the original monobook skin, by adding a little bit of code to make the removal of javacsript/css optional, and also store the result in a cookie.

4 Results: A mediawiki skin that detects browser and is switchable[edit]

Example here monomix:

Currently, the main skin of the wiki is monomix, and if you have skin=nocss selected, you can browse the whole wiki like that!

  • Note, however, that if you are logged in, your skin choice overrides this mechanism. But if you are logged, you can of course go to your preferences and selection the monomix skin, and then the above links will work.
  • Note also that the mobile skin extension (Mediawiki/Mobile/Skin) overrides this. (However, we have now built mobile detection into the skin, see Mediawiki access/Mobile/Skin.)


5 To do[edit]

  • Incorporate the monobmo skin in the above mechanism.

Also:

  • Need to determine how the various mechanisms interact.
  • The mobile skin should be optional, i.e. the mobile user should be able to see the standard skin. (DONE)
  • SkinPerPage, SkinPerNamespace should be overridable by the nocss skin, if so desired.
  • Logged in users should have a choice over the skin: Either to use the default skin for that page, or to override all settings by their custom skin.