From e29f31684fb2f0359a7dd5f34d23dc8a3e801e52 Mon Sep 17 00:00:00 2001 From: Minoo Date: Wed, 2 Mar 2011 21:23:44 -0500 Subject: [PATCH] Recreated tagthispersonNew branch based on the latest tagthisperson plugin code -#91 --- .../tagthisperson/popcorn.tagthisperson.html | 9 ++-- .../tagthisperson/popcorn.tagthisperson.js | 23 +++++----- .../popcorn.tagthisperson.unit.html | 1 + .../popcorn.tagthisperson.unit.js | 44 ++++++++++++------- 4 files changed, 48 insertions(+), 29 deletions(-) diff --git a/plugins/tagthisperson/popcorn.tagthisperson.html b/plugins/tagthisperson/popcorn.tagthisperson.html index f843588..bc5afee 100644 --- a/plugins/tagthisperson/popcorn.tagthisperson.html +++ b/plugins/tagthisperson/popcorn.tagthisperson.html @@ -15,18 +15,20 @@ end: 10, // seconds person: 'Anna Sob', image: 'http://newshour.s3.amazonaws.com/photos%2Fspeeches%2Fguests%2FRichardNSmith_thumbnail.jpg', + href: 'http://annasob.wordpress.com', target: 'tagdiv' } ) .tagthisperson({ start: 5, // seconds end: 15, // seconds person: 'Scott', + href: 'http://scottdowne.wordpress.com/', target: 'tagdiv' } ) .tagthisperson({ start: 0, // seconds end: 15, // seconds - person: 'Scott', + person: 'Mike', target: 'tagdiv2' } ) }, false); @@ -35,8 +37,9 @@

Popcorn tagthisperson Plug-in Demo

-

A tag displaying Scott will appear at 0 seconds and disappear at 15 seconds.

-

A separate tag displaying Anna Sob with an image will appear at 0 seconds and disappear at 10 seconds. At 5 seconds Scott will be appended to this tag.

+

A tag displaying Mike will appear at 0 seconds and disappear at 15 seconds.

+

A separate tag displaying Anna Sob with an image and a URL attached will appear at 0 seconds and disappear at 10 seconds.

+

At 5 seconds Scott with a URL attached will be appended to this tag and disappear at 15 seconds.

+
diff --git a/plugins/tagthisperson/popcorn.tagthisperson.unit.js b/plugins/tagthisperson/popcorn.tagthisperson.unit.js index abba179..e9332da 100644 --- a/plugins/tagthisperson/popcorn.tagthisperson.unit.js +++ b/plugins/tagthisperson/popcorn.tagthisperson.unit.js @@ -1,17 +1,19 @@ test("Popcorn tagthisperson Plugin", function () { var popped = Popcorn( "#video" ), - expects = 7, + expects = 8, count = 0, interval, interval2, interval3, + interval4, tagdiv = document.getElementById( 'tagdiv' ); + tagdiv2 = document.getElementById( 'tagdiv2' ); expect(expects); function plus() { - if ( ++count===expects ) { + if ( ++count === expects ) { start(); } } @@ -29,21 +31,35 @@ test("Popcorn tagthisperson Plugin", function () { end: 5, // seconds person: 'Anna Sob', image: 'http://newshour.s3.amazonaws.com/photos%2Fspeeches%2Fguests%2FRichardNSmith_thumbnail.jpg', + href: 'http://annasob.wordpress.com', target: 'tagdiv' } ) .tagthisperson({ start: 3, // seconds end: 10, // seconds person: 'Scott', + href: 'http://scottdowne.wordpress.com/', target: 'tagdiv' } ) + .tagthisperson({ + start: 6, // seconds + end: 10, // seconds + person: 'Mike', + target: 'tagdiv2' + } ) + .tagthisperson({ + start: 7, // seconds + end: 12, // seconds + person: 'Daniel', + target: 'tagdiv2' + } ) .volume(0) .play(); interval = setInterval( function() { if( popped.currentTime() > 0 && popped.currentTime() <= 5 ) { - equals ( tagdiv.childElementCount, 1, "tagdiv now contains one child elements" ); + equals ( tagdiv.childElementCount, 2, "tagdiv now contains two child elements" ); plus(); equals ( tagdiv.textContent.trim() , "Anna Sob" ,"tagdiv shows the first tag" ); plus(); @@ -52,25 +68,23 @@ test("Popcorn tagthisperson Plugin", function () { }, 2000); interval2 = setInterval( function() { - if( popped.currentTime() > 3 && popped.currentTime() < 5 ) { - equals ( tagdiv.textContent.trim() , "Anna Sob, Scott", "tagdiv shows the first & second tag" ); + if( popped.currentTime() > 5 ) { + equals ( tagdiv.innerHTML.search( " 5 ) { - equals ( tagdiv.innerHTML.trim() , "Scott" ,"tagdiv shows the second tag only" ); - plus(); - clearInterval( interval3 ); - } - }, 5000); - interval4 = setInterval( function() { - if( popped.currentTime() > 10 ) { + if( popped.currentTime() > 12 ) { equals ( tagdiv.innerHTML , "" ,"tagdiv is now cleared" ); plus(); - clearInterval( interval4 ); + equals ( tagdiv2.innerHTML , "" ,"tagdiv2 is now cleared" ); + plus(); + clearInterval( interval3 ); } }, 4000); + }); -- 2.43.0