14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/facebooker2/rails/helpers/javascript.rb', line 14
def fb_connect_async_js(app_id=Facebooker2.app_id,options={},&proc)
opts = Hash.new.merge!(options)
cookie = opts[:cookie].nil? ? true : opts[:cookie]
status = opts[:status].nil? ? true : opts[:status]
xfbml = opts[:xfbml].nil? ? true : opts[:xfbml]
channel_url = opts[:channel_url]
lang = opts[:locale] || 'en_US'
= capture(&proc) if block_given?
js = " <div id=\"fb-root\"></div>\n <script>\n window.fbAsyncInit = function() {\n FB.init({\n appId : '\#{app_id}',\n status : \#{status}, // check login status\n cookie : \#{cookie}, // enable cookies to allow the server to access the session\n \#{\"channelUrl : '\#{channel_url}', // add channelURL to avoid IE redirect problems\" unless channel_url.blank?}\n oauth : true,\n xfbml : \#{xfbml} // parse XFBML\n });\n \#{extra_js}\n };\n\n (function() {\n var e = document.createElement('script'); e.async = true;\n e.src = document.location.protocol + '//connect.facebook.net/\#{lang}/all.js';\n document.getElementById('fb-root').appendChild(e);\n }());\n </script>\n JAVASCRIPT\n escaped_js = fb_html_safe(js)\n if block_given? \n concat(escaped_js)\n #return the empty string, since concat returns the buffer and we don't want double output\n # from klochner\n \"\" \n else\n escaped_js\n end\nend\n"
|