Changeset 33148
- Timestamp:
- 05/07/09 22:59:19 (4 years ago)
- Files:
-
- 1 modified
-
platform/tdiary/plugin/search-yahoo.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
platform/tdiary/plugin/search-yahoo.rb
r33145 r33148 3 3 # search-yahoo.rb - site search plugin sample using Yahoo! Search BOSS API. 4 4 # 5 # Copyright (C) 2009, TADA Tadashi < sho@spc.gr.jp>5 # Copyright (C) 2009, TADA Tadashi <t@tdtds.jp> 6 6 # You can redistribute it and/or modify it under GPL. 7 7 # … … 34 34 appid = @conf['search-yahoo.appid'] 35 35 36 url << "#{q}?appid=#{appid}&count= 50&start=#{start}"36 url << "#{q}?appid=#{appid}&count=20&start=#{start}" 37 37 38 38 proxy = @conf['proxy'] 39 39 proxy = 'http://' + proxy if proxy 40 timeout( 10 ) do40 timeout( 20 ) do 41 41 open( url, :proxy => proxy ) {|f| f.read } 42 42 end … … 68 68 r = search_input_form( query ) 69 69 r << '<dl class="search-result">' 70 res['resultset_web'].each do |elem|70 (res['resultset_web']||[]).each do |elem| 71 71 url = elem['url'] 72 72 next unless url =~ @conf['search-yahoo.result_filter'] … … 78 78 r << '</dl>' 79 79 80 ### PENDING ### 81 # r << '<div class="search-navi">' 82 # doc.elements.to_a( '/ysearchresponse/prevpage' ).each do |p| 83 # if /start=\d+/ =~ p.text then 84 # r << %Q|<a href="#{@conf.index}?q=#{u query}&#$&"><前の50件</a> | 85 # end 86 # end 87 # 88 # doc.elements.to_a( '/ysearchresponse/nextpage' ).each do |n| 89 # if /start=\d+/ =~ n.text then 90 # r << %Q|<a href="#{@conf.index}?q=#{u query}&#$&">次の50件></a>| 91 # end 92 # end 93 # r << '</div>' 80 r << '<div class="search-navi">' 81 (res['prevpage']||[]).each do |p| 82 if /start=\d+/ =~ p then 83 r << %Q|<a href="#{@conf.index}?q=#{u query}&#$&"><前の20件</a> | 84 end 85 end 86 87 (res['nextpage']||[]).each do |n| 88 if /start=\d+/ =~ n then 89 r << %Q|<a href="#{@conf.index}?q=#{u query}&#$&">次の20件></a>| 90 end 91 end 92 r << '</div>' 94 93 95 94 r
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)