tdiary-contrib 3.2.2.20130518
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +35 -0
- data/README.en.md +12 -0
- data/README.md +13 -0
- data/Rakefile +41 -0
- data/doc/en/filter/spambayes.txt +3 -0
- data/doc/en/plugin.txt +1 -0
- data/doc/en/style/hatena.txt +10 -0
- data/doc/en/style/markdown.txt +16 -0
- data/doc/en/util.txt +1 -0
- data/doc/ja/filter/antirefspam.history.txt +59 -0
- data/doc/ja/filter/antirefspam.txt +86 -0
- data/doc/ja/filter/comment_key.ja.html +182 -0
- data/doc/ja/filter/spambayes.txt +3 -0
- data/doc/ja/plugin/add_bookmark.txt +50 -0
- data/doc/ja/plugin/category_to_tag.txt +21 -0
- data/doc/ja/plugin/cocoment.txt +31 -0
- data/doc/ja/plugin/google_adsense.txt +25 -0
- data/doc/ja/plugin/google_analytics.txt +7 -0
- data/doc/ja/plugin/image_detail.txt +69 -0
- data/doc/ja/plugin/image_gps.txt +36 -0
- data/doc/ja/plugin/image_gps2.txt +41 -0
- data/doc/ja/plugin/livedoor_weather.txt +105 -0
- data/doc/ja/plugin/opensearch_ad.txt +16 -0
- data/doc/ja/plugin/section_footer.txt +84 -0
- data/doc/ja/plugin/select_theme.txt +1 -0
- data/doc/ja/plugin.txt +13 -0
- data/doc/ja/style/hatena.txt +10 -0
- data/doc/ja/style/markdown.txt +13 -0
- data/doc/ja/util.txt +12 -0
- data/filter/antirefspam.rb +263 -0
- data/filter/commentkey.rb +29 -0
- data/filter/commentsize.rb +18 -0
- data/filter/hidecomment.rb +13 -0
- data/filter/iplookup.rb +55 -0
- data/filter/plugin/antirefspam.rb +59 -0
- data/filter/plugin/commentkey.rb +58 -0
- data/filter/plugin/commentsize.rb +12 -0
- data/filter/plugin/en/iplookup.rb +9 -0
- data/filter/plugin/en/spambayes.rb +123 -0
- data/filter/plugin/iplookup.rb +39 -0
- data/filter/plugin/ja/antirefspam.rb +91 -0
- data/filter/plugin/ja/commentkey.rb +17 -0
- data/filter/plugin/ja/commentsize.rb +6 -0
- data/filter/plugin/ja/iplookup.rb +9 -0
- data/filter/plugin/ja/spambayes.rb +124 -0
- data/filter/plugin/spambayes.rb +501 -0
- data/filter/plugin/zh/iplookup.rb +9 -0
- data/filter/rblcheck.rb +36 -0
- data/filter/spambayes.rb +535 -0
- data/filter/spamlookup.rb +37 -0
- data/io/dbi_io/ChangeLog +19 -0
- data/io/dbi_io/README.ja +39 -0
- data/io/dbi_io/dbi_io.rb +181 -0
- data/io/dbi_io/plugin/refererDbiIO.rb +76 -0
- data/io/dbi_io/tdiary_table.sql +42 -0
- data/js/appstore.js +109 -0
- data/js/datepicker.js +69 -0
- data/js/editor.js +82 -0
- data/js/flickr.js +157 -0
- data/js/image_ex.js +79 -0
- data/js/jquery.socialbutton.js +842 -0
- data/js/nicovideo.js +17 -0
- data/js/picasa.js +322 -0
- data/js/plugin_checker.js +71 -0
- data/js/prettify/lang-apollo.js +2 -0
- data/js/prettify/lang-clj.js +18 -0
- data/js/prettify/lang-css.js +2 -0
- data/js/prettify/lang-go.js +1 -0
- data/js/prettify/lang-hs.js +2 -0
- data/js/prettify/lang-lisp.js +3 -0
- data/js/prettify/lang-lua.js +2 -0
- data/js/prettify/lang-ml.js +2 -0
- data/js/prettify/lang-n.js +4 -0
- data/js/prettify/lang-proto.js +1 -0
- data/js/prettify/lang-scala.js +2 -0
- data/js/prettify/lang-sql.js +2 -0
- data/js/prettify/lang-tex.js +1 -0
- data/js/prettify/lang-vb.js +2 -0
- data/js/prettify/lang-vhdl.js +3 -0
- data/js/prettify/lang-wiki.js +2 -0
- data/js/prettify/lang-xq.js +3 -0
- data/js/prettify/lang-yaml.js +2 -0
- data/js/prettify/prettify.css +1 -0
- data/js/prettify/prettify.js +28 -0
- data/js/referer.js +17 -0
- data/js/show_and_hide.js +39 -0
- data/js/socialbutton.js +126 -0
- data/js/twitter_anywhere.js +28 -0
- data/js/yahoo_kousei.js +21 -0
- data/lib/bayes/convert.rb +34 -0
- data/lib/bayes.rb +232 -0
- data/lib/exifparser/BUGS +1 -0
- data/lib/exifparser/ChangeLog +169 -0
- data/lib/exifparser/README +15 -0
- data/lib/exifparser/install.rb +1015 -0
- data/lib/exifparser/lib/exifparser/makernote/canon.rb +502 -0
- data/lib/exifparser/lib/exifparser/makernote/fujifilm.rb +415 -0
- data/lib/exifparser/lib/exifparser/makernote/minolta.rb +84 -0
- data/lib/exifparser/lib/exifparser/makernote/mk_nikonflensname.rb +39 -0
- data/lib/exifparser/lib/exifparser/makernote/nikon.rb +267 -0
- data/lib/exifparser/lib/exifparser/makernote/nikon2.rb +581 -0
- data/lib/exifparser/lib/exifparser/makernote/nikonflensname.rb +438 -0
- data/lib/exifparser/lib/exifparser/makernote/olympus.rb +225 -0
- data/lib/exifparser/lib/exifparser/makernote/prove.rb +84 -0
- data/lib/exifparser/lib/exifparser/makernote/sigma.rb +237 -0
- data/lib/exifparser/lib/exifparser/pre-setup.rb +1 -0
- data/lib/exifparser/lib/exifparser/scan.rb +278 -0
- data/lib/exifparser/lib/exifparser/tag.rb +2298 -0
- data/lib/exifparser/lib/exifparser/thumbnail.rb +76 -0
- data/lib/exifparser/lib/exifparser/utils.rb +88 -0
- data/lib/exifparser/lib/exifparser.rb +265 -0
- data/lib/exifparser/sample/exifview.rb +279 -0
- data/lib/tdiary-contrib.rb +19 -0
- data/lib/wgs2tky.rb +93 -0
- data/misc/section_footer2/buzzurl.yaml +6 -0
- data/misc/section_footer2/fc2.yaml +6 -0
- data/misc/section_footer2/ldc.yaml +6 -0
- data/misc/section_footer2/retweet.yaml +7 -0
- data/misc/section_footer2/twitter.yaml +7 -0
- data/misc/section_footer2/yahoo.yaml +6 -0
- data/misc/tdiarygraph/tdiarygraph120x90e.swf +0 -0
- data/misc/tdiarygraph/tdiarygraph125x125e.swf +0 -0
- data/misc/tdiarygraph/tdiarygraph240x180e.swf +0 -0
- data/misc/tdiarygraph/tdiarygraph468x60e.swf +0 -0
- data/misc/tdiarygraph/tdiarygraph728x90e.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes125x125r.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes125x125r7.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes125x125s.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes125x30.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes234x30.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes468x30.swf +0 -0
- data/plugin/add_bookmark.rb +89 -0
- data/plugin/apple_webclip.rb +26 -0
- data/plugin/appstore.rb +47 -0
- data/plugin/bigpresen.rb +86 -0
- data/plugin/bitly.rb +39 -0
- data/plugin/bootstrap-navi.rb +54 -0
- data/plugin/canonical.rb +9 -0
- data/plugin/category_similar.rb +73 -0
- data/plugin/category_to_tag.rb +60 -0
- data/plugin/category_to_tagcloud.rb +172 -0
- data/plugin/cocomment.rb +37 -0
- data/plugin/code-prettify.rb +23 -0
- data/plugin/coderwall.rb +34 -0
- data/plugin/datepicker.rb +28 -0
- data/plugin/day2section.rb +20 -0
- data/plugin/del_footer.rb +111 -0
- data/plugin/description_from_body.rb +23 -0
- data/plugin/development.rb +16 -0
- data/plugin/editor.rb +11 -0
- data/plugin/en/add_bookmark.rb +20 -0
- data/plugin/en/del_footer.rb +10 -0
- data/plugin/en/git-register.rb +3 -0
- data/plugin/en/livedoor_weather.rb +25 -0
- data/plugin/en/microsummary.rb +18 -0
- data/plugin/en/nicovideo.rb +38 -0
- data/plugin/en/openid.rb +8 -0
- data/plugin/en/section_footer.rb +6 -0
- data/plugin/en/section_footer2.rb +3 -0
- data/plugin/en/socialbutton.rb +5 -0
- data/plugin/everytrail.rb +39 -0
- data/plugin/facebook_comments.rb +59 -0
- data/plugin/flickr.rb +209 -0
- data/plugin/gist.rb +16 -0
- data/plugin/git-register.rb +240 -0
- data/plugin/github_badge.rb +27 -0
- data/plugin/github_link.rb +9 -0
- data/plugin/goo_gl.rb +42 -0
- data/plugin/google_adsense.rb +132 -0
- data/plugin/google_analytics.rb +39 -0
- data/plugin/google_map.rb +168 -0
- data/plugin/google_sitemaps.rb +60 -0
- data/plugin/google_webmaster.rb +22 -0
- data/plugin/hatena_bookmark_nocomment.rb +9 -0
- data/plugin/hatena_star.rb +66 -0
- data/plugin/hb_footer.rb +255 -0
- data/plugin/hb_footer4sec.rb +244 -0
- data/plugin/hb_footer4sec_js.rb +30 -0
- data/plugin/hide_comment_form.rb +4 -0
- data/plugin/hide_sidebar_iphone.rb +21 -0
- data/plugin/iddy.rb +81 -0
- data/plugin/image_detail.rb +143 -0
- data/plugin/image_ex.rb +462 -0
- data/plugin/image_gps.rb +128 -0
- data/plugin/inline_wiki.rb +6 -0
- data/plugin/instagr.rb +64 -0
- data/plugin/ja/add_bookmark.rb +20 -0
- data/plugin/ja/del_footer.rb +10 -0
- data/plugin/ja/flickr.rb +62 -0
- data/plugin/ja/git-register.rb +3 -0
- data/plugin/ja/google_sitemaps.rb +35 -0
- data/plugin/ja/livedoor_weather.rb +25 -0
- data/plugin/ja/microsummary.rb +18 -0
- data/plugin/ja/nicovideo.rb +41 -0
- data/plugin/ja/openid.rb +7 -0
- data/plugin/ja/section_footer.rb +6 -0
- data/plugin/ja/section_footer2.rb +4 -0
- data/plugin/ja/socialbutton.rb +6 -0
- data/plugin/jdate.rb +20 -0
- data/plugin/jholiday.rb +16 -0
- data/plugin/jmonth.rb +20 -0
- data/plugin/jquery_ui_theme.rb +55 -0
- data/plugin/jroku.rb +28 -0
- data/plugin/jyear.rb +37 -0
- data/plugin/latlonglab_route.rb +25 -0
- data/plugin/lazy_referer.rb +38 -0
- data/plugin/livedoor_weather.rb +180 -0
- data/plugin/make_link.rb +44 -0
- data/plugin/makerss_category.rb +43 -0
- data/plugin/makerss_comment.rb +35 -0
- data/plugin/microsummary.rb +62 -0
- data/plugin/mm_footer.rb +215 -0
- data/plugin/monthly_autopagerize.rb +67 -0
- data/plugin/my_hotentry.rb +132 -0
- data/plugin/navi_day.rb +118 -0
- data/plugin/navi_this_month.rb +15 -0
- data/plugin/nicovideo.rb +115 -0
- data/plugin/notify_miniblog.rb +134 -0
- data/plugin/ogp.rb +55 -0
- data/plugin/ohmsha_estore.rb +71 -0
- data/plugin/openid.rb +90 -0
- data/plugin/opensearch_ad.rb +33 -0
- data/plugin/picasa.rb +56 -0
- data/plugin/plugin_checker.rb +41 -0
- data/plugin/popit.rb +22 -0
- data/plugin/prettify.rb +19 -0
- data/plugin/prezi.rb +10 -0
- data/plugin/profile.rb +222 -0
- data/plugin/puboo.rb +93 -0
- data/plugin/pygments_css.rb +76 -0
- data/plugin/rating.rb +419 -0
- data/plugin/recent_estraier.rb +50 -0
- data/plugin/recent_tweet.rb +71 -0
- data/plugin/retweet.rb +86 -0
- data/plugin/rubykaigi.rb +99 -0
- data/plugin/search-bing.rb +87 -0
- data/plugin/search-default.rb +264 -0
- data/plugin/search-google-custom.rb +60 -0
- data/plugin/search-yahoo-websearch.rb +121 -0
- data/plugin/search-yahoo.rb +109 -0
- data/plugin/section_footer.rb +195 -0
- data/plugin/section_footer2.rb +278 -0
- data/plugin/section_permalink.rb +73 -0
- data/plugin/section_permalink_anchor.rb +39 -0
- data/plugin/select_style.rb +42 -0
- data/plugin/select_theme.rb +90 -0
- data/plugin/show_and_hide.rb +77 -0
- data/plugin/slideshare.rb +10 -0
- data/plugin/socialbutton.rb +60 -0
- data/plugin/tatsu_zine.rb +93 -0
- data/plugin/tdiarygraph_flashstyle.rb +296 -0
- data/plugin/tdiarytimes.rb +166 -0
- data/plugin/tdiarytimes2.rb +406 -0
- data/plugin/tdiarytimes_flashstyle.rb +263 -0
- data/plugin/tdiarytimes_textstyle.rb +290 -0
- data/plugin/title_anchor.rb +16 -0
- data/plugin/tweet_quote.rb +106 -0
- data/plugin/twitpic.rb +10 -0
- data/plugin/twitter.rb +46 -0
- data/plugin/twitter_anywhere.rb +209 -0
- data/plugin/twitter_badge.rb +42 -0
- data/plugin/twitter_js.rb +59 -0
- data/plugin/ustream.rb +19 -0
- data/plugin/vimeo.rb +14 -0
- data/plugin/volatile.rb +89 -0
- data/plugin/vote.rb +100 -0
- data/plugin/wikiloc.rb +27 -0
- data/plugin/windex.rb +512 -0
- data/plugin/yahoo_kousei.rb +79 -0
- data/plugin/yahoo_map.rb +97 -0
- data/plugin/youtube.rb +33 -0
- data/plugin/yshop.rb +189 -0
- data/plugin/zenback.rb +46 -0
- data/spec/apple_webclip_spec.rb +46 -0
- data/spec/fixtures/friendfeed.xml +2 -0
- data/spec/fixtures/github.json +1 -0
- data/spec/fixtures/twitter.xml +73 -0
- data/spec/gist_spec.rb +16 -0
- data/spec/github_link_spec.rb +39 -0
- data/spec/google_analytics_spec.rb +60 -0
- data/spec/jdate_spec.rb +23 -0
- data/spec/jmonth_spec.rb +28 -0
- data/spec/jyear_spec.rb +21 -0
- data/spec/my_hotentry_spec.rb +78 -0
- data/spec/openid_spec.rb +246 -0
- data/spec/opensearch_ad_spec.rb +50 -0
- data/spec/profile_spec.rb +88 -0
- data/spec/rcov.opts +2 -0
- data/spec/spec_helper.rb +223 -0
- data/spec/title_anchor_spec.rb +39 -0
- data/spec/twitter_js_spec.rb +116 -0
- data/spec/youtube_spec.rb +20 -0
- data/style/hatena_style.rb +1011 -0
- data/style/markdown_style.rb +239 -0
- data/style/wikiext_style.rb +21 -0
- data/tdiary-contrib.gemspec +25 -0
- data/util/clean-spam/README.ja +1 -0
- data/util/clean-spam/tdiary-comment-clean +46 -0
- data/util/clean-spam/tdiary-comment-clean2 +81 -0
- data/util/clean-spam/tdiary-referer-clean +46 -0
- data/util/convert_pstore.rb +82 -0
- data/util/estraier-search/ChangeLog +36 -0
- data/util/estraier-search/README.ja +114 -0
- data/util/estraier-search/en/estraier-register.rb +3 -0
- data/util/estraier-search/estraier-register.rb +298 -0
- data/util/estraier-search/estraier-search.rb +273 -0
- data/util/estraier-search/estraier.rhtml +73 -0
- data/util/estraier-search/estraier.rxml +23 -0
- data/util/estraier-search/i.estraier.rhtml +31 -0
- data/util/estraier-search/ja/estraier-register.rb +3 -0
- data/util/image-gallery/README.ja +27 -0
- data/util/image-gallery/image-gallery.rb +523 -0
- data/util/image-gallery/image-gallery.rb.euc-jp +523 -0
- data/util/image-gallery/js/SmoothGallery/Changelog +52 -0
- data/util/image-gallery/js/SmoothGallery/css/ReMooz.css +186 -0
- data/util/image-gallery/js/SmoothGallery/css/img/carrow1.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/carrow2.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/closebox.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/closebox.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/fleche1.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/fleche1.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/fleche2.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/fleche2.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/loading-bar-black.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/open.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/open.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_e.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_n.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_ne.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_nw.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_s.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_se.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_sw.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_w.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/spinner.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/jd.gallery.css +371 -0
- data/util/image-gallery/js/SmoothGallery/css/layout.css +91 -0
- data/util/image-gallery/js/SmoothGallery/license.txt +621 -0
- data/util/image-gallery/js/SmoothGallery/resizer.php +113 -0
- data/util/image-gallery/js/SmoothGallery/scripts/Changelog +52 -0
- data/util/image-gallery/js/SmoothGallery/scripts/History.Routing.js +126 -0
- data/util/image-gallery/js/SmoothGallery/scripts/History.js +109 -0
- data/util/image-gallery/js/SmoothGallery/scripts/ReMooz.js +364 -0
- data/util/image-gallery/js/SmoothGallery/scripts/jd.gallery.js +843 -0
- data/util/image-gallery/js/SmoothGallery/scripts/jd.gallery.set.js +183 -0
- data/util/image-gallery/js/SmoothGallery/scripts/jd.gallery.transitions.js +90 -0
- data/util/image-gallery/js/SmoothGallery/scripts/jdgalleryresize.js +828 -0
- data/util/image-gallery/js/SmoothGallery/scripts/license.txt +621 -0
- data/util/image-gallery/js/SmoothGallery/scripts/mootools-1.2-more.js +103 -0
- data/util/image-gallery/js/SmoothGallery/scripts/mootools-1.2.1-core-yc.js +349 -0
- data/util/image-gallery/js/SmoothGallery/scripts/resizer.php +113 -0
- data/util/image-gallery/misc/plugin/recent_image.rb +406 -0
- data/util/image-gallery/skel/gallery.rhtml +154 -0
- data/util/image-gallery/skel/gallery.rhtml.euc-jp +154 -0
- data/util/image-gallery/tdiary.conf.igsample +8 -0
- data/util/image-gallery/theme/image-gallery.css +85 -0
- data/util/image2flickr.rb +282 -0
- data/util/posttdiary/README.ja +12 -0
- data/util/posttdiary/posttdiary-ex.rb +1155 -0
- data/util/posttdiary/posttdiary.rb +245 -0
- data/util/rast-search/ChangeLog +55 -0
- data/util/rast-search/README.ja +99 -0
- data/util/rast-search/en/rast-register.rb +3 -0
- data/util/rast-search/i.rast.rhtml +33 -0
- data/util/rast-search/ja/rast-register.rb +3 -0
- data/util/rast-search/rast-register.rb +326 -0
- data/util/rast-search/rast-search.rb +249 -0
- data/util/rast-search/rast.rhtml +66 -0
- data/util/rast-search/rast.rxml +21 -0
- data/util/section_link/README +11 -0
- data/util/section_link/misc/plugin/section_link.rb +68 -0
- data/util/section_link/misc/plugin/section_link_anchor.rb +38 -0
- data/util/section_link/tdiary/tdiary_day_ext.rb +21 -0
- data/util/section_link/tdiary/tdiaryext_style.rb +36 -0
- data/util/section_link/tdiary/wikiext_style.rb +36 -0
- data/util/tdiary-for-ruby1.9/compatible.rb +97 -0
- data/util/tdiary-for-ruby1.9/tdiary-2.2.0.patch +98 -0
- data/util/tdiary-for-ruby1.9/tdiary-2.3.1.patch +212 -0
- data/util/tdiary-grep/README +4 -0
- data/util/tdiary-grep/grep.rb +445 -0
- data/util/tdiary-mode/http.el +130 -0
- data/util/tdiary-mode/tdiary-mode.el +613 -0
- data/util/tdiary-vim/ChangeLog +25 -0
- data/util/tdiary-vim/README +60 -0
- data/util/tdiary-vim/tdiary.vim +350 -0
- data/util/tdiarysearch/README.en +53 -0
- data/util/tdiarysearch/README.ja +99 -0
- data/util/tdiarysearch/search.rb +504 -0
- metadata +497 -0
data/plugin/rating.rb
ADDED
@@ -0,0 +1,419 @@
|
|
1
|
+
# $Revision:0.1$
|
2
|
+
# rating.rb: ʣ�����ˤ�뵭��ɾ���ȥ����ɽ��
|
3
|
+
# for tDiary
|
4
|
+
#
|
5
|
+
# �Ȥ���
|
6
|
+
# ���Τޤ� plugin �ǥ��쥯�ȥ���֤��ޤ���
|
7
|
+
# '����' -> 'rating.rb Configuration' �ǡ�ɾ������
|
8
|
+
# ɽ�����Ƥ����ꡣ
|
9
|
+
# ���路����
|
10
|
+
# http://www.maripo.jp/diary/?date=20071019
|
11
|
+
#
|
12
|
+
# Copyright (c) 2007 Mariko/Maripo GODA <god@maripo.jp>
|
13
|
+
# http://www.maripo.jp/
|
14
|
+
# You can redistribute it and/or modify it under GPL.
|
15
|
+
|
16
|
+
|
17
|
+
require 'pstore'
|
18
|
+
require 'cgi'
|
19
|
+
@dbase = "#{@cache_path}/rating.db"
|
20
|
+
|
21
|
+
#########################################
|
22
|
+
# Config (Form)
|
23
|
+
#########################################
|
24
|
+
|
25
|
+
add_conf_proc('rating', 'rating.rb Configuration') do
|
26
|
+
rating_config = RatingConfig.new(@dbase)
|
27
|
+
form_string = ""
|
28
|
+
|
29
|
+
if @mode == 'saveconf'
|
30
|
+
|
31
|
+
# save conf
|
32
|
+
index = 0
|
33
|
+
|
34
|
+
# edit axes
|
35
|
+
rating_config.each { |axis_config|
|
36
|
+
#check values
|
37
|
+
if (@cgi.params["label" + index.to_s][0] != "" && (@cgi.params["range" + index.to_s][0]).to_i > 0)
|
38
|
+
axis_config.edit(@cgi.params["label" + index.to_s][0], @cgi.params["label_max" + index.to_s][0],@cgi.params["label_min" + index.to_s][0],@cgi.params["range" + index.to_s][0].to_i,@cgi.params["order" + index.to_s][0].to_i,@cgi.params["display" + index.to_s][0]!=nil)
|
39
|
+
index += 1
|
40
|
+
end
|
41
|
+
}
|
42
|
+
if (@cgi.params["label_new"][0] != "" && @cgi.params["range_new"][0].to_i > 0)
|
43
|
+
# add new axis
|
44
|
+
rating_config.add_axis(@cgi.params["label_new"][0], @cgi.params["label_max_new"][0], @cgi.params["label_min_new"][0], @cgi.params["range_new"][0].to_i)
|
45
|
+
end
|
46
|
+
rating_config.save_to_db
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
# print conf form
|
51
|
+
|
52
|
+
form_string += <<HTML
|
53
|
+
<p>
|
54
|
+
�ե����ɥХå��ե����������ޤ������Ϥ����ĤǤ�������뤳�Ȥ��Ǥ��ޤ���
|
55
|
+
</p>
|
56
|
+
<p>
|
57
|
+
<a href="http://www.maripo.jp/">���</a>�� <a href="http://www.maripo.jp/diary/?date=20071019">blog</a> ���ɲþ��Ƥ��뤫�⤷��ޤ���
|
58
|
+
</p>
|
59
|
+
<h3>������ˡ</h3>
|
60
|
+
<ul>
|
61
|
+
<li>�� �� ɽ���������֤Ǥ����������ۤ��������¤Ӥޤ����ֹ椬����Ǥ�OK��</li>
|
62
|
+
<li>ɽ�� �� ����ʤ����ϥ����å����Ƥ��ޤäƤ���������
|
63
|
+
<li>����̾�� �� (��) "���ε����ϻ��ͤˤʤ�ޤ�����"</li>
|
64
|
+
<li>�����٥� �� �� "�ޤä������ͤˤʤ�ʤ�"</li>
|
65
|
+
<li>�ǹ��٥� �� �� "�ȤƤ⻲�ͤˤʤä�"</li>
|
66
|
+
<li>������ �� �� : 1��5��5�ʳ��ʤ� "5"</li>
|
67
|
+
</p>
|
68
|
+
<h3>��������</h3>
|
69
|
+
<form>
|
70
|
+
<table>
|
71
|
+
HTML
|
72
|
+
index = 0;
|
73
|
+
|
74
|
+
rating_config.each { |axis_config|
|
75
|
+
form_string += <<HTML
|
76
|
+
<tr>
|
77
|
+
<td>��:<input type="text" size="2" name="order#{index}" value="#{axis_config.order}"></td>
|
78
|
+
<td>
|
79
|
+
����̾��:<input type="text" size="16" name="label#{index}" value="#{axis_config.label}">��
|
80
|
+
�����٥�:<input type="text" size="10" name="label_min#{index}" value="#{axis_config.label_min}">��
|
81
|
+
�ǹ��٥�:<input type="text" size="10" name="label_max#{index}" value="#{axis_config.label_max}">��
|
82
|
+
������:<input type="text" size="4" name="range#{index}" value="#{axis_config.range.to_s}">��
|
83
|
+
ɽ��:<input type="checkbox" name="display#{index}" value="#{axis_config.label_max}" #{axis_config.check_label}>
|
84
|
+
</td>
|
85
|
+
</tr>
|
86
|
+
HTML
|
87
|
+
index += 1
|
88
|
+
}
|
89
|
+
form_string += <<HTML
|
90
|
+
<tr>
|
91
|
+
<td>�ɲ�</td>
|
92
|
+
<td>
|
93
|
+
����̾��:<input type="text" size="16" name="label_new">
|
94
|
+
�����٥�:<input type="text" size="10" name="label_min_new">
|
95
|
+
�ǹ��٥�:<input type="text" size="10" name="label_max_new">
|
96
|
+
������:<input type="text" size="4" name="range_new">
|
97
|
+
</td>
|
98
|
+
</tr>
|
99
|
+
</table>
|
100
|
+
HTML
|
101
|
+
form_string += '</form>'
|
102
|
+
form_string #evaluate
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
#########################################
|
107
|
+
# Entry of the day
|
108
|
+
#########################################
|
109
|
+
|
110
|
+
add_body_leave_proc do |date|
|
111
|
+
graph_string = ""
|
112
|
+
form_string = ""
|
113
|
+
contentString = ""
|
114
|
+
|
115
|
+
#initialize DateEval object
|
116
|
+
todays_eval = DateEval.new(date.strftime('%Y%m%d'), @dbase)
|
117
|
+
|
118
|
+
#initialize RatingConfig object
|
119
|
+
@rating_config = RatingConfig.new(@dbase)
|
120
|
+
|
121
|
+
graph_string += <<HTML
|
122
|
+
<!-- Generated by plugin "rating.rb" -->
|
123
|
+
<div class="ratingGraphContainer" style="overflow:hidden;height:18px;">
|
124
|
+
<div
|
125
|
+
onclick="with(this.parentNode.style){if(overflow=='hidden'){overflow='visible';}else{overflow='hidden';}}"
|
126
|
+
style="cursor:hand;"
|
127
|
+
class="ratingGraphOpener">
|
128
|
+
[ʬ�ۤ�ߤ�]
|
129
|
+
</div>
|
130
|
+
<div class="ratingGraphContent">
|
131
|
+
HTML
|
132
|
+
form_string += '<!-- Generated by plugin "rating.rb" -->' + "\n"
|
133
|
+
form_string += ('<form action="./"><input type="hidden" name="comment" value="submit"><input type="hidden" name="body" value="rating"><input type="hidden" name="body" value="rating"><input type="hidden" name="name" value=""><input type="hidden" value="' + date.strftime('%Y%m%d') + '"><div class="ratingForm">')
|
134
|
+
@rating_config.each{|axis_config|
|
135
|
+
|
136
|
+
if !axis_config.display
|
137
|
+
next
|
138
|
+
end
|
139
|
+
|
140
|
+
# add axis info
|
141
|
+
form_string += ('<div class="ratingQuestion"><span class="ratingLabel">' + axis_config.label + '</span>')
|
142
|
+
|
143
|
+
# add radio buttons
|
144
|
+
form_string += ('<span class="ratingRadioButtons"><span class="ratingLabelMin">' + axis_config.label_min + '</span>')
|
145
|
+
|
146
|
+
# append graph string
|
147
|
+
current_rank = 0
|
148
|
+
|
149
|
+
graph_string += '<div class="ratingGraphBox">' #begin "graphBox"
|
150
|
+
graph_string += '<span class="ratingGraphAverage">average : ' + sprintf("%10.2f", todays_eval.get_average(axis_config.id)) +'</span><br>'
|
151
|
+
while current_rank < axis_config.range
|
152
|
+
graph_string += ('<div style="clear:both"><div
|
153
|
+
class="ratingGraphRank">' + (current_rank + 1).to_s + '</div><div
|
154
|
+
class="ratingGraphBar" style="width:' +
|
155
|
+
todays_eval.get_graph_length(axis_config.id, current_rank).to_s +
|
156
|
+
'px"></div><span class="ratingGraphValue"> (' + todays_eval.get_value(axis_config.id, current_rank).to_s + 'ɼ)</span></div>')
|
157
|
+
current_rank += 1
|
158
|
+
end
|
159
|
+
graph_string += '</div>' #end "graphBox"
|
160
|
+
|
161
|
+
for current_rank in 0..axis_config.range - 1
|
162
|
+
form_string += " " + '<input type="radio" name="axis' + axis_config.id.to_s + '" value="' + current_rank.to_s + '">' + (current_rank + 1).to_s
|
163
|
+
end
|
164
|
+
form_string += ('<span class="ratingLabelMax">' + axis_config.label_max + '</span></span>')
|
165
|
+
form_string += '</div>'
|
166
|
+
}
|
167
|
+
graph_string += <<HTML
|
168
|
+
</div>
|
169
|
+
</div>
|
170
|
+
<div style="clear:both;height:0px;"></div>
|
171
|
+
HTML
|
172
|
+
form_string += '<input type="hidden" name="date" value="' + date.strftime('%Y%m%d') + '">'
|
173
|
+
form_string += '<input type="submit" value="ɾ������"></div></form>'+"\n"
|
174
|
+
(form_string + graph_string)
|
175
|
+
|
176
|
+
end
|
177
|
+
|
178
|
+
#########################################
|
179
|
+
# class RatingConfig
|
180
|
+
#########################################
|
181
|
+
|
182
|
+
class RatingConfig
|
183
|
+
@axes
|
184
|
+
@max_axis_id= 0
|
185
|
+
@dbase
|
186
|
+
|
187
|
+
def initialize (dbase)
|
188
|
+
@dbase = dbase
|
189
|
+
db = PStore.new(@dbase)
|
190
|
+
db.transaction do
|
191
|
+
#begin transaction
|
192
|
+
if db.root?("config")
|
193
|
+
@axes = Hash.new
|
194
|
+
obj = db["config"]
|
195
|
+
@max_axis_id = obj[0]
|
196
|
+
obj.each{|ary|
|
197
|
+
id = ary[4]
|
198
|
+
@axes[id] = AxisConfig.new(ary[0],ary[1],ary[2],ary[3],ary[4],ary[5],ary[6])
|
199
|
+
}
|
200
|
+
else
|
201
|
+
@axes = Hash.new
|
202
|
+
@max_axis_id = 0
|
203
|
+
end
|
204
|
+
end
|
205
|
+
#end transaction
|
206
|
+
end #end initialize
|
207
|
+
|
208
|
+
def save_to_db
|
209
|
+
save_array = Array.new
|
210
|
+
db = PStore.new(@dbase)
|
211
|
+
save_array.push(@max_axis_id)
|
212
|
+
each {|axis_config|
|
213
|
+
save_array.push(axis_config.to_array)
|
214
|
+
}
|
215
|
+
db.transaction do
|
216
|
+
#begin transaction
|
217
|
+
db["config"] = save_array
|
218
|
+
end
|
219
|
+
#end transaction
|
220
|
+
end #end save_to_db
|
221
|
+
|
222
|
+
def add_axis (label, label_max, label_min, range)
|
223
|
+
@max_axis_id += 1
|
224
|
+
new_axis = AxisConfig.new(label, label_max, label_min, range, @max_axis_id, 0, true)
|
225
|
+
@axes[@max_axis_id] = new_axis
|
226
|
+
end #end add_axis
|
227
|
+
|
228
|
+
def edit_axis (axis_id, label, label_max, label_min, range, order,display)
|
229
|
+
target_axis = @axes[axis_id]
|
230
|
+
target_axis.edit(label, label_max, label_min, range, order,display)
|
231
|
+
end
|
232
|
+
|
233
|
+
def length
|
234
|
+
return @axes.size
|
235
|
+
end #end length
|
236
|
+
|
237
|
+
def each
|
238
|
+
@axes.to_a.sort {|a, b| a[1].order <=> b[1].order}.each {|key ,axis_conf|
|
239
|
+
yield axis_conf
|
240
|
+
}
|
241
|
+
end #end each
|
242
|
+
end
|
243
|
+
|
244
|
+
#########################################
|
245
|
+
# class AxisConfig
|
246
|
+
#########################################
|
247
|
+
|
248
|
+
class AxisConfig
|
249
|
+
@label
|
250
|
+
@label_max
|
251
|
+
@label_min
|
252
|
+
@range
|
253
|
+
@id
|
254
|
+
@order
|
255
|
+
@display = true
|
256
|
+
|
257
|
+
#accessors
|
258
|
+
attr_reader :label, :label_max, :label_min, :range, :id, :order, :display
|
259
|
+
|
260
|
+
def initialize (label, label_max, label_min, range, id,order,display)
|
261
|
+
@label = label
|
262
|
+
@label_max = label_max
|
263
|
+
@label_min = label_min
|
264
|
+
@range = range
|
265
|
+
@id = id
|
266
|
+
@order = order
|
267
|
+
@display = display
|
268
|
+
end #end initialize
|
269
|
+
|
270
|
+
def edit (label, label_max, label_min, range, order, display)
|
271
|
+
@label = label
|
272
|
+
@label_max = label_max
|
273
|
+
@label_min = label_min
|
274
|
+
@range = range
|
275
|
+
@order = order
|
276
|
+
@display = display
|
277
|
+
end #end initialize
|
278
|
+
|
279
|
+
def to_array
|
280
|
+
return [@label, @label_max, @label_min, @range, @id, @order,@display]
|
281
|
+
end
|
282
|
+
|
283
|
+
def disable
|
284
|
+
@hidden = true
|
285
|
+
end #end disable
|
286
|
+
|
287
|
+
def enable
|
288
|
+
@hidden = false
|
289
|
+
end #end disable
|
290
|
+
|
291
|
+
def check_label
|
292
|
+
return @display? "checked":""
|
293
|
+
end #end check_label
|
294
|
+
|
295
|
+
end
|
296
|
+
|
297
|
+
#########################################
|
298
|
+
# class DateEval
|
299
|
+
#########################################
|
300
|
+
|
301
|
+
class DateEval
|
302
|
+
@axes #axes[id][rank]
|
303
|
+
@date_string = ""
|
304
|
+
@dbase
|
305
|
+
@average #average[id]
|
306
|
+
@total #total[id]
|
307
|
+
GRAPH_PIXEL_LENGTH = 300
|
308
|
+
|
309
|
+
attr_reader :axes, :average, :total
|
310
|
+
|
311
|
+
# constructor
|
312
|
+
def initialize (date_string, dbase)
|
313
|
+
@dbase = dbase
|
314
|
+
@date_string = date_string
|
315
|
+
db = PStore.new(@dbase)
|
316
|
+
db.transaction do
|
317
|
+
#begin transaction
|
318
|
+
if db.root?(date_string)
|
319
|
+
#read
|
320
|
+
@axes = db[date_string]
|
321
|
+
else
|
322
|
+
#initialize
|
323
|
+
@axes = Hash.new
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
#end transaction
|
328
|
+
|
329
|
+
end #end constructor
|
330
|
+
|
331
|
+
def get_value(id, rank)
|
332
|
+
if @axes.key?(id) && @axes[id][rank] != nil
|
333
|
+
return @axes[id][rank]
|
334
|
+
else
|
335
|
+
return 0
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
def get_average(id)
|
340
|
+
sum = 0
|
341
|
+
vote = 0
|
342
|
+
unless @axes.key?(id)
|
343
|
+
return 0
|
344
|
+
end
|
345
|
+
for index in 0..@axes[id].length - 1
|
346
|
+
if @axes.key?(id) && @axes[id][index] != nil
|
347
|
+
vote += @axes[id][index]
|
348
|
+
sum += @axes[id][index] * index
|
349
|
+
end
|
350
|
+
end
|
351
|
+
if @axes[id].length == 0
|
352
|
+
return 0
|
353
|
+
else
|
354
|
+
return sum.to_f/vote + 1
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
def vote(id, rank)
|
359
|
+
unless @axes.key?(id)
|
360
|
+
@axes[id] = Array.new
|
361
|
+
end
|
362
|
+
if @axes[id][rank] != nil
|
363
|
+
@axes[id][rank] += 1
|
364
|
+
else
|
365
|
+
@axes[id][rank] = 1
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
def save_to_db
|
370
|
+
db = PStore.new(@dbase)
|
371
|
+
db.transaction do
|
372
|
+
#begin transaction
|
373
|
+
#save
|
374
|
+
db[@date_string] = @axes
|
375
|
+
end
|
376
|
+
#end transaction
|
377
|
+
end #end save_to_db
|
378
|
+
|
379
|
+
def get_graph_length (id, rank)
|
380
|
+
unless @axes.key?(id)
|
381
|
+
return 0
|
382
|
+
end
|
383
|
+
if @axes[id][rank] != nil
|
384
|
+
total = 0
|
385
|
+
@axes[id].each {|val|
|
386
|
+
unless val == nil
|
387
|
+
total += val
|
388
|
+
end
|
389
|
+
}
|
390
|
+
return (@axes[id][rank] * GRAPH_PIXEL_LENGTH / total).to_i
|
391
|
+
else
|
392
|
+
return 0
|
393
|
+
end
|
394
|
+
end #end
|
395
|
+
|
396
|
+
end # class dateEval end
|
397
|
+
|
398
|
+
#########################################
|
399
|
+
# Comment (vote)
|
400
|
+
#########################################
|
401
|
+
|
402
|
+
if (@mode == 'comment')
|
403
|
+
|
404
|
+
if @cgi.params["body"][0] != 'rating'
|
405
|
+
return
|
406
|
+
end
|
407
|
+
@dbase = "#{@cache_path}/rating.db"
|
408
|
+
#initialize RatingConfig object
|
409
|
+
rating_config = RatingConfig.new(@dbase)
|
410
|
+
#initialize DateEval object
|
411
|
+
todays_eval = DateEval.new(@cgi.params['date'][0], @dbase)
|
412
|
+
|
413
|
+
rating_config.each { |axis_config|
|
414
|
+
if @cgi.params["axis" + axis_config.id.to_s][0]!= nil
|
415
|
+
todays_eval.vote(axis_config.id, @cgi.params["axis" + axis_config.id.to_s][0].to_i)
|
416
|
+
end
|
417
|
+
}
|
418
|
+
todays_eval.save_to_db
|
419
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# recent_estraier.rb $Revision 1.1 $
|
2
|
+
#
|
3
|
+
# recent_estraier: Estraier検索語新しい順
|
4
|
+
# estsearch.cgiが作成する検索キーワードログから
|
5
|
+
# 最新xx件分の検索語を表示します。
|
6
|
+
# パラメタ:
|
7
|
+
# file: 検索キーワードログファイル名(絶対パス表記)
|
8
|
+
# estraier: estseach.cgiのパス
|
9
|
+
# limit: 表示件数(未指定時:5)
|
10
|
+
# make_link: <a>を生成するか?(未指定時:生成する)
|
11
|
+
#
|
12
|
+
#
|
13
|
+
# Copyright (c) 2005 SHIBATA Hiroshi <h-sbt@nifty.com>
|
14
|
+
# Distributed under the GPL2.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'nkf'
|
18
|
+
|
19
|
+
def recent_estraier(file, estraier, limit = 5, make_link = true)
|
20
|
+
begin
|
21
|
+
lines = []
|
22
|
+
log = open(file)
|
23
|
+
if log.stat.size > 300 * limit then
|
24
|
+
log.seek(-300 * limit,IO::SEEK_END)
|
25
|
+
end
|
26
|
+
log.each_line do |line|
|
27
|
+
lines << line
|
28
|
+
end
|
29
|
+
|
30
|
+
result = "<ol>"
|
31
|
+
lines.reverse.each_with_index do |line,idx|
|
32
|
+
break if idx >= limit
|
33
|
+
word = NKF::nkf('-We -m0', line.split(/\t/)[2])
|
34
|
+
if word.empty? then
|
35
|
+
limit += 1
|
36
|
+
else
|
37
|
+
if make_link
|
38
|
+
result << %Q|<li><a href="#{estraier}?phrase=#{u(h(word))}&enc=EUC-JP">#{h word}</a></li>|
|
39
|
+
else
|
40
|
+
result << %Q|#{h word}|
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
result << %Q[</ol>]
|
46
|
+
|
47
|
+
rescue
|
48
|
+
%Q[<p class="message">#$! (#{$!.class})<br>cannot read #{file}.</p>]
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#
|
2
|
+
# recemt_tweet.rb: Twitter status plugin for tDiary
|
3
|
+
#
|
4
|
+
# Copyright (C) 2007 by Nishimoto Masaki <gaju@gaju.jp>
|
5
|
+
# Distributed under GPL.
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'open-uri'
|
9
|
+
require 'timeout'
|
10
|
+
require 'rexml/document'
|
11
|
+
|
12
|
+
def recent_tweet( id, count )
|
13
|
+
begin
|
14
|
+
cache = "#{@cache_path}/recent_tweet.xml"
|
15
|
+
xml = open( cache ) {|f| f.read }
|
16
|
+
if Time::now > File::mtime( cache ) + 10*60 then
|
17
|
+
File::delete( cache ) # clear cache 10 minutes later
|
18
|
+
end
|
19
|
+
rescue Errno::ENOENT
|
20
|
+
begin
|
21
|
+
xml = recent_tweet_call_api( id )
|
22
|
+
open( cache, 'wb' ) {|f| f.write( xml ) }
|
23
|
+
rescue Timeout::Error, StandardError
|
24
|
+
return %Q|<div class="recent_tweet error">recent_tweet: #{$!}</div>|
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
begin
|
29
|
+
doc = REXML::Document::new( xml )
|
30
|
+
if doc then
|
31
|
+
html = '<div class="recent-tweet">'
|
32
|
+
html << '<p class="recent-tweet-title">'
|
33
|
+
html << '<a href="http://twitter.com/' << id << '">What am I doing...</a>'
|
34
|
+
html << '</p>'
|
35
|
+
html << '<ul class="recent-tweet-body">'
|
36
|
+
i = 0
|
37
|
+
doc.elements.each( 'statuses/status' ) do |status|
|
38
|
+
created_at = Time.parse( status.elements.to_a( 'created_at' )[0].text )
|
39
|
+
text = status.elements.to_a( 'text' )[0].text
|
40
|
+
if /^@/.match( text ) == nil and i < count then
|
41
|
+
html << '<li class="recent-tweet-status">'
|
42
|
+
if Time.now > created_at + 60*60*23 then
|
43
|
+
time = created_at.localtime.strftime( '%b %d %H:%M' )
|
44
|
+
else
|
45
|
+
time = created_at.localtime.strftime( '%H:%M' )
|
46
|
+
end
|
47
|
+
html << '<span class="recent-tweet-text">' << %Q|#{text}| << '</span> '
|
48
|
+
html << '<span class="recent-tweet-time">(' << %Q|#{time}| << ')</span>'
|
49
|
+
html << '</li>'
|
50
|
+
i += 1
|
51
|
+
end
|
52
|
+
end
|
53
|
+
html << '</ul></div>'
|
54
|
+
@conf.to_native( html )
|
55
|
+
else
|
56
|
+
return '<div class="recent-tweet error">recent_tweet: Failed to open file</div>'
|
57
|
+
end
|
58
|
+
rescue REXML::ParseException
|
59
|
+
return '<div class="recent-tweet error">recent_tweet: Failed to parse XML</div>'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def recent_tweet_call_api( id )
|
64
|
+
request = "http://twitter.com/statuses/user_timeline/#{id}.xml"
|
65
|
+
|
66
|
+
proxy = @conf['proxy']
|
67
|
+
proxy = 'http://' + proxy if proxy
|
68
|
+
timeout( 10 ) do
|
69
|
+
open( request, :proxy => proxy ) {|f| f.read }
|
70
|
+
end
|
71
|
+
end
|
data/plugin/retweet.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
#
|
2
|
+
# retweet.rb - show retweet count in each section
|
3
|
+
# This plugin uses a Topsy Retweet Button for Web Sites powered by Topsy.com
|
4
|
+
#
|
5
|
+
# Copyright (C) 2010, MATSUOKA Kohei <http://www.machu.jp/diary/>
|
6
|
+
# You can redistribute it and/or modify it under GPL2.
|
7
|
+
#
|
8
|
+
|
9
|
+
#
|
10
|
+
# settings for Topsy Retweet Button.
|
11
|
+
# see: http://labs.topsy.com/button/retweet-button/#global_settings
|
12
|
+
#
|
13
|
+
# your Twitter username
|
14
|
+
@topsy_nick = "your_twitter_account"
|
15
|
+
# retweet button color
|
16
|
+
#@topsy_theme = "blue"
|
17
|
+
# retweet button text
|
18
|
+
#@topsy_retweet_text = "retweet"
|
19
|
+
|
20
|
+
unless defined?(permalink)
|
21
|
+
def permalink( date, index, escape = true )
|
22
|
+
ymd = date.strftime( "%Y%m%d" )
|
23
|
+
uri = @conf.index.dup
|
24
|
+
uri.sub!( %r|\A(?!https?://)|i, @conf.base_url )
|
25
|
+
uri.gsub!( %r|/\.(?=/)|, "" ) # /././ -> /
|
26
|
+
link = uri + anchor( "#{ymd}p%02d" % index )
|
27
|
+
link.sub!( "#", "%23" ) if escape
|
28
|
+
link
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
unless defined?(subtitle)
|
33
|
+
def subtitle( date, index, escape = true )
|
34
|
+
diary = @diaries[date.strftime( "%Y%m%d" )]
|
35
|
+
return "" unless diary
|
36
|
+
sn = 1
|
37
|
+
diary.each_section do |section|
|
38
|
+
if sn == index
|
39
|
+
old_apply_plugin = @options["apply_plugin"]
|
40
|
+
@options["apply_plugin"] = true
|
41
|
+
title = apply_plugin( section.subtitle_to_html, true )
|
42
|
+
@options["apply_plugin"] = old_apply_plugin
|
43
|
+
title.gsub!( /(?=")/, "\\" ) if escape
|
44
|
+
return title
|
45
|
+
end
|
46
|
+
sn += 1
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# load Tospy's script and initialize
|
52
|
+
add_header_proc do
|
53
|
+
r = ""
|
54
|
+
r << %Q|<script type="text/javascript" src="http://cdn.topsy.com/topsy.js?init=topsyWidgetCreator"></script>\n|
|
55
|
+
return r unless @topsy_theme or @topsy_nick or @topsy_retweet_text
|
56
|
+
r << %Q|<script type="text/javascript" id="topsy_global_settings"><!--\n|
|
57
|
+
r << %Q| var topsy_theme = "#{@topsy_theme}";\n| if @topsy_theme
|
58
|
+
r << %Q| var topsy_nick = "#{@topsy_nick}";\n| if @topsy_nick
|
59
|
+
r << %Q| var topsy_retweet_text = "#{@topsy_retweet_text}";\n| if @topsy_retweet_text
|
60
|
+
r << %Q|//--></script>\n|
|
61
|
+
end
|
62
|
+
|
63
|
+
# show retweet button in top of section
|
64
|
+
add_section_enter_proc do |date, index|
|
65
|
+
<<-"EOS"
|
66
|
+
<div class="topsy_widget_data" style="float: right; margin-left: 1em;"><!-- {
|
67
|
+
"url": "#{permalink(date, index)}",
|
68
|
+
"title": "#{subtitle(date, index)}",
|
69
|
+
"style": "big"
|
70
|
+
} --></div>
|
71
|
+
EOS
|
72
|
+
end
|
73
|
+
|
74
|
+
# show retweet button in end of section
|
75
|
+
add_section_leave_proc do |date, index|
|
76
|
+
<<-"EOS"
|
77
|
+
<div class="tags">
|
78
|
+
<img src="http://www.machu.jp/diary/twitter_logo_small.png" height="16" width="62" alt="Twitter">:
|
79
|
+
<div class="topsy_widget_data" style="float: right; margin-left: 1em;"><!-- {
|
80
|
+
"url": "#{permalink(date, index)}",
|
81
|
+
"title": "#{subtitle(date, index)}",
|
82
|
+
"style": "small"
|
83
|
+
} --></div>
|
84
|
+
</div>
|
85
|
+
EOS
|
86
|
+
end
|