*/
var ranOnce = false;
-
+
Popcorn.plugin( "facebook" , {
manifest: {
about: {
});
};
}
-
-
+
+
// Lowercase to make value consistent no matter what user inputs
_type = _type.toLowerCase();
-
+
var validType = function( type ) {
return ( ["like", "like-box", "activity", "facepile", "live-stream", "send"].indexOf( type ) > -1 );
};
if ( !validType( _type ) ) {
throw new Error( "Facebook plugin type was invalid." );
}
-
-
+
+
options._container = document.createElement( "fb:" +_type );
-
+
// All the the "types" for facebook share largely identical attributes, for loop suffices.
// ** Credit to Rick Waldron, it's essentially all his code in this function.
var setOptions = function() {
var attr = _type === "activity" ? "site" : "href";
options._container.setAttribute( attr, ( options[ attr ] || document.URL ) );
-
+
// create an array of Facebook widget attributes
- var fbAttrs = (
- "width height layout show_faces stream header colorscheme" +
- " maxrows border_color recommendations font always_post_to_friends xid"
+ var fbAttrs = (
+ "width height layout show_faces stream header colorscheme" +
+ " maxrows border_color recommendations font always_post_to_friends xid"
).split(" ");
Popcorn.forEach( fbAttrs, function( attr ) {
}
});
};
-
+
setOptions();
-
+
if ( !target && Popcorn.plugin.debug ) {
throw new Error( "Facebook target container doesn't exist" );
}
test("Popcorn Facebook Plugin", function () {
-
+
var popped = Popcorn("#video"),
expects = 5,
count = 0,
Popcorn.plugin.debug = true;
var pop = Popcorn( "#video" );
-
+
expect( 2 );
-
+
// Tests for thrown Error on emtpy block
try {
pop.facebook({});
} catch( e ) {
ok( true, "Empty event was caught by debugger" );
}
-
+
// Tests for thrown Error on invalid plugin type
try {
pop.facebook({
end : 6
});
} catch( e ) {
- ok( true, "Facebook plugin type was invalid." );
- }
+ ok( true, "Facebook plugin type was invalid." );
+ }
});