Class: SocialButtons::GooglePlus::Scripter

Inherits:
Scripter
  • Object
show all
Defined in:
lib/social_buttons/view_helpers/google_plus.rb

Instance Attribute Summary

Attributes inherited from Scripter

#caller, #options

Instance Method Summary collapse

Methods inherited from Scripter

#initialize

Constructor Details

This class inherits a constructor from SocialButtons::Scripter

Instance Method Details

#language(lang = nil) ⇒ Object



60
61
62
# File 'lib/social_buttons/view_helpers/google_plus.rb', line 60

def language lang = nil
  "window.___gcfg = {lang: '#{lang}'};" if lang
end

#script(lang = nil) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/social_buttons/view_helpers/google_plus.rb', line 47

def script lang = nil
  return empty_content if widgetized? :google_plus
  widgetized! :google_plus
  ['<script type="text/javascript">',
    " #{language lang} ",
    '(function() {',
    'var po = document.createElement(\'script\'); po.type = \'text/javascript\'; po.async = true;',
    'po.src = \'https://apis.google.com/js/plusone.js\';',
    'var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s);',
    '})();',
  '</script>'].join.html_safe
end