# amazon_search.rb $Revision: 0.4 $
#
# Amazon Search B3
# Powered by Drk7jp http://www.drk7.jp/MT/archives/000366.html
#
# Copyright (C) 2004 by miyaken
Amazonからページに関連する商品を自動検索します。Powered by Drk7jp
HTML end def amazon_search_header_desc <<-HTML指定可能な値は次のとおりです。半角 | で連結することで複数カテゴリを指定することが可能です。例えば、書籍とソフトウェアの検索なら、Book|Software となります。
指定できるカテゴリ:Book, Electronics, Kitchen, Music, DVD, Video, Software, Video Games, all
HTML end def amazon_search_daymode_desc <<-HTML日記を日付表示した際に自動でプラグインを動作させるか設定します。
HTML end @amazon_search_daymode_yes = '動作させる' @amazon_search_daymode_no = '動作させない' end unless @conf.mobile_agent? then def amazon_search_url(date) a = [@conf.base_url, @conf.index, anchor(date.strftime('%Y%m%d'))] a.join.sub(%r|/\./|, '/') end def amazon_search( num=nil, idx=nil, tl=nil, cl=nil, footer=nil ) if num == nil then num = @conf['amazon_search.num'] || 5 end if idx == nil then idx = @conf['amazon_search.idx'] || "Book" end if tl == nil then tl = 40 end if cl == nil then cl = 100 end if footer == nil then footer = true end a = [@conf.base_url, @conf.index] uri = a.join.sub(%r|/\./|, '/') %Q[\n] end add_body_leave_proc do |date| if @mode == 'day' and not @conf['amazon_search.nodaymode'] uri = amazon_search_url(date).split(//n).map num = @conf['amazon_search.num'] || 5 idx = @conf['amazon_search.idx'] || "Book" %Q[\n] else '' end end add_conf_proc( 'similaryty_search_google', amazon_search_label ) do if @mode == 'saveconf' then @conf['amazon_search.noheader'] = !!(@cgi.params['amazon_search.noheader'][0] == 'true') @conf['amazon_search.style'] = @cgi.params['amazon_search.style'][0] @conf['amazon_search.num'] = @cgi.params['amazon_search.num'][0] @conf['amazon_search.idx'] = @cgi.params['amazon_search.idx'][0] @conf['amazon_search.nodaymode'] = !!(@cgi.params['amazon_search.nodaymode'][0] == 'true') end <<-HTML #{amazon_search_desc} #{amazon_search_header_desc} #{amazon_search_style_desc} #{amazon_search_num_desc} #{amazon_search_idx_desc} #{amazon_search_daymode_desc} HTML end end # of @conf.mobile_agent?