Difference between revisions of "Widget:SpaceAPI"

From Hackerspace ACKspace
Jump to: navigation, search
m (typo fix)
(implemented float)
Line 13: Line 13:
 
|padding=8px
 
|padding=8px
 
|interval=20
 
|interval=20
 +
|float=right
 
}}</nowiki>
 
}}</nowiki>
  
Line 22: Line 23:
 
|padding=8px
 
|padding=8px
 
|interval=20
 
|interval=20
 +
|float=right
 
}}<br/>
 
}}<br/>
 
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.)
 
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.)
Line 34: Line 36:
 
     if ( typeof SpaceState === "undefined" )
 
     if ( typeof SpaceState === "undefined" )
 
     {
 
     {
         window.SpaceState = function( _width, _height, _padding, _url, _interval )
+
         window.SpaceState = function( _width, _height, _float, _padding, _url, _interval )
 
         {
 
         {
 
             this._width = _width;
 
             this._width = _width;
Line 41: Line 43:
 
             this._url = _url;
 
             this._url = _url;
 
             this._interval = 1000 * _interval;
 
             this._interval = 1000 * _interval;
             this._float = "right";
+
             this._float = _float;
 
         }
 
         }
  
Line 162: Line 164:
 
     }
 
     }
  
     var state = new SpaceState( "<!--{$width|escape:html|default:auto}-->", "<!--{$height|escape:html|default:auto}-->", "<!--{$padding|escape:html|default:8px}-->", "<!--{$url|validate:url}-->", <!--{$interval|validate:int|default:0}--> );
+
     var state = new SpaceState( "<!--{$width|escape:html|default:auto}-->", "<!--{$height|escape:html|default:auto}-->", "<!--{$float|escape:html|default:none}-->", "<!--{$padding|escape:html|default:8px}-->", "<!--{$url|validate:url}-->", <!--{$interval|validate:int|default:0}--> );
 
     state.start();
 
     state.start();
  

Revision as of 15:35, 31 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
|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.