Module: Jaap3::Addthis::Helper

Defined in:
lib/addthis.rb

Instance Method Summary collapse

Instance Method Details

#addthis_bookmark_button(*args) ⇒ Object Also known as: addthis_share_button



24
25
26
27
28
29
30
# File 'lib/addthis.rb', line 24

def addthis_bookmark_button(*args)
  url, options = extract_addthis_url_and_options(args)
  options[:button_html] = yield if block_given?
  options = BOOKMARK_BUTTON_DEFAULTS.merge(options)
  s = %Q{<a href="http://www.addthis.com/bookmark.php?v=20" onmouseover="#{addthis_open("", url, options[:page_title])}" onmouseout="addthis_close()" onclick="return addthis_sendto()" title="#{options[:title]}">}
  addthis_tag(s, options)
end

#addthis_email_button(*args) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/addthis.rb', line 33

def addthis_email_button(*args)
  url, options = extract_addthis_url_and_options(args)
  options[:button_html] = yield if block_given?
  options = EMAIL_BUTTON_DEFAULTS.merge(options)
  s = %Q{<a href="http://www.addthis.com/bookmark.php" onclick="#{addthis_open("email", url, options[:page_title])}" title="#{options[:title]}">}
  addthis_tag(s, options)
end

#addthis_feed_button(url, *args) ⇒ Object



41
42
43
44
45
46
# File 'lib/addthis.rb', line 41

def addthis_feed_button(url, *args)
  options = FEED_BUTTON_DEFAULTS.merge(extract_addthis_options(args))
  options[:button_html] = yield if block_given?
  s = %Q{<a href="http://www.addthis.com/feed.php?pub=#{options[:publisher]}&h1=#{url.gsub(/[^a-zA-Z0-9_\.\-]/n) {|c| sprintf('%%%02x', c[0]) }}&t1=" onclick="#{addthis_open("feed", url)}" title="#{options[:title]}" target="_blank">}
  addthis_tag(s, options)
end