sugar 0.0.37 → 0.0.38

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.37
1
+ 0.0.38
@@ -8,25 +8,21 @@ module Sugar
8
8
  initializers = []
9
9
 
10
10
  if piwik = options.delete(:piwik)
11
- static_includes << "//#{piwik[:site]}/piwik.js"
12
- initializers = %{
13
- var piwikTracker = Piwik.getTracker("#{piwik[:site]}/piwik.php", #{piwik[:id]});
14
- piwikTracker.trackPageView();
15
- piwikTracker.enableLinkTracking();
16
- }
17
- noscript_includes << %[<img src="//#{piwik[:site]}/piwik.php?idsite=#{piwik[:id]}" alt="" style="border:0" />]
11
+ static_includes << "//#{piwik[:site]}/piwik.js"
12
+ initializers << "var piwikTracker=Piwik.getTracker('#{piwik[:site]}/piwik.php', #{piwik[:id]});piwikTracker.trackPageView();piwikTracker.enableLinkTracking();"
13
+ noscript_includes << "//#{piwik[:site]}/piwik.php?idsite=#{piwik[:id]}"
18
14
  end
19
15
 
20
- if options[:metrika]
21
- static_includes << '//mc.yandex.ru/resource/watch.js'
22
- initializers << "var yaCounter#{options[:metrika]} = new Ya.Metrika(#{options[:metrika]});"
23
- noscript_includes << %(<img src="//mc.yandex.ru/watch/#{options[:metrika]}" alt="" />)
16
+ if metrika = options.delete(:metrika)
17
+ static_includes << '//mc.yandex.ru/resource/watch.js'
18
+ initializers << "var yaCounter#{metrika} = new Ya.Metrika(#{metrika});"
19
+ noscript_includes << "//mc.yandex.ru/watch/#{metrika}"
24
20
  end
25
21
 
26
- if options[:analytics]
22
+ if analytics = options.delete(:analytics)
27
23
  dynamic_includes << 'var gaJsHost=("https:"==document.location.protocol)?"https://ssl.":"http://www.";'
28
24
  dynamic_includes << 'document.write(unescape("%3Cscript src=\'"+gaJsHost+"google-analytics.com/ga.js"\' type=\'text/javascript\'%3E%3C/script%3E));'
29
- initializers << "var pageTracker = _gat._getTracker('#{options}'); pageTracker._trackPageview();"
25
+ initializers << "var pageTracker = _gat._getTracker('#{analytics}'); pageTracker._trackPageview();"
30
26
  end
31
27
 
32
28
  returning('') do |result|
@@ -41,9 +37,12 @@ module Sugar
41
37
  result << javascript_tag(initializers)
42
38
  end
43
39
  unless noscript_includes.empty?
40
+ includes = noscript_includes.collect do |noscript|
41
+ %(<img src="#{noscript}" style="border:0" alt="" />)
42
+ end.join("\n")
44
43
  result << content_tag(:noscript,
45
44
  content_tag(:div,
46
- noscript_includes.join,
45
+ includes,
47
46
  :style => 'position: absolute'))
48
47
  end
49
48
  end
data/sugar.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sugar}
8
- s.version = "0.0.37"
8
+ s.version = "0.0.38"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alexander Semyonov"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.37
4
+ version: 0.0.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Semyonov