Module:User:Lady G2016/NavboxMobile/doc

This module implements the Navbox template for mobile devices when Extension:MobileFrontend is installed. This mobile version differs from the desktop version as follows:


 * The table does not collapse.
 * The list cells, e.g. group1, list1, each display across the width of the screen
 * Images are not displayed, as it increases the complexity of the layout while reducing the area needed for content.

Overview
This approach works by utilizing CSS class rules. See: Hiding content on desktop devices

An  class in MediaWiki:Common.css will not display classes intended for mobile devices.

A  class in MediaWiki:Mobile.css will not display classes intended for desktop devices.

Use these classes together inside the same template. The template will be rendered twice, but only display once depending on the view (desktop or mobile).

Module description
The module was copied from Module:Navbox and modified as follows:


 * All instances of  were replaced with   to provide unique CSS identifiers that are independent of.
 * All statements which processed images were removed. The statements remain as comments to show what was changed.

In, the cell pair of (groupCell, listCell) appearing as a single row is broken into separate rows by adding   just before listCell.

Adding this row and removing the images are the only functional changes made to the existing  template. Except for removal of the images, the parameters used in the current  are supported.

MediaWiki:Common.css
In MediaWiki:Common.css, add: /* Only for mobile devices */ .onlymobile { display:none; }

MediaWiki:Mobile.css
In MediaWiki:Mobile.css, add: /* Only for desktop devices */ .nomobile { display:none; }

MobileFrontend processes MediaWiki:Mobile.css. To provide an independent class that is not affected by the navbox rules, copy all of the  and   CSS styles from MediaWiki:Common.css to MediaWiki:Mobile.css.

Replace all  with. For example,  becomes. This will match the CSS properties in Module:NavboxMobile.

An example page can be found at User:Lady G2016/MediaWiki:Mobile.css.

Template:Navbox
Modify Template:Navbox to call both the desktop and mobile Lua modules as follows:

This will render both the desktop (navbox) and mobile (navboxMobile) versions. When displaying from a desktop view, MediaWiki:Common.css will not display the mobile template. When displaying from a mobile, only the mobile template will be displayed.

Constraints and limitations
This template was developed with MediaWiki 1.27.4 (Long Term Support) and MobileFrontEnd 1.0.0 (29 June 2016). No testing was performed with other versions.

The navbox class is explicitly disabled in /extensions/MobileFrontend/resources/skins.minerva.content.styles/hacks.less. Attempts to override navbox using  do not display as intended when the   class is enabled.