Sha256: 913a0a72b6c9500980fdde23bbc56608e3efb341e6f7f43f1d04112bf3f05ea1

Contents?: true

Size: 718 Bytes

Versions: 18

Compression:

Stored size: 718 Bytes

Contents

module Phrase::ViewHelpers
  def phrase_javascript(auth_token=nil)
    return "" unless Phrase.enabled?
    
    auth_token ||= Phrase.auth_token
    js = 
%{<script>
  //<![CDATA[
    var phrase_auth_token = '#{auth_token}';
    (function() {
      var phraseapp = document.createElement('script'); phraseapp.type = 'text/javascript'; phraseapp.async = true;
      phraseapp.src = ['#{Phrase.js_use_ssl ? 'https' : 'http'}://', '#{Phrase.js_host}/assets/phrase/#{Phrase.client_version}/app.js?', new Date().getTime()].join('');
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(phraseapp, s);
    })();
  //]]>
</script>}
    js.respond_to?(:html_safe) ? js.html_safe : js
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
phrase-0.4.14 lib/phrase/view_helpers.rb
phrase-0.4.13 lib/phrase/view_helpers.rb
phrase-0.4.12 lib/phrase/view_helpers.rb
phrase-0.4.11 lib/phrase/view_helpers.rb
phrase-0.4.10 lib/phrase/view_helpers.rb
phrase-0.4.9 lib/phrase/view_helpers.rb
phrase-0.4.8 lib/phrase/view_helpers.rb
phrase-0.4.7 lib/phrase/view_helpers.rb
phrase-0.4.6 lib/phrase/view_helpers.rb
phrase-0.4.5 lib/phrase/view_helpers.rb
phrase-0.4.4 lib/phrase/view_helpers.rb
phrase-0.4.3 lib/phrase/view_helpers.rb
phrase-0.4.2 lib/phrase/view_helpers.rb
phrase-0.4.1 lib/phrase/view_helpers.rb
phrase-0.4.0 lib/phrase/view_helpers.rb
phrase-0.3.7 lib/phrase/view_helpers.rb
phrase-0.3.6 lib/phrase/view_helpers.rb
phrase-0.3.5 lib/phrase/view_helpers.rb