Difference between revisions of "Widget:SpaceAPI"
m (polyline needs a marker) |
m (auto-check follow button for special beacon poly line) |
||
Line 720: | Line 720: | ||
var apiBeacon = this.data.sensors.beacon[ 0 ]; | var apiBeacon = this.data.sensors.beacon[ 0 ]; | ||
var beacon = {}; | var beacon = {}; | ||
+ | var bHoaB = false; | ||
beacon.point = L.latLng( apiBeacon.location.lat,apiBeacon.location.lon ); | beacon.point = L.latLng( apiBeacon.location.lat,apiBeacon.location.lon ); | ||
Line 739: | Line 740: | ||
popup.setContent( ( this._leaflet.descriptions[ apiBeacon.name ] || apiBeacon.name ) + "<br/>Last update: " + this._nlsTime( delta ) + " ago" ); | popup.setContent( ( this._leaflet.descriptions[ apiBeacon.name ] || apiBeacon.name ) + "<br/>Last update: " + this._nlsTime( delta ) + " ago" ); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
// TODO: clean up old beacons!! | // TODO: clean up old beacons!! | ||
Line 755: | Line 751: | ||
this._leaflet.map.removeLayer( _beacon.circle ); | this._leaflet.map.removeLayer( _beacon.circle ); | ||
}, this ); | }, this ); | ||
− | + | this._leaflet.beacons = [ beacon ]; | |
− | + | ||
+ | if ( bHoaB && this._leaflet.follow === null ) | ||
{ | { | ||
− | + | this._leaflet.follow = true; | |
− | + | document.querySelector( "div.leaflet-bar > a.leaflet-clickable" ).className = "leaflet-clickable toggle"; | |
} | } | ||
− | |||
− | |||
this._drawBeaconPolyLine( ); | this._drawBeaconPolyLine( ); |
Revision as of 08:43, 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.