suncat: Basic Suncat Studio avatar (Default)
Suncat ([personal profile] suncat) wrote in [site community profile] dw_nifty2010-09-04 10:28 am

LibraryThing widgets

After I added a LibraryThing widget to my own DW blog, I got some requests to share the technique in this group. Finally, I'm getting around to writing something up.

The first widget developed at LibraryThing for posting on blogs was written in JavaScript. But Dreamwidth, like its parent site LiveJournal, doesn't allow for inclusion of such script-based widgets on its journals. (If this is no longer a limitation, I hope someone in the know will correct me.) Sooo, a clever person over at LT developed an image-based widget that lives just fine on LJ-style sites.

The LT blog post describing how to use the widget: Graphical Widgets for LJ and etc..

While detailed, the above blog post might still be confusing for folks not very familiar with HTML or especially argument strings on URLs. So I'll provide a detailed breakdown of the options I used to produce my own widget (seen at the bottom of the left-hand sidebar of my journal).

My code, tucked into the "Custom Text" module:

<div class="ltwidget">
<img src="http://www.librarything.com/gwidget/widget.php
?view=Suncat&type=random&width=205
&top=Some books of mine at LibraryThing
&bc=d6e5b2&ac=1c1d19&tc=3c6022&hc=1c1d19
&hbold=1&tbold=1&tag=knitting" />
</div>

Please note about the above code, and this is very important to making it work, everything inside the img element should be all together on one long line. I broke it up simply so it could be read. Now I'll step through each piece of this. I haven't used all the features provided, but this should give you useful clues.

<div class="ltwidget">

I've applied a CSS class to the containing div so that I can meld the widget into my overall journal design.

http://www.librarything.com/gwidget/widget.php

The widget as it appears on your journal here at DW is actually an image being generated on the LT server, and fetched on command. Read the above LT blog posting for more information.

?

The "?" marks the start of the parameters that you're feeding to the widget generator, to get back a customized image. Notice that all the following text consists of pairs of text items separated by "&"s. Each pair is of form parameter=value.

beatrice_otter: Poirot: Little Grey Cells (Little Grey Cells)

[personal profile] beatrice_otter 2010-09-04 05:07 pm (UTC)(link)
Thank you! I've been wanting one of these for a long time.

So, what are hex color codes and how do I figure out which ones fit with my layout? Also, if I want it to pull from all my books, can I omit &tag=[whatever]? Or could I put more than one tag in, and how would I do that?
beatrice_otter: Me in red--face not shown (Default)

[personal profile] beatrice_otter 2010-09-04 05:54 pm (UTC)(link)
Okay, but if there's a way to use that overkill site you pointed out to get anything vaguely close to the red of my site scheme, I couldn't find it. My layout is a very basic red, black, and white. I would like something that doesn't clash horribly, and I guarantee I won't be able to match the reds myself and it will bug me if it doesn't. Help! (And thank you for your help!)
beatrice_otter: Me in red--face not shown (Default)

[personal profile] beatrice_otter 2010-09-04 06:51 pm (UTC)(link)
Thank you so much for taking the time to do this--one last question. How do I actually install it? What page should I be looking for, what box do I put it in--as you can probably tell, I know virtually nothing about this kind of thing. I wandered around the Customize Journal Style things and just got lost and confused.
beatrice_otter: Supergirl Victory (Supergirl Victory)

[personal profile] beatrice_otter 2010-09-04 09:56 pm (UTC)(link)
Aha! It's working! Yay! Is there anything I could do for you in return, write you a short fic, maybe? Any fandom/character I've written is fair game, but I don't write slash.
matgb: Artwork of 19th century upper class anarchist, text: MatGB (Default)

[personal profile] matgb 2010-09-04 06:25 pm (UTC)(link)
Using the Firefox Colorpicker plugin, the main red on the sidebar is #C90808, the lighter shade around your icon and other headers is #D02828, the lines between each entry and for the headers on the entries is the first one.

All of this is also viewable within the CSS of your journal, I think it should be automatically displaying on the customise journal pages, but it's been a long time since I used a site scheme, so I'm not sure.

(and while I get cited occasionaly as someone to go to for stuff like this, the above explanation of what the hex codes actually are is the first I've actually known, I've just used them for years, translating them back to RGB colours just never mattered to me)

Tis a nifty trick. I wonder if I can get a barcode scanner for my phone, might get me using my account again...
beatrice_otter: Me in red--face not shown (Default)

[personal profile] beatrice_otter 2010-09-04 06:47 pm (UTC)(link)
Thank you!
beatrice_otter: Me in red--face not shown (Default)

[personal profile] beatrice_otter 2010-09-04 05:46 pm (UTC)(link)
Thank you!
mscongeniality: (Default)

[personal profile] mscongeniality 2010-09-04 05:52 pm (UTC)(link)
Thank you! I've got the LT widget on my LJ but hadn't gotten around to figuring it out for Dreamwidth. Can't wait to implement this.
adelheid: (wrangling tool)

[personal profile] adelheid 2010-09-05 12:26 am (UTC)(link)
Awesome! Putting this and the LT post in my delicious to come back to later (and see if I can rejig it for Goodreads, which I use more.)
dhobikikutti: earthen diya (Default)

[personal profile] dhobikikutti 2011-01-26 11:47 am (UTC)(link)
If you do figure out how to do it for Goodreads, please let us know - that's the one I've been waiting for!
(reply from suspended user)
unjapanologist: (Default)

[personal profile] unjapanologist 2011-02-02 07:20 pm (UTC)(link)
I've been looking for something like this for ages! Thank you so much for the write-up.