Mediawiki access/SkinSelection
From Bjoern Hassler
Contents |
[edit] 1 Can anonymous users choose a mediawiki skin?
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.
[edit] 2 What's available?
[edit] 2.1 Ad-hoc skin selection
http://www.mediawiki.org/wiki/Manual:Parameters_to_index.php
http://www.sciencemedianetwork.org/wiki_source/index.php?title=Main_Page&useskin=cologneblue
[edit] 2.2 Extensions to select skins per page, namespace, or browser
There are some extensions that allow page or namespace specific selection of skins:
- http://www.mediawiki.org/wiki/Extension:SkinPerNamespace
- http://www.mediawiki.org/wiki/Extension:SkinPerPage (for examples see Mediawiki/SkinPerPage)
- and also on the type of browser: http://www.mediawiki.org/wiki/Extension:MobileSkin (example on Mediawiki access/Mobile/Skin).
(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.)
[edit]
The following two projects refer to skin selection, but there doesn't seem to be code downloadable:
- http://www.aboutus.org/UrlMagic which is similar to SkinPerPage, but it also redirects the full url, turning a single mediawiki installation into a multi-site CMS. Nice, but no code available ti seems.
- http://wiki.anotherwebcom.com/Configuring:_awc_stuff.php_(file_Info)
http://www.mediawiki.org/wiki/Category:Skin_extensions
- http://www.mediawiki.org/wiki/Extension:AdvancedSkinSystem
- http://www.mediawiki.org/wiki/Extension:DynamicSkin
- http://www.mediawiki.org/wiki/Extension:WikiSkin
[edit] 2.4 Mediawiki 1.14.0: $wgHandheldStyle
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".
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.
[edit] 3 Thoughts on Skin Selection
It should be possible to tweak the skin through parameters, perhaps even without modification of mediawiki core.
[edit] 3.1 Remembering the setting
To remember the setting, we can use a $_SESSION variable.
[edit] 3.2 Example
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.
[edit] 4 Results: A mediawiki skin that detects browser and is switchable
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.)
[edit] 5 To do
- 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.