If you haven't already, take a look at:
http://apidoc.digg.com/MakingWidgets
On my personal web site, there are a few examples of custom widgets like yours:
http://www.sbw.org/diggwidget/
If you'll post the URL of your test page, I'll take a look. It's
usually something simple. (You can email it to me privately, if you
don't want to post it to the public forum.)
Both links are in the response for each story. Note the "link" and
"href" attributes on each story element. Your Javascript code can
use those in any way you like.
Thanks for emailing the link to your test page.
When I request your widget.js (note, NOT mywidget.js, which isn't
there), the response has your Javascript code wrapped in an HTML
document. Looks like something got corrupted there.
>Do I need to specify where the jquery library is?
Yes, of course. Your copy of widget.js emits <link> tags that try to
load JQuery and the CSS from a relative URL, and your server responds
404 to those URLs. So that won't work.
You'll probably want to create your own CSS.
As for JQuery, you can continue to load it from Digg's CDN, or copy
it to your server, or (my personal preference) load it from Google
Code, as in this example:
http://www.sbw.org/diggcustomwidget-no-dom/
If you do copy that last example, your Javascript must change more,
because it doesn't load JQuery-DOM. I think it actually makes the
Javascript a little simpler.
A good tool to help you get better with Javascript is:
When I open your test page, Firebug told me right away that there's a
syntax error on line 14 of your widget.js. There's a line break in
the middle of a string literal.
Widgets based on APIs from Digg and others can be a lot of
fun! Firebug makes it much easier to debug them.
I don't know whether that's the only problem with your test page, but
it should help you to get it working.
Understood. But I do see a number of differences between yours and
the original. In particular, right now there's a line break in the
middle of a string literal on line 23, and a missing string delimiter
on line 31. There may be more.
Firebug showed me the first error. I spotted the second while
comparing the two files. There may be more differences.
You might copy the file again, taking care not to introduce any
changes. Firefox's "Save As" isn't a particularly good tool for
that, as it tries to interpret widgetjs as an HTML page.
If you have shell access to your server, you can use the ftp or wget
command to download widgetjs from Digg directly.