2010-11-04

Last Comments with Style

Hot on the heels of the last release a few days ago that introduced visitors-only mode into Last Comments, today comes another round of improvements to both versions of the gadget that should start trickling through to end users soon. Included in this round of updates are the ability to style Elements (author names, post titles, comment previews, dates, and times), a new default Display List that takes advantage of Element styling, and an improved internal HTML structure.

Previous versions of Last Comments displayed the latest comments as lists but internally, none of the available list tags were used. Now the list of recent comments is actually a list (an unordered list) and each section is a list-item. This upgrade is necessary for my ultimate plans to turn Last Comments into a widget in version 1.x.

The new styling feature, though, is quite tangible. It allows you to show Elements in bold and italics and with underlines. You can also make the font size of the Element larger or smaller by about 1 point. In addition, you can apply the styling to Element itself or to the Element and the Custom Text surrounding the element. What's more, you can also direct Last Comments to include the Element and its Custom Text in the link, making it possible once again to mimic the old Recent Comments gadget.

Element styling is achieved by listing lowercase letters denoting each style before the Element in your Display List. Here is a list of the styling options:
AbbreviationMeaning
b-bold
e-Element only (by default, styles are applied to the Element and its Custom Text)
i-italicize
l-larger font size
s-smaller font size
u-underline
w-whole Element entry is linked (by default, only the Element is linked, not its Custom Text)
For example, the old default Display List was:
S Aa*_wrote: Cc Ppon_*
which showed the Separator bar, the Author linked to the Author's URL followed by the text " wrote:" on the next line, the Comment Preview linked to the Comment URL on the next line, and the text "on " followed by the Post Title linked to the Post URL on the bottom line. 

The new default Display List is:
S lwAa*_wrote: Cc lwPpon_*
which changes the top line with the Author into a larger font and links the Author's URL to both the Author and the text " wrote:". It also makes the same styling changes to the bottom line which is shown in a larger font with the Post URL linked to both the text "on " and the Post Title. The Comment Preview remains unchanged from the previous versions.

You can combine every style if you like: 
beilsuwAa*_wrote:
is a valid entry in the Display List that would look like this: "Aratina wrote:" (the smaller font size will override the larger font size). Styling options are made to be backwards compatible, so they must follow the minus sign  (minus signs can be placed before Elements to keep them on the same line as the previous Element), like so:
beiAa*_on_ -biPp
which would look like this: "Aratina on Last Comments with Style". Likewise, if you use the options X, V, or F but do not show the Separator, then there should be no space after the X, V, or F and the styling options, like so: 
VbelP*_was_ -Lscribbled*_on_by_ -blA
which would look like this: "Last Comments with Style was scribbled on by Visitor20" (the blog owner's comments will not appear when option V is used because that turns on visitors-only mode).

Now that I have seen it in action, I feel like I should have implemented this feature long ago. As always, I welcome feedback and might be willing to incorporate new features into the gadget if they are feasible, so let me know what you think in the comments!