Difference between revisions of "Widget:SpaceAPI"

From Hackerspace ACKspace
Jump to: navigation, search
(reverted changes, they don't work)
Line 74: Line 74:
 
             if ( this._float )
 
             if ( this._float )
 
                 style += "float:" + this._float + ";"
 
                 style += "float:" + this._float + ";"
             var div = '<div id="spaceAPI' + this._intervalId + '" style="' + style + '"></div>';
+
             document.write( '<div id="spaceAPI' + this._intervalId + '" style="' + style + '">' + this._msgLoading + '</div>' );
            div = '<div id="spaceAPI"></div>';
 
            document.write( div );
 
  
//' + this._msgLoading + '
+
            this._node = document.getElementById( "spaceAPI" + this._intervalId );
  
 
             // Update the spacestate immediately
 
             // Update the spacestate immediately
Line 86: Line 84:
 
         SpaceState.prototype._fetchSpaceState = function( )
 
         SpaceState.prototype._fetchSpaceState = function( )
 
         {
 
         {
            if ( !this._node )
 
                this._node = document.getElementById( "spaceAPI" /*+ this._intervalId*/ );
 
 
 
             this._node.innerText += ".";
 
             this._node.innerText += ".";
 
             var xhr = new XMLHttpRequest( );
 
             var xhr = new XMLHttpRequest( );

Revision as of 14:59, 7 September 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
|float=right
}}

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.