Widgets

From MoochWiki

Jump to: navigation, search

What's a widget?

A widget is a small piece of HTML code that you copy/paste into your blog or personal web site. The widget then displays live information from BookMooch on your web page.

What information can a widget display?

The list of widget choices is a bit on the long side, but there are only a few variations on the theme. All the widgets display a book cover or a book title, from either your inventory, wishlist or mooched history.

How do I get and use widgets?

The widget code is listed on this BookMooch page:

In order to use a BookMooch widget, you must have your own blog or web page. There are many web site technologies on the Internet, and so there are many ways of embedding widgets in them.

The simplest way to test which embedding technologies will work for you is to copy/paste the test HTML into your web page, and see which messages it displays. Then, use the first listed method which works. The test HTML is displayed if you leave the default technology as “I don’t understand” :

You can test a widget easily by copying just the URL out from the HTML code, like so:

http://bookmooch.com/widget/en/html/inv_recent_cover/johnbuckman/10/+/

and putting it in as the URL in your web browser. In this case, you'll see 10 book covers.

Note that if you elect to show book covers, and some of your books don't have covers, it will simply skip that book.

You can also modify the URL in various ways to get more options than the pull down menus give you. For example, this is the default URL for the "5 most recent books you're giving away, separated by a space" : http://bookmooch.com/widget/en/html/inv_recent/johnbuckman/5/+/

if you wanted to separate each book with " | ", you change the + (which is the HTML for a space in a URL) to "+|+" like so: http://bookmooch.com/widget/en/html/inv_recent/johnbuckman/5/+|+/

and if you wanted to show just 3 books instead of 5, change the number in the URL: http://bookmooch.com/widget/en/html/inv_recent/johnbuckman/3/+|+/

You can also change the user that the widget is getting information from: it doesn't need to be you. For example, if I change "johnbuckman" to "buckman_ca" the widget changes accordingly: http://bookmooch.com/widget/en/html/inv_recent/buckman_ca/2/+%7C+/

The "en" in each URL specifies the language any text in the widget would return in. Currently, none of the widgets returns any text other than the author name and book title, which we never translate.

The "html" parameter in the URL above determines the output format of the widget. Currently, there are only two choices, "js" for javascript, and "html" for plain HTML.

Personal tools