Using the new Lua feature to generate SVGs, some users and me developed a Lua module to generate colored SVG maps (see Template:Map) that is already being used on enwiki and eswiki. However, the generated maps are often too small and we would like to have some way to enlarge them.
Description
Related Objects
- Mentioned Here
- T407710: Allow Lua access to source code of SVG files
Event Timeline
One simple solution would be offering a link that opens the full-size map in a new tab. This is actually possible by right-clicking the map and then clicking "Open image in new tab". However, most users won't find this. Perhaps if there was some way to wrap the generated <img> with <a> so that when the user clicks it, it opens in the full-size map in a new tab? Something like svg:toLinkedImage() instead of svg:toImage()?
Another solution would be some way to get the data-URL of the SVG. We could then use that URL to offer a link to the full-size version of the map below the thumbnail. T407710 seems related.
However, I think being able to click the SVG to open the full-size version of the map would be better, as it'd be more consistent with the way users currently interact with image thumbnails (and thus more intuitive) and it would also avoid us the need to generate, position and localize the link to open the full-size map.
Yet another way would be enhancing Extension:MediaViewer to support opening SVGs generated via Lua. Perhaps a CSS class that when found, will trigger MediaViewer?
My attempt at this is https://en.wikipedia.org/wiki/Template:CineMol (it supports a click to enlarge on the generated images. Mildly hacky)
@Bawolff Thanks, that looks super promising! I'll delve into it during April and if I can get to a general solution from your code, I'll post it here and close this task. Cheers!