From 08c8c80b28ceddc642ba822275056ab2662f069c Mon Sep 17 00:00:00 2001 From: rwldrn Date: Mon, 20 Dec 2010 18:28:55 -0500 Subject: [PATCH] [#238] Add plugin manifest to Popcorn.registry entries --- popcorn.js | 9 ++++++++- test/popcorn.unit.js | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/popcorn.js b/popcorn.js index 03b8096..d2206d5 100644 --- a/popcorn.js +++ b/popcorn.js @@ -554,7 +554,8 @@ }); - + // Plugin manifests + Popcorn.manifest = {}; // Plugins are registered Popcorn.registry = []; // An interface for extending Popcorn @@ -659,6 +660,12 @@ Popcorn.registry.push(plugin); + if ( !!( "manifest" in setup ) ) { + + // Augment the manifest object + Popcorn.manifest[ name ] = setup.manifest; + } + return plugin; }; diff --git a/test/popcorn.unit.js b/test/popcorn.unit.js index 6ea97f7..280a538 100644 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js @@ -402,6 +402,45 @@ test("UI/Mouse", function () { }); module("Popcorn Plugin") +test("Manifest", function () { + + Popcorn.plugin( "footnote" , (function(){ + + return { + manifest: { + about:{ + name: "Popcorn Manifest Plugin", + version: "0.0", + author: "Rick Waldron", + website: "" + }, + options: { + start : { elem:'input', type:'text', label:'In' }, + end : { elem:'input', type:'text', label:'Out' }, + text : { elem:'input', type:'text', label:'Manifest Text' }, + target : 'text-container' + } + }, + start: function(event, options){ + }, + + end: function(event, options){ + + } + + }; + + })()); + + + expect(1); + + equal( Popcorn.sizeOf( Popcorn.manifest ), 1, "One manifest stored" ); + + // add more tests + + Popcorn("#video").removePlugin("footnote"); +}); test("Update Timer", function () { -- 2.43.0