Feingold08 > RussForge
 

Current Projects: The Quote Widget

Overview

Several of the more advanced pro-Feingold blogs have widgets that will display random quotes by or about Russ every time a page is visited. This widget gives that same functionality to blogs that don't have an advanced Content Management System or PHP backends.

This project provided a number of challenges, including:

  • it should be easy to add to a blog
  • the appearance should be highly configurable
  • it should show something reasonable to visitors that don't have JavaScript activated

As of this version, we believe that all these challenges have been met.

The idea is to add one or more of these elements to your page (for example, in your template)

  • <span id="quote_text"></span>
  • <span id="quote_by"></span>,
  • <span id="quote_about"></span>.
  • <span id="quote_link"></span>,
  • <span id="quote_date"</span>

And then to call the following JavaScript which will put the appropriate text into the spans:

<script type="text/javascript" src="http://feingold08.sf.net/apps/feingold-quotes.js"></script>
<script type="text/javascript" >
write_russ_quote();
</script>

For example, you could lay out the spans like this:

<i><span id="quote_text">"It's time to stand up - not to cheer, but to fight back."</span></i><br/>
--<span id="quote_by">Senator Russ Feingold</span>,
<span id="quote_about">On Executive Power</span>.
(<span id="quote_link"><a href="http://www.dailykos.com/storyonly/2006/2/2/10581/84829">Daily Kos</a></span>,
<span id="quote_date">2006-02-02</span>)

And the result would look like this:

"It's time to stand up - not to cheer, but to fight back."
--Senator Russ Feingold, On Executive Power. (Daily Kos, 2006-02-02)

Note that in the above example, we put stuff in between the span tags. This provides a default quote to visitors that don't hava JavaScript support in their browsers.

You can change the appearance of any of the spans in a number of ways, from defining CSS elements for them to wrapping the spans in normal HTML tags (like the italics tag above). Check out the example page in the repository for a concrete example.

Surf the repository for more goodies.

Your Feedback

Here are some of the places that you can share your ideas about this and other RussForge tools with the developers: