I have a few sites that have been working fine with the Facebook API module enabled. However, I did notice today that when I enable the Facebook API module, any "collapsible" areas in an overlay are broken.
The collapsible functions do work when the admin overlay is not used with the Facebook API module enabled.
Disabling the Facebook API module brings the collapsible functions back on the admin overlay.
I am running Fedora 17, Apache 2.2.22, PHP 5.4.4, Drupal 7.14, with the Drupal for Facebook Module 7.x-3.3-beta2
I did not see any other issues regarding overlay and collapsible fieldsets, so please excuse this issue if this is a duplicate.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | fb_7x_js_fix.diff | 2.28 KB | Dave Cohen |
| #2 | fb.js_.patch | 305 bytes | t_radigan |
Comments
Comment #1
Dave Cohen commentedAny javascript error can break collapsible fieldsets. You need to use firebug, or something like it, to determine exactly what the javascript error is.
Comment #2
t_radigan commentedI found a possible type-o in the fb.js file.
There was a closing curly brace on an if statement followed by ');'. After I removed the ');' the module does not disable the collapsible fieldsets. I haven't done much testing with it, but added a patch file to this post. Not sure if the ');' needed to be there, but at a quick glance, it appeared that it should not be.
window.fbAsyncInit = function() {
if (Drupal.settings.fb) {
FB.init(Drupal.settings.fb.fb_init_settings);
}
// Facebook recommends calling getLoginStatus after FB.init (http://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/)
// However, it's got lots of bugs reported against it (https://developers.facebook.com/bugs/240058389381072, http://developers.facebook.com/bugs/173032012783482?browse=search_4ecd4a...)
// So we make it optional whether we call it or not.
if (Drupal.settings.fb.get_login_status) {
FB.getLoginStatus(function(response) {
FB_JS.initFinal(response);
FB_JS.authResponseChange(response);
});
}
else if (Drupal.settings.fb.fb_init_settings.authResponse) {
// Our authResponse sent to us from fb.module.
FB_JS.initFinal({'authResponse' : Drupal.settings.fb.fb_init_settings.authResponse});
}
else {
// No application. Not safe to call FB.getLoginStatus().
// Or, we are configured to not call getLoginStatus().
// We still want to initialize XFBML, third-party modules, etc.
FB_JS.initFinal({'authResponse' : null});
}
if (!Drupal.settings.fb.get_login_status && Drupal.settings.fb.test_login_status && FB.getUserID()) {
// This is an alternative to calling getLoginStatus(). Adds some overhead to the client side by calling FB.api on every page. But, will detect if user has logged out of facebook.
FB.api('/me', function(response) {
// Calling FB.api is unfortunate overhead, but no other way to detect if user has logged out of facebook.
if (typeof(response.error) != 'undefined') {
// Fake an auth response change so Drupal knows user is logged out.
FB_JS.authResponseChange({'authResponse' : null});
}
else if (response.id != Drupal.settings.fb.fbu) {
// Fake an auth response change so Drupal knows user has changed.
FB_JS.authResponseChange({'authResponse' : {'userID' : response.id}});
}
});
}
};
Comment #3
t_radigan commentedNevermind, after looking at the call further it appears it does belong there. But removing the ');' does fix the collapsible fieldset issue. This only started occuring after the upgrade to 3.3-beta2
Comment #4
Dave Cohen commentedWhat you posted is hard to read. Firebug should give you an answer quickly.
I pushed a bunch of D6 patches into the D7 branch before beta2. Wouldn't surprise me if there are some bugs I didn't catch. I'm not testing with the overlay... thats the first thing I disable on a fresh drupal install.
Comment #5
t_radigan commentedYeah i did notice it was hard to read, but that wasnt the issue anyway after i took a harded look at the fb.js file. but i can reproduce the issue on a clean install of both drupal and the fb module. just enable the fb api and there go the collapsible links in the overlay. i will check a bit more with firebug after lunch.
Comment #6
t_radigan commentedCan you possibly narrow down the D6 patches that were implemented in the 3.3-beta2? I put a break in Firebug on entering the collapse.js and the fb.js and i'm not seeing much -- other than the collapse.js jumps over the function that actually enables the links for collapsible fields.
Granted, I am relatively new to Drupal (only about a year or 2 in) and I haven't written much javascript/jQuery/php in a LONG time as my function is geared more to Linux admin/networking/infrastructure support, but I am enjoying getting back to debugging code.
I did download the 3.3-beta1 and ran a diff on the fb.js between the two and the changes are abundant. But I'm not sure if the problem lies within the fb.js or not.
Comment #7
t_radigan commentedThis issue is also affecting the ability to run an available updates check with the admin overlay. Again, take the admin overlay out, everything works as expected, but collapsible fieldsets and even the check for updates is broken with the 3.3-beta2.
Comment #8
t_radigan commentedWhen debugging the collapse.js, it gets into Drupal.behaviors.collapse, hits the 'attach: function(context settings)' and then jumps down to the bottom of the function, bypassing the entire 'attach: function(context, settings)' function.
Comment #9
Dave Cohen commentedYou don't see anything in the console?
Comment #10
Dave Cohen commentedI think I see where fb.js got a bad patch. Stay tuned...
Comment #11
Dave Cohen commentedI moved a whole bunch of patches from the 6.x branch, and I guess it got a little sloppy. This patch should clean up fb.js. please let me know if you encounter any more problems.
Comment #12
t_radigan commentedThat patch worked for me.
Comment #13
socialnicheguru commentedpatch no longer applies
Comment #14
Dave Cohen commentedPatch applied to beta3. Should be fixed.
Comment #16
byung commentedAnyone else getting this collapsible error with beta4? Fixed in beta3 but not with beta4.
Comment #17
Dave Cohen commentedDo you see any errors in the firebug or chrome console?