Difference between revisions of "Widget:SpaceAPI"
m (only pan if zoomed beyond set max) |
m (disable default zoom if we have a beacon) |
||
Line 163: | Line 163: | ||
this._leaflet = {}; | this._leaflet = {}; | ||
this._leaflet.point = L.latLng( 50.8925,5.9713 ); | this._leaflet.point = L.latLng( 50.8925,5.9713 ); | ||
− | this._leaflet.map = L.map( mapNode ).setView( this._leaflet.point, 16); | + | this._leaflet.map = L.map( mapNode ).panTo( this._leaflet.point ); |
+ | //this._leaflet.map = L.map( mapNode ).setView( this._leaflet.point, 16); | ||
L.CRS.CustomZoom = L.extend({}, L.CRS.EPSG3857, | L.CRS.CustomZoom = L.extend({}, L.CRS.EPSG3857, | ||
Line 394: | Line 395: | ||
bounds.extend( this._leaflet.point ); | bounds.extend( this._leaflet.point ); | ||
− | this._leaflet.map.fitBounds( bounds ); | + | // Depending on polyline: don't zoom |
− | if ( this._leaflet.map.getZoom() > 18 ) | + | //this._leaflet.map.fitBounds( bounds ); |
− | this._leaflet.map.setZoom( 18 ); | + | //if ( this._leaflet.map.getZoom() > 18 ) |
+ | //this._leaflet.map.setZoom( 18 ); | ||
} | } | ||
}.bind( this ) ); | }.bind( this ) ); | ||
Line 775: | Line 777: | ||
this._leaflet.point = L.latLng( this.data.location.lat, this.data.location.lon ); | this._leaflet.point = L.latLng( this.data.location.lat, this.data.location.lon ); | ||
this._leaflet.marker.setLatLng( this._leaflet.point ); | this._leaflet.marker.setLatLng( this._leaflet.point ); | ||
+ | this._leaflet.map.setZoom( 18 ); | ||
+ | |||
// Set popup data and open it | // Set popup data and open it |
Revision as of 09:29, 2 October 2018
This widget allows you to display the Space API data (provided as JSON)
Created by Xopr
Using this widget
To insert this widget, use the following code:
{{#widget:SpaceAPI |url=/spaceAPI/ |width=260px |height=20px |padding=8px |interval=20 |float=right |features=beacon }}
This will give the following result:
Notes
- url is mandatory, the rest is optional (leave out interval to make the data static).
- it also must be written without protocol since colon (:) is not allowed, and may be relative, for example: //ackspace.nl/spaceAPI/ or /spaceAPI/
- You must provide a unit for the sizes (i.e. px, %, etc.)
Copy to your site
To use this widget on your site, just install MediaWiki Widgets extension and copy full source code of this page to your wiki as Widget:SpaceAPI article.