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