Difference between revisions of "Widget:SpaceAPI"
(fixed some variable references, added title (in preparation of lastchange timestamp)) |
(fixed title timestamp) |
||
Line 55: | Line 55: | ||
SpaceState.prototype._msgClosed = "Closed"; | SpaceState.prototype._msgClosed = "Closed"; | ||
SpaceState.prototype._msgUnknown = "Unknown"; | SpaceState.prototype._msgUnknown = "Unknown"; | ||
+ | SpaceState.prototype._msgSince = "Since: "; | ||
SpaceState.prototype._colorOpen = "#0f0"; | SpaceState.prototype._colorOpen = "#0f0"; | ||
SpaceState.prototype._colorClosed = "#f00"; | SpaceState.prototype._colorClosed = "#f00"; | ||
Line 131: | Line 132: | ||
open = spaceState.state.open; | open = spaceState.state.open; | ||
message = spaceState.state.message; | message = spaceState.state.message; | ||
− | // | + | |
− | + | // Start as epoch timestamp (NOTE: check if timezone doesn't mess things up) | |
− | title = | + | var d = new Date( 0 ); |
+ | d.setUTCSeconds( spaceState.state.lastchange ); | ||
+ | title = this._msgSince + d.toLocaleString( ); | ||
} | } | ||
catch( _e ) | catch( _e ) |
Revision as of 16:27, 25 August 2015
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=https://ackspace.nl/spaceAPI/ |width=260px |height=20px |padding=8px |interval=20 }}
This will give the following result:
Note that url is mandatory, the rest is optional (leave out interval to make the data static). Also, 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.