| 29 | | my $user = $entry->meta->{hatenabookmark_users}; |
|---|
| 30 | | my $users = $user >= 2 ? "$user users" : "$user user"; |
|---|
| 31 | | |
|---|
| 32 | | $user >= 10 ? |
|---|
| 33 | | qq(<strong style="background-color: #ffcccc; font-weight: bold; font-style: normal; display: inline;"><a href="$url" style="color: red;">$users</a></strong>) |
|---|
| 34 | | : $user >= 2 ? |
|---|
| 35 | | qq(<em style="background-color: #fff0f0; font-weight: bold; display: inline; font-style: normal;"><a href="$url" style="color: #ff6666;">$users</a></em>) |
|---|
| 36 | | : qq(<a href="$url">$users</a>); |
|---|
| | 34 | return |
|---|
| | 35 | $user >= 10 ? qq(<strong style="background-color: #ffcccc; font-weight: bold; font-style: normal; display: inline;"><a href="$url" style="color: red;">$users</a></strong>) |
|---|
| | 36 | : $user >= 2 ? qq(<em style="background-color: #fff0f0; font-weight: bold; display: inline; font-style: normal;"><a href="$url" style="color: #ff6666;">$users</a></em>) |
|---|
| | 37 | : qq(<a href="$url">$users</a>); |
|---|
| | 38 | } else { |
|---|
| | 39 | my $size = $self->conf->{image_size} || 'normal'; |
|---|
| | 40 | my $img_url = HTML::Entities::encode("http://b.hatena.ne.jp/entry/image/$size/$permalink"); |
|---|
| | 41 | return qq(<a href="$url"><img src="$img_url" style="border:0;vertical-align:middle" /></a>); |
|---|
| | 42 | } |
|---|
| | 47 | __END__ |
|---|
| | 48 | |
|---|
| | 49 | =head1 NAME |
|---|
| | 50 | |
|---|
| | 51 | Plagger::Plugin::Widget::HatenaBookmarkUsersCount - Widget to Hatena Bookmark with users count |
|---|
| | 52 | |
|---|
| | 53 | =head1 SYNOPSIS |
|---|
| | 54 | |
|---|
| | 55 | - module: Widget::HatenaBookmarkUsersCount |
|---|
| | 56 | |
|---|
| | 57 | =head1 DESCRIPTION |
|---|
| | 58 | |
|---|
| | 59 | This plugin allows you to put a widget containing Hatena Bookmarks |
|---|
| | 60 | users count and linking to the individual entry page. |
|---|
| | 61 | |
|---|
| | 62 | If I<Filter::HatenaBookmarkUsersCount> plugin is loaded, it uses the |
|---|
| | 63 | metadata found via XML-RPC, otherwise it uses Hatena Bookmarks' image |
|---|
| | 64 | based API. |
|---|
| | 65 | |
|---|
| | 66 | =head1 CONFIG |
|---|
| | 67 | |
|---|
| | 68 | =over 4 |
|---|
| | 69 | |
|---|
| | 70 | =item image_size |
|---|
| | 71 | |
|---|
| | 72 | If you use the default Hatena Bookmarks image API, you can change the |
|---|
| | 73 | size of the image by this config. Optional and defaults to I<normal>. |
|---|
| | 74 | |
|---|
| | 75 | =back |
|---|
| | 76 | |
|---|
| | 77 | =head1 AUTHOR |
|---|
| | 78 | |
|---|
| | 79 | Kazuhiro Osawa |
|---|
| | 80 | |
|---|
| | 81 | Tatsuhiko Miyagawa |
|---|
| | 82 | |
|---|
| | 83 | =head1 SEE ALSO |
|---|
| | 84 | |
|---|
| | 85 | L<Plagger>, L<Plagger::Plugin::Filter::HatenaBookmarkUsersCount>, L<http://hatena.g.hatena.ne.jp/hatenabookmark/20060712/1152696382> |
|---|