} )
*
*/
- Popcorn.plugin( "footnote" , {
-
- manifest: {
- about:{
- name: "Popcorn Footnote Plugin",
- version: "0.1",
- author: "@annasob",
- website: "annasob.wordpress.com"
+
+ Popcorn.forEach( [ "footnote", "text" ], function( name ) {
+
+ Popcorn.plugin( name , {
+
+ manifest: {
+ about: {
+ name: "Popcorn " + name + " Plugin",
+ version: "0.2",
+ author: "@annasob, @rwaldron",
+ website: "annasob.wordpress.com"
+ },
+ options: {
+ start: { elem: "input", type: "text", label: "In" },
+ end: { elem: "input", type: "text", label: "Out" },
+ text: { elem: "input", type: "text", label: "Text" },
+ target: name + "-container"
+ }
},
- _setup: function( options ) {
- options._container = document.createElement( "div" );
- options._container.style.display = "none";
- options._container.innerHTML = options.text;
- options:{
- start : {elem:'input', type:'text', label:'In'},
- end : {elem:'input', type:'text', label:'Out'},
- target : 'footnote-container',
- text : {elem:'input', type:'text', label:'Text'}
- }
- },
+ _setup: function(options) {
- var target = document.getElementById( options.target );
+ var target = document.getElementById( options.target );
- target && target.appendChild( options._container );
- },
- /**
- * @member footnote
- * The start function will be executed when the currentTime
- * of the video reaches the start time provided by the
- * options variable
- */
- start: function( event, options ) {
- options._container.style.display = "inline";
- },
- /**
- * @member footnote
- * 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.style.display = "none";
- },
- _teardown: function( options ) {
-
- var target = document.getElementById( options.target );
+ options._container = document.createElement( 'div' );
+ options._container.style.display = "none";
+ options._container.innerHTML = options.text;
- target && target.removeChild( options._container );
+ if ( !target && Popcorn.plugin.debug ) {
+ throw new Error( "target container doesn't exist" );
}
- });
+ target && target.appendChild( options._container );
+ },
+ /**
+ * @member footnote
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
+ * options variable
+ */
+ start: function(event, options){
+ options._container.style.display = "inline";
+ },
+ /**
+ * @member footnote
+ * 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.style.display = "none";
+ },
+ _teardown: function( options ) {
+ document.getElementById( options.target ) && document.getElementById( options.target ).removeChild( options._container );
+ }
});
++});
})( Popcorn );
pointLayer,
selectControl,
popup,
- target;
-
- target = document.getElementById( options.target );
+ isGeoReady,
+ target = document.getElementById( options.target );
// create a new div within the target div
// this is later passed on to the maps api
- newdiv = document.createElement( 'div' );
- newdiv.id = "openmapdiv" + i;
- newdiv.style.width = "100%";
- newdiv.style.height = "100%";
+ newdiv = document.createElement( "div" );
+ newdiv.id = "openmapdiv" + i;
+ newdiv.style.width = "100%";
+ newdiv.style.height = "100%";
i++;
-
+ if ( !target && Popcorn.plugin.debug ) {
+ throw new Error( "target container doesn't exist" );
+ }
++
target && target.appendChild( newdiv );
// callback function fires when the script is run
Popcorn.plugin( "tagthisperson" , ( function() {
return {
- manifest: {
- about:{
- name: "Popcorn tagthisperson Plugin",
- version: "0.1",
- author: "@annasob",
- website: "annasob.wordpress.com"
- },
- options:{
- start : {elem:'input', type:'text', label:'In'},
- end : {elem:'input', type:'text', label:'Out'},
- target : 'tagthisperson-container',
- person : {elem:'input', type:'text', label:'Name'},
- image : {elem:'input', type:'text', label:'Image Src'},
- href : {elem:'input', type:'text', label:'URL'}
- }
- },
+
_setup: function( options ) {
- var exists = false;
+ var exists = false,
+ target = document.getElementById( options.target );
+
+ if ( !target && Popcorn.plugin.debug ) {
+ throw new Error( "target container doesn't exist" );
+ }
+
// loop through the existing objects to ensure no duplicates
// the idea here is to have one object per unique options.target
for ( var i = 0; i < peopleArray.length; i++ ) {