Upgrade javascript for D7.
authorDave Cohen
Tue, 8 Nov 2011 02:55:28 +0000 (18:55 -0800)
committerDave Cohen
Tue, 8 Nov 2011 02:55:28 +0000 (18:55 -0800)
fb_canvas.js
fb_tab.js

index da22652..69222c5 100644 (file)
@@ -17,7 +17,7 @@ Drupal.behaviors.fb_canvas = {
         jQuery(document).bind('fb_init', FB_Canvas.setAutoResize);
       }
       else {
-        // FB alreda initialized.
+        // FB already initialized.
         FB_Canvas.setAutoResize();
       }
     });
index d11e8f0..f28dde0 100644 (file)
--- a/fb_tab.js
+++ b/fb_tab.js
@@ -7,12 +7,22 @@
 /**
  * Enable canvas page specific javascript on this page.
  */
-Drupal.behaviors.fb_tab = function(context) {
-  // Resize if body class includes fb_canvas-resizable.
-  $('body.fb_tab-resizable:not(.fb_tab-processed)').each(function () {
-    $(this).addClass('fb_tab-processed');
-    jQuery(document).bind('fb_init', FB_Tab.setAutoResize);
-  });
+Drupal.behaviors.fb_tab = {
+  attach: function(context, settings) {
+    // Resize if body class includes fb_canvas-resizable.
+    jQuery('body.fb_tab-resizable:not(.fb_tab-processed)').each(function () {
+      jQuery(this).addClass('fb_tab-processed');
+      if (typeof(FB) == 'undefined') {
+        // FB not yet initialized.
+        jQuery(document).bind('fb_init', FB_Tab.setAutoResize);
+      }
+      else {
+        // FB already initialized.
+        FB_Tab.setAutoResize();
+      }
+      jQuery(document).bind('fb_init', FB_Tab.setAutoResize);
+    });
+  }
 };
 
 FB_Tab = function(){};