[OSM-dev] Revised wiki languages bar, CSS and JS code review wanted

Andrew Hain andrewhainosm at hotmail.co.uk
Sat Jun 6 09:22:10 UTC 2015


I have been rewriting the languages bar in the wiki and I would like some
feedback.

The motivations for the rewrite are:
The bar makes extensive use of the #ifexist parser function, which is
expensive in Mediawiki and limited in the number of times it can be called.
Most of the pages in
http://wiki.osm.org/wiki/Category:Pages_with_too_many_expensive_parser_function_calls
are at least exacerbated by the presence of a language bar.

To mitigate the issue above, minority languages are hardcoded into the
hidden lower box even when translations exist. Up to now, the only response
available for criticism of the banishment
[http://thread.gmane.org/gmane.comp.gis.openstreetmap/64130] has been to
adjust the choice of languages tested for display at the top.

The red links are hidden by a script that is only executed when the page has
loaded. This is a particular nuisance on mobile devices where it can take up
most of the screen.

The list of languages is spread over three locations with an intricate
syntax and different ways of entering them depending on the size of their
presence in OSM.

The new bar uses CSS to avoid the issues above, with a more detailed
explanation at http://wiki.osm.org/wiki/User:Wynndale/language_test .

But:

My CSS and web scripting skills are worthy of the Daily WTF and this is
still a proof of concept at this stage.

There are stray bars on each side of this page from the language bar markup.

The script to view red links assumes that the links are two levels below the
bar. Is it worth making it a show/hide toggle?

There is a style “padding : 2px;” in the CSS definition that was inherited
from the existing bar, which may be a problem on mobile devices.

For all I know, there are sites out there that have their own maybe better
solutions.

--
Andrew


More information about the dev mailing list