From fd59af3fb22f958a720d557ec477c8936b628688 Mon Sep 17 00:00:00 2001 From: Christopher De Cairos Date: Tue, 17 May 2011 11:44:18 -0400 Subject: [PATCH] used single function for start and end functions, also added newlines to all the popcorn.facebook.* files (in an earlier commit) --- plugins/facebook/popcorn.facebook.js | 34 ++++++++++++---------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/plugins/facebook/popcorn.facebook.js b/plugins/facebook/popcorn.facebook.js index fbb2b59..94e0f3a 100644 --- a/plugins/facebook/popcorn.facebook.js +++ b/plugins/facebook/popcorn.facebook.js @@ -42,6 +42,19 @@ * 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:{ @@ -176,16 +189,7 @@ * 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 @@ -194,15 +198,7 @@ * 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" ); } }); -- 2.43.0