On May 11, 9:21 pm, Rob Russell <[email protected]> wrote:
> I just made a gadget with the example source code from the page you linked
> to. It seems to work fine (I set it to 12 items and added dynamic height so
> they didn't get trimmed). I tested in Firefox 3.6 and Chrome on Linux. Are
> you still having problems with it?
Ah, it's not as simple as I thought it was. Inside gadgets, it works
fine. In my specific case, I am calling _IG_FetchFeedAsJSON inside of
a Greasemonkey script. I realize this isn't something you probably
support, but here's a test...
When in iGoogle, just go to this url:
javascript:_IG_FetchFeedAsJSON("http://feeds.gawker.com/lifehacker/
excerpts.xml",function(data){alert(data.Entry.length);},50);
This will only give you 9 entries back. The FetchFeedAsJSON() method
in the containing page apparently isn't respecting the passed-in
number of items to retrieve.
If you inspect the functions, they are actually different. In the
iGoogle container:
function _IG_FetchFeedAsJSON(a, b, c, d, e) {
if (typeof e != "object") {
e = {};
}
var f = "fr_" + ig_ib++;
a = "url=" + _esc(a);
if (!isNaN(e.refreshInterval) && e.refreshInterval >= 0) {
a = _appendMaxAgeParameter(a, e.refreshInterval);
}
if (c) {
a += "&val=" + _esc(c);
}
if (d) {
a += "&sum=1";
}
c = f + ("=" + _esc(a));
if (ig_hb) {
d = {};
d[f] = b;
ig_gb(c, d);
} else {
if (ig_J != "") {
ig_J += "&";
}
ig_J += c;
ig_K[f] = b;
}
}
and within a gadget iframe:
function _IG_FetchFeedAsJSON(B, F, C, A, D) {
var E = D || {};
E.CONTENT_TYPE = "FEED";
E.NUM_ENTRIES = C;
E.GET_SUMMARIES = A;
gadgets.io.makeRequest(B, function (J) {J.data = J.data || {};if
(J.errors && J.errors.length > 0) {J.data.ErrorMsg = J.errors[0];}if
(J.data.link) {J.data.URL = B;}if (J.data.title) {J.data.Title =
J.data.title;}if (J.data.description) {J.data.Description =
J.data.description;}if (J.data.link) {J.data.Link = J.data.link;}if
(J.data.items && J.data.items.length > 0) {J.data.Entry =
J.data.items;for (var H = 0; H < J.data.Entry.length; ++H) {var I =
J.data.Entry[H];I.Title = I.title;I.Link = I.link;I.Summary =
I.summary || I.description;I.Date = I.pubDate;}}for (var G = 0; G <
J.data.Entry.length; ++G) {var I = J.data.Entry[G];I.Date = I.Date /
1000;}F(J.data);}, E);
}
Unfortunately, in the container, the gadgets.io.makeRequest() method
isn't implemented.
Matt Kruse
--
You received this message because you are subscribed to the Google Groups
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/Google-Gadgets-API?hl=en.