[[api]]
 

API Reference

This page explains how to create a widget

Widget Xml File

Rules

A widget is a file compliant to the xml standard.

Tags

<?xml version=“1.0”?> <widget> : Main widget tag

  <category>Name</category>                       : Category name
  <icon>http://mywidget.com/myicon.gif</icon>     : Widget icon
  <author>uStart</author>              : Author's name
  <website>www.ustart.org</website>    : Author's website
  <option name="hasoptions">1</option>   : Author's website
  <option name="help">http://mywidget/help.html</option>        : Help file 
  <option name="width">large</option>    : Default width     : large / small
  
  <locale lang="en">                                          :  localized section (en/fr/es)
      <title>My Widget</title>                                :  widget's title
      <description>My widget description</description>        :  widget's description
      <thumbnail>http://mywidget.com/thumb.gif</thumbnail>    :  widget's thumbnail url
      <msg name="MSG_HELLO">Hello</msg>                       :  translation item accessible by _L('') macro in script
      <msg name="MSG_WORLD">World</msg>                       :  translation item accessible by _L('') macro in script
  </locale>
  <style><![[CDATA                                            :  CSS stylesheet for the widget 
       .my_rule{
       }
  ]]></style>
  <script><![CDATA[                                            :  Javascript code source of the widget
     widget.setContent(_L("MSG_HELLO"));
  ]]></style>

</widget>

Main Object : widget

HTML constructor
  • widget.setOptions(html) : changes the HTML of the options section
  • widget.setContent(html) : changes the HTML of the widget body
  • widget.setTitle(title) : change the title of the widget
  • widget.setUnread(unread) : set number of unread items in this widget
  • widget.select(selector,options) : select DOM objects according to the css selector (eg div#my_section) , return an aray
Preferences
  • widget.setPref(name,value) : store a variable
  • widget.getPref(name,value) : get a stored variable
Ajax
  • widget.GetFeed(url,callback) : AJAX get the feed and return the parsed feed in callback function
  • widget.GetUrl(url,callback) : AJAX get the url and return the text in callback function
 
api.txt · Last modified: 2010/02/13 15:12 by teamustart
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki