<extension>
  <title>Twitter Extension</title>
  <label>Twitter</label>
  <copyright>Copyright (c) 2006-2009 MindTouch, Inc.</copyright>
  <description>This extension contains functions for embedding Twitter feeds.</description>
  <uri.help>http://wiki.developer.mindtouch.com/MindTouch_Deki/Extensions/Twitter</uri.help>
  <uri.logo>http://scripts.mindtouch.com/logos/twitter-logo.png</uri.logo>
  <namespace>twitter</namespace>

  <requires host="MindTouch Deki 1.9.0b" />
  
  <function>
    <name>all</name>
    <description>Embed Twitter feed of user and friends.</description>
    <param name="name" type="str">Twitter user name.</param>
    <param name="width" type="num" optional="true">Control width. (default: 290)</param>
    <param name="height" type="num" optional="true">Control height. (default: 350)</param>
    <param name="theme" type="str" optional="true">Control theme. (one of "smooth", "velvetica", "revo"; default: "smooth")</param>
    <return>
      <html xmlns:eval="http://mindtouch.com/2007/dekiscript">
        <body>
          <object 
            classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 
            codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0" 
            eval:width="args.width ?? 290" 
            eval:height="args.height ?? 350" 
            id="TwitterWidget" 
            align="middle"
          >
            <param name="allowScriptAccess" value="always" />
            <param name="allowFullScreen" value="false" />
            <param name="movie" value="http://static.twitter.com/flash/widgets/profile/TwitterWidget.swf" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#000000" />
            <param name="FlashVars" eval:value="'userID=' .. string.trim(args.name) .. '&amp;styleURL=http://static.twitter.com/flash/widgets/profile/' .. string.trim(args.theme ?? 'smooth') .. '.xml'" />
            <embed 
                src="http://static.twitter.com/flash/widgets/profile/TwitterWidget.swf" 
                quality="high" 
                bgcolor="#000000" 
                eval:width="args.width ?? 290" 
                eval:height="args.height ?? 350" 
                name="TwitterWidget" 
                align="middle" 
                allowScriptAccess="sameDomain" 
                allowFullScreen="false" 
                type="application/x-shockwave-flash" 
                pluginspage="http://www.macromedia.com/go/getflashplayer" 
                eval:FlashVars="'userID=' .. string.trim(args.name) .. '&amp;styleURL=http://static.twitter.com/flash/widgets/profile/' .. string.trim(args.theme ?? 'smooth') .. '.xml'"/>
          </object>
        </body>
      </html>
    </return>
  </function>

  <function>
    <name>current</name>
    <description>Show latest Twitter entry from user.</description>
    <param name="name" type="str">Twitter user name.</param>
    <param name="width" type="num" optional="true">Control width. (default: 176)</param>
    <param name="height" type="num" optional="true">Control height. (default: 176)</param>
    <param name="backgroundcolor" type="str" optional="true">Background color. (default: "0x111B1C")</param>
    <return>
      <html xmlns:eval="http://mindtouch.com/2007/dekiscript">
        <body>
          <embed src="http://twitter.com/flash/twitter_badge.swf"
                 eval:flashvars="'id=' .. string.trim(args.name) .. '&amp;type=user&amp;color1=' .. (args.backgroundcolor ?? '0x111B1C')"
                 quality="high"
                 eval:width="web.size(args.width ?? 176)"
                 eval:height="web.size(args.height ?? 176)"
                 name="twitter_badge"
                 align="middle"
                 allowScriptAccess="always"
                 wmode="transparent"
                 type="application/x-shockwave-flash"
                 pluginspage="http://www.macromedia.com/go/getflashplayer" />
        </body>
      </html>
    </return>
  </function>

  <function>
    <name>counter</name>
    <description>Show Twitter counter for user.</description>
    <param name="name" type="str">Twitter user name.</param>
    <return>
      <html xmlns:eval="http://mindtouch.com/2007/dekiscript">
        <body>
          <a rel="custom" eval:href="uri.appendquery('http://twittercounter.com', { username: args.name })" eval:title="'TwitterCounter for @' .. args.name">
            <img width="88" height="26" eval:src="uri.appendquery('http://twittercounter.com/counter', { username: args.name })" style="border: medium none ;" eval:alt="'TwitterCounter for @' .. args.name" />
          </a>
        </body>
      </html>
    </return>
  </function>
</extension>