Last active
December 22, 2015 03:29
-
-
Save ifthenelse/6410700 to your computer and use it in GitHub Desktop.
Facebook autogrowth code for Facebook Tabs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="fb-root"></div> | |
<script type="text/javascript"> | |
var goTo = true; | |
function goToLogIn() { | |
if (goTo) { | |
self.location = "{{ path('facebook_security_check') }}"; | |
} | |
} | |
window.fbAsyncInit = function() { | |
FB.init({ | |
appId: '{{ facebook_app_id }}', | |
cookie: true, | |
xfbml: true, | |
oauth: true, | |
status: false | |
}); | |
FB.Event.subscribe('auth.statusChange', function(response) { | |
setTimeout(goToLogIn, 500); | |
}); | |
// FB.Canvas.setAutoGrow(true); | |
if($('.in_fb').size()){ | |
var _fb_auto = {}; | |
_fb_auto.body = $('body'); | |
_fb_auto.wr = $('.main_centered_wr'); | |
_fb_auto.offset = 0; | |
_fb_auto.mt = 0; | |
setInterval(function(){ | |
// _fb_auto.body.height(_fb_auto.body.height() + _fb_auto.bg_offset); | |
FB.Canvas.setSize({ width: 810, height: (_fb_auto.body.height() + _fb_auto.offset - _fb_auto.mt) }); | |
},500); | |
} | |
}; | |
(function() { | |
var e = document.createElement('script'); | |
e.async = true; | |
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; | |
document.getElementById('fb-root').appendChild(e); | |
}()); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment