Tested at http://en.wikipedia.beta.wmflabs.org/wiki/MapLink
That page only has `<maplink>`, but it still loads the mapbox library on initial page load. Instead, it should load it only after the user clicks.
Looking at the dependencies, `ext.kartographer.live` is what contains all the code, and `ext.kartographer.fullscreen` gets loaded on maplink click, and it does not depend on the `ext.kartographer.live`. The `MapLink::render()` adds the `ext.kartographer.live` for some reason - added by ec8ef2f1b2da02e1944252cd56d462e59f16de7d (@MaxSem?)
== Proposed Structure
| **module** | ** Added by PHP ** | **depends on** | **may load via JS** | **notes**
| maplink | on `<maplink>` | | fullscreen | Contains a tiny JS loader that attaches to maplinks. CSS to style links.
| mapframe | on `<mapframe>` | site, live | fullscreen | Contains JS loader that modifies to mapframes. CSS to style mapframe.
| mapframe.snap | on `<mapframe>` | | mapframe | For later - when we implement map snapshot image service, inseart this instead of `mapframe`
| fullscreen | | site, live | | Loaded by maplink and mapframe
| live | | mapbox, settings | | The core map resource, maybe used by external tools like Commons upload wizard
| site | | | | Loaded only for `<mapframe>`. Custom class
| settings | | | | Custom class, sets global map configuration JS vars
| mapbox **(lib)** | | | | External lib, includes Leaflet
| visualEditor | | | maplink, mapframe, ve.dialog | Main Visual Editor resource. **TBD:** At what point should maplink and mapframe resources be loaded?
| ve.dialog | | leaflet.draw | | VE code for map editor dialog
| leaflet.draw **(lib)** | | mapbox | | External lib - drawing tools for VE
== Existing structure
PHP:
| TagHandler.php | addModuleStyles( 'ext.kartographer.style' )
| MapFrame.php | addModules( 'ext.kartographer.live' )
| MapLink.php | addModules( 'ext.kartographer.live' )
JS:
| kartographer.js | openFullscreenMap | ext.kartographer.fullscreen
| ve.ce.MWInlineMapsNode.js | constructor | ext.kartographer.settings
| ve.ui.MWMapsDialog.js | constructor | ext.kartographer.editor
| ve.ce.MWMapsNode.js | constructor | ext.kartographer.settings
| ve.ce.MWMapsNode.js | update(): if requiresInteractive | ext.kartographer.live
Modules:
| **module** | **used by** | **dependencies** | **style** | **script** | **notes**
| ext.kartographer.settings | js-ve | | | | Set JS configuration for Kartographer, like available scaling factors, styles, etc. Used by live & visualeditor resources, loaded by VE ve.ce.MWInlineMapsNode & ve.ce.MWMapsNode
| ext.kartographer.style | php-all | | styles/kartographer.less | | Styles for maplink, mapframe, fullscreen (TODO: maybe we should break it into separate modules). Loaded by mapframe & maplink tag handlers
| ext.kartographer.site | | | MediaWiki:Kartographer.css | MediaWiki:Kartographer.js | Site-customized css & js, should only be loaded for <mapframe>, fullscreen, and edit. Used by live & fullscreen resources
| ext.kartographer.live | php-all, js-ve* | mapbox, ext.kartographer.settings, ext.kartographer.site | | lib/leaflet.sleep.js, kartographer.js | Show interactive map - required by <mapframe>, fullscreen, editor. Used by editor resource. Loaded by all tags and ve.ce.MWMapsNode
| ext.kartographer.fullscreen | js | ext.kartographer.site | | kartographer.MapDialog.js | Loaded when user clicks on a maplink or expands a mapframe, from JS in openFullscreenMap()
| ext.kartographer.editor | js-ve | leaflet.draw, ext.kartographer.live | | | Loaded by VE map editor dialog - ve.ui.MWMapsDialog
| ext.kartographer.visualEditor | | ext.kartographer.settings | ve.ui.MWMaps.css | ve-maps/* | Loads css & js for the VE map support. Used only by VisualEditorPluginModules setting below
| mapbox | | | lib/mapbox/* | lib/mapbox/* | External mapframe lib, handles drawing of the map. Used by live and leaflet.draw resources
| leaflet.draw | | mapbox | lib/leaflet.draw/* | lib/leaflet.draw/* | External leaflet lib to allow visual geojson editing in the VE map dialog, loaded by editor resource
== Proposed Structure
| **module** | ** Added by PHP ** | **depends on** | **may load via JS** | **notes**
| maplink | on `<maplink>` | | fullscreen | Contains a tiny JS loader that attaches to maplinks. CSS to style links.
| mapframe | on `<mapframe>` | site, live | fullscreen | Contains JS loader that modifies to mapframes. CSS to style mapframe.
| mapframe.snap | on `<mapframe>` | | mapframe | For later - when we implement map snapshot image service, inseart this instead of `mapframe`
| fullscreen | | site, live | | Loaded by maplink and mapframe
| live | | mapbox, settings | | The core map resource, maybe used by external tools like Commons upload wizard
| site | | | | Loaded only for `<mapframe>`. Custom class
| settings | | | | Custom class, sets global map configuration JS vars
| mapbox **(lib)** | | | | External lib, includes Leaflet
| visualEditor | | | maplink, mapframe, ve.dialog | Main Visual Editor resource. **TBD:** At what point should maplink and mapframe resources be loaded?
| ve.dialog | | leaflet.draw | | VE code for map editor dialog
| leaflet.draw **(lib)** | | mapbox | | External lib - drawing tools for VE