alula-plugins 0.4.16 → 0.4.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,8 @@ require 'alula/plugin'
2
2
 
3
3
  module Alula
4
4
  class Analytics
5
+ Alula::Plugin.needs_cookieconsent
6
+
5
7
  def self.path
6
8
  File.join(File.dirname(__FILE__), %w{.. .. .. plugins analytics})
7
9
  end
@@ -16,24 +18,24 @@ module Alula
16
18
  options.each do |provider, opts|
17
19
  tracker = case provider
18
20
  when "chartbeat"
19
- Alula::Plugin.addon :head, ->(context) { "<script type=\"text/javascript\">var _sf_startpt=(new Date()).getTime()</script>"}
21
+ Alula::Plugin.script :head, "var _sf_startpt=(new Date()).getTime()"
20
22
  <<-EOT
21
- <script type="text/javascript">var _sf_async_config={uid:#{opts['uid']},domain:"#{opts['domain']}"};(function(){function e(){window._sf_endpt=(new Date).getTime();var e=document.createElement("script");e.setAttribute("language","javascript"),e.setAttribute("type","text/javascript"),e.setAttribute("src",("https:"==document.location.protocol?"https://a248.e.akamai.net/chartbeat.download.akamai.com/102508/":"http://static.chartbeat.com/")+"js/chartbeat.js"),document.body.appendChild(e)}var t=window.onload;window.onload=typeof window.onload!="function"?e:function(){t(),e()}})();</script>
23
+ var _sf_async_config={uid:#{opts['uid']},domain:"#{opts['domain']}"};(function(){function e(){window._sf_endpt=(new Date).getTime();var e=document.createElement("script");e.setAttribute("language","javascript"),e.setAttribute("type","text/javascript"),e.setAttribute("src",("https:"==document.location.protocol?"https://a248.e.akamai.net/chartbeat.download.akamai.com/102508/":"http://static.chartbeat.com/")+"js/chartbeat.js"),document.body.appendChild(e)}var t=window.onload;window.onload=typeof window.onload!="function"?e:function(){t(),e()}})();
22
24
  EOT
23
25
  when "gosquared"
24
26
  <<-EOT
25
- <script type="text/javascript">var GoSquared={};GoSquared.acct="#{opts}",function(e){function t(){e._gstc_lt=+(new Date);var t=document,n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="//d1l6p2sc9645hc.cloudfront.net/tracker.js";var r=t.getElementsByTagName("script")[0];r.parentNode.insertBefore(n,r)}e.addEventListener?e.addEventListener("load",t,!1):e.attachEvent("onload",t)}(window);</script>
27
+ var GoSquared={};GoSquared.acct="#{opts}",function(e){function t(){e._gstc_lt=+(new Date);var t=document,n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="//d1l6p2sc9645hc.cloudfront.net/tracker.js";var r=t.getElementsByTagName("script")[0];r.parentNode.insertBefore(n,r)}e.addEventListener?e.addEventListener("load",t,!1):e.attachEvent("onload",t)}(window);
26
28
  EOT
27
29
  when "woopra"
28
30
  <<-EOT
29
- <script type="text/javascript">function woopraReady(e){return e.setDomain("#{opts}"),e.setIdleTimeout(3e5),e.track(),!1}(function(){var e=document.createElement("script");e.src=document.location.protocol+"//static.woopra.com/js/woopra.js",e.type="text/javascript",e.async=!0;var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();</script>
31
+ function woopraReady(e){return e.setDomain("#{opts}"),e.setIdleTimeout(3e5),e.track(),!1}(function(){var e=document.createElement("script");e.src=document.location.protocol+"//static.woopra.com/js/woopra.js",e.type="text/javascript",e.async=!0;var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();
30
32
  EOT
31
33
  when "gauges"
32
34
  <<-EOT
33
- <script type="text/javascript">var _gauges=_gauges||[];(function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.id="gauges-tracker",e.setAttribute("data-site-id","#{opts}"),e.src="//secure.gaug.es/track.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();</script>
35
+ var _gauges=_gauges||[];(function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.id="gauges-tracker",e.setAttribute("data-site-id","#{opts}"),e.src="//secure.gaug.es/track.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();
34
36
  EOT
35
37
  end
36
- Alula::Plugin.addon(:body, ->(context) { tracker }) if tracker
38
+ Alula::Plugin.script(:body, tracker) if tracker
37
39
  end
38
40
  end
39
41
  end
@@ -2,6 +2,8 @@ require 'alula/plugin'
2
2
 
3
3
  module Alula
4
4
  class Disqus
5
+ Alula::Plugin.needs_cookieconsent
6
+
5
7
  def self.path
6
8
  File.join(File.dirname(__FILE__), %w{.. .. .. plugins disqus})
7
9
  end
@@ -12,13 +14,9 @@ module Alula
12
14
 
13
15
  def self.install(options)
14
16
  return false unless options.shortname
15
- # Force defer mode on script loading
16
- # Alula::Plugin.script_load_mode = :defer
17
17
 
18
- # Add Emphasis -powered link to footer
19
- Alula::Plugin.addon(:post_bottom, ->(context) {
18
+ Alula::Plugin.script(:post_bottom, ->(context) {
20
19
  <<-EOS
21
- <script type="text/javascript">
22
20
  var disqus_shortname = '#{options['shortname']}';
23
21
  var disqus_identifier = '#{context.item.metadata.disqus_identifier || context.item.slug}';
24
22
  (function() {
@@ -26,8 +24,6 @@ module Alula
26
24
  dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
27
25
  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
28
26
  })();
29
- </script>
30
- <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
31
27
  EOS
32
28
  }
33
29
  )
@@ -37,7 +37,7 @@ module Alula
37
37
 
38
38
  def content
39
39
  # FeedBuilder support, skip sublime extensions for feeds
40
- return super if self.context.item.metadata.renderer.class.to_s == "Alula::FeedBuilder"
40
+ return super if self.context.item.metadata.renderer.class.to_s[/FeedBuilder/]
41
41
 
42
42
  image = attachment_url(@source, :image)
43
43
  thumbnail = attachment_url(@source, :thumbnail)
@@ -47,6 +47,11 @@ module Alula
47
47
 
48
48
  return super unless image and thumbnail
49
49
 
50
+ unless @options['alternative'] or @options['title']
51
+ @options['title'] = info(@source, :image).title
52
+ @options['alternative'] = info(@source, :image).title
53
+ end
54
+
50
55
  tag = "<a"
51
56
  tag += " class=\"img fancybox fb_zoomable #{@options["classes"].join(" ")}\""
52
57
  tag += " href=\"#{image}\""
@@ -3,7 +3,7 @@ module Alula
3
3
  module VERSION
4
4
  MAJOR = 0
5
5
  MINOR = 4
6
- PATCH = 16
6
+ PATCH = 17
7
7
  PRE = nil
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alula-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.16
4
+ version: 0.4.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-23 00:00:00.000000000 Z
12
+ date: 2012-08-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: alula
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.4.16
21
+ version: 0.4.17
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.4.16
29
+ version: 0.4.17
30
30
  description: Offers simple collection of basic plugins that are not necessary needed
31
31
  for every blog.
32
32
  email: mikko@owlforestry.com