Twitter

Introduction

Twitter is a service for friends, family, and co–workers to communicate and stay connected through the exchange of quick, frequent answers to one simple question: What are you doing?

Installation

Follow these steps to install this script on your wiki.

  1. Go to System Settings inside the Control Panel.
  2. Under Extensions, click Add Script.
  3. Enter a descriptive name for the extension
  4. Under Configuration add the following to the Manifest field: http://scripts.mindtouch.com/twitter.xml
  5. Add extra configuration values as listed below under Configuration (If Configuration is not listed below, ignore this step.)
  6. Click on add script.

Related Links: DekiScript service, Extension Overview, DekiScript Overview, Extension Demos.


Overview

This extension contains functions for embedding Twitter feeds. This script requires MindTouch Deki 1.9.0b or later.

Functions:

  1. twitter.all
  2. twitter.counter
  3. twitter.current

twitter.all(name, width, height, oddbubblecolor, evenbubblecolor, oddtextcolor, eventextcolor, backgroundcolor) : xml

Embed Twitter feed of user and friends.

Parameters:

NameTypeDescription
namestrTwitter user name.
widthnum(optional) Control width. (default: 200)
heightnum(optional) Control height. (default: 400)
oddbubblecolorstr(optional) Color for bubbles on odd rows. (default: "0xFFFFCE")
evenbubblecolorstr(optional) Color for bubbles on even rows. (default: "0xFFDAAA")
oddtextcolorstr(optional) Text color for odd rows. (default: "0x4A396D")
eventextcolorstr(optional) Text color for event rows. (default: "0xBA0909")
backgroundcolorstr(optional) Background color. (default: "0x111B1C")


twitter.counter(name) : xml

Show Twitter counter for user.

Parameters:

NameTypeDescription
namestrTwitter user name.


twitter.current(name, width, height, backgroundcolor) : xml

Show latest Twitter entry from user.

Parameters:

NameTypeDescription
namestrTwitter user name.
widthnum(optional) Control width. (default: 176)
heightnum(optional) Control height. (default: 176)
backgroundcolorstr(optional) Background color. (default: "0x111B1C")


Source Code

<extension>
  <title>Twitter Extension</title>
  <label>Twitter</label>
  <copyright>Copyright (c) 2008 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: 200)</param>
    <param name="height" type="num" optional="true">Control height. (default: 400)</param>
    <param name="oddbubblecolor" type="str" optional="true">Color for bubbles on odd rows. (default: "0xFFFFCE")</param>
    <param name="evenbubblecolor" type="str" optional="true">Color for bubbles on even rows. (default: "0xFFDAAA")</param>
    <param name="oddtextcolor" type="str" optional="true">Text color for odd rows. (default: "0x4A396D")</param>
    <param name="eventextcolor" type="str" optional="true">Text color for event rows. (default: "0xBA0909")</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://static.twitter.com/flash/twitter_timeline_badge.swf" 
                 eval:flashvars="'user_id=' .. string.match(web.text('http://twitter.com/' .. args.name, '//_:link[@type=\'application/rss+xml\']/@href' ?? ''), '.*/(\\d+).rss') .. '&amp;color1=' .. (args.oddbubblecolor ?? '0xFFFFCE') .. '&amp;color2=' .. (args.evenbubblecolor ?? '0xFFDAAA') .. '&amp;textColor1=' .. (args.oddtextcolor ?? '0x4A396D') .. '&amp;textColor2=' .. (args.eventextcolor ?? '0xBA0909' ) .. '&amp;backgroundColor=' .. (args.backgroundcolor ?? '0x111B1C') .. '&amp;textSize=' .. (args.textsize ?? 10)" 
                 eval:width="web.size(args.width ?? 200)" 
                 eval:height="web.size(args.height ?? 400)" 
                 quality="high" 
                 name="twitter_timeline_badge" 
                 align="middle" 
                 type="application/x-shockwave-flash" 
                 allowScriptAccess="always" 
                 pluginspage="http://www.adobe.com/go/getflashplayer" />
        </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.match(web.text('http://twitter.com/' .. args.name, '//_:link[@type=\'application/rss+xml\']/@href' ?? ''), '.*/(\\d+).rss') .. '&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>


Tag page
You must login to post a comment.
Powered by MindTouch Deki v.8.08.2