if ( apikey ) {
script.innerHTML = "api_key: " + apikey;
}
-
- options.type = options.type.toLowerCase();
+
+ options.type = options.type && options.type.toLowerCase() || "";
-
+
// Replace the LinkedIn plugin's error message to something more helpful
var errorMsg = function() {
-
options._container = document.createElement( "p" );
options._container.innerHTML = "Plugin requires a valid <a href='https://www.linkedin.com/secure/developer'>apikey</a>";
- document.getElementById( options.target ).appendChild( options._container );
+ if ( !target && Popcorn.plugin.debug ) {
+ throw ( "target container doesn't exist" );
+ }
+ target && target.appendChild( options._container );
};
-
+
var setOptions = (function ( options ) {
return {
* The end function will be executed when the currentTime
* of the video reaches the end time provided by the
* options variable
- */
+ */
end: function( event, options ) {
- options._container.parentNode.style.display = "none";
+ options._container.style.display = "none";
},
_teardown: function( options ) {
var tar = document.getElementById( options.target );
popped.exec( 6, function() {
popped.pause().removeTrackEvent( popped.data.trackEvents.byStart[ 4 ]._id );
- equals ( theArticle.innerHTML, "", "wikidiv is now empty" );
+ equals( theArticle.innerHTML, "", "wikidiv is now empty" );
plus();
});
+
+ // empty track events should be safe
+ popped.wikipedia({});
+
+ // debug should log errors on empty track events
+ Popcorn.plugin.debug = true;
+ try {
+ popped.wikipedia({});
+ } catch( e ) {
+ ok(true, 'empty event was caught by debug');
+ plus();
+ }
});