# # Google AdSense plugin for tDiary # # Copyright (C) 2004 Kazuhiko # You can redistribute it and/or modify it under GPL2. # # modified by TADA Tadashi # def google_adsense( layout = nil, slot = nil ) google_adsense_init( layout ) google_ad_client = "pub-3317603667498586" google_ad_size = [ [468, 60], # 0 [120, 600], # 1 [728, 90], # 2 [300, 250], # 3 [125, 125], # 4 [160, 600], # 5 [120, 240], # 6 [180, 150], # 7 [250, 250], # 8 [336, 280], # 9 [200, 200], # 10 [234, 60] # 11 ] result = <<-EOF EOF result.gsub( /^\t+/, '' ) end def google_adsense_init( layout ) if layout != nil then @conf['google_adsense.layout'] = layout.to_i else @conf['google_adsense.layout'] = 0 unless @conf['google_adsense.layout'] end @conf['google_adsense.layout'] = @conf['google_adsense.layout'].to_i if @conf['google_adsense.layout'] < 0 or @conf['google_adsense.layout'] > 11 then @conf['google_adsense.layout'] = 0 end @conf['google_adsense.color.border'] = 'CCCCCC' unless @conf['google_adsense.color.border'] @conf['google_adsense.color.bg'] = 'FFFFFF' unless @conf['google_adsense.color.bg'] @conf['google_adsense.color.link'] = '000000' unless @conf['google_adsense.color.link'] @conf['google_adsense.color.url'] = '666666' unless @conf['google_adsense.color.url'] @conf['google_adsense.color.text'] = '333333' unless @conf['google_adsense.color.text'] end add_section_leave_proc do |date,index| if @mode == 'day' and index == 1 and @conf['google_adsense.slot'] then %Q|
#{google_adsense( 0, @conf['google_adsense.slot'] )}
| else '' end end # insert section target tags add_body_enter_proc do |date| "\n" end add_body_leave_proc do |date| "\n" end add_conf_proc( 'google_adsense', 'Google AdSense' ) do if @mode == 'saveconf' then @conf['google_adsense.layout'] = @cgi.params['google_adsense.layout'][0].to_i @conf['google_adsense.color.border'] = @cgi.params['google_adsense.color.border'][0] @conf['google_adsense.color.bg'] = @cgi.params['google_adsense.color.bg'][0] @conf['google_adsense.color.link'] = @cgi.params['google_adsense.color.link'][0] @conf['google_adsense.color.url'] = @cgi.params['google_adsense.color.url'][0] @conf['google_adsense.color.text'] = @cgi.params['google_adsense.color.text'][0] else google_adsense_init( nil ) end <<-HTML

バナーのサイズ(#{@conf['google_adsense.layout']})

広告バナーのサイズは全部で12種類あります。お好きなサイズを選んでください。

バナーの色

バナーの各パーツの色を指定できます。HTMLやCSSと同じ、6桁の16進数で指定します。

  
背景  
リンク  
URL  
テキスト  
HTML end