Difference between revisions of "Widget:SpaceAPI"

From Hackerspace ACKspace
Jump to: navigation, search
(innerText (legacy) to textContent)
(allow relative url for spaceAPI and since colon is not allowed anymore: URLs will be without protocol and may well be relative)
Line 8: Line 8:
  
 
  <nowiki>{{#widget:</nowiki>{{PAGENAME}}<nowiki>
 
  <nowiki>{{#widget:</nowiki>{{PAGENAME}}<nowiki>
|url=https://ackspace.nl/spaceAPI/
+
|url=/spaceAPI/
 
|width=260px
 
|width=260px
 
|height=20px
 
|height=20px
Line 18: Line 18:
 
This will give the following result:<br/>
 
This will give the following result:<br/>
 
{{#widget:{{PAGENAME}}
 
{{#widget:{{PAGENAME}}
|url=https://ackspace.nl/spaceAPI/
+
|url=/spaceAPI/
 
|width=260px
 
|width=260px
 
|height=20px
 
|height=20px
Line 25: Line 25:
 
|float=right
 
|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.)
+
'''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 ==
 
== Copy to your site ==
Line 164: Line 167:
 
     }
 
     }
  
     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}--> );
+
     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|escape:urlpathinfo}-->", <!--{$interval|validate:int|default:0}--> );
 
     state.start();
 
     state.start();
  

Revision as of 12:06, 24 February 2016

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
}}

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.