Digg

Installation

Follow these steps to install this script on your wiki.

  1. Go to Service managmenent inside the Control Panel.
  2. Under Add Service, click Local and select type Extension.
  3. Enter a descriptive name and the SID: sid://mindtouch.com/2007/12/dekiscript
  4. Add "manifest" to the config section with value set to http://scripts.mindtouch.com/digg.xml
  5. Add extra configuration values as listed below under Configuration (If Configuration is not listed below, ignore this step.)
  6. Click on add service.

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


Overview

This extension contains functions for using Digg.com. This script requires MindTouch Deki 1.8.3 or later.

Functions:

  1. digg.news
  2. digg.this

digg.news(max, width, height, border, theme) : xml

Embed the 'Digg News' widget.

Parameters:

NameTypeDescription
maxnum(optional) Max items to display. (default: 10)
widthnum(optional) Widget width. (default: 300)
heightnum(optional) Widget height. (default: 350)
borderbool(optional) Show border. (default: true)
themestr(optional) Widget color theme. (default: "digg-widget-theme1")


digg.this(uri, compact, bgcolor) : xml

Embed the 'Digg It' badge.

Parameters:

NameTypeDescription
uriuri(optional) URI to for the Digg story. (default: current page)
compactbool(optional) Use compact visual style for button. (default: false)
bgcolorstr(optional) CSS style for background color. (default: white)


Source Code

<extension>
  <title>MindTouch Digg Extension</title>
  <label>Digg</label>
  <copyright>Copyright (c) 2007, 2008 MindTouch, Inc.</copyright>
  <description>This extension contains functions for using Digg.com.</description>
  <uri.help>http://wiki.developer.mindtouch.com/MindTouch_Deki/Extensions/Digg</uri.help>
  <uri.logo>http://scripts.mindtouch.com/logos/digg-logo.png</uri.logo>
  <namespace>digg</namespace>
  
  <function>
    <name>this</name>
    <description>Embed the 'Digg It' badge.</description>
    <param name="uri" type="uri" optional="true">URI to for the Digg story. (default: current page)</param>
    <param name="compact" type="bool" optional="true">Use compact visual style for button. (default: false)</param>
    <param name="bgcolor" type="str" optional="true">CSS style for background color. (default: white)</param>
    <return>
      <html xmlns:eval="http://mindtouch.com/2007/dekiscript">
        <body>
          <eval:if test="args.uri || args.compact || args.bgcolor">
            <script>
              <eval:if test="args.uri">digg_url = <eval:js>args.uri</eval:js>;</eval:if>
              <eval:if test="args.compact">digg_skin = "compact";</eval:if>
              <eval:if test="args.bgcolor">digg_bgcolor = <eval:js>args.bgcolor</eval:js>;</eval:if>
            </script>
          </eval:if>
          <script src="http://digg.com/tools/diggthis.js" type="text/javascript" />
        </body>
      </html>
    </return>
  </function>
  
  <function>
    <name>news</name>
    <description>Embed the 'Digg News' widget.</description>
    <param name="max" type="num" optional="true">Max items to display. (default: 10)</param>
    <param name="width" type="num" optional="true">Widget width. (default: 300)</param>
    <param name="height" type="num" optional="true">Widget height. (default: 350)</param>
    <param name="border" type="bool" optional="true">Show border. (default: true)</param>
    <param name="theme" type="str" optional="true">Widget color theme. (default: "digg-widget-theme1")</param>
    <return>
      <html xmlns:eval="http://mindtouch.com/2007/dekiscript">
        <body>
          <eval:if test="args.width || args.height || !(args.border ?? true) || args.theme">
            <script>
              <eval:if test="args.width">digg_width = <eval:js>web.size(args.width)</eval:js>;</eval:if>
              <eval:if test="args.height">digg_height = <eval:js>web.size(args.height)</eval:js>;</eval:if>
              <eval:if test="!(args.border ?? true)">digg_border = 0;</eval:if>
              <eval:if test="args.theme &amp;&amp; (args.theme != '')">digg_theme = <eval:js>args.theme</eval:js>;</eval:if>
            </script>
          </eval:if>
          <script src="http://digg.com/tools/widgetjs" type="text/javascript" />
          <script eval:src="'http://digg.com/tools/services?type=javascript&amp;callback=diggwb&amp;endPoint=/stories/popular&amp;count=' .. (args.max ?? 10)" type="text/javascript" />  
        </body>
      </html>
    </return>
  </function>
</extension>



Samples


Output

To embed the Digg News widget using the defaults:

{{ digg.news() }} 

./DefaultDiggNewsWidget.JPG

To embed the Digg News widget using the defaults, except for the theme
"digg-widget-theme4":

{{ digg.news{ theme: "digg-widget-theme4"} }}

./ThemedDiggNewsWidget.JPG

To embed the "Digg It" badge using the defaults:

{{ digg.this() }} 

./DefaultDiggItWidget.JPG

To embed the "Digg It" badge using the defaults, except for a green background color:

{{ digg.this{ bgcolor: "#0f0" } }}

./GreenDiggItWidget.JPG
Tag page
You must login to post a comment.
Powered by MindTouch Deki Enterprise Edition v.8.08 RC1