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
@@ -0,0 +1,166 @@
|
|
1
|
+
# tdiarytimes.rb $Revision: 1.2 $
|
2
|
+
#
|
3
|
+
# Copyright (c) 2003 neuichi <neuichi@nmnl.jp>
|
4
|
+
# Distributed under the GPL
|
5
|
+
#
|
6
|
+
# プラグイン配布ページ
|
7
|
+
# http://nmnl.jp/hiki/software/?tDiary+%3A%3A+Plugin
|
8
|
+
#
|
9
|
+
# 動作条件:
|
10
|
+
# ruby-gdが使える環境が必要です。
|
11
|
+
#
|
12
|
+
# 使い方:
|
13
|
+
# このプラグインをプラグインディレクトリに入れ、
|
14
|
+
# index.rbと同じディレクトリに、tdiarytimes.pngという名前の
|
15
|
+
# サーバが書き込み権限を持っているファイルを作ります。
|
16
|
+
# これで日記に書き込みするごとに、tdiarytimes.pngに
|
17
|
+
# 画像を書き込みます。
|
18
|
+
#
|
19
|
+
# 日記上からこのpngファイルを呼び出すには、
|
20
|
+
# tDiray上からプラグインとして
|
21
|
+
# <%=tdiarytimes%>
|
22
|
+
# として呼び出します。
|
23
|
+
# 引数としてimgタグのaltの文字列を指定することも出来ます。
|
24
|
+
# <%=tdiarytimes '文字列'%>
|
25
|
+
#
|
26
|
+
# また、tdiary.confに以下のオプションを書き込むことにより、
|
27
|
+
# カスタマイズをすることが出来ます。
|
28
|
+
#
|
29
|
+
# @options['tdiarytimes.width'] = 400
|
30
|
+
# 四角の横幅。デフォルト値400。
|
31
|
+
# 実際に出力される画像サイズは、これに+10したサイズ。
|
32
|
+
#
|
33
|
+
# @options['tdiarytimes.height'] = 20
|
34
|
+
# 四角の縦幅。デフォルト値20。
|
35
|
+
# 実際に出力される画像サイズは、これに+16したサイズ。
|
36
|
+
#
|
37
|
+
# @options['tdiarytimes.file'] = 'tdiarytimes.png'
|
38
|
+
# 出力する画像ファイル名。デフォルトは'tdiarytimes.png'
|
39
|
+
#
|
40
|
+
# @options['tdiarytimes.fillcolor'] = '#444444'
|
41
|
+
# 四角の色。デフォルトは'#444444'
|
42
|
+
#
|
43
|
+
# @options['tdiarytimes.linecolor'] = '#ffffff'
|
44
|
+
# 縦棒の色。デフォルトは'#ffffff'
|
45
|
+
#
|
46
|
+
# @options['tdiarytimes.textcolor'] = '#444444'
|
47
|
+
# 文字色。デフォルトは'#444444'
|
48
|
+
#
|
49
|
+
# @options['tdiarytimes.text'] = 'T D I A R Y T I M E S'
|
50
|
+
# 出力する文字。デフォルトは'T D I A R Y T I M E S'。なお半角英数字のみ対応。
|
51
|
+
#
|
52
|
+
# @options['tdiarytimes.day'] = 30
|
53
|
+
# ログを保存する最大日数。デフォルトは30。
|
54
|
+
# この場合、30日以上経ったデータは消去され、縦棒として描画されなくなる。
|
55
|
+
#
|
56
|
+
|
57
|
+
require 'GD'
|
58
|
+
|
59
|
+
if /^(append|replace)$/ =~ @mode then
|
60
|
+
|
61
|
+
#初期設定
|
62
|
+
width = @options['tdiarytimes.width'] || 400
|
63
|
+
height = @options['tdiarytimes.height'] || 20
|
64
|
+
file = @options['tdiarytimes.file'] || 'tdiarytimes.png'
|
65
|
+
fillcolor = @options['tdiarytimes.fillcolor'] || '#444444'
|
66
|
+
linecolor = @options['tdiarytimes.linecolor'] || '#ffffff'
|
67
|
+
textcolor = @options['tdiarytimes.textcolor'] || '#444444'
|
68
|
+
text = @options['tdiarytimes.text'] || 'T D I A R Y T I M E S'
|
69
|
+
day = @options['tdiarytimes.day'] || 30
|
70
|
+
|
71
|
+
cache = "#{@cache_path}/tdiarytimes"
|
72
|
+
Dir::mkdir( cache ) unless File::directory?( cache )
|
73
|
+
|
74
|
+
image = GD::Image.new(width + 10,height + 16)
|
75
|
+
transcolor = image.colorAllocate("#fffffe")
|
76
|
+
image.transparent(transcolor)
|
77
|
+
image.interlace = TRUE
|
78
|
+
fillcolor = image.colorAllocate(fillcolor)
|
79
|
+
linecolor = image.colorAllocate(linecolor)
|
80
|
+
textcolor = image.colorAllocate(textcolor)
|
81
|
+
|
82
|
+
#帯の描画
|
83
|
+
image.filledRectangle(5,8,width + 4,height + 7,fillcolor)
|
84
|
+
|
85
|
+
#時間挿入
|
86
|
+
if width >= 160
|
87
|
+
hour = 2
|
88
|
+
hour_w = width / 12.0
|
89
|
+
image.string(GD::Font::TinyFont, 2, height + 8, "0", textcolor)
|
90
|
+
11.times {
|
91
|
+
image.string(GD::Font::TinyFont, (hour_w * hour/2).to_i , height + 8, hour.to_s, textcolor)
|
92
|
+
hour += 2
|
93
|
+
}
|
94
|
+
image.string(GD::Font::TinyFont, width + 2, height + 8, "0", textcolor)
|
95
|
+
else
|
96
|
+
hour = 0
|
97
|
+
hour_w = width / 6.0
|
98
|
+
6.times {
|
99
|
+
image.string(GD::Font::TinyFont, (hour_w * hour/4).to_i + 4, height + 8, hour.to_s, textcolor)
|
100
|
+
hour += 4
|
101
|
+
}
|
102
|
+
image.string(GD::Font::TinyFont, width + 2, height + 8, "0", textcolor)
|
103
|
+
end
|
104
|
+
|
105
|
+
#現在時刻の保存,読み込み
|
106
|
+
begin
|
107
|
+
io = open("#{cache}/tdiarytimes.dat","r")
|
108
|
+
ary_times = Marshal.load(io)
|
109
|
+
io.close
|
110
|
+
rescue
|
111
|
+
ary_times = []
|
112
|
+
end
|
113
|
+
|
114
|
+
ary_times << Time.now.to_f
|
115
|
+
ary_times_new = []
|
116
|
+
|
117
|
+
while ary_times.size != 0
|
118
|
+
time = ary_times.shift
|
119
|
+
time_now = Time.now.to_f.to_i
|
120
|
+
ary_times_new << time.to_i if (86400 * day) > (time_now - time).to_i
|
121
|
+
end
|
122
|
+
|
123
|
+
ary_times = ary_times_new
|
124
|
+
|
125
|
+
io = open("#{cache}/tdiarytimes.dat","w")
|
126
|
+
Marshal.dump(ary_times,io)
|
127
|
+
io.close
|
128
|
+
|
129
|
+
|
130
|
+
#時間軸の挿入
|
131
|
+
while ary_times.size != 0
|
132
|
+
time = Time.at(ary_times.shift)
|
133
|
+
time_w = ((time.to_a[2] * 60 + time.to_a[1]) / 1440.0 * width).to_i
|
134
|
+
image.line(time_w + 5, 8 ,time_w + 5,height + 7, linecolor)
|
135
|
+
end
|
136
|
+
|
137
|
+
#文字の挿入
|
138
|
+
image.string(GD::Font::TinyFont, 5, 0, text, textcolor)
|
139
|
+
|
140
|
+
pngfile = open(file, 'w')
|
141
|
+
image.png(pngfile)
|
142
|
+
pngfile.close
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
def tdiarytimes(alt = nil)
|
147
|
+
width = @options['tdiarytimes.width'].to_i || 400
|
148
|
+
width += 10
|
149
|
+
|
150
|
+
height = @options['tdiarytimes.height'].to_i || 20
|
151
|
+
height += 16
|
152
|
+
|
153
|
+
file = @options['tdiarytimes.file'] || 'tdiarytimes.png'
|
154
|
+
text = @options['tdiarytimes.text'] || 'T D I A R Y T I M E S'
|
155
|
+
|
156
|
+
result = ""
|
157
|
+
|
158
|
+
if alt
|
159
|
+
result << %Q|<img src="#{h file}" alt="#{h alt}" width="#{width}" height="#{height}" class="tdiarytimes">|
|
160
|
+
else
|
161
|
+
result << %Q|<img src="#{h file}" alt="#{h text}" width="#{width}" height="#{height}" class="tdiarytimes">|
|
162
|
+
end
|
163
|
+
|
164
|
+
result
|
165
|
+
|
166
|
+
end
|
@@ -0,0 +1,406 @@
|
|
1
|
+
# tdiarytimes.rb $originalRevision: 1.1 $
|
2
|
+
#
|
3
|
+
# Copyright (c) 2003 neuichi <neuichi@nmnl.jp>
|
4
|
+
# Distributed under the GPL
|
5
|
+
#
|
6
|
+
# 2003-12-01 circle extention added by Minero Aoki <aamine@loveruby.net>
|
7
|
+
# $Id: tdiarytimes2.rb,v 1.2 2007/01/11 02:55:26 tadatadashi Exp $
|
8
|
+
#
|
9
|
+
# プラグイン配布ページ
|
10
|
+
# http://i.loveruby.net/w/tdiarytimes.html
|
11
|
+
#
|
12
|
+
# 動作条件:
|
13
|
+
# ruby-gdが使える環境が必要です。
|
14
|
+
#
|
15
|
+
# 使い方:
|
16
|
+
# このプラグインをプラグインディレクトリに入れ、
|
17
|
+
# index.rbと同じディレクトリに、tdiarytimes.pngという名前の
|
18
|
+
# サーバが書き込み権限を持っているファイルを作ります。
|
19
|
+
# これで日記に書き込みするごとに、tdiarytimes.pngに
|
20
|
+
# 画像を書き込みます。
|
21
|
+
#
|
22
|
+
# 日記上からこのpngファイルを呼び出すには、
|
23
|
+
# tDiray上からプラグインとして
|
24
|
+
# <%=tdiarytimes%>
|
25
|
+
# として呼び出します。
|
26
|
+
# 引数としてimgタグのaltの文字列を指定することも出来ます。
|
27
|
+
# <%=tdiarytimes '文字列'%>
|
28
|
+
#
|
29
|
+
# また、tdiary.confに以下のオプションを書き込むことにより、
|
30
|
+
# カスタマイズをすることが出来ます。
|
31
|
+
#
|
32
|
+
# @options['tdiarytimes.width'] = 400
|
33
|
+
# 四角の横幅。デフォルト値400。
|
34
|
+
# 実際に出力される画像サイズは、これに+10したサイズ。
|
35
|
+
#
|
36
|
+
# @options['tdiarytimes.height'] = 20
|
37
|
+
# 四角の縦幅。デフォルト値20。
|
38
|
+
# 実際に出力される画像サイズは、これに+16したサイズ。
|
39
|
+
#
|
40
|
+
# @options['tdiarytimes.file'] = 'tdiarytimes.png'
|
41
|
+
# 出力する画像ファイル名。デフォルトは'tdiarytimes.png'
|
42
|
+
#
|
43
|
+
# @options['tdiarytimes.fillcolor'] = '#444444'
|
44
|
+
# 四角の色。デフォルトは'#444444'
|
45
|
+
#
|
46
|
+
# @options['tdiarytimes.linecolor'] = '#ffffff'
|
47
|
+
# 縦棒の色。デフォルトは'#ffffff'
|
48
|
+
#
|
49
|
+
# @options['tdiarytimes.textcolor'] = '#444444'
|
50
|
+
# 文字色。デフォルトは'#444444'
|
51
|
+
#
|
52
|
+
# @options['tdiarytimes.fadeout'] = false
|
53
|
+
# フェードアウトするか。デフォルトはfalse。
|
54
|
+
# フェードアウトしたいときには true にすればよい。
|
55
|
+
#
|
56
|
+
# @options['tdiarytimes.fadeoutcolor'] = '#ffffff'
|
57
|
+
# フェードアウトするとき、
|
58
|
+
# デフォルトではfillcolorへとフェードアウトしていく。
|
59
|
+
# ここで色を指定するとその色へとフェードアウトしていく。
|
60
|
+
# デフォルトは false
|
61
|
+
#
|
62
|
+
# @options['tdiarytimes.text'] = 'T D I A R Y T I M E S'
|
63
|
+
# 出力する文字。デフォルトは'T D I A R Y T I M E S'。なお半角英数字のみ対応。
|
64
|
+
#
|
65
|
+
# @options['tdiarytimes.day'] = 30
|
66
|
+
# ログを保存する最大日数。デフォルトは30。
|
67
|
+
# この場合、30日以上経ったデータは消去され、縦棒として描画されなくなる。
|
68
|
+
#
|
69
|
+
|
70
|
+
require 'GD'
|
71
|
+
|
72
|
+
::GD::Image.module_eval {
|
73
|
+
def tiny_string(text, x, y, color)
|
74
|
+
string(GD::Font::TinyFont, x, y, text, color)
|
75
|
+
end
|
76
|
+
|
77
|
+
def small_string(text, x, y, color)
|
78
|
+
string(GD::Font::SmallFont, x, y, text, color)
|
79
|
+
end
|
80
|
+
}
|
81
|
+
|
82
|
+
# Ruby 1.6 missing File.read
|
83
|
+
unless ::File.respond_to?(:read)
|
84
|
+
def (::File).read(fname)
|
85
|
+
File.open(fname) {|f|
|
86
|
+
return f.read
|
87
|
+
}
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Ruby 1.6 missing MatchData#captures
|
92
|
+
unless ::MatchData.method_defined?(:captures)
|
93
|
+
::MatchData.module_eval {
|
94
|
+
def captures
|
95
|
+
a = to_a()
|
96
|
+
a.shift
|
97
|
+
a
|
98
|
+
end
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
102
|
+
class TDiaryTimes
|
103
|
+
class << TDiaryTimes
|
104
|
+
alias newobj new
|
105
|
+
end
|
106
|
+
|
107
|
+
def TDiaryTimes.new(datadir, options)
|
108
|
+
case options['tdiarytimes.shape']
|
109
|
+
when 'bar', nil
|
110
|
+
c = TDiaryTimesBar
|
111
|
+
when 'circle'
|
112
|
+
c = TDiaryTimesCircle
|
113
|
+
else
|
114
|
+
raise ArgumentError, "unknown tdiarytimes.shape: #{options['tdiarytimes.shape']}"
|
115
|
+
end
|
116
|
+
c.newobj("#{datadir}/tdiarytimes", options)
|
117
|
+
end
|
118
|
+
|
119
|
+
def initialize(dbfile, options)
|
120
|
+
@dbfile = dbfile
|
121
|
+
@image_file = options['tdiarytimes.file'] || 'tdiarytimes.png'
|
122
|
+
@day = options['tdiarytimes.day'] || 30
|
123
|
+
@keepdb = options['tdiarytimes.keepdb']
|
124
|
+
end
|
125
|
+
|
126
|
+
attr_reader :image_file
|
127
|
+
|
128
|
+
def update_image
|
129
|
+
now = Time.now
|
130
|
+
mtimes = (load_database() + [now]).reject {|tm|
|
131
|
+
(now - tm) > (60 * 60 * 24 * @day)
|
132
|
+
}
|
133
|
+
image = create_image(mtimes)
|
134
|
+
File.open(@image_file, 'w') {|png|
|
135
|
+
image.png(png)
|
136
|
+
}
|
137
|
+
save_database(mtimes) unless @keepdb
|
138
|
+
end
|
139
|
+
|
140
|
+
private
|
141
|
+
|
142
|
+
#
|
143
|
+
# database
|
144
|
+
#
|
145
|
+
|
146
|
+
def load_database
|
147
|
+
begin
|
148
|
+
return Marshal.load(File.read(@dbfile))
|
149
|
+
rescue Errno::ENOENT
|
150
|
+
return []
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def save_database(content)
|
155
|
+
File.open(@dbfile, 'w') {|f|
|
156
|
+
Marshal.dump(content, f)
|
157
|
+
}
|
158
|
+
end
|
159
|
+
|
160
|
+
#
|
161
|
+
# common paint methods
|
162
|
+
#
|
163
|
+
|
164
|
+
def fadeout_color(srccolor, destcolor, time)
|
165
|
+
par = (Time.now - time).to_f / (60 * 60 * 24 * @day)
|
166
|
+
r, g, b = *zip(parse_rgb(srccolor), parse_rgb(destcolor))\
|
167
|
+
.map {|src, dest| src - (src - dest) * par }.map {|c| c.to_i }
|
168
|
+
sprintf('#%02x%02x%02x', r, g, b)
|
169
|
+
end
|
170
|
+
|
171
|
+
def parse_rgb(str)
|
172
|
+
hex = '[\da-f]'
|
173
|
+
m = /\A\#(#{hex}{2})(#{hex}{2})(#{hex}{2})\z/io.match(str) or
|
174
|
+
raise ArgumentError, "tdiarytimes: not color: #{str.inspect}"
|
175
|
+
m.captures.map {|c| c.hex }
|
176
|
+
end
|
177
|
+
|
178
|
+
def zip(*lists)
|
179
|
+
result = []
|
180
|
+
lists[0].each_index do |idx|
|
181
|
+
result.push lists.map {|lst| lst[idx] }
|
182
|
+
end
|
183
|
+
result
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
class TDiaryTimesBar < TDiaryTimes
|
188
|
+
def initialize(dbfile, options)
|
189
|
+
super
|
190
|
+
@text = options['tdiarytimes.text'] || 'T D I A R Y T I M E S'
|
191
|
+
@width = options['tdiarytimes.width'].to_i || 400
|
192
|
+
@height = options['tdiarytimes.height'].to_i || 20
|
193
|
+
@textcolor = options['tdiarytimes.textcolor'] || '#444444'
|
194
|
+
@fillcolor = options['tdiarytimes.fillcolor'] || '#444444'
|
195
|
+
@linecolor = options['tdiarytimes.linecolor'] || '#ffffff'
|
196
|
+
@fadeoutcolor = options['tdiarytimes.fadeoutcolor'] || @fillcolor
|
197
|
+
@fadeoutp = options['tdiarytimes.fadeout']
|
198
|
+
end
|
199
|
+
|
200
|
+
def html(alt)
|
201
|
+
%Q[<img src="#{h image_file()}"
|
202
|
+
alt="#{h( alt || @text )}"
|
203
|
+
width="#{@width + GAP_W}"
|
204
|
+
height="#{@height + GAP_H}"
|
205
|
+
class="tdiarytimes">].gsub(/\s+/, ' ')
|
206
|
+
end
|
207
|
+
|
208
|
+
private
|
209
|
+
|
210
|
+
GAP_W = 16
|
211
|
+
GAP_H = 16
|
212
|
+
|
213
|
+
def create_image(mtimes)
|
214
|
+
image = GD::Image.new(@width + GAP_W, @height + GAP_H)
|
215
|
+
image.transparent(image.colorAllocate('#fffffe'))
|
216
|
+
image.interlace = true
|
217
|
+
|
218
|
+
image.tiny_string @text, (GAP_W / 2), 0, image.colorAllocate(@textcolor)
|
219
|
+
image.filledRectangle 0 + GAP_W / 2, 0 + GAP_H / 2,
|
220
|
+
image.width - GAP_W / 2, image.height - GAP_H / 2,
|
221
|
+
image.colorAllocate(@fillcolor)
|
222
|
+
if @fadeoutp
|
223
|
+
paint_lines_fadeout image, mtimes, @linecolor, @fadeoutcolor
|
224
|
+
else
|
225
|
+
paint_lines image, mtimes, @linecolor
|
226
|
+
end
|
227
|
+
paint_hours image, image.colorAllocate(@textcolor),
|
228
|
+
(image.width - GAP_W > 160 ? 2 : 4)
|
229
|
+
|
230
|
+
image
|
231
|
+
end
|
232
|
+
|
233
|
+
def paint_lines(image, mtimes, color)
|
234
|
+
gdcolor = image.colorAllocate(color)
|
235
|
+
mtimes.each do |time|
|
236
|
+
line image, time, gdcolor
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
def paint_lines_fadeout(image, mtimes, linecolor, destcolor)
|
241
|
+
mtimes.each do |time|
|
242
|
+
line image, time,
|
243
|
+
image.colorAllocate(fadeout_color(linecolor, destcolor, time))
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
def line(image, time, color)
|
248
|
+
x0 = (image.width - GAP_W).to_f * (time.hour * 60 + time.min) / (60 * 24)
|
249
|
+
x = (x0 + (GAP_W / 1.25)).to_i
|
250
|
+
image.line x, 0 + (GAP_H / 2),
|
251
|
+
x, image.height - (GAP_H / 2),
|
252
|
+
color
|
253
|
+
end
|
254
|
+
|
255
|
+
def paint_hours(image, color, stepping)
|
256
|
+
0.step(24, stepping) do |hour|
|
257
|
+
image.tiny_string hour.to_s,
|
258
|
+
(image.width - GAP_W) * (hour.to_f / 24) + (GAP_W / 2) - 4,
|
259
|
+
image.height - (GAP_H / 2),
|
260
|
+
color
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
class TDiaryTimesCircle < TDiaryTimes
|
266
|
+
def initialize(dbfile, options)
|
267
|
+
super
|
268
|
+
#@text # cannot change now
|
269
|
+
@width = options['tdiarytimes.width'].to_i || 80
|
270
|
+
@height = options['tdiarytimes.height'].to_i || 80
|
271
|
+
@textcolor = options['tdiarytimes.textcolor'] || '#444444'
|
272
|
+
@fillcolor = options['tdiarytimes.fillcolor'] || '#444444'
|
273
|
+
@linecolor = options['tdiarytimes.linecolor'] || '#ffffff'
|
274
|
+
@fadeoutcolor = options['tdiarytimes.fadeoutcolor'] || @fillcolor
|
275
|
+
@fadeoutp = options['tdiarytimes.fadeout']
|
276
|
+
end
|
277
|
+
|
278
|
+
def html(alt)
|
279
|
+
%Q[<img src="#{h image_file()}"
|
280
|
+
alt="#{h( alt || '' )}"
|
281
|
+
width="#{@width}"
|
282
|
+
height="#{@height}"
|
283
|
+
class="tdiarytimes">].gsub(/\s+/, ' ')
|
284
|
+
end
|
285
|
+
|
286
|
+
private
|
287
|
+
|
288
|
+
MIN_DEGREE = 0
|
289
|
+
MAX_DEGREE = 250
|
290
|
+
BAR_WIDTH = 24
|
291
|
+
TRANSCOLOR = '#ffffff'
|
292
|
+
|
293
|
+
def create_image(mtimes)
|
294
|
+
image = GD::Image.new(@width, @height)
|
295
|
+
trans = image.colorAllocate(TRANSCOLOR)
|
296
|
+
image.transparent trans
|
297
|
+
image.interlace = true
|
298
|
+
|
299
|
+
paint_outer_circle image, trans
|
300
|
+
if @fadeoutp
|
301
|
+
paint_lines_fadeout image, mtimes, @linecolor, @fadeoutcolor
|
302
|
+
else
|
303
|
+
paint_lines image, mtimes, @linecolor
|
304
|
+
end
|
305
|
+
paint_inner_circle image, trans
|
306
|
+
textcolor = image.colorAllocate(@textcolor)
|
307
|
+
image.small_string 'tdiary', @width / 2 + 1, 11, textcolor
|
308
|
+
image.small_string 'times', @width / 2 + 4, 21, textcolor
|
309
|
+
|
310
|
+
image
|
311
|
+
end
|
312
|
+
|
313
|
+
def paint_outer_circle(image, trans)
|
314
|
+
image.filledArc @width / 2, @height / 2,
|
315
|
+
@width, @height,
|
316
|
+
MIN_DEGREE, MAX_DEGREE,
|
317
|
+
if @fillcolor == TRANSCOLOR
|
318
|
+
then trans
|
319
|
+
else image.colorAllocate(@fillcolor)
|
320
|
+
end,
|
321
|
+
0
|
322
|
+
end
|
323
|
+
|
324
|
+
def paint_inner_circle(image, trans)
|
325
|
+
image.filledArc @width / 2, @height / 2,
|
326
|
+
@width - BAR_WIDTH * 2,
|
327
|
+
(@width - BAR_WIDTH * 2) * (@height.to_f / @width),
|
328
|
+
0, 360, trans, 0
|
329
|
+
end
|
330
|
+
|
331
|
+
def paint_lines(image, mtimes, color)
|
332
|
+
gdcolor = image.colorAllocate(color)
|
333
|
+
mtimes.each do |time|
|
334
|
+
line image, time, gdcolor
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
def paint_lines_fadeout(image, mtimes, linecolor, destcolor)
|
339
|
+
mtimes.each do |time|
|
340
|
+
line image, time,
|
341
|
+
image.colorAllocate(fadeout_color(linecolor, destcolor, time))
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
def line(image, time, color)
|
346
|
+
d0 = (time.hour * 60 + time.min).to_f / (60 * 24)
|
347
|
+
d = MIN_DEGREE + (MAX_DEGREE - MIN_DEGREE) * d0
|
348
|
+
image.line @width / 2, @height / 2,
|
349
|
+
@width / 2 + degcos(d) * (@width / 2) * 0.95,
|
350
|
+
@height / 2 + degsin(d) * (@height / 2) * 0.95,
|
351
|
+
color
|
352
|
+
end
|
353
|
+
|
354
|
+
include Math
|
355
|
+
|
356
|
+
def degsin(d)
|
357
|
+
sin(d / (180 / Math::PI))
|
358
|
+
end
|
359
|
+
|
360
|
+
def degcos(d)
|
361
|
+
cos(d / (180 / Math::PI))
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
def tdiarytimes(alt = nil)
|
366
|
+
TDiaryTimes.new(@conf.data_path, @options).html(alt)
|
367
|
+
end
|
368
|
+
|
369
|
+
|
370
|
+
if $0 == __FILE__ # debugging
|
371
|
+
tmp_options_bar = {
|
372
|
+
'tdiarytimes.shape' => 'bar',
|
373
|
+
'tdiarytimes.textcolor' => '#666666',
|
374
|
+
'tdiarytimes.linecolor' => '#df0000',
|
375
|
+
'tdiarytimes.fillcolor' => '#0f5f0f',
|
376
|
+
'tdiarytimes.fadeout' => true,
|
377
|
+
'tdiarytimes.keepdb' => false # for debug
|
378
|
+
}
|
379
|
+
tmp_options_circle = {
|
380
|
+
'tdiarytimes.shape' => 'circle',
|
381
|
+
'tdiarytimes.textcolor' => '#000000',
|
382
|
+
'tdiarytimes.linecolor' => '#bfbfbf',
|
383
|
+
'tdiarytimes.fillcolor' => '#2f2f7f',
|
384
|
+
'tdiarytimes.fadeout' => true,
|
385
|
+
'tdiarytimes.keepdb' => false # for debug
|
386
|
+
}
|
387
|
+
|
388
|
+
@mode = 'latest'
|
389
|
+
@conf = Object.new
|
390
|
+
def @conf.data_path
|
391
|
+
'.'
|
392
|
+
end
|
393
|
+
case ARGV[0]
|
394
|
+
when 'bar'
|
395
|
+
@options = tmp_options_bar
|
396
|
+
else
|
397
|
+
@options = tmp_options_circle
|
398
|
+
end
|
399
|
+
TDiaryTimes.new(@conf.data_path, @options).update_image
|
400
|
+
puts tdiarytimes()
|
401
|
+
exit 0
|
402
|
+
end
|
403
|
+
|
404
|
+
if /append|replace/ =~ @mode
|
405
|
+
TDiaryTimes.new(@conf.data_path, @options).update_image
|
406
|
+
end
|