From 669331986dc2563f05333216b78175dedd78d9e2 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Wed, 20 Jul 2011 15:31:14 -0400 Subject: [PATCH] [#657] Style and formatting --- plugins/footnote/popcorn.footnote.js | 20 +++--- plugins/footnote/popcorn.footnote.unit.html | 25 ++++---- plugins/footnote/popcorn.footnote.unit.js | 67 ++++++++++++++++----- 3 files changed, 75 insertions(+), 37 deletions(-) diff --git a/plugins/footnote/popcorn.footnote.js b/plugins/footnote/popcorn.footnote.js index fba5771..44ce4e3 100755 --- a/plugins/footnote/popcorn.footnote.js +++ b/plugins/footnote/popcorn.footnote.js @@ -30,21 +30,21 @@ Popcorn.plugin( name , { manifest: { - about:{ + 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'}, - target : name + '-container', - text : {elem:'input', type:'text', label:'Text'} + 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' ); + _setup: function( options ) { + options._container = document.createElement( "div" ); options._container.style.display = "none"; options._container.innerHTML = options.text; @@ -58,7 +58,7 @@ * of the video reaches the start time provided by the * options variable */ - start: function(event, options){ + start: function( event, options ) { options._container.style.display = "inline"; }, /** @@ -67,7 +67,7 @@ * of the video reaches the end time provided by the * options variable */ - end: function(event, options){ + end: function( event, options ) { options._container.style.display = "none"; }, _teardown: function( options ) { diff --git a/plugins/footnote/popcorn.footnote.unit.html b/plugins/footnote/popcorn.footnote.unit.html index 6777a99..ba39a85 100755 --- a/plugins/footnote/popcorn.footnote.unit.html +++ b/plugins/footnote/popcorn.footnote.unit.html @@ -4,11 +4,11 @@ Popcorn API - - + @@ -21,23 +21,24 @@

    - - -
    + +
    +
    diff --git a/plugins/footnote/popcorn.footnote.unit.js b/plugins/footnote/popcorn.footnote.unit.js index 2539c6d..dbdf83f 100755 --- a/plugins/footnote/popcorn.footnote.unit.js +++ b/plugins/footnote/popcorn.footnote.unit.js @@ -1,38 +1,38 @@ test("Popcorn Footnote Plugin", function () { - + var popped = Popcorn("#video"), - expects = 8, + expects = 8, count = 0, setupId, - footnotediv = document.getElementById('footnotediv'); - + footnotediv = document.getElementById("footnotediv"); + expect(expects); - + function plus() { if ( ++count===expects) { start(); } } - + stop(); - - ok ('footnote' in popped, "footnote is a mehtod of the popped instance"); + + ok ("footnote" in popped, "footnote is a mehtod of the popped instance"); plus(); - + equals ( footnotediv.childElementCount, 0, "initially, there is nothing inside the footnotediv" ); plus(); - + popped.footnote({ start: 0, // seconds end: 2, // seconds - text: 'This video made exclusively for drumbeat.org', - target: 'footnotediv' + text: "This video made exclusively for drumbeat.org", + target: "footnotediv" }) .footnote({ start: 2, // seconds end: 4, // seconds - text: 'Visit webmademovies.org for more details', - target: 'footnotediv' + text: "Visit webmademovies.org for more details", + target: "footnotediv" }); setupId = popped.getLastTrackEventId(); @@ -60,5 +60,42 @@ test("Popcorn Footnote Plugin", function () { plus(); }); popped.play().volume(0); - + +}); + + +test("Popcorn Text Plugin", function () { + + var popped = Popcorn("#video"), + expects = 2, + count = 0, + setupId, + textdiv = document.getElementById( "textdiv" ); + + expect(expects); + + function plus() { + if ( ++count===expects) { + start(); + } + } + + ok( "text" in popped, "text is a method of the popped instance" ); + plus(); + + popped.text({ + start: 0, // seconds + end: 3, // seconds + text: "I am an alias", + target: "textdiv" + }); + + stop(); + + popped.exec( 2, function() { + + equal( textdiv.children[0].innerHTML , "I am an alias", "I am an alias set by Popcorn.p.text" ); + plus(); + + }).currentTime(1).play(); }); -- 2.43.0