Module: Awestruct::Extensions::Flattr::Flattrable

Defined in:
lib/awestruct/extensions/flattr.rb

Instance Method Summary collapse

Instance Method Details

#flattr_compact_counter(param = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/awestruct/extensions/flattr.rb', line 29

def flattr_compact_counter(param={})
  url = param[:url] ? param[:url] : site.base_url + self.url
  title = param[:title] ? param[:title] : self.title
  category = param[:category] ? param[:category] : "text"
  tags = param[:tags] ? "tags:" + param[:tags] + ";" : ""
  html = %Q|<a class="FlattrButton" style="display:none;" href="#{url}" title="#{title}" |
  html += %Q|rev="flattr;button:compact;uid:#{site.flattr_username};category:#{category};#{tags}"></a>|
  html
end

#flattr_javascriptObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/awestruct/extensions/flattr.rb', line 10

def flattr_javascript()
  html = %Q|<script type='text/javascript'> /* <![CDATA[ */     (function() {\n|
  html += %Q|var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];|
  html += %Q|s.type = 'text/javascript';\n|
  html += %Q|s.async = true;\n|
  html += %Q|s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto&uid=#{site.flattr_username}&category=text';\n|
  html += %Q|t.parentNode.insertBefore(s, t);\n|
  html += %Q|})(); /* ]]> */ </script>|
  html
end

#flattr_large_counter(param = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/awestruct/extensions/flattr.rb', line 20

def flattr_large_counter(param={})
  url = param[:url] ? param[:url] : site.base_url + self.url
  title = param[:title] ? param[:title] : self.title
  category = param[:category] ? param[:category] : "text"
  tags = param[:tags] ? "tags:" + param[:tags] + ";" : ""
  html = %Q|<a class="FlattrButton" style="display:none;" href="#{url}" title="#{title}" |
  html += %Q|rev="flattr;uid:#{site.flattr_username};category:#{category};#{tags}"></a>|
  html
end