Digg Extension
Vendor
MindTouch
Type Script
Categories Widget
Requires MindTouch Core 1.8.3 or later
Status Stable
License Free/Open Source
Manifest http://scripts.mindtouch.com/digg.xml

 

Install Script
To add  this script to your site, enter the address of your MindTouch installation (ex: http://www.mindtouch.com) and click the Add Script button.  This will open your control panel and prepopulate the necessary values.  You will still need to manually add configuration settings if required.  Note that no changes are made to your site until you confirm the action in your control panel.
Your site address:     


Table of Contents

Description

This extension contains functions for using Digg.com.

See also How to add a script, Using the Extension Dialog, Learn about DekiScript, Extensions Directory.


Functions

digg.news(max : num, width : num, height : num, border : bool, theme : str) : 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 : uri, compact : bool, bgcolor : str) : 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)


Script Source

<extension>
  <title>Digg Extension</title>
  <label>Digg</label>
  <copyright>Copyright (c) 2006-2009 MindTouch Inc.</copyright>
  <description>This extension contains functions for using Digg.com.</description>
  <uri.help>http://developer.mindtouch.com/App_Catalog/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.