Created
January 15, 2012 00:35
-
-
Save elpeo/1613598 to your computer and use it in GitHub Desktop.
add Grow! button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/plugin/section_footer2.rb | |
+++ b/plugin/section_footer2.rb | |
@@ -48,7 +48,7 @@ unless defined?(subtitle) | |
end | |
def init_buttons_status | |
- @installed_buttons = ['yaml', 'delicious', 'hatena', 'facebook', 'twitter', 'plusone'] | |
+ @installed_buttons = ['yaml', 'delicious', 'hatena', 'facebook', 'twitter', 'plusone', 'grow'] | |
if @conf['section_footer2.isDisplay'].nil? | |
@conf['section_footer2.isDisplay'] = '' | |
end | |
@@ -77,6 +77,13 @@ add_header_proc do | |
EOS | |
end | |
+add_footer_proc do | |
+ <<-"EOS" | |
+ <script src="http://growbutton.com/javascripts/button.js?apikey=#{u( @conf['section_footer2.grow.api_key'] )}&insert=false" type="text/javascript"></script> | |
+ <style type="text/css">.growbutton-ifm {margin-bottom: -7px !important; }</style> | |
+ EOS | |
+end | |
+ | |
add_section_enter_proc do |date, index| | |
@category_to_tag_list = {} | |
init_buttons_status | |
@@ -194,6 +201,15 @@ def add_plusone(date, index) | |
%Q!<g:plusone size="medium" href="#{permalink(date, index, false)}"></g:plusone> | ! | |
end | |
+def add_grow( date, index ) | |
+ <<-HTML | |
+ <span itemscope itemref="rectangle" itemtype="http://growbutton.com/ns#button"> | |
+ <span itemprop="url">#{permalink(date, index, false)}</span> | |
+ <span itemprop="title">#{h(subtitle(date, index))}</span> | |
+ </span> | | |
+ HTML | |
+end | |
+ | |
def add_yaml(date, index) | |
r = '' | |
yaml_dir = "#{@cache_path}/yaml/" | |
@@ -253,6 +269,7 @@ add_conf_proc('section_footer2', 'Section Footer Button') do | |
@cgi.params['section_footer2.isDisplay'].each do |item| | |
@conf['section_footer2.isDisplay'] << item + '\n' | |
end | |
+ @conf['section_footer2.grow.api_key'] = @cgi.params['section_footer2.grow.api_key'][0] | |
end | |
r = '<h3>表示するボタンをチェックしてください(YAMLをチェックすると各自でインストールしたYAMLのボタンをすべて表示します)</h3>' | |
@@ -267,6 +284,8 @@ add_conf_proc('section_footer2', 'Section Footer Button') do | |
r << %Q|<input name="section_footer2.isDisplay" value="#{button}" #{item_checked} type="checkbox" />#{button}| | |
end | |
r << '</p>' | |
+ r << '<h3>Grow! API Key</h3>' | |
+ r << %Q|<input name="section_footer2.grow.api_key" value="#{h( @conf['section_footer2.grow.api_key'] )}" type="text" size="36" />| | |
end | |
# Local Variables: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment