var options for google AJAX feed api

42 views
Skip to first unread message

sudrland

unread,
Jun 27, 2008, 10:09:20 AM6/27/08
to Google AJAX API
I am trying to find some documentation, if it exists, that would list
the var options and what values are possible.

In the dynamic feed control for the API the script contains the
following code:

var options = {
stacked : true,
horizontal : false,
title : "Featured Article:",
numResults: 10
}

What I'm trying to accomplish is to include my proxy prefix on the
link in the featured article portion of the application -
http://www.lib.montana.edu/feeds/lis2.php - I have downloaded
gfdynamicfeedcontrol.js and placed it on my server and was able to
customize the feeds to have the proxy prefix on the feed entries -
http://www.lib.montana.edu/feeds/meta/scripts/gfdynamicfeedcontrol2.js.

I know that the function
GFdynamicFeedControl.prototype.displayCurrentEntry_ = function() is
controlling the display, but have not been able to figure out yet how
to customize that code to include the proxy prefix. I then wondered
about the var options variables. Either solution is acceptable, as
long as I can get the proxy prefix into the featured article link,
otherwise I'll need to remove that feature.

Ben Lisbakken

unread,
Jun 27, 2008, 2:24:04 PM6/27/08
to Google-AJAX...@googlegroups.com
You'll be able to find documentation in here (http://www.google.com/uds/solutions/dynamicfeed/reference.html).  In there you'll see you can specify the title.  If that's not what you want, a quick way to find the code that you're looking for is to use Firebug.

Use the HTML inspector on the title that you want to change, examine the HTML, find something unique about the HTML, then do a find in the control's js file for that html and you'll see where it is generated.

-Ben

sudrland

unread,
Jun 27, 2008, 3:28:31 PM6/27/08
to Google AJAX API
I did find the reference documentation, but wanted to be sure that was
exhaustive of the options that were changeable. I do have a static
title, but that option does not alter the url in the featured article
div. The two classes I would like to alter are gf-title and gf-
snippet and those are not in the gfdynamicfeedcontrol.js, but in the
script that calls the API. I'd like to alter the snippet size to
include more than 120 characters of an article abstract, for
instance.

I'll check out Firebug and see what I can do.

<div style="top: 0px;" class="gf-result"><div class="gf-title"><a
target="_blank" class="gf-title" href="http://se...


thanks,
Michael

On Jun 27, 12:24 pm, Ben Lisbakken <lisba...@google.com> wrote:
> You'll be able to find documentation in here (http://www.google.com/uds/solutions/dynamicfeed/reference.html). In there
> you'll see you can specify the title. If that's not what you want, a quick
> way to find the code that you're looking for is to use Firebug.
>
> Use the HTML inspector on the title that you want to change, examine the
> HTML, find something unique about the HTML, then do a find in the control's
> js file for that html and you'll see where it is generated.
>
> -Ben
>
> On Fri, Jun 27, 2008 at 7:09 AM, sudrland <sudrl...@gmail.com> wrote:
>
> > I am trying to find some documentation, if it exists, that would list
> > the var options and what values are possible.
>
> > In the dynamic feed control for the API the script contains the
> > following code:
>
> > var options = {
> > stacked : true,
> > horizontal : false,
> > title : "Featured Article:",
> > numResults: 10
> > }
>
> > What I'm trying to accomplish is to include my proxy prefix on the
> > link in the featured article portion of the application -
> >http://www.lib.montana.edu/feeds/lis2.php- I have downloaded

sudrland

unread,
Jun 27, 2008, 3:52:47 PM6/27/08
to Google AJAX API
This is the code in the gfdynamicfeedcontrol.js that I want to alter
to include the proxy prefix:

this.clearNode_(this.nodes.entry);
this.current = this.entries[this.entryIndex].html;
this.current.style.top = '0px';
this.nodes.entry.appendChild(this.current);
this.createOverlay_();

I need to add the prefix "http:://proxybz.lib.montana.edu/login?url="
to the link url.

Michael
> > >http://www.lib.montana.edu/feeds/lis2.php-I have downloaded

sudrland

unread,
Jun 27, 2008, 4:50:18 PM6/27/08
to Google AJAX API
Although this part of the code displays the 'feature' putting in the
proxy here is not desirable, since it will add the proxy every time
the function is called.

Michael
> > > >http://www.lib.montana.edu/feeds/lis2.php-Ihave downloaded

Ben Lisbakken

unread,
Jun 27, 2008, 5:10:05 PM6/27/08
to Google-AJAX...@googlegroups.com
Sudrland --

If I were you I'd take a look at the GSnewsBar.prototype.searchComplete prototype method.  Specifically, the ns.results variable.  I would think that if you went through that variable, and changed all results' links or titles to whatever you want, this would be an easy way to acheive what you are trying to do.

-Ben

sudrland

unread,
Jul 9, 2008, 4:24:03 PM7/9/08
to Google AJAX API
I looked at the GSnewsBar.prototype.searchComplete prototype method,
however, I could not figure out how to use that function with the
gfdynamicfeedcontrol.js and the ajax feed API. I am unsure how to
apply that method or what I need within the application exactly to
make that work. (http://www.lib.montana.edu/feeds/lis.php). My
application takes feeds from our electronic journal subscriptions
through databases such as EBSCO, Gale, and Emerald, mashes those
together using the Google AJAX feed API and serves them together as a
virtual current periodical room so that users may browse the table of
contents for journals in their academic discipline. I chose journals
in Library and Information Science as a test to bring the web service
together. I am unsure about the licensing agreements we have and
wanted to add our proxy prefix - http://proxybz.lib.montana.edu/login?url=
- to cover myself and ensure that only individuals affiliated with our
institution could access the databases and subscriptions.

I have been able to break down the following code within the
GFdynamicFeedControl.prototype.displayCurrentEntry_ = function () a
little bit -

this.current = this.entries[this.entryIndex].html;

I declared a variable and used the createLink_ function to create an
instance of the article link from the feed replacing the first five
lines of code in the function with the following -

this.clearNode_(this.nodes.entry);
var link = this.createLink_(this.entries[this.entryIndex].link,
this.entries[this.entryIndex].title,
this.options.linkTarget);
var class = 'gf-title';
var listEntry = this.createDiv_(class);
listEntry.appendChild(link);
this.nodes.entry.appendChild(listEntry);
this.createOverlay_();

Thus, I was able have a link in the featured div that was formated the
way I wanted it. However, I was not able to isolate the author or
snippet portions in a similar manner. I tried

this.entries[this.entryIndex].author and
this.entries[this.entryIndex].contentSnippet

and these broke the application. I then declared another variable and
wrote the following -

this.clearNode_(this.nodes.entry);
var link = this.createLink_(this.entries[this.entryIndex].link,
this.entries[this.entryIndex].title,
this.options.linkTarget);
var entry = this.entries[this.entryIndex].html;

var class = 'featureLink';
var listEntry = this.createDiv_(class);
listEntry.appendChild(link);
listEntry.appendChild(entry);
this.nodes.entry.appendChild(listEntry);
this.createOverlay_();

As you can see this would add the whole entry including the link,
author(s), and snippet so that I would have two links one after
another in the featured div. I then went into the css and declared
the 'gf-title a {display: none}', and this removed the second link.
While this works and looks fine as long as the css is available, I do
not think that this is a great solution. What do you suggest - can I
bring out the author and snippet in a similar manner and just have the
wrong code or can you suggest how to use the other function from the
GSnewsBar.

thank you for your time and consideration,
Michael

On Jun 27, 3:10 pm, Ben Lisbakken <lisba...@google.com> wrote:
> Sudrland --
>
> If I were you I'd take a look at the GSnewsBar.prototype.searchComplete
> prototype method. Specifically, the ns.results variable. I would think
> that if you went through that variable, and changed all results' links or
> titles to whatever you want, this would be an easy way to acheive what you
> are trying to do.
>
> -Ben
>

Ben Lisbakken

unread,
Jul 10, 2008, 12:25:29 PM7/10/08
to Google-AJAX...@googlegroups.com
Hey Michael --

Try this code:
http://paste-it.net/public/qc1f670/

Paste it in the gfdynamicfeedcontrol.js to replace the existing function.

All I did was add a custom string that is pre-pended to the feed titles.  Let me know if this is what you were trying to achieve.

-Ben

sudrland

unread,
Jul 14, 2008, 11:49:30 AM7/14/08
to Google AJAX API
Tried that and I get nothing. Putting the proxy prefix in that
function doesn't change the entry links in the feature. I think the
function I need to alter is in the API somewhere -
http://www.google.com/uds/api/feeds/1.0/en/ca63ecac88fdd4d8bb7d3232ac057e79/default.I.js
I am pretty sure this is the case because
I wrote another version - http://www.lib.montana.edu/feeds/lis3.php
that does not use the gfdynamicfeedcontrol.js and the API returns the
title of the article as an a href URL, the author, and the snippet for
each entry.


On Jul 10, 10:25 am, Ben Lisbakken <lisba...@google.com> wrote:
> Hey Michael --
>
> Try this code:http://paste-it.net/public/qc1f670/
>
> Paste it in the gfdynamicfeedcontrol.js to replace the existing function.
>
> All I did was add a custom string that is pre-pended to the feed titles.
> Let me know if this is what you were trying to achieve.
>
> -Ben
>
> On Wed, Jul 9, 2008 at 1:24 PM, sudrland <sudrl...@gmail.com> wrote:
>
> > I looked at the GSnewsBar.prototype.searchComplete prototype method,
> > however, I could not figure out how to use that function with the
> > gfdynamicfeedcontrol.js and the ajax feed API. I am unsure how to
> > apply that method or what I need within the application exactly to
> > make that work. (http://www.lib.montana.edu/feeds/lis.php). My
> > application takes feeds from our electronic journal subscriptions
> > through databases such as EBSCO, Gale, and Emerald, mashes those
> > together using the Google AJAX feed API and serves them together as a
> > virtual current periodical room so that users may browse the table of
> > contents for journals in their academic discipline. I chose journals
> > in Library and Information Science as a test to bring the web service
> > together. I am unsure about the licensing agreements we have and
> > wanted to add our proxy prefix -http://proxybz.lib.montana.edu/login?url=

Ben Lisbakken

unread,
Jul 14, 2008, 7:45:07 PM7/14/08
to Google-AJAX...@googlegroups.com
Hey Michael --

Try this:
http://www.lisbakken.com/ajaxapi/hello_world/hello_world_dynamicFeed.html

It's my custom string infront of the entries.  Is this what you're trying to do?

-Ben

MIKE KLAUSMEYER

unread,
Jul 15, 2008, 5:04:05 PM7/15/08
to Google-AJAX...@googlegroups.com

Ben

 

Thanks! I’ll check it out and let you know.

 

Mike

 

 


sudrland

unread,
Jul 15, 2008, 5:15:54 PM7/15/08
to Google AJAX API
How did you do that?

What I really want is the proxy prefix added to each of the entries in
the banner rotation, for instance if the url is
http://www.tmz.com/2008/07/15/poshs-denim-flop-spice/

then I want it to be http://proxybz.lib.montana.edu/login?url=http://www.tmz.com/2008/07/15/poshs-denim-flop-spice/

I figured out how to add the prefix to the other entries by adding
code to the

GFdynamicFeedControl.prototype.createLink_ = function(href, text,
opt_target) {
var link = document.createElement('a');
var proxy = 'http://proxybz.lib.montana.edu/login?url=';
link.href = proxy + href;
link.innerHTML = text;
if (opt_target) {
link.target = opt_target;
}
return link;
};

This did not touch the a href URL in the banner rotation -

Michael

On Jul 14, 5:45 pm, Ben Lisbakken <lisba...@google.com> wrote:
> Hey Michael --
>
> Try this:http://www.lisbakken.com/ajaxapi/hello_world/hello_world_dynamicFeed....
>
> It's my custom string infront of the entries. Is this what you're trying to
> do?
>
> -Ben
>
> On Mon, Jul 14, 2008 at 8:49 AM, sudrland <sudrl...@gmail.com> wrote:
>
> > Tried that and I get nothing. Putting the proxy prefix in that
> > function doesn't change the entry links in the feature. I think the
> > function I need to alter is in the API somewhere -
>
> >http://www.google.com/uds/api/feeds/1.0/en/ca63ecac88fdd4d8bb7d3232ac...
> > I am pretty sure this is the case because
> > I wrote another version -http://www.lib.montana.edu/feeds/lis3.php

Ben Lisbakken

unread,
Jul 15, 2008, 5:26:52 PM7/15/08
to Google-AJAX...@googlegroups.com
Michael --

Try my version again (make sure to clear your cache so that you get the updated version):
http://www.lisbakken.com/ajaxapi/hello_world/hello_world_dynamicFeed.html

The code that I changed is here:
http://paste-it.net/public/xe019e8/

-Ben

sudrland

unread,
Jul 16, 2008, 10:55:24 AM7/16/08
to Google AJAX API
Ben -

Actually that is helpful and I'll be able to use that since I turned
off the titles, and it is getting closer to what I want, however,
that's still not the URL I want to put the prefix on. From your
version we have the following three divisions - the two feeds (Digg
and TMZ) and the banner at the top that rotates an article at a
specified interval. In this example 'Ray Allen Throws TMZ Under "The
Bus"' is a URL link in the container for the feed TMZ. I have been
able to append the string I want in that URL. The problem is the URL
in the top rotating banner container -

TMZ <--- I
turned off the title links by changing the code
Ray Allen Throws TMZ Under "The Bus" <--- **** I want to put
the (string) proxy prefix here before this URL *****
by TMZ Staff
-
1 hour ago
Filed under: Talk Sports NBA rejection specialist Ray Allen finally
fessed up to his ultra-embarrassing denial from One Sunset ...

Digg
Batman Through The Years
Viacom allows Google to conceal YouTube usernames in court
25 Great Photography Tutorials and Links From Around the Web
Über-Tight Code: The Software Behind the Mars Phoenix Lander

TMZ
Rampage: Terror Outside the Ring
Ray Allen Throws TMZ Under "The Bus"
<----- I have been able to add the string to these links through the
createLink_ = function (etc.) {
Khloe K Gets Clubbed Before Jail
LC -- I Won't Walk With Bitches!


hopefully that is more clear; i wish i could have put an image in here
to illustrate.

-Michael

On Jul 15, 5:26 pm, Ben Lisbakken <lisba...@google.com> wrote:
> Michael --
>
> Try my version again (make sure to clear your cache so that you get the
> updated version):http://www.lisbakken.com/ajaxapi/hello_world/hello_world_dynamicFeed....
>
> The code that I changed is here:http://paste-it.net/public/xe019e8/
>
> -Ben
>
> On Tue, Jul 15, 2008 at 2:15 PM, sudrland <sudrl...@gmail.com> wrote:
>
> > How did you do that?
>
> > What I really want is the proxy prefix added to each of the entries in
> > the banner rotation, for instance if the url is
> >http://www.tmz.com/2008/07/15/poshs-denim-flop-spice/
>
> > then I want it to be
> >http://proxybz.lib.montana.edu/login?url=http://www.tmz.com/2008/07/1...
> ...
>
> read more »

Ben Lisbakken

unread,
Jul 16, 2008, 12:22:54 PM7/16/08
to Google-AJAX...@googlegroups.com
Let's try one more time :)
http://www.lisbakken.com/ajaxapi/hello_world/hello_world_dynamicFeed.html
and
http://paste-it.net/public/a8bcf10/

All I did was change the feeds object _before_ it gets displayed anywhere.  That way I don't have to worry when and where it gets displayed and change that code -- instead I just change the data before it gets run through.

Also, I would highly suggest Firebug if you're going to be mucking around with other people's Javascript.  You can set breakpoints, inspect objects, etc.  Very useful!

Hope this code does it for ya.

-Ben

sudrland

unread,
Jul 16, 2008, 5:01:39 PM7/16/08
to Google AJAX API
Ben,

Thank you. Before I go 'mucking around with other people's javascript'
I'll check out Firebug.
I hope I didn't offend anyone. I'll let you know how it turns out -
thanks again,

- Michael

On Jul 16, 10:22 am, Ben Lisbakken <lisba...@google.com> wrote:
> Let's try one more time :)http://www.lisbakken.com/ajaxapi/hello_world/hello_world_dynamicFeed....
> andhttp://paste-it.net/public/a8bcf10/
>
> All I did was change the feeds object _before_ it gets displayed anywhere.
> That way I don't have to worry when and where it gets displayed and change
> that code -- instead I just change the data before it gets run through.
>
> Also, I would highly suggest Firebug if you're going to be mucking around
> with other people's Javascript. You can set breakpoints, inspect objects,
> etc. Very useful!
>
> Hope this code does it for ya.
>
> -Ben
>
> ...
>
> read more »

Ben Lisbakken

unread,
Jul 16, 2008, 5:22:18 PM7/16/08
to Google-AJAX...@googlegroups.com
Sorry Michael, I didn't mean to come off with that tone!  I love mucking with people's Javascript :)

I just meant that when you are trying to rework some code Firebug is invaluable.  By all means, we are happy for our users to reuse our code however they want.

-Ben

sudrland

unread,
Jul 16, 2008, 5:24:42 PM7/16/08
to Google AJAX API
Ben -

Awesome! Works great. Thanks and sorry about 'mucking' with your
javascript. It was pretty important to get the proxy in there for
licensing agreements. That being said, I'm not sure how this might
impact our electronic subscriptions. Nevertheless, I wanted to thank
you and apologize.

- Michael

On Jul 16, 10:22 am, Ben Lisbakken <lisba...@google.com> wrote:
> Let's try one more time :)http://www.lisbakken.com/ajaxapi/hello_world/hello_world_dynamicFeed....
> andhttp://paste-it.net/public/a8bcf10/
>
> All I did was change the feeds object _before_ it gets displayed anywhere.
> That way I don't have to worry when and where it gets displayed and change
> that code -- instead I just change the data before it gets run through.
>
> Also, I would highly suggest Firebug if you're going to be mucking around
> with other people's Javascript. You can set breakpoints, inspect objects,
> etc. Very useful!
>
> Hope this code does it for ya.
>
> -Ben
>
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages