]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
used single function for start and end functions, also added newlines to all the...
authorChristopher De Cairos <chris.decairos@gmail.com>
Tue, 17 May 2011 15:44:18 +0000 (11:44 -0400)
committerChristopher De Cairos <chris.decairos@gmail.com>
Tue, 17 May 2011 15:44:18 +0000 (11:44 -0400)
plugins/facebook/popcorn.facebook.js

index fbb2b59dad0a973fa4b7f6c557683a76fc5e7a2e..94e0f3a7944d9522d5c0e04576f3d1abe4f56c13 100644 (file)
    * Site - href for activity feed. No idea why it must be "site". Default is current page
    * Type - determines which plugin to create
    */
+   
+   function toggle( container, display ) {
+     if ( container ) {
+       container.style.display = display;
+       
+       return;
+     }
+     
+     setTimeout(function() {
+       toggle( container, display );
+     }, 10 );
+   }
+   
   Popcorn.plugin( "facebook" , {  
     manifest:{
       about:{
     * options variable
     */
     start: function( event, options ){
-      var display = function () {
-        if ( options._container ) {
-          options._container.style.display = "inline";
-        } else {
-          setTimeout ( display, 10 ); 
-        }
-      }
-      
-      display();
-      
+      toggle( options._container, "inline" );     
     },
     /**
     * @member facebook
     * options variable
     */
     end: function( event, options ){
-      var hide = function () {
-        if ( options._container ) {
-      options._container.style.display = "none";
-      } else {
-          setTimeout ( hide, 10 ); 
-        }
-      }
-      
-      hide();
+      toggle ( options._container, "none" );
     }
   });